Ad: Click Here

Mapping the Atari cover

APPENDIX FIVE

Color

Color is a very important aspect in the Atari computers; you may not fully appreciate it unless you've spent a long time working with computers or monitors with monochrome displays. The Atari has sixteen colors available for display in eight different luminance (brightness) factors. These colors are stored in memory locations 704 to 712. The first four of these registers are used to determine the color of your players and missiles. The second five determine the color of the playfields, background, lines drawn and areas filled. The Atari has a default value for each of the five playfield registers that is assigned on powerup: Playfield Location Color Value 0 708 Orange 40 1 709 Light green 202 2 710 Dark blue 148 3 711 Red 70 4 (BAK) 712 Black 0 The figure in the value category represents the number you would get if you PEEKed into that location. For discussion of the locations, refer to the Memory Map. To change these colors, you can use either a POKE statement or the BASIC command SETCOLOR (abbreviated to SE). You should refer to the description in the earlier Memory Map text. SETCOLOR has three parameters: the register to change (which always corresponds to one of the memory locations above); the hue (a number from zero to fifteen which corresponds to the available colors); and the luminance (an even number between zero and fourteen). The Atari will treat any odd number as if it were the next lowest even number where luminance is concerned. Your statement might look like this: SETCOLOR 0,2,8 This will produce the orange color in playfield zero. To change it to red, you would use: SETCOLOR 0,4,6 Unless you are changing the background or border or you are changing a register which has already been used for drawing on the screen, you won't see any change from using SETCOLOR. The effect comes when you follow up with a COLOR command, telling the Atari which register to use for the DRAWTO or fill command. You can easily POKE the location with the proper color value by using this formula: COLOR = HUE * 16 + LUMINANCE So the orange in the above example would be obtained by: POKE 708,40 and the red by: POKE 708,70 These are the values listed in the chart above. It's quite simple to change them to your own colors using either method. Of course, you'll have to adjust your colors every time you change GRAPHICS modes or press RESET, since both restore the registers to their default values. What's more, the player/missile registers can only be changed using POKE; they have no corresponding SETCOLOR commands and are all preset to zero. The winter 81/82 edition of The Atari Connection, the house organ of Atari Inc., had a nice little chart in full color to display all of the colors available. The SETCOLOR number in the following list is the value you would place as the second number in the statement right after the register number. SETCOLOR POKE Color number number Black 0 0 Rust 1 16 Red-orange 2 32 Dark orange 3 48 Red 4 64 Dark lavender 5 80 Cobalt blue 6 96 Ultramarine blue 7 112 Medium blue 8 128 Dark blue 9 144 Blue-grey 10 166 Olive green 11 176 Medium green 12 192 Dark green 13 208 Orange-green 14 224 Orange 15 240 The next number in the SETCOLOR statement would be the luminance. You would add the luminance value to the POKE number. When you want to use the DRAWTO or XIO 18 (FILL) commands, you must first specify what color register to use by the COLOR command. The confusing part for most people is that the number in the COLOR command doesn't correspond to the same number as the SETCOLOR register and, to make things worse, it's not always the same number in different GRAPHICS modes! Modes zero, one, and two are text modes; they print characters to the screen rather than graphics, so you don't use the COLOR command in these modes. In GR.0, you actually have only one color as chosen by SETCOLOR 2. The luminance is ignored in this command and is instead set with SETCOLOR 1 -- where the color is ignored. You can use SETCOLOR to change the colors of the text and the background as below: GRAPHICS 0 SETCOLOR Register Character luminance 1 709 Background 2 710 Border (BAK) 4 712 GRAPHICS 1 and 2 SETCOLOR Register Uppercase and numbers 0 708 Lowercase characters 1 709 Inverse uppercase 2 710 Inverse lowercase 3 711 Background, border 4 712 When you want to draw or fill an area in modes three to eight, you must use the proper COLOR statement for the SETCOLOR register: GRAPHICS 3, 5, 7 SETCOLOR COLOR Register Four color modes Graphics point or 0 1 708 fill area 1 2 709 2 3 710 Background, border 4 0 712 GRAPHICS 4, 6 SETCOLOR COLOR Register Two color modes Graphics point 0 1 708 Background, border 4 0 712 GRAPHICS 8 SETCOLOR COLOR Register One color, two luminances Graphics luminance 1 1 709 Background color 2 0 710 Border 4 -- 712 It's awkward, but not difficult to use. You will have to refer to this chart or the chart on page 53 of your BASIC Reference Manual until you get the hang of it. Remember to precede any COLOR statement with a SETCOLOR somewhere in your program and to precede a DRAW or XIO 18 with a COLOR or the computer will use the previously designated register. The GTIA chip confuses things somewhat: in GRAPHICS 10, register 704 stores the background color while 712 is used as a normal color register. This means you must change it with a POKE rather than a SETCOLOR statement. However, in the two other GTIA modes (GR.9 and GR. 11), you still use location 712, SETCOLOR 4, for the background; see the examples of GTIA modes at location 623. With GRAPHICS 9, the COLOR command is used to set the luminance level to one of sixteen possible values; the value you use with the COLOR statement is equal to the luminance used (so you can have COLOR 15, COLOR 10, etc. Actually you can use any value up to 255 with COLOR and not get an error message; see the demo program for GR.11 in location 623). SETCOLOR 4 defines the background and graphics color. There is only one color in GR.9. In GRAPHICS 11, COLOR is used to define the color the same way it is used for luminance in GR.9, while the luminance of each color is the same value; you can have sixteen colors all of the same luminance. GRAPHICS 10 allows you to set the nine color registers to individual colors and luminances, but you must use POKE commands for the registers 704 to 707. For more information on the GTIA modes, see COMPUTE!, July to September 1982, and De Re Atari. There are many good programs for drawing your own pictures in various GRAPHICS modes; Micropainter from Datasoft is one of my favorites; then there's Drawpic from Artworx, The Graphics Machine from Santa Cruz, Graphic Master from Datasoft, Graphics Composer from Versaware and The Next Step from Online which is really a utility for character creation and color set selection. COMPUTE! published an interesting program called "Supercube" over many issues in 1980 and 1981.

Return to Table of Contents | Previous Chapter | Next Chapter