Retrochallenge 2014 Summer – Atari SetColor and Color commands

Are you looking for some Commodore 64 technique? Bad timing! We are in the midst of Retrochallenge Summer, and for the month of July I’m all Atari!

Today I managed to draw the playfield, which is going to be a view of the goal area in 3D-ish view:

Playfield almost ready
Playfield almost ready

The first concept that I had to grasp is the Atari colours and how to use them. Atari graphics work with the concept of colour registers, with a total of 5 registers available.  Since I’m using the graphic mode 7(+16), I have four colours available, one background and three colours, so I will use only four of the registers.

To set the colour I am going to use, first I have to use the command SETCOLOR, using the following format:

SETCOLOR (color_reg #), (color #),(luminance #)

where

color_reg # is a number between 0 and 4 (the register #3 is not used on graphic mode 7)

color # is the code of the colour you want to set for that register, using the following table:

Number 
0
1
2
3
4
5
6
7
Color*
Gray
Gold
Orange
Red-Orange
Pink
Violet
Purple Blue
Blue
Number 
8
9
10
11
12
13
14
15
Color
Light Blue
Blue-Green
Turquoise
Green-Blue
Green
Yellow-Green
Orange-Green
Light Orange

luminance # is a even value from 0 to 14, where 14 is almost white.

After setting the colour registers to the desired values, you can select the colour to be used by the drawing commands using the COLOR command. The COLOR command parameter is the colour register number, not the colour code 0-15 used in SETCOLOR.

In my game playfield, I wanted to have the football field green and the lines white. For the graphic mode 7, the color register #4 refers to the background colour. So, to make that to work my program has the following lines:

[code]
30000 GRAPHICS 7+16
30010 SETCOLOR 4,14,2:REM GREEN
30010 SETCOLOR 0,0,14:REM WHITE
30100 COLOR 1: REM SELECTS COLOUR REGISTER #1 WHICH IS SET TO WHITE
30110 PLOT 0,30:DRAWTO 159,30
(…)
[/code]

When you set the colour register #4 to green, the background will turn green immediately. As for the other register, calling COLOR #n command will make all the subsequent drawing commands use that colour. If you later change the register #0 to another colour, all graphics already drawn using that register will turn into the new colour immediately as well.

See you next time!

 

Author: Paulo Garcia

Leave a Reply

Your email address will not be published. Required fields are marked *