Extended color mode

From C64-Wiki
Jump to: navigation, 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. Conversely, most characters without a shifted version (numbers and punctuation, PETSCII characters 32-63) can only appear with background colors 53281 and 53283, and five graphical characters (PETSCII characters 123-127) are replaced by copies of the characters 32 spaces lower (91-95) appearing in the "shifted" colors.

Example[edit]

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"

RUN

ABC ABC ABC ABC

READY.

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.