CTIA, GTIA and FGTIA: Which Graphics Chip Do You Have?

Black GRAPHICS 8 screen with a grey rectangle crossed by a purple vertical player bar; the text window reads P0PF NORMAL:4 MODE 9:0 and GTIA (OR FGTIA) PRESENT

The chip that turns ANTIC's data into a colour picture went through three versions. The CTIA shipped in the first NTSC Atari 400s and 800s. The GTIA replaced it and is in nearly every machine. The FGTIA is a SECAM variant used in France. Software almost never notices the difference, with one big exception: GRAPHICS 9, 10 and 11 exist only on the GTIA. If an old program shows a plain striped mess where a shaded picture should be, or a modern demo looks wrong on an early 800, this is the first thing to check.

What you'll learn: what each chip does and which machines have it, how to tell them apart from the keyboard, how a program can detect the chip itself, and the known problem with some late GTIAs.

What you need: Atari BASIC for the tests. The detection program was run in the atari800 emulator, which emulates a GTIA.

1. The family

Chip Part number Found in
CTIA C012295 (NTSC) Early NTSC 400 and 800
GTIA C014805 (NTSC), C014889 (PAL) Later NTSC 400/800, all PAL 400/800, all XL and XE models
FGTIA C020120 (SECAM) SECAM 800XL, 130XE and XE Game System

Atari's documentation expands the names to "Color Television Interface Adaptor" and "Graphics Television Interface Adaptor". The original internal names were probably "Colleen Television Interface Adaptor" and "George's Television Interface Adaptor".

Apart from graphics, the same chip reads the joystick triggers and console keys, drives the 400/800's internal speaker, and on the XL/XE senses whether a cartridge is present. All of that is identical across the three versions.

2. What the GTIA adds

The GTIA is backward-compatible with the CTIA. It adds three graphics modes, selected with the top two bits of the PRIOR register (shadow GPRIOR, location 623):

GPRIOR bits 7–6 BASIC What you get
01 (64) GRAPHICS 9 16 shades of one hue
10 (128) GRAPHICS 10 9 colours from the colour registers
11 (192) GRAPHICS 11 16 hues at one brightness

All three take the high-resolution data of ANTIC mode F (or text modes 2 and 3) and read it 4 bits at a time, giving 80 wide pixels per line. GTIA Graphics Modes 9, 10 and 11 covers them in detail.

On a CTIA, those two PRIOR bits are simply ignored. The screen is shown in the base ANTIC mode, normally mode F (one hue, two brightness levels, 320 dots across), so a GRAPHICS 9 picture comes out as a pattern of fine dots instead of shades. The OS still accepts GRAPHICS 9 to 11 without error, so nothing tells the program that anything is wrong. The Atari OS revision A and Atari BASIC revision A supported these modes from their 1979 release. Robin Sherer of Santa Cruz Education Software was quoted in InfoWorld (15 March 1982) as saying the GTIA "had it designed before the computer even went to market", but Atari had already ordered a large stock of CTIAs and used them first.

The FGTIA is software-compatible with the GTIA, with one difference: in GRAPHICS 9 it shows only 8 distinct brightness levels instead of 16.

3. The one-POKE test

At the READY prompt, type:

POKE 623,64

With a GTIA or FGTIA, the screen turns black. The text is still there, but GTIA mode 9 now reinterprets it as 4-bit pixels. With a CTIA, nothing visible happens and the screen stays blue. Type GRAPHICS 0 (or press RESET) to get your normal screen back.

4. Detecting the chip in software

A program can't look at the screen, but it can look at the collision registers. In GTIA mode 9 the playfield acts as background for priority purposes, and no playfield collisions are registered. A CTIA ignores the mode bits, so the same pixels still count as playfield and do collide. So:

  1. Draw something solid in GRAPHICS 8.
  2. Put player 0 over it.
  3. With normal priority, clear the collision registers, wait a frame, and confirm that P0PF (53252) is non-zero. This proves the test is valid.
  4. Set GPRIOR to 64, clear the collisions again, wait, and read P0PF. Zero means GTIA. Non-zero means CTIA.
10 REM CTIA OR GTIA? COLLISION TEST
20 GRAPHICS 8:COLOR 1:SETCOLOR 2,0,0
30 FOR Y=40 TO 80:PLOT 100,Y:DRAWTO 219,Y:NEXT Y
40 A=PEEK(106)-8:POKE 54279,A:B=A*256+512
50 FOR I=0 TO 127:POKE B+I,0:NEXT I
60 FOR I=50 TO 90:POKE B+I,255:NEXT I
70 POKE 53248,120:POKE 704,68:POKE 559,46:POKE 53277,2
80 G=0:GOSUB 200:C0=C
90 G=64:GOSUB 200:C1=C
100 POKE 623,0
110 ? "P0PF NORMAL:";C0;"  MODE 9:";C1
130 IF C0=0 THEN ? "NO OVERLAP - TEST FAILED":END
140 IF C1=0 THEN ? "GTIA (OR FGTIA) PRESENT":GOTO 160
150 ? "CTIA PRESENT"
160 GOTO 160
200 POKE 623,G:T=PEEK(20):IF PEEK(20)=T THEN 200
210 POKE 53278,0:T=PEEK(20)
220 IF PEEK(20)<T+2 AND PEEK(20)>=T THEN 220
230 C=PEEK(53252):RETURN

How it works:

  • Lines 40–70 set up double-line-resolution player graphics 2K below the top of RAM (see Player/Missile Graphics in Atari BASIC). Player 0 is a solid bar from byte 50 to 90 of its area, at horizontal position 120. PMBASE is 54279, PCOLR0 704, SDMCTL 559 and GRACTL 53277.
  • The subroutine at 200 writes the priority shadow and waits for the vertical blank to copy it to the hardware (line 200 waits for the frame counter at location 20 to change). It then writes HITCLR (53278) to clear all collisions and waits two more frames so that the player has been drawn over the box.
  • On the emulated GTIA the program printed P0PF NORMAL:4 MODE 9:0. The 4 is bit 2, meaning a collision with playfield 2, which is the colour register GRAPHICS 8 pixels use.

A machine-language version works the same way, and is the safe approach for a game or demo that wants to fall back to a non-GTIA picture. Bill Wilkinson described another software technique in his "Insight: Atari" column in COMPUTE! #32 (January 1983).

5. Which machines to suspect

  • Any NTSC Atari 400 or 800 could have either chip. The CTIA is only in early production, so a later 800 usually has a GTIA. Run the test.
  • PAL 400/800s, every XL and every XE have a GTIA, or an FGTIA on SECAM models.
  • In emulators, the chip can be an option. Altirra added a CTIA emulation mode, which is useful for checking that your software degrades gracefully.

6. The faulty late GTIAs

A substantial number of late Atari XE computers, especially 800XE machines made in China, shipped with moderately defective GTIA chips. Polish documentation on the Atariki wiki describes how to recognise them. Simius designed a "GTIA Fixer" board for the problem in 2010, and Jürgen van Radecke later offered it. A separate, temperature-dependent oddity called "Delayed GTIA Functions" was documented by Pawel Rosowski in 2013. If graphics on an XE glitch only when the machine is warm, these are the places to look.

Troubleshooting

  • POKE 623,64 blackens the screen and you can't read anything: that is the GTIA result. Type GRAPHICS 0 blind, or press RESET.
  • The detection program says "TEST FAILED": player graphics aren't showing. Check that nothing else uses the memory below RAMTOP, and that SDMCTL (559) has the player DMA bits set.
  • GRAPHICS 9 shows dots instead of shades on a real machine: CTIA. The program needs a GTIA, or a fallback mode.
  • Shades look banded on a French machine: FGTIA, which has 8 brightness levels in mode 9.

Further reading

  • Michael Current, comp.sys.atari.8bit FAQ, section 1.12 "What are SALLY, ANTIC, CTIA/GTIA/FGTIA, POKEY, and FREDDIE?".
  • Avery Lee, Altirra Hardware Reference Manual, chapter 6 (CTIA/GTIA): priority and collision behaviour in the GTIA modes.
  • Bill Wilkinson, "Insight: Atari", COMPUTE! #32 (January 1983), p. 171.
  • On this site: GTIA Graphics Modes 9, 10 and 11, Collision Detection in Depth, PRIOR and GPRIOR: Priority Register Tricks.

Credits