Skip to content →

Opening borders

C64 timing

The C64 has its main screen, and it has borders (green in the image above). In some cases, we might want to remove said border, to display even more graphics. The border area is very limited as to what we can actually draw there, but it can be abused to quite an extent, if you know how.

The border is drawn on every cycle, and has the highest drawing priority. Therefore, sprites that are (partially or whole) in the border area, will be covered by the border.

Top and Bottom Border

First of all, we want to open top and bottom border. To achieve this, we will have 25-row mode active, and inside the 25th row, we will change back to 24-row mode, therefore the C64 will miss the check if he is supposed to start drawing.
The check the C64 does is something like:

if((row == 24 && row_mode = ROWS_24 && x == 0) ||
   (row == 25 && row_mode = ROWS_25 && x == 0)) {
  draw_top_bottom_border = true;
}

This needs to be done every frame, or we will lose the effect immediately.
Once the border is open, we will have something like this:


If we now want to add a horizontal line for example, we would need to change the border color, and the background color.

ATTENTION: This only effects the top and bottom border drawing mechanism. The left / right borders will still remain, as they are triggered by a different mechanism, that will be shown in the next chapter.

What the open border in the image is, is the default background color that the VIC will draw now (0xD021).

The white line consists of two color changes, 0xD021 (default background color, middle), and 0xD020 (default border color, right and left)

Now, a very interesting part. The VIC doesn’t actually just output the default background color, but it draws the data of 0x3FFF in every line, where a set bit is black, and an unset bit is the default background color. Therefore, if we set 0x3FFF to, e.g., 0x33, we can get a pattern like this:

So, with some fine-tuned timing and modification of the data in 0x3FFF we are able to achieve effects like this:

0x3FFF data modification animation in top / bottom border

Left and Right border

Comments

Leave a Reply