GTIA
by Tim McGuinness
Every ATARI computer owner probably has heard about the new GTIA chip that replaces the CTIA chip. This upgrade item for both the 400 and 800 computers began appearing in new machines in the beginning of 1982. Some of you who bought at about that time may wonder if you have the GTIA. You can find out by running the following BASIC program.
10 GRAPHICS 9
20 GOTO 20
If you get a black screen, you have the new chip. If you get a blue screen, you have the old chip.
GTIA means Graphics Television Interface Adapter, and CTIA means Color Television Interface Adapter. GTIA continues to do all the things CTIA did, but more.
GTIA widens the gap between the ATARI computers and other home systems. It adds three more "modes" of graphic display to the nine available with the CTIA. Those modes began with GRAPHICS 0 (Test Mode) and ended with GRAPHICS 8, a high-resolution (small pixel) mode with one color of your choice in two luminances. Modes 3,5 and 7 gave you up to four colors simultaneously, with different sized pixels in each mode.
With GTIA you gain the following:
- GR.9--sixteen luminances (shades) of one of the available colors
- GR.10--nine individuals colors, each a combination of one hue and one luminance
- GR.11--sixteen colors, all at the same luminance.
The pixel with these modes is long and flat, having a 4:1 ratio, with 80 across the screen by 192 down. For comparison, a hyphen in text mode has a 7:1 ratio. The pixel (picture element) is the smallest programmable unit in a given text or graphics mode.
Using the GTIA is as simple as using the CTIA. Just use GR.9, GR.10 or GR.11 in the same way the previous modes are used (see ATARI BASIC Reference Manual and Self-Teaching Guide).
The GTIA is fully supported by the Operating System, and all the commands and utilities that run with the CTIA can be used with the GTIA, except you now have more colors available to you. Sixteen color changes can take place on a line, completely independent of the main processor. This is better than the 12 changes you could get using display list interrupts, for example. Contouring and 3-D effects are greatly enhanced. (see Listings).
GTIA programs can be used on CTIA equipped machines, but will suffer color simplification and some shifting (e.g. blue for green).
If you have the GTIA chip, you may want to type in some of the following listings. The first demonstrates GR.9. Here, the background hue is set by the SETCOLOR command. Then, the COLOR command determines the luminances for drawing on the screen by using values from 0 to 15.
10 GRAPHICS 9 20 SETCOLOR 4,8,0 30 FOR I=1 TO 78 40 COLOR I 50 PLOT I,I+I 60 NEXT I 70 GOTO 10
We will skip mode 10 for a moment to compare the similarities of mode 9 to mode 11. Here the program can use 16 different hues (colors) all at the same luminance, i.e., just the reverse of mode 9. This time the SETCOLOR command is used to provide the luminance value only, as in the line "SETCOLOR 4,0,10". The 10 is the luminance value.
10 GRAPHICS 11 20 SETCOLOR 4,0,10 30 FOR I=1 TO 78 40 COLOR I 50 PLOT I,I+I 60 NEXT I 70 GOTO 10
Note that as in all pre-GTIA graphics modes, the first binary bit of the luminance designator is not used. Therefore, only even-numbered luminance values results in distinct changes, so there are really only eight different luminances. The COLOR command this time selects the various hues by using the values from 0 through 15.
In mode 10 the computer will allow nine color registers to be used in the playfield at one time. Each register must be set to some combination of hue and luminance. You can do this in BASIC with either the SETCOLOR command, or with the POKE command. We will use POKE to put the color designators directly into decimal addresses 708-712, which hold the four playfield registers and the background register.
To set the four player/missile color registers at addresses 704-708, you must use POKE. The COLOR command is used to select the color register desired, and these can be from 0 through 8 only. A value over 8 will result in an unknown register being used.
A typical BASIC program for GR.10 will include: a GR.10 command; a set of POKE (or SETCOLOR and POKE) commands; and a color command which selects the desired color register for drawing on the screen. This is demonstrated in the main listing with this article.
The main listing draws four cylinders in various colors and rotates them. To change the hue/luminance combinations simply change the values in lines 10 through 17.
5 DEG 6 GRAPHICS 10 10 POKE 706,8 11 POKE 707,32 12 POKE 708,56 13 POKE 709,80 14 POKE 710,104 15 POKE 711,128 16 POKE 712,152 17 POKE 705,176 20 FOR ANG=180 TO 360+180 STEP 6 30 X=8+8*COS(ANG) 40 Y=16+8*SIN(ANG) 50 COLOR(ANG-180)/45+1:PLOT X,Y 60 DRAWTO X,50+Y 70 COLOR 0:PLOT X,Y 90 NEXT ANG 120 FOR ANG=180 TO 360+180 STEP 6 130 X=26+8*COS(ANG) 140 Y=16+8*SIN(ANG) 150 COLOR 9-(ANG-180)/45:PLOT X,Y 160 DRAWTO X,50+Y 170 COLOR 0:PLOT X,Y 190 NEXT ANG 220 FOR ANG=180 TO 360+180 STEP 6 230 X=44+8*COS(ANG) 240 Y=16+8*SIN(ANG) 250 COLOR (ANG-180)/45+1:PLOT X,Y 260 DRAWTO X,50+Y 270 COLOR 0:PLOT X,Y 290 NEXT ANG 320 FOR ANG=180 TO 360+180 STEP 6 330 X=62+8*COS(ANG) 340 Y=16+8*SIN(ANG) 350 COLOR 9-(ANG-180)/45:PLOT X,Y 360 DRAWTO X,50+Y 370 COLOR 0:PLOT X,Y 390 NEXT ANG 410 GO TO 500 420 FOR ANG=180 TO 360+180 STEP 6 430 X=50+8*COS(ANG) 440 Y=16+8*SIN(ANG) 450 COLOR (ANG-180)/45:PLOT X,Y 460 DRAWTO X,50+Y 470 COLOR 0:PLOT X,Y 490 NEXT ANG 500 A=PEEK(705) 510 FOR I=705 TO 711 520 POKE I,PEEK(I+1) 530 NEXT I 540 POKE 712,A 550 GO TO 500
The last listing draws a light show in all 16 hues. Enjoy your ATARI.
5 T=0 10 GRAPHICS 11 20 XX=0 30 YY=0 40 C=0 50 X=INT(RND(0)*80) 60 Y=INT(RND(0)*192) 70 C=C+1:IF C=17 THEN C=0 80 S=INT(RND(0)*14+1) 90 COLOR C 100 PLOT XX,YY 110 DRAWTO X,Y 120 COLOR C 130 PLOT XX,YY 140 XX=X:YY=Y 150 SOUND 0,C*10,X,15:SOUND 0,0,0,0 160 T=T+1:IF T=400 THEN 5 170 GOTO 50
Tim McGuinness is a design engineer in corporate research and development for ATARI Inc.