Colour Name Value Keyboard
Black0CTRL-1
White1CTRL-2
Red2CTRL-3
Cyan3CTRL-4
Purple4CTRL-5
Green5CTRL-6
Blue6CTRL-7
Yellow7CTRL-8
Orange8C=-1
Brown9C=-2
Pink10C=-3
Dark Grey11C=-4
Medium Grey12C=-5
Light Green13C=-6
Light Blue14C=-7
Light Grey15C=-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.

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.

« PREV   Using Colour   NEXT »