Display Lists Explained: How ANTIC Builds the Atari Screen

Text screen listing the GRAPHICS 8 display list: 112 112 112, 79 with an address, many 15s, a second 79 at 36864, and the closing 65

Every picture an Atari 8-bit computer puts on the screen is produced by a tiny program that most users never see: the display list. It is executed not by the 6502 CPU but by ANTIC, Atari's dedicated video microprocessor. Once you understand the display list, almost every famous Atari graphics trick — mixed text and graphics, hidden graphics modes, fine scrolling, display list interrupts, page flipping — stops being magic and becomes a few bytes you can change.

What you'll learn: what ANTIC does, the format of a display list instruction, how the standard GRAPHICS 0 list is put together, how to find and decode the display list of any mode from BASIC, and the hardware rules (scan-line budget, 1K and 4K boundaries) that trip up beginners.

What you need: any Atari 400/800/XL/XE (or an emulator such as Altirra or atari800) with Atari BASIC. No assembly language is required for this guide.

ANTIC: a processor just for the picture

Most early home computers had fixed video circuitry that turned one block of RAM into one kind of picture. The Atari designers instead built ANTIC, a true microprocessor with its own instruction set, program and data. Its program is the display list, and it tells ANTIC three things:

  1. Where the screen data is in memory.
  2. How to interpret that data (which display mode to use, line by line).
  3. What special options to apply (interrupts, scrolling).

The key mental shift is to stop thinking of the screen as one homogeneous image. ANTIC sees it as a vertical stack of mode lines. A mode line is a horizontal band one or more TV scan lines tall: a GRAPHICS 2 text line is 16 scan lines high, a GRAPHICS 7 line is 2, a GRAPHICS 8 line just 1. The display list is simply the list of those bands, top to bottom — and nothing forces them all to be the same mode.

ANTIC fetches the data itself by DMA (direct memory access), "stealing" cycles from the 6502. That is why turning ANTIC off with POKE 559,0 makes BASIC programs run noticeably faster, by around 30%.

The instruction format

A display list instruction is one byte, sometimes followed by a two-byte address. The low four bits select the instruction type; the high four bits are option flags:

Bit Value Meaning
7 128 Display List Interrupt (DLI) at the last scan line of this mode line
6 64 Load Memory Scan (LMS): the next two bytes (low, high) are a new screen-data address
5 32 Enable vertical fine scrolling
4 16 Enable horizontal fine scrolling
0–3 0–15 Mode: 0 = blank lines, 1 = jump, 2–15 = a display mode

Blank lines (low nybble 0): bits 4–6 give the count, so the values are 0 (1 line), 16 (2), 32 (3), 48 (4), 64 (5), 80 (6), 96 (7) and 112 (8 blank lines, hex $70). Blank lines show the background colour.

Jumps (low nybble 1) are three-byte instructions. A plain JMP (1) reloads ANTIC's program counter. JVB, "jump and wait for vertical blank" (65, $41), jumps and then waits for the next frame — this is how every normal display list ends, looping back to its own start.

Display modes are ANTIC modes 2–15 ($2–$F). Modes 2–7 are character (text) modes; 8–15 are map (bitmap) modes. ANTIC numbers do not match BASIC's GRAPHICS numbers:

ANTIC mode BASIC mode Type Scan lines per mode line Bytes per line (normal width)
2 0 text, 40 columns 8 40
3 — text with descenders 10 40
4 12 (XL OS) 4-colour text 8 40
5 13 (XL OS) 4-colour text, tall 16 40
6 1 20-column text 8 20
7 2 20-column text, tall 16 20
8 3 40 × 24 map, 4 colours 8 10
9 4 80 × 48, 2 colours 4 10
A 5 80 × 48, 4 colours 4 20
B 6 160 × 96, 2 colours 2 20
C 14 (XL OS) 160 × 192, 2 colours 1 20
D 7 160 × 96, 4 colours 2 40
E 15 (XL OS) 160 × 192, 4 colours 1 40
F 8 (and 9–11 with GTIA) 320 × 192 1 40

