Using Colour
Colour | Name | Value | Keyboard |
---|---|---|---|
Black | 0 | CTRL-1 | |
White | 1 | CTRL-2 | |
Red | 2 | CTRL-3 | |
Cyan | 3 | CTRL-4 | |
Purple | 4 | CTRL-5 | |
Green | 5 | CTRL-6 | |
Blue | 6 | CTRL-7 | |
Yellow | 7 | CTRL-8 |
Colour | Name | Value | Keyboard |
---|---|---|---|
Orange | 8 | C=-1 | |
Brown | 9 | C=-2 | |
Pink | 10 | C=-3 | |
Dark Grey | 11 | C=-4 | |
Medium Grey | 12 | C=-5 | |
Light Green | 13 | C=-6 | |
Light Blue | 14 | C=-7 | |
Light Grey | 15 | C=-8 |
You can use the sixteen colours in immediate mode by using the keyboard controls in the chart. If you want green, then all you have to do is press CTRL and 6, then the cursor becomes green. Now that the cursor is green, everything you type will be green until you change the colour again. If you want pink, press the Commodore key and the 3 key. (The Commodore key is represented by "C=" in the chart above.)
You can add colour to your programs by typing the keyboard controls in your PRINT
statements. Try typing 10 ?"
and then
press CTRL and 2, which is the code for white, and then end with another quotation mark. You will see 10 ?"E"
.
That E
is the code for white. You can put any colour you want in your PRINT
statement, not just
white. You can have many colour changes in one line. Next, I will tell you about how to change the background colour.
Other computers that were around at the time of the Commodore had simple BASIC commands for graphics and sound, but the Commodore does not
have any BASIC commands specifically for graphics or sound. What you have to do instead is manipulate the Commodore's VIC-II video chip or the SID
sound chip directly. You use the POKE
command to send values to an address in the memory. You can think of RAM as a really long street
with 65,536 addresses, starting from 0 and going up to 65,535. Some addresses are for storing your BASIC program; some are for keeping track of the
screen and its colours. Some addresses are very important to the computer and if you put the wrong value in your computer will crash!
The address of the screen's background colour is 53281 and the values you can store there ([0..15]
) are on the chart at the
top of the page. So if you want to change the background colour to white, type POKE 53281,1
. You can put in colours from 0 to 15.
You can also change the border colour if you want to. The address of the border colour is 53280, so to change the border to red, you have to
type POKE 53280,2
. There are two ways to change the colour of your text. One way is to use the keyboard controls as I showed you
above; you can also change the colour of your typing by using POKE
. For example, POKE 646,5
will change your colour
to green. 646 is the address of the next colour that will PRINT
.
Next, I will talk about making simple pictures with character grahpics.