System information
For both the Commodore 64 and the Commodore 128, the colour RAM occupies the area from address $D800 to
$DBE7. However, the Commodore 128 has as mentioned earlier two 64 kB RAM banks and it is possible to select
which of these two banks that contains the colour RAM seen by the CPU or by the VIC chip. Bit 0 in the register
at address $0001 defines which colour RAM bank that is seen by the CPU while bit 1 in the register at address
$0001 defines which colour RAM bank that is seen by the VIC chip. This makes it possible to quickly change the
colours of a whole screen. The CPU can define the colours in a colour RAM bank that is not seen by the VIC chip
and when it wants the colours to appear on the screen, it just switches in the colour RAM bank it has written to
so that the VIC chip can see it. (Bits 0 and 1 in the register at address $0001 are on the Commodore 64 used
for switching in or out BASIC or Kernal ROM, which on the Commodore 128 is taken care of by the MMU.) The
switching of colour RAM bank seen by the VIC chip can be used to slightly improve some of the advanced VIC
graphics modes . For example, in FLI mode, the colour RAM bank can be switched every fourth raster line and in
IFLI mode it can be switched every frame. I have come up with this idea for improvement myself. I don't know if
anyone else has had the same idea before and if it in that case has been tested in practise. Note that this feature
is only possible in C128 mode.
For the Commodore 64, character ROM is only accessible by the VIC chip in video banks 0 and 2 (the VIC chip
can only see 16 kB of RAM while there are 64 kB of RAM in total leading to that there are four possible video
banks). The Commodore 128 does not have this limitation. Character ROM is accessible in all video banks unless
character ROM has been switched out explicitly using bit 2 of the register at address $0001 (if the screen editor
has not been disabled by writing $FF to memory location $00D8, bit 2 of the shadow register at $00D9 has to be
used instead).
VIC sprite programming
When an IRQ occurs, one of the things that the BASIC part of the IRQ routine does is to read the values of the
shadow registers $11D6-$11E6 and write them into the actual registers $D000-$D010 that control the positions
of sprites on the screen. This means that it is no use to write to the registers $D000-$D010 to set sprite
positions since the written values will be overwritten at the next IRQ. Instead, the shadow registers at $11D6-
$11E6 should be written to in order to set the positions of sprites. If you want to write to the actual registers
directly, this can be done by setting bit 0 of the system variable at address $0A04 equal to 0. This tells the
Kernal that BASIC has not been initialised and therefore the BASIC part of the IRQ routine will not be executed.
Because of this, some BASIC commands, e.g. SOUND, PLAY and SPRITE, will not work.
The sprite pointers are on the C128 just as on the C64 normally placed at $07F8-$07FF. However, on the C128,
these pointers have pre-defined values pointing to a block of memory at $0E00-$0FFF that is reserved for sprite
data. Since Power Assembler uses a part of this memory ($0F00-$1000), you will probably want to change the
values of the sprite pointers. The C64 does not have pre-defined values for the sprite pointers.
The sprite pointers are in the C64 and the C128 always located as the last 8 bytes of the 1 kB chunk of screen
memory. If you on the C128 use the BASIC command GRAPHIC to go to one of the graphics modes, the screen
memory uses addresses $1C00-$1FFF instead of $0400-$07FF. This means that addresses $1FF8-$1FFF are used
for sprite pointers instead of addresses $07F8-$07FF.
Sound and SID chip version
Sound is programmed in exactly the same way on the Commodore 128 as on the Commodore 64.
In contrast to what many people believe, most Commodore 128s contain the older version of the SID chip called
6581. My two C128s both contain that version and also other people I have been in contact with who have
checked the SID chip version of their C128s have that version. The only C128 model I know of that contains the
newer version called 8580 is the Commodore 128 DCR (the metal case model that was mainly sold in North
America). However, it is possible that late manufactured versions of other C128 models might also contain the
8580 version although I have not encountered any so far. If you want to check the version of the SID chip in
your Commodore 128, you can use my program "SYSTEM INFO" that you can find under Introduction. The two
versions of the SID chip are not interchangeable without adding or removing other electrical components due to
different voltages.
Kernal