Drawing bars in the border¶
If you watch old Amiga and Atari ST demos, one of the tricks they’d perform is drawing in the screen border. If you didn’t know, because computers used to be plugged into TV sets, it wasn’t possible to know precisely where on the screen the image would show up. To avoid parts of the screen being cut off by the TV - which might have a large plastic bezel around it - and to make a nice square edged image - TVs used to have slightly curved corners, the machines of the day had borders around their bitmapped displays. It also helped reduce the resolution of the display to something technology of the time could generate.
Being able to remove the borders was a popular trick and while not directly applicable to the Next as both its sprite system and Layer 2 are able to draw to a larger area, we’re able to do things in the border if we think creatively.
The first step is to colour the entire border a single colour, but to do it with a colour we’re not using anywhere else. It also seems to be important to turn off the enhanced ULA and to set the Next to use the ULA palette
// Turn off enhanced ULA and set palette to be ULA IO_NEXTREG_REG = 0x43; IO_NEXTREG_DAT = 0x0; zx_border(16);
Now we’ve set the border to whatever colour 16 is - a shade of off-green.
If we now use the regular Next palette registers, it’s quite easy to change the colour of the entire border to something else
#define RGB2COLOUR(r,g,b) (uint8_t)(((r & 0x7) << 5) | ((g & 0x7) << 2) | (b & 0x3)) // Choose ULA palette 16 IO_NEXTREG_REG = REG_PALETTE_INDEX; IO_NEXTREG_DAT = 16; // Remap it to green IO_NEXTREG_REG = REG_PALETTE_VALUE_8; IO_NEXTREG_DAT = RGB2COLOUR(0,7,0);
This code should turn the border a wonderful Atari ST desktop bright green.
To make stripes in the border, all we now need is some way to
Wait for a specific line on the screen
Remap colour 16 to whatever we want
Wait for the line to stop at
Remap colour 16 back to what it was originally - or a new colour
The trick is that the Next isn’t drawing anything, all it’s doing is remapping the colour of the background while the “electron beam” drawing the screen is going over that area of the screen.
The example code from Initialisation page draws a bar with various colours.