Undoubtedly, you have noticed thus far, that there is an area you cannot write –normally– to, surrounding the area where you can print or draw graphics over. This area is called the BORDER and using standard NextBASIC statements you can only change its colour. The statement:
BORDER colour
changes the border colour to any of the eight normal colours (not 8 or 9) or colours changed by the PALETTE statement we shall explore below in length.
There are two more statements, INVERSE and OVER, which, when in an attribute mode, control not the attributes, but the actual graphic data that is printed on the screen. They use the numbers 0 for off and 1 for on in the same way as FLASH and BRIGHT do, but those are the only possibilities. If you do INVERSE 1, then the graphic data printed will be the inverse of their usual form: paper pixels will be replaced by ink pixels and vice versa.
The statement:
OVER 1
sets into action a particular sort of overprinting. Normally when something is written into a character position it completely obliterates what was there before; but now the new character will simply be added in on top of the old one (but see Exercise 1). Note that if the character you're overprinting with has a pixel in the same position with the character you're printing OVER, the result will be a blank pixel. In other words, OVER is a XOR operation.
This can be particularly useful for writing composite characters, like letters with accents on them, as in this program to print out German letters – an o with an umlaut above it:
10 OVER 1
20 FOR n=1 TO 32
30 PRINT "o"; CHR$ 8;"""";
40 NEXT n
(notice the control character CHR$ 8 which backs up one space.)
The previous example, reminded us of the PRINT positioning control codes. We can do exactly the same with colours by using the special colour control codes in a similar manner like the one we explored in Chapter 14.
The colour control codes are:
CHR$ 16 corresponds to INK
CHR$ 17 corresponds to PAPER
CHR$ 18 corresponds to FLASH
CHR$ 19 corresponds to BRIGHT
CHR$ 20 corresponds to INVERSE
CHR$ 21 corresponds to OVER
These are each followed by one character that shows a colour by its code: so (for instance):
PRINT CHR$ 16 + CHR$ 9; ...
has the same effect as:
ZX Spectrum Next User Manual, 3rd Edition (ISBN 978-1-5272-5496-1), written and illustrated by Phoebus R. Dokos. Copyright © 2020-2024 Phoebus Dokos / SpecNext Ltd. Licensed under CC BY-NC-SA 4.0. This is a transcription and can contain errors; check any doubt against the printed page.