NTSC Artifacting: Getting Colour Out of GRAPHICS 8

Atari's manuals say GRAPHICS 8 gives you one colour in two luminances. Anyone who drew a single-pixel line on a 1980s American TV knew better: thin vertical lines came out green, blue, orange or purple depending on where they were drawn. These "television artifacts" are a side effect of how colour TV signals work, and Atari programmers — and game designers on other machines too — turned them into a free extra palette.

What you'll learn: what causes artifact colours, which modes and machines produce them, which pixel patterns give which colours, a test program, De Re Atari's trick for drawing with artifact colours as if in a four-colour mode, and the caveats.

What you need: Atari BASIC. To see real artifacts you need an NTSC machine connected by composite video or RF; emulators approximate the effect when their NTSC artifacting option is enabled.

Why it happens

In TV-engineering terms: a colour TV signal carries brightness (luma) as the main signal and colour (chroma) as a 3.58 MHz subcarrier mixed into it; the phase of that subcarrier determines the hue. A "colour clock" is one cycle of the subcarrier, and the Atari's lower-resolution modes change colour no faster than once per colour clock.

GRAPHICS 8 (ANTIC mode F), GRAPHICS 0 (mode 2) and ANTIC mode 3 change luminance every half colour clock — 320 pixels across. A pattern of alternating light and dark half-clock pixels creates a luma signal at exactly the subcarrier frequency, and the TV's decoder cannot tell it apart from genuine colour. And unlike broadcast TV, the Atari doesn't filter chroma-like frequencies out of its luma, and its signal doesn't invert subcarrier phase between lines, so the false colours are stable rather than shimmering.

Consequences:

  • Only the hi-res modes (GRAPHICS 0, GRAPHICS 8, ANTIC 3) artifact.
  • NTSC only, really. PAL's subcarrier is at a different ratio to the pixel clock (5 colour cycles per 4 low-res pixels), so PAL artifacting needs much more complex patterns and gives a different, far less useful effect.
  • Composite or RF only. With an S-Video (separate luma/chroma) connection there is no artifacting at all.
  • Hues vary by machine and TV. The most common pairs are blue/green on 800s, purple/green on XLs and red/blue on XEs, because the delay between luma and colour burst differs between models. The TV's tint control also changes them. GTIA and CTIA machines also differ.

What patterns give what

Judson Pewther's article in COMPUTE!'s Second Book of Atari Graphics summarises the rules for plotting white on black in GRAPHICS 8 (colours are those he saw on a typical set):

Horizontally adjacent lit pixels X coordinate(s) Typical colour
1 even green
1 odd blue
2 even, odd orange
2 odd, even light blue
3 — nearly white
4 — white

The colour does not depend on Y, only on whether X is even or odd and on what's next to it horizontally. In effect, the practical horizontal resolution drops to 160 coloured "pixels". Effects are strongest with a bright foreground on a dark background (or dense dark patterns on a light background), and Pewther recommends lowering the TV's brightness and contrast and experimenting with the tint control. The even and odd colours are always opposite each other in the signal, with a brightness halfway between the two luminances.

A test pattern

10 GRAPHICS 8+16:SETCOLOR 2,0,0:SETCOLOR 1,0,14:COLOR 1
20 FOR X=0 TO 38 STEP 2:PLOT X,20:DRAWTO X,170:NEXT X
30 FOR X=61 TO 99 STEP 2:PLOT X,20:DRAWTO X,170:NEXT X
40 FOR X=120 TO 156 STEP 4:PLOT X,20:DRAWTO X,170:PLOT X+1,20:DRAWTO X+1,170:NEXT X
50 FOR X=181 TO 217 STEP 4:PLOT X,20:DRAWTO X,170:PLOT X+1,20:DRAWTO X+1,170:NEXT X
60 FOR X=240 TO 279:PLOT X,20:DRAWTO X,170:NEXT X
70 GOTO 70