(The 400/800 operating system does not support BASIC modes 12–15; only the XL/XE OS does, but every machine's ANTIC can display them through a custom display list.)

Anatomy of the GRAPHICS 0 display list

De Re Atari prints the standard text screen's display list. In decimal it is:

112 112 112          three "8 blank lines" instructions (24 scan lines)
66  lo  hi           ANTIC mode 2 (64+2 = LMS) + screen address
2 2 2 ... 2          23 more mode 2 lines (24 text lines in all)
65  lo  hi           JVB back to the start of the display list

The three blank-line instructions push the picture 24 scan lines down, past the top overscan area of a typical TV. Then comes the first real mode line with the LMS bit set, telling ANTIC where screen memory begins. Because the screen data is contiguous, no further LMS is needed: ANTIC just keeps reading 40 bytes per line. The whole list is 32 bytes.

Two pointers matter here:

  • 560/561 ($230/$231, SDLSTL/SDLSTH) hold the display list address. They are the OS shadow of ANTIC's DLISTL/DLISTH ($D402/$D403); the OS copies them into the hardware every vertical blank.
  • 88/89 ($58/$59, SAVMSC) hold the address where the OS thinks screen memory starts — the address PRINT and PLOT use. Normally it equals the LMS address at DLIST+4 and DLIST+5, but it does not have to (that difference is the whole basis of page flipping).

Decoding any display list from BASIC

This program finds the current display list and prints each instruction, showing LMS addresses and the final jump. Change line 10 to try other modes (add 16 to suppress the text window, e.g. GRAPHICS 24), then press a key to get back to the text screen.

10 GRAPHICS 8+16:DL=PEEK(560)+256*PEEK(561):DIM R(250):N=0
20 I=0
30 B=PEEK(DL+I):M=B-16*INT(B/16):L=INT(B/64)-2*INT(B/128)
40 N=N+1:R(N)=B
50 IF M=1 THEN N=N+1:R(N)=-(PEEK(DL+I+1)+256*PEEK(DL+I+2)):GOTO 100
60 IF L=1 AND M>1 THEN N=N+1:R(N)=-(PEEK(DL+I+1)+256*PEEK(DL+I+2)):I=I+2
70 I=I+1:IF N<245 THEN 30
100 OPEN #1,4,0,"K:":GET #1,K:CLOSE #1:GRAPHICS 0
110 PRINT "DISPLAY LIST AT ";DL
120 FOR J=1 TO N:IF R(J)<0 THEN PRINT "(";-R(J);") ";:GOTO 140
130 PRINT R(J);" ";
140 NEXT J

Negative entries in the array are used to mark addresses, which the listing shows in parentheses. For GRAPHICS 8+16 you will see 112 112 112, then 79 (64 + 15: mode F with LMS) and an address, a long run of 15s, a second 79 with another address part-way down, more 15s, and finally 65 and the list's own address. That second LMS exists because a GRAPHICS 8 screen needs 7,680 bytes, and ANTIC's memory scan counter cannot cross a 4K boundary (see below).

The variable M isolates the mode nybble and L isolates bit 6, which is how the program tells an LMS instruction (mode 2–15 with bit 6 set) from a blank-line instruction such as 112, which also has bit 6 set but mode 0.

The hardware rules

The scan-line budget. ANTIC does not keep track of TV timing for you. A standard display is 192 scan lines plus the 24 blank lines at the top. Keep your total at 192 visible lines or fewer; the absolute ceiling is 240 scan lines (scan lines 8–247), and the closing JVB itself costs one scan line. Too many lines and the picture rolls or flickers on real TVs. Fewer lines are harmless and give the CPU back some DMA time.

Display lists cannot cross a 1K boundary. ANTIC's display list counter only increments its lower 10 bits; at a 1K boundary it wraps around to the start of the same 1K block, even in the middle of a three-byte instruction. If a list must straddle a boundary, put a JMP (1, lo, hi) just before it.

Screen data cannot cross a 4K boundary in mid-line. The memory scan counter only increments its lower 12 bits. A screen bigger than 4K needs a fresh LMS at the start of the first line beyond the boundary — and the boundary must fall exactly between two lines, because an LMS only takes effect at the start of a line. The OS arranges this for GRAPHICS 8 automatically.

Change pointers safely. The display list pointer is live: if you change 560/561 while ANTIC is mid-frame you can briefly run garbage as a display list. De Re Atari's recipe is to POKE 559,0 (ANTIC DMA off), store the new address in 560/561, then restore 559 to 34 (its default, $22: normal playfield plus display-list DMA). The OS copies the new address into ANTIC during the next vertical blank.

Where the OS puts things

The OS builds the display list and screen memory just below RAMTOP (location 106, which holds the number of the highest usable page). Pressing RESET or executing any GRAPHICS statement rebuilds them from scratch, discarding any changes you made. The total memory used by display list plus screen is 992 bytes for GRAPHICS 0, 4,190 for GRAPHICS 7 and 8,112 for GRAPHICS 8.

Troubleshooting

  • Screen rolls or loses sync after your changes: you have more than about 192–240 scan lines. Add up the scan lines per mode line from the table.
  • Garbage in the lower part of the screen: the screen data crosses a 4K boundary without an LMS, or the display list crosses a 1K boundary without a JMP.
  • Your modified list vanished: a GRAPHICS statement, a RESET, or a DOS call reopened the screen. Re-apply your changes afterwards.
  • PRINT/PLOT output appears in the wrong place on a modified screen: the OS still assumes the original layout (see the companion guide on custom display lists).

Further reading

  • De Re Atari (Atari, Inc., 1982), Chapter 2 — the original explanation by Chris Crawford and colleagues.
  • Mapping the Atari by Ian Chadwick (COMPUTE! Books, 1983), entries for 559, 560–561 and the ANTIC registers at 54272 onward.
  • Atari Graphics and Arcade Game Design by Jeffrey Stanton and Dan Pinal (Arrays, 1984) — display lists, scrolling and interrupts aimed at game programmers.
  • Altirra Hardware Reference Manual by Avery Lee — cycle-exact behaviour of ANTIC, including odd edge cases.
  • Related guides on this site: custom display lists, display list interrupts, coarse and fine scrolling, page flipping.

Credits