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.
Screen Memory
- 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.
Colour Memory
- 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+0+0), 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 (values in brackets show the luminance variations):
0 (16 32 48 64 80 96 112) = black 1 (17 33 49 65 81 97 113) = white 2 (18 34 50 66 82 98 114) = red 3 (19 35 51 67 83 99 115) = cyan 4 (20 36 52 68 84 100 116) = purple 5 (21 37 53 69 85 101 117) = green 6 (22 38 54 70 86 102 118) = blue 7 (23 39 55 71 87 103 119) = yellow 8 (24 40 56 72 88 104 120) = orange 9 (25 41 57 73 89 105 121) = brown 10 (26 42 58 74 90 106 122) = yellow-green 11 (27 43 59 75 91 107 123) = pink 12 (28 44 60 76 92 108 124) = blue green 13 (29 45 61 77 93 109 125) = light blue 14 (30 46 62 78 94 110 126) = dark blue 15 (31 47 63 79 95 111 127) = light green