In GRAPHICS 8, 710 (SETCOLOR 2) sets the background colour and luminance and 709 (SETCOLOR 1) the luminance of lit pixels. On an NTSC composite display you should see five vertical bands: even columns (one hue), odd columns (the opposite hue), even-odd pairs, odd-even pairs, and a solid block that stays white. On S-Video, or a PAL machine, all five look like shades of grey and white.

Drawing with artifact colours: the POKE 87,7 trick

De Re Atari's Appendix D shows how to make BASIC plot artifact colours directly. Location 87 (DINDEX) holds the OS's idea of the current graphics mode. GRAPHICS 7 and GRAPHICS 8 both use 40 bytes per line, so if you open GRAPHICS 8 and then POKE 87 with 7, the OS draws with two-bit pixels, 160 across: COLOR 1 plots the bit pair 01, COLOR 2 plots 10, COLOR 3 plots 11. Each of those two-bit pixels is one colour clock wide, and each produces its own artifact colour. Here is De Re Atari's demonstration:

10 GRAPHICS 8:POKE 87,7:POKE 710,0:POKE 709,14
20 COLOR 1:PLOT 10,5:DRAWTO 10,70
30 PLOT 40,5:DRAWTO 40,70
40 COLOR 2:PLOT 20,5:DRAWTO 20,70
50 PLOT 41,5:DRAWTO 41,70
60 COLOR 3:PLOT 30,5:DRAWTO 30,70
70 FOR X=1 TO 3:COLOR X:POKE 765,X
80 PLOT X*25+60,5:DRAWTO X*25+60,70
90 DRAWTO X*25+40,70:POSITION X*25+40,5
100 XIO 18,#6,12,0,"S:"
110 NEXT X

It draws single lines in COLOR 1, 2 and 3, a line pair at X = 40/41 that combines COLOR 1 on the left with COLOR 2 on the right (the fourth artifact colour), and then three filled shapes using the OS fill command XIO 18 with the fill colour in location 765 (FILDAT). Coordinates are now 0–159 across. COLOR 3, both half-pixels lit, gives the "no artifact" result — a solid line of constant luminance.

The same four patterns can be thought of as bit pairs across neighbouring colour clocks; experiment with how close together the lit columns are.

Artifacting in practice

  • It's free colour. A GRAPHICS 8 screen can show the background, two luminances and two or three artifact hues without any interrupts or extra memory. Pewther's article includes moiré-pattern art programs built entirely on the effect.
  • Fonts. Brannon's character-design advice in the same book — draw vertical strokes two pixels wide — exists precisely to avoid artifact fringes on GRAPHICS 0 text.
  • Mixed hardware. Because the hues change from 800 to XL to XE and from TV to TV, a design that looks perfect on one machine may look odd on another. Many programs offered a colour-swap option for this reason.
  • Players on top. Player/missile graphics are positioned in whole colour clocks and don't artifact, so they combine well with an artifacted background.

Troubleshooting

  • No colours at all: you're on PAL, on S-Video/RGB, or your emulator's NTSC artifact option is off. Also check you used single-pixel features — solid areas never artifact.
  • Colours different from the table: expected. Adjust the tint control; the exact hues depend on the computer model and display.
  • Lines look dim: a lone one-pixel line is genuinely darker than a two-pixel one; use brighter luminance in 709.
  • POKE 87,7 program draws in the wrong places: you must POKE after the GRAPHICS 8 statement, and coordinates are then in GRAPHICS 7 units (0–159 across).

Further reading

  • De Re Atari (Atari, 1982), Appendix D, "Television Artifacts".
  • COMPUTE!'s Second Book of Atari Graphics (COMPUTE! Books, 1984), "Artifacting" by Judson Pewther, with four art programs.
  • Altirra Hardware Reference Manual, section 6.4 — the full signal-theory explanation, including PAL artifacting.
  • Mapping the Atari by Ian Chadwick (COMPUTE! Books), location 710.

Credits