The Commodore Plus/4 – like his other brothers – has memory areas in which screen characters and colour values are stored independently from each other. Because it uses the TED chip these memory addresses are different from the C64 and C128.
Each character from the top left corner to the bottom right corner occupies one byte of memory, 40 columns across in 25 rows.
- starts at 3072 (decimal) or $0C00 (hex)
- ends at 4071 (decimal) or $0FE7 (hex)
You can POKE screen display codes into each position using this formula:
POKE 3072 + X + 40 * Y, Z // where // X = current column // Y = current row // Z = screen display code // write the letter X into the top left corner of the screen POKE 3072, 24
Note that there’s a difference between screen display codes (A = 1, B = 2…) and ASCII/PETSCII codes (A = 65, B = 66…). The latter are used when printing single charters via CHR$ or returning their values via ASC.
- starts at 2048 (decimal) or $0800 (hex)
- ends at 3047 (decimal) or $0BE7 (hex)
You can POKE colour values into each cursor position using the following formula:
POKE 2048 + X + 40 * Y, C + L * 16 // where // X = current column // Y = current row // C = colour value (0 to 15) // L = luminance value (0 to 7) // turn the character in the top left corner of the screen light red POKE 2048, 2 + 7 * 16 // or POKE 2048, 114
Luminance is a TED feature. It was an attempt to increase the colour palette which still only consisted of 16 colours (like on the C64) by adding brightness to each value. When compared to the “pure” 16 colours of its brothers, the Plus/4 palette looks a little weird (for example, the standard BASIC background is white according to its colour value, even though it appears to be some shade of “dirty grey”).
You can add 128 to each value to make the character flash at the same frequency as the cursor.
Contrary to the Plus/4 user guide, the colour values are as follows:
0 black 1 white 2 red 3 cyan 4 purple 5 green 6 blue 7 yellow 8 orange 9 brown 10 yellow-green 11 pink 12 blue green 13 light blue 14 dark blue 15 light green