Page 1 of 1
Color codes
Posted: Sat Sep 08, 2012 3:55 am
by Rob the rookie
Does anyone know the code for the place in memory that controls the background color of the VIC 20?
I am trying to change the colors of the border and the background but cant find the command.
If anyone knows how to change background and border colors on a VIC 20 please let me know.
Thanks for looking
Rob
Posted: Sat Sep 08, 2012 5:35 pm
by rhurst
You can get these just about anywhere from a Google search, but here's
my link to some useful programming docs.
Posted: Sat Sep 08, 2012 9:07 pm
by Jeff-20
POKE 36879, (any number 0 - 255)
Posted: Sun Sep 09, 2012 1:01 am
by buzbard
More specifically:
POKE36879,(BG*16)+BC+8
BG = BackGround Color (0 to 15)
BC = Border Color (0 to 7)
The color codes are:
0=Black
1=White
2=Red
3=Cyan
4=Purple
5=Green
6=Blue
7=Yellow
8=Orange
9=Light Orange
10=Pink
11=Light Cyan
12=Light Purple
13=Light Green
14=Light Blue
15=Light Yellow
Edit: Oops, left off the +8.

Posted: Fri Sep 14, 2012 7:33 pm
by RJBowman
36879 was the one memory location that I remembered from my original VIC20 use from nearly thirty years ago.
Posted: Sat Nov 10, 2012 2:33 pm
by adric22
I'm having some difficulty with this.
The VIC-20 seems to handle colors differently than the C64. I mean, obviously the 64 has two separate addresses for border and background. But besides that. I can't seem to figure out how to get a black background, with black border, and white text. I always get text that appears reversed.
Posted: Sat Nov 10, 2012 3:00 pm
by Witzo
I think this is what you are looking for, from the VIC 20 Programmer's Reference Guide:
Code: Select all
APPENDIX B
SCREEN & BORDER COLOR
COMBINATIONS
You can change the screen and border colors of the VIC anytime, in or
out of a program, by typing
POKE 36879,X
where X is one of the numbers shown in the chart below. POKE 36879,27
returns the screen to the normal color combinations, which is a CYAN
border and white screen.
Try typing POKE 36879,8. Then type CTRL{white} and you have
white letters on a totally black screen! Try some other combinations. This
POKE command is a quick and easy way to change the screen colors in a
program.
------------------------------------------------------------
BORDER
------------------------------------------------------------
SCREEN BLK WHT RED CYAN PUR GRN BLU YEL
BLACK 8 9 10 11 12 13 14 15
WHITE 24 25 26 27 28 29 30 31
RED 40 41 42 43 44 45 46 47
CYAN 56 57 58 59 60 61 62 63
PURPLE 72 73 74 75 76 77 78 79
GREEN 88 89 90 91 92 93 94 95
BLUE 104 105 106 107 108 109 110 111
YELLOW 120 121 122 123 124 125 126 127
ORANGE 136 137 138 139 140 141 142 143
LT.ORANGE 152 153 154 155 156 157 158 159
PINK 168 169 170 171 172 173 174 175
LT.CYAN 184 185 186 187 188 189 190 191
LT.PURPLE 200 201 202 203 204 205 206 207
LT.GREEN 216 217 218 219 220 221 222 223
LT.BLUE 232 233 234 235 236 237 238 239
LT.YELLOW 248 249 250 251 252 253 254 255
One address 36879, with the above values for any combination of border and screen colour.
Poke 36879,8 for black border and screen.
Print"<ctrl-2>" for white letters.
Posted: Sat Nov 10, 2012 3:49 pm
by adric22
Ah yes.. that works much better. There must be an extra bit in there somewhere that is used for reverse or something. I am guessing bit 3 must have something to do with that?
Posted: Sat Nov 10, 2012 5:38 pm
by buzbard
adric22 wrote:Ah yes.. that works much better. There must be an extra bit in there somewhere that is used for reverse or something. I am guessing bit 3 must have something to do with that?
You are correct:
Code: Select all
Bit 3: Default value: 1. This bit serves as the inverse color switch. When set to one, the background and foreground colors are in their respective places. Setting this to zero, however, inverts that scheme. The foreground color will be used for the background and all the characters are shaded in the background color.
I forgot to add the +8 in the line I posted above, which sets the color mode to normal, sorry.
I'm surprised no one caught that.