Color codes

Discuss anything related to the VIC
Post Reply
Rob the rookie
Vic 20 Newbie
Posts: 10
Joined: Fri Sep 07, 2012 3:59 am

Color codes

Post 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
rhurst
Omega Star Commander
Posts: 1369
Joined: Thu Jan 31, 2008 2:12 pm
Website: https://robert.hurst-ri.us
Location: Providence, RI
Occupation: Tech & Innovation

Post by rhurst »

You can get these just about anywhere from a Google search, but here's my link to some useful programming docs.
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

POKE 36879, (any number 0 - 255)
High Scores, Links, and Jeff's Basic Games page.
User avatar
buzbard
Vic 20 Devotee
Posts: 213
Joined: Sun Jul 03, 2005 9:10 am

Post 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. :oops:
Last edited by buzbard on Sat Nov 10, 2012 5:27 pm, edited 1 time in total.
Ray..
RJBowman
Vic 20 Enthusiast
Posts: 198
Joined: Tue Oct 25, 2011 7:50 pm

Post by RJBowman »

36879 was the one memory location that I remembered from my original VIC20 use from nearly thirty years ago.
adric22
Vic 20 Hobbyist
Posts: 143
Joined: Fri Mar 11, 2005 6:54 pm

Post 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.
User avatar
Witzo
Vic 20 Afficionado
Posts: 381
Joined: Thu Dec 01, 2011 9:14 am
Location: The Hague

Post 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.
adric22
Vic 20 Hobbyist
Posts: 143
Joined: Fri Mar 11, 2005 6:54 pm

Post 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?
User avatar
buzbard
Vic 20 Devotee
Posts: 213
Joined: Sun Jul 03, 2005 9:10 am

Post 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. :oops:

I'm surprised no one caught that.
Ray..
Post Reply