Classic Computer Magazine Archive BEST OF ANTIC VOLUME 1

Colors for your Pilot

This time I will show you how to use all 128 colors of the ATARI and how you can rapidly change these colors in your displays. To display data on the TV screen, PILOT first gets data (character or graphics information) from your program and then looks at special memory locations to determine the color to use. You can use a maximum of four colors at one time on your screen. Each color is selected by the PEN; (color) instruction. This instruction calls these locations by the names "Red", "Blue", "Yellow", and "Erase" Once PILOT knows what name (location) a line belongs to, it uses the color value found there for all lines drawn by that PEN: (color) instruction.

When PILOT looks at the "Blue" location it will find a color value there. This value will cause the ATARI to draw blue lines when you first turn it on. Fortunately, you can put any color value into these locations. So, even though PILOT calls these locations by color names (for convenience) any color may be found there. You can change these colors using a special form of the C:ompute command. Turn your machine on and type this in direct mode:

C:@B710 = 86
C:@B712 = 5*16+6

The first instruction might be spoken "Compute byte 710 equals 86" In this case, the 710 is the special address PILOT calls its "Blue" location. The 86 is a color value for a red color. In effect we put "red paint into a can labeled blue"

In the second instruction, the "712" is PlLOT's "Erase" register. The "5" is a hue (color) number and the "6" is a luminance number (more on them later).

In the graphic mode, PILOT uses four locations or registers. Their names, addresses and uses are listed in Table 1.

You change the color of any register (paint can) by placing a different color value in any of the addresses. Color values are made up of two numbers, a "hue number" and a "luminence" or brightness number. Table 2 gives these values and what they usually look line on my TV.

Name Register Value Used for Address
Red 0 70 Graphics 708
Yellow 1 26 Graphics 709
Blue 2 148 Text Window & Graphics 710
None 3 148 Not Used 711
Erase 4 0 Background & Border 712

Table 2
Hue Luminance
0 = gray 0-lowest possible luminance (black)
1 = green brown 2-
2 = yellow/orange 4-
3 = orange 6-
4 = red/orange 8-
5 = pink 10-
6 = bluish purple 12-
7 = purple 14-maximum luminance (white)
8 = blue
9 = bright blue
10 = turquoise
11 = greenish blue
12 = green
13 = yellowish green
14 = orangish green
15=light orange

The color value needed in each register is calculated as follows:

Hue number# 16 + luminance number.

A color value for the red we used above is 86 or "16*5 + 6." Changing a register can be done at any time in your program.

The listing draws two horses in different color registers and then changes the colors rapidly to illustrate the power of this technique.

Let me leave you with an experiment: Use Mode 1 or Mode 2 letters (see last issue) and determine which color registers are used for uppercase and lowercase letters.

You may be interested in a new learning club for PILOT / LOGO users. It has a good newsletter, simple programs and an educational orientation. It is free to people under 18. Write to:

Young People's LOGO Association
1208 Hillsdale Drive
Richardson, Texas 75081

by Ken Harms