System information
revision of the 8564-VIC chip. The bug also to a certain degree exists with the 6567-VIC chip in the C64 but
there it is much less visible. Another bug in the 8564-VIC chip is that when using raster interrupts, there can
sometimes be lots of white dots flashing around. This is visible in some games. The just mentioned bugs in the
8564-VIC chip can be pretty annoying and therefore if you want to play C64 games a lot, I would recommend
using a real Commodore 64 rather than a Commodore 128 in Commodore 64 mode.
So, what about graphics features? Are there any differences in that area between the 8564-VIC and the 6567-
VIC? The answer to this question was long believed to be no. However, just around the turn of the century (from
20th to 21st) it was found that the test bit in register $D030 (the register used for 2 MHz mode) does indeed
hide unknown graphics modes (something that was suspected several years earlier). It was found that as long as
this bit is set, one raster line is skipped per clock cycle. This can be used for increasing the screen refresh
frequency, which causes a more stable picture, especially for PAL C128s since PAL uses 50 Hz (NTSC uses 60
Hz). The test bit can also be used for more advanced techniques as described in the following sections.
On PAL systems, skipping an odd number of raster lines not only increases the screen refresh frequency but also
leads to new colours in addition to the 16 usual ones. This is used in the C128 demo "Risen from Oblivion". It is
impressive to see the frogs in lots of different green colours in that demo. I really recommend that demo, which
has one VIC part and one VDC part. It is the best C128 demo there is (and one of the very few there is as well).
In 2007, it was found that skipping raster lines makes it possible to accomplish interlace mode, which doubles
the vertical resolution, although it causes some flickering. The experiment was made using an NTSC C128 but it
is probably possible to do this on a PAL C128 too.
The test bit tricks all have in common that they only work with real C128s, i.e. not with emulators, and that they
only work together with certain monitors and TV sets. The VIC part of "Risen from Oblivion" for example works
with most Commodore 1084 monitors (I have however seen one person reporting that it did not work with his
1084 monitor).
VIC graphics and character programming
One difference between the Commodore 64 and the Commodore 128 when it comes to graphics is that the C128
has built-in support for split-screen mode. When split-screen mode is enabled, it means that there is a vertical
division of the screen into two different areas. One of the areas uses bit-map mode or multi-colour bit-map mode
while the other area uses standard character mode. This is possible to do also on the C64 but there is no built-in
support for it so you need to write your own raster-interrupt code to do it there.
The screen editor (which is a part of the Kernal) in the Commodore 128 is raster interrupt-driven in order to
make split-screen mode possible. This is a difference compared to the Commodore 64 where the Kernal uses
timer interrupts instead of raster interrupts. The C128 screen editor reads the value of so called shadow registers
to update actual registers when raster interrupts occur. This means that when the screen editor is enabled,
registers that are used to enable/disable graphics modes or set pointers to screen memory, beginning of
character data or bit map data (this concerns registers $D011, $D016 and $D018) should not be written to
directly. If they are written to directly the written value will just be overwritten by the screen editor when the
next raster interrupt occurs. Instead, shadow registers should be written to.
Let us for example assume that we have a split-screen with standard or multi-colour bit-map mode at the top of
the screen and standard character mode at the bottom of the screen. Then, we will get two raster interrupts per
screen update. We will get the "normal" interrupt at the top of the screen that we always get but since we are in
split-screen mode, the raster compare register is reprogrammed when the interrupt occurs so that we will also
get an interrupt further down on the screen where we want the split to occur. If we look at the pointer to the
screen memory only in order not to make this example too complex (we could also look at other pointers and
enabling/disabling of different modes), what happens is that at the interrupt occuring at the top of the screen,
bits 7-4 in register $D018 are set equal to the value of bits 7-4 of shadow register $0A2D. At the interrupt
occuring further down on the screen, bits 7-4 in register $D018 are set equal to the value of bits 7-4 of shadow
register $0A2C. This example shows that different shadow registers are used for pointers used in (multi-colour)
bit map mode and in multi-colour/standard character mode even though they are mapped to the same actual
registers at different points in time when interrupts occur.
As mentioned in the previous paragraph, there is one "normal" interrupt occuring once per screen update and if
split-screen mode is enabled, a second interrupt occurs as well further down on the screen during each screen
update. However, it is only during the "normal" interrupt that the Kernal operations occuring at an IRQ are done
(e.g. checking keyboard, blinking cursor, updating clock etc.). Whether it is a "normal" interrupt or not is
indicated by the screen editor in bit 7 of register $D011. If that bit is equal to 1, it is a "normal" interrupt,
otherwise not.
If you do not want to use shadow registers, you can turn off the screen editor by writing $FF to memory location
$00D8. Then, you can program graphics in exactly the same way as on the Commodore 64, i.e. by writing to the
actual registers directly. The registers have the same addresses as on the Commodore 64.