Extended color mode

From C64-Wiki
Jump to navigationJump to search

Extended color mode is a special feature of the VIC-II's text screen: By setting bit 6 (weight 64) in 53265/$D011, each individual character on the text screen may have one of four different background colors. The "trade-off" is that the character set is limited to the first 64 out of normally 256 available characters. Colors are selected by POKEing the color values into four bytes, 53281-53284.

The two most significant bits in the character code for each position on the screen determines which of the four background colors applies to that character:

  • 00xxxxxx gives the background color specified in 53281/$D021
  • 01xxxxxx gives the background color specified in 53282/$D022
  • 10xxxxxx gives the background color specified in 53283/$D023
  • 11xxxxxx gives the background color specified in 53284/$D024

The remaining six bits indicate which of the first 64 characters in the current character set should appear at that position. Due to the layout of the character set, bit six is set by holding the SHIFT  key while typing, and bit seven is set by turning on reverse text. Therefore:

  • 53281 is invoked by typing normally
  • 53282 is invoked by typing with the SHIFT  key
  • 53283 is invoked by turning on reverse mode
  • 53284 is invoked by using SHIFT  with reverse mode

After extended color mode is enabled, typing with the SHIFT  key down will cause the characters to appear in the alternate background color, rather than upper-case or as glyphs. For characters without a shifted version (numbers and punctuation, PETSCII characters 32-63), you need to type the graphic character that has the same PETSCII code + 192, i.e. to produce a 1 with background color 53282, you can do PRINT CHR$(ASC("1")+192) or you can type it as CBM-E. If reverse mode is on, you get background colour 53284 instead.


This BASIC example demonstrates the extended color mode:

10 POKE 53281,1
20 POKE 53282,2
30 POKE 53283,5
40 POKE 53284,6
50 POKE 53265,PEEK(53265) OR 64
60 PRINT "ABC abc ";CHR$(18);"ABC abc"




The first four lines set up the four background colors; white, red, green, and blue, in their respective registers. Line 50 engages the extended color mode, and line 60 prints the example text. Note that CHR$(18) is the control character for "reverse on", and the letters shown as lowercase would actually be shifted (capital letters in the big/small character set, or graphics in the big/graphics character set).

Do not use along with multicolor mode![edit]

Extended color mode should not be used simultaneously with multicolor mode for the text screen: The VIC-II seems to "lock up" if both modes are engaged, showing a blank, black screen. The problem clears as soon as either multicolor or extended color mode is disabled.