GTIA Joystick Painter
Powerful Atari Animation Tool
GTIA Joystick Painter is a powerful drawing program for nine-color Atari Graphics 10 mode. This BASIC program works on all 8-bit Atari computers with at least 32K. A disk drive is required.
Atari graphic modes 9, 10 and 11 are called GTIA modes. The Atari's main microprocessor chip is saddled with an enormous workload, because the Atari has so many different graphics modes, hue/luminance combinations, sound features and controllers for devices such as joysticks. That's where the GTIA chip comes in, as well as other special chips such as ANTIC and POKEY.
Earlier Ataris used the CTIA (Color Television Interface Adaptor). But today almost all Atari 8-bit users have computers with the newer GTIA chip. GTIA stands for Graphics Television Interface Adaptor (or George's TIA, for George McLeod who designed the chip). To make sure your computer has GTIA, type:
10 GR.9:GOTO 10
If your screen turns black, you have it. If nothing happens, you don't.
Among other things, the GTIA chip controls color and luminance (brightness) of ordinary playfield graphics such as those called from BASIC with COLOR, PLOT and DRAWTO statements while in graphics modes 3 to 11.
GRAPHICS 9, 10, 11
Graphics 9 is a one-color, 16-luminance mode. Graphics 10 has nine colors with independent hue and luminance settings. Graphics 11 has 16 colors and only one Lnrninance. Each mode has 80 columns and 192 rows. Modes 9, 10 and 11 are actually variations on Graphics 8, so details such as memory required to map the screen (about 8K) remain the same.
In BASIC, you can reach any of these GTIA modes with normal GRAPHICS statements. You can also POKE 623,64 (which sets bit 6) to turn on Graphics 9, POKE 623,128 (which sets bit 7) for Graphics 10 and POKE 62 3,192 for Graphics 11 (which sets bits 6 and 7).
When the GTIA bits are set, the computer interprets display memory differently. In Graphics 8, each memory location keeps track of eight consecutive pixels. Each byte of memory can hold a value between 0 and 255 -- corresponding to the number of combinations of lit and unlit dots you can make in each eight-dot byte.
But in the GTIA modes, not only can each dot be turned on or off, but it also must contain information about which of 16 hues or luminance levels is displayed. And, unlike Graphics modes 1-8, there are no text windows in the GTIA modes.
In Graphics 8, each row can display 320 dots. Since you need extra color information for each dot in modes 9, 10 and 11, you only get 80 dots per row. Also, modes 9 and 11 don't have 16 color registers available--just five regular color registers.
You can only get additional colors by making the color value of each dot onscreen directly represent the color or luminance of the dot, instead of indicating which color register to look into for that value. If you want to change the colors of some dots onscreen, you'll have to redraw each one in its new color.
To see how GTIA modes work, type this short program:
10 GRAPHICS 9
20 SETCOLOR 4,12,0
30 FOR I=0 TO 15:COLOR I
40 PLOT 4 * I+ 5,2:DRAWTO 4 * I+ 5,190
50 DRAWTO 4 * I+ 6,190: DRAWTO 4 * I + 6,2
60 NEXT I
70 GOTO 70
You should see 16 shades of green bars on the screen. To see 16 different colors at once, substitute these lines:
10 GRAPHICS 11
20 SETCOLOR 4,0,4
Here's a set of practical instructions for Graphics 9:
1. Use a GRAPHICS 9 command to set the mode.
2. Use SETCOLOR to select the color to be used. The register used to specify this color is 712, which holds the background color. Use the form SETCOLOR 4,C,0 where C is between 0 and 15.
3. To PLOT or DRAWTO, use COLOR S to specify the shade, where S is between 0 and 15.
4. Now PLOT and DRAWTO normally The horizontal coordinate must be between 0 and 79, and the vertical coordinate must be between 0 and 191.
Try this:
100 GRAPHICS 9
120 SETCOLOR 4,15,0: REM Color is gold
130 FOR I=25 To 49
140 C = I + (74-I-I) * (I>37)-22
150 D = INT(SQR(144-(I-37) * (I-37)))/2
160 COLOR 15-C:PLOT I,32-D:DRAWTO I,32+D
170 COLOR C:DRAWT0 I,155+D
180 NEXT I
190 GOTO 190
GTIA JOYSTICK PAINTER
With this lesson's GTIA Editor, you can easily create ambitious medium-resolution Graphics 10 drawings, SAVE them to disk and LOAD them later. Type in Listing 1 GEDIT.BAS, check it with TYPO II and SAVE a copy before you RUN it.
If you have trouble typing the special characters in lines 2030, 2080, 2130, 2180 and 2250, don't type them in. Listing 2 will create them for you. Type Listing 2, check it with TYPO II and SAVE a copy to disk. When RUN, Listing 2 creates these hard-to-type lines and stores themm in a disk file called D:LINES.LST.
To merge the two programs, LOAD "D:GEDIT.BAS" then ENTER "D: LINES. LST" remember to SAVE the completed program before you RUN it.
USING THE PAINTER
Plug a joystick into port 1. When RUN, GTIA. Joystick Painter displays eight colored blocks at the bottom of the screen (your "palette" of color choices) and four flashing marks (the boundaries of your drawing cursor).
Press [C] to pick a color to draw with. A line will appear under the present color. Move the joystick left or right to select one of the eight default colors. After you select a color, you can change it by moving the joystick forward and backward. When you're satisfied with your palette, press the joystick button.
Now use the joystick to position the flashing cursor. To draw, hold down the joystick button. Release it to stop drawing. To change the size of the drawing cursor, press [CONTROL] and an [ARROW] key. To erase the screen, press [SHIFT] [CLEAR].
Press [E] to change the cursor color to the white background color. Then erase as much as you want by pressing the trigger. To start drawing again, select a new color by pressing [C].
Press [S] to SAVE your drawing. Your picture will temporarily vanish and a "Filename to SAVE?" prompt will appear in its place.
Now, type in a filename for your picture and press [RETURN]. The program will SAVE your drawing, along with the eight color values of your palette.
Press [L] to LOAD a drawing. At the "Filename to LOAD?" prompt, type in the name of the file to load and press [RETURN]. The program will LOAD the drawing and its color palette.
Pressing [RETURN] at either of these prompts will return you to the drawing screen.
GRAPHICS 10
Graphics mode 10 might be more important than any other Atari Graphics mode because it offers an extended selection of the number of possible onscreen colors without using the Player/Missile graphics which will be introduced in a later lesson. It also allows color indirection, meaning that you can select nine colors from the 128 color/hue combinations and that you can change the color of any object onscreen with just one SETCOLOR or POKE command.
Because of the differences in possible color/hue combinations, the operating instructions for Graphics 10 are different from Graphics 9 and 11:
1. Use the GRAPHICS 10 command.
2. Select a color register to draw with using the COLOR command. Here, that command refers not to the color value itself, but to the register that contains the color value. Therefore the range of values is 0 to 8.
COLOR REGISTERS
Before you use a color register, you'll probably want to know what actual color value it contains and how to change it. The default colors of the normal playfield registers are orange, blue, pink, green and black. These can be controlled by the SETCOLOR command.
Since register 0 corresponds to memory location 704, COLOR 0 will set the color to be plotted according to what's in 704. To calculate this number, use this formula: N=(16*color value)+ luminance value.
For example, to set color register 0 to the background blue of a Graphics 0 screen, you'd want the value generated by the statement SETCOLOR x,9,4. Since the color value is 9 and the luminance value is 4, the number to POKE into 704 is (16 * 9) + 4, or 148.
GRAPHICS MODE 11
Graphics 11 is almost identical to Graphics 9-except that it offers 16 colors at one level of brightness. The instructions for using it are almost the same as those for Graphics 9:
1. Use a GRAPHICS 11 command.
2. Use SETCOLOR to select the color to be used. Use the form SETCOLOR 4,0,B, where B is an even number between 0 and 14.
3. To PLOT or DRAWTO, use COLOR. The colors correspond to the shades you would normally use for the second value of the SETCOLOR command.
4. Now PLOT and DRAWTO normally. The acceptable horizontal and vertical boundaries are the same as for Graphics 9.
GTIA GRAPHICS MODE SUMMARY
SCREEN SIZE (COLUMNSxROWS) GRAPHICS 9 80x192 MEMORY REQUIRED: 8138 BYTES
DISPLAY TYPE | DEFAULT COLORS | SETCOLORS (N) | POKE ADDRESS | COLOR (N) |
|
||||
ONE HUE, 16 LUMINANCES, CHANGE HUE WITH SETCOLOR 4, HUE,0 OR POKE 712, HUE | BLACK | 4 | 712 | 0 |
1 | ||||
2 | ||||
3 | ||||
DARK GRAY | 4 | |||
5 | ||||
6 | ||||
7 | ||||
GRAY | 8 | |||
9 | ||||
10 | ||||
11 | ||||
LIGHT GRAY | 12 | |||
13 | ||||
14 | ||||
WHITE | 15 | |||
NINE COLORS | BLACK | 704 | 0 | |
BLACK | 705 | 1 | ||
BLACK | 706 | 2 | ||
BLACK | 707 | 3 | ||
ORANGE | 0 | 708 | 4 | |
LIGHT GREEN | 1 | 709 | 5 | |
BLUE | 2 | 710 | 6 | |
RED | 3 | 711 | 7 | |
BLACK | 4 | 712 | 8 | |
ONE LUMINANCE, 16 HUES, CHANGE LUMINANCE WITH SETCOLOR 4, LUM, 0, OR POKE 712, LUM | BLACK | 4 | 712 | 0 |
GOLD | 1 | |||
ORANGE | 2 | |||
RED ORANGE | 3 | |||
PINK | 4 | |||
PURPLE | 5 | |||
PURPLE BLUE | 6 | |||
AZURE BLUE | 7 | |||
SKY BLUE | 8 | |||
LIGHT BLUE | 9 | |||
TURQUOISE | 10 | |||
GREEN BLUE | 11 | |||
GREEN | 12 | |||
YELLOW GREEN | 13 | |||
ORANGE GREEN | 14 | |||
LIGHT ORANGE | 15 |
Robin Sherer is co-autbor of Master Memory Map of the Atari and otherAlari reference books.
Listing 1: GEDIT.BAS Download
Listing 2: LINES.BAS (not needed)