GTIA Graphics Modes 9, 10 and 11: 16 Shades, 9 Colours, 16 Hues
The GTIA ("Graphics Television Interface Adaptor") is the chip that turns ANTIC's data into a video signal on almost every Atari 8-bit. It replaced the original CTIA early in the 400/800's life and added three extra ways of interpreting the high-resolution data stream — reachable from BASIC as GRAPHICS 9, 10 and 11. They trade horizontal resolution for colour: 80 fat pixels across, but 16 shades, 9 independent colours or 16 hues on every line, without any interrupt tricks.
What you'll learn: how the three modes encode pixels, how to set colours for each, simple BASIC demos, how PRIOR selects the modes, how to tell a CTIA from a GTIA, and the limitations to plan around.
What you need: any XL/XE, or a 400/800 with a GTIA (see below), Atari BASIC and about 8K of free RAM. Emulators all default to GTIA.
Which machines have GTIA?
Early NTSC 400/800 units shipped with the CTIA; later NTSC 400/800s, all PAL 400/800s and all XL/XE models have the GTIA, while SECAM machines use a variant called FGTIA (which gives only 8 luminances in GRAPHICS 9). The 400/800 OS Rev. A and Atari BASIC were "GTIA-ready" from their 1979 release, which is why GRAPHICS 9–11 work from BASIC on every machine — even if, on a CTIA, the result is not what was intended.
How the modes work
All three are reinterpretations of ANTIC mode F (GRAPHICS 8's data), so the display list and memory use are the same as GRAPHICS 8: 40 bytes per line, 192 lines, nearly 8K. GTIA takes each 4 bits (two adjacent GRAPHICS 8 pixel pairs) and turns them into one pixel two colour clocks wide. Result: 80 × 192 pixels, each about four times wider than tall — and such long, skinny pixels don't draw curves well.
The modes are selected by the top two bits of the priority register PRIOR ($D01B), shadowed at GPRIOR, 623 ($26F):
| GPRIOR value | Bits 7–6 | Mode |
|---|---|---|
| 0 | 00 | normal (CTIA-compatible) |
| 64 | 01 | GRAPHICS 9 — 16 luminances of one hue |
| 128 | 10 | GRAPHICS 10 — 9 colour registers |
| 192 | 11 | GRAPHICS 11 — 16 hues of one luminance |
The GRAPHICS statement sets this for you. Add the player/playfield priority bits (1, 2, 4 or 8) if you also use players. GTIA modes are cleared by an OPEN of the screen (i.e. by GRAPHICS), and they have no text window.
GRAPHICS 9: sixteen shades
The hue comes from the background register (712); the pixel value (COLOR 0–15) supplies the luminance, which GTIA ORs into the low nybble. So set the background's luminance to zero: SETCOLOR 4,hue,0. This bypasses the colour registers, which normally ignore bit 0 of the luminance — so GRAPHICS 9 is the only mode with all 16 brightness levels, giving 256 possible colours overall.
10 GRAPHICS 9:SETCOLOR 4,9,0
20 FOR I=0 TO 15:COLOR I
30 FOR X=I*5 TO I*5+4:PLOT X,0:DRAWTO X,191:NEXT X
40 NEXT I
50 GOTO 50
Sixteen bars from black to bright blue fill the screen. Change the 9 to any hue 0–15. Louis and Helen Markoya, writing in COMPUTE!'s Second Book of Atari Graphics, suggested GRAPHICS 9 for shaded, bas-relief and 3-D looking images — it is still the go-to mode for digitised photos.
GRAPHICS 11: sixteen hues
The mirror image of mode 9: the background register supplies one luminance and the pixel value supplies the hue. Use SETCOLOR 4,0,luminance. Pixel value 0 is always forced to luminance 0, so COLOR 0 is black.
10 GRAPHICS 11:SETCOLOR 4,0,8
20 FOR I=0 TO 15:COLOR I
30 FOR X=I*5 TO I*5+4:PLOT X,0:DRAWTO X,191:NEXT X
40 NEXT I
50 GOTO 50
GRAPHICS 10: nine independent colours
Here the pixel value selects a colour register, so all nine of GTIA's registers — four player/missile colours and five playfield colours — become screen colours:
| COLOR | Register | Shadow |
|---|---|---|
| 0 | COLPM0 (background in this mode) | 704 |
| 1–3 | COLPM1–COLPM3 | 705–707 |
| 4–7 | COLPF0–COLPF3 | 708–711 |
| 8 | COLBK | 712 |
SETCOLOR only reaches 708–712, so POKE the others (value = hue × 16 + luminance). Pixel values 9–15 don't exist; they fall back to lower registers. This demo draws eight colour bars and then rotates the colours through the registers — a "marquee" effect the Markoyas also used:
10 GRAPHICS 10:POKE 704,0
20 FOR R=1 TO 8:POKE 704+R,R*16+6:NEXT R
30 FOR I=1 TO 8:COLOR I
40 FOR X=I*9 TO I*9+7:PLOT X,20:DRAWTO X,170:NEXT X
50 NEXT I
60 A=PEEK(705)
70 FOR R=705 TO 711:POKE R,PEEK(R+1):NEXT R
80 POKE 712,A
90 FOR W=1 TO 30:NEXT W:GOTO 60
Because each colour lives in its own register, you can recolour any part of a GRAPHICS 10 picture instantly — the sky, say — without redrawing it.
Is it a CTIA or a GTIA?
A quick test: POKE 623,64 in GRAPHICS 0. With a GTIA the screen goes black (the text data is now being shown as GRAPHICS 9 shades of the black background hue); with a CTIA nothing changes.
For a program that adapts itself, Craig Chamberlain and Sheldon Leemon published a detection routine in COMPUTE! that uses collision detection. The idea is that in GRAPHICS 9 the playfield acts as background and never registers playfield collisions, whereas a CTIA ignores the GTIA bits and shows plain mode F, which does. A version of the same idea:
10 GRAPHICS 8+16:POKE 623,64
20 COLOR 1:PLOT 0,0:DRAWTO 0,191
30 POKE 53248,42:POKE 53261,3
40 POKE 53278,0:FOR K=1 TO 100:NEXT K
50 C=PEEK(53252):POKE 53261,0:POKE 53248,0
60 GRAPHICS 0
70 IF C=0 THEN PRINT "GTIA PRESENT"
80 IF C<>0 THEN PRINT "CTIA (NO GTIA MODES)"
Line 30 positions player 0 at colour clock 42 and writes 3 straight into its graphics register GRAFP0 (53261), producing a full-height two-pixel stripe at the very left edge of the playfield, over the line drawn in line 20. Line 40 clears the collision registers and waits a few frames; line 50 reads P0PF (53252).
Limitations and quirks
- No text window and no text. GTIA modes are map modes. To combine them with a text line you need a custom display list plus a DLI that changes PRIOR's hardware register at $D01B mid-screen (the shadow 623 is only copied once per frame).
- Players and missiles still work and are a good way to add extra colours in modes 9 and 11. In mode 9, players always have priority over the playfield.
- Collisions are unreliable: none at all in GRAPHICS 9 and 11; in GRAPHICS 10 only the playfield-register colours register, and the background is set by 704.
- Horizontal fine scrolling must use even HSCROL values only.
- Artifacting differs. Colour artifacts on a GTIA machine are not identical to a CTIA's on the same TV, and GTIA programs are not downward compatible: on a CTIA they produce a recognisable but colourless picture.
- Other ANTIC modes. GTIA modes only fully work with the high-resolution ANTIC modes 2, 3 and F (low-resolution modes encode their data differently on the ANTIC-to-GTIA bus). A neat consequence is that GTIA modes over GRAPHICS 0 turn every character into a 2 × 8 block of GTIA pixels — a full-screen 16-shade picture from under 1K of screen memory plus a redefined character set. PC tools such as Graph2Font and native editors such as Macro Edit can design such fonts.
- PAL blending. On PAL machines, alternating mode 9 and mode 11 scan lines lets the TV's colour averaging mix the grey levels with the hues, giving a pseudo-256-colour picture — the basis of several modern image formats.
Troubleshooting
- GRAPHICS 9 picture looks washed out: the background register has a non-zero luminance being ORed in. Use
SETCOLOR 4,hue,0. - GRAPHICS 11 colours all look the same brightness — or too dark: that's the mode; pick the luminance with
SETCOLOR 4,0,lum. - GRAPHICS 10 colours not changing with SETCOLOR: registers 704–707 have no SETCOLOR number; POKE them.
- An error when opening the mode, or not enough memory for your program: GTIA modes need about 8K of free RAM for the screen, the same as GRAPHICS 8.
- On a 400/800, the screen shows stripes instead of shades: you have a CTIA. A GTIA was sold as a service upgrade; the Markoyas advised asking an authorised Atari service centre.
Further reading
- De Re Atari (Atari, 1982), Appendix E.
- COMPUTE!'s Second Book of Atari Graphics (COMPUTE! Books, 1984), "GTIA: An Illustrated Overview".
- Mapping the Atari by Ian Chadwick (COMPUTE! Books), location 623 — includes short demos for all three modes and the GTIA test.
- Altirra Hardware Reference Manual, section 6.9, for exact priority and collision behaviour.
- Antic Vol. 3 No. 5, "All Modes", which explores all 56 ANTIC/GTIA combinations (referenced by the comp.sys.atari.8bit FAQ).
Credits
- Picture: GRAPHICS 9: one hue, sixteen luminances, from the first demo in this guide. — Program authors; screenshot by the site
- De Re Atari, Appendix E: GTIA — AtariArchives.org
- COMPUTE!'s Second Book of Atari Graphics — GTIA: An Illustrated Overview (Louis and Helen Markoya) — AtariArchives.org
- Mapping the Atari (revised edition) — 623 GPRIOR, 704-712, 53248 GTIA introduction, 53252 P0PF, 53275 PRIOR — AtariArchives.org
- Altirra Hardware Reference Manual, sections 6.8-6.9 (high resolution and GTIA special modes) — Avery Lee (Altirra)
- comp.sys.atari.8bit FAQ (Michael Current) — 1.12 CTIA/GTIA/FGTIA and graphics modes table — Michael Current (comp.sys.atari.8bit FAQ)
- AtariAge forum — GTIA Modes 9, 10 & 11 + ANTIC data and color clocks — AtariAge forum members
