Commodore VIC-20 User Manual page 196

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

182
The VIC 20 User Guide
location you are POKEing is correctly set. The next section describes how to
do this.
Color Memory
Earlier in this chapter we mentioned that the colors of the characters on
the screen are kept in a special area called color memory. As our most recent
example shows, an understanding of how to use color memory is essential
when using POKE in displays. So, before proceeding further with POKEing
screen memory, let's take a look at color memory.
FINDING COLOR MEMORY
Like screen memory, color memory "moves," but the factors that
determine its location are different. To find the start of color memory, use
the following formula:
10 CB=37888+256*(PEEK(648) AND 2)
The section entitled "VIC Chip's Window into Memory" near the end
ofthis chapter includes more information on how the VIC chip locates color
memory.
CONTENTS OF COLOR MEMORY
As with screen memory, there is one location in color memory for each
character on the screen. The order of character colors is the same as that of
the characters themselves, so the formula used to find a character's location
in color memory is like the one used to locate the character in screen
memory.
Color memory location
=
start of color memory
+
column
+
22 • row
The color of each character is stored in color memory as a number from
o
to 7. The colors produced by these numbers are as follows:
o
Black
White
2
Red
3 Cyan
4
Purple
5
Green
6
Blue
7 Yellow
To help you remember these numbers, you can use the following rule:
fhe POKE value to set a color is one less than the value of the number key

Advertisement

Table of Contents
loading

Table of Contents