System information

It is possible to use the VDC chip in C64 mode on a C128 but this is not a trivial task since the Kernal in the C64
does not support using the VDC chip and routines from the C128 Kernal would therefore have to be copied into
the C64 RAM memory and be modified appropriately. The terminal program
Novaterm is an example of a
program that uses the VDC chip in C64 mode. A much easier thing to do is to use the VDC RAM memory as extra
memory in C64 mode. By doing this, you will have 80 kB or 128 kB of RAM memory available in C64 mode
instead of 64 kB (although the VDC RAM memory is more difficult and slower to access than the normal C64 RAM
memory).
A bug that exists in older revisions of the VDC chip is that sometimes data can be lost on a read or a write. This
is due to a synchronization problem. Another bug that exists is that the block copy function sometimes copies
one byte too little. There is a workaround in the C128 Kernal for the block copy bug. I have received information
from a person who has worked a lot with the VDC chip that out of five C128s he knows of only one has a VDC
chip without bugs.
BASIC incompatibilities
Commodore claimed that a BASIC program written for BASIC 2.0 (Commodore 64) should also work under BASIC
7.0 (Commodore 128 in Commodore 128 mode) provided that the program does not POKE to or PEEK from
memory locations that have different meanings on C64 and C128. However, I have found this not to be true. I
think that the incompatibilities are important enough to be described on this page even though the page is
mainly intended for assembly programming.
One incompatibility problem occurs when having a PRINT statement that writes the last character on the last
column of a row. Under BASIC 7.0, the next PRINT statement then begins on the next row but under BASIC 2.0,
the next PRINT statement begins on the row after the next row. This problem can be overcome by ending the
PRINT statement with a ";". Then, the next PRINT statement begins on the next row both under BASIC 7.0 and
under BASIC 2.0. However, there is also another incompatibility problem that adding a ";" does not solve. The
problem is that when having a PRINT statement that writes the last character on the last column of a row, BASIC
7.0 moves all the following rows one row down while BASIC 2.0 does not affect the following rows. The only way
of solving this problem is probably that when the screen needs to be updated, all the rows below the first row
that is rewritten must also be rewritten. Then, it will work both under BASIC 2.0 and under BASIC 7.0. Because
of the just mentioned problems, most BASIC programs I have written for BASIC 2.0 look wrong on the screen
when they are run under BASIC 7.0.
As mentioned under Sprites, the BASIC part of the IRQ routine on the Commodore 128 reads from shadow
registers and writes to actual VIC and SID registers. This means that BASIC 2.0 programs that use sprites and
sound will not work under BASIC 7.0 (since they write directly to VIC and SID registers) unless the BASIC part of
the IRQ routine is disabled. The disabling can be done by setting bit 0 of the system variable at address $0A04
equal to 0. Note that on a Commodore 64, address $0A04 is a part of the BASIC text area so writing to this
memory location would destroy the BASIC program. Therefore, it needs to be checked that the program is
running on a Commodore 128 in Commodore 128 mode before writing to this memory location.
As mentioned under Graphics, the raster-interrupt driven screen editor on the Commodore 128 reads from
shadow registers and writes to actual registers. This means that BASIC 2.0 programs that write directly to
registers $D011, $D016 or $D018 in order to enable/disable graphics modes or to set pointers to screen memory,
beginning of character data or bit map data will not work under BASIC 7.0 unless the screen editor is disabled.
The screen editor can be disabled by writing $FF to the system variable at address $00D8. Since the memory
location at address $00D8 has another use on the Commodore 64 than on the Commodore 128, it first needs to
be checked that the program is running on a Commodore 128 in Commodore 128 mode before writing to this
memory location.
To detect if a program is running on a Commodore 128 or on a Commodore 64, the CPU vectors can be read and
compared. For example, the low byte of the BREAK/IRQ vector at address $FFFE contains $48 if running on a
Commodore 64 (or on a Commodore 128 in Commodore 64 mode) and $17 if running on a Commodore 128 in
Commodore 128 mode.
Incompatibilities between real C64 and C128 in C64 mode
Almost all programs that have been implemented for the C64 also work on the C128 in C64 mode. This section
describes why a few programs do not work.
A main cause of a C64 program not working on the C128 in C64 mode is that the program writes to $D030. On
the C64, this is an unused memory address but on the C128 in C64 mode it is used for clock frequency setting
(1 or 2 MHz) and it also contains a test bit for the VIC-IIe chip. Therefore, writing certain values to $D030 on