ANTIC and the Display List, Part 3 (Mixed Text and Graphics)
- Type
- Graphics
- Category
- Display list tutorial demo
- Author
- Alan J. Zett
- Published in
- SoftSide magazine, "Exploring the Atari Frontier" series by Alan J. Zett (1982–83) — ANTIC and the Display List, Part 3
- Language
- Atari BASIC
- Requirements
- Any 8-bit Atari, 16K RAM, Atari BASIC
- Tags
- display-list, antic, mixed-modes, tutorial, softside, alan-zett, atari-basic
About the program
SoftSide was a US magazine that published BASIC programs for several machines. Its editor Alan J. Zett wrote a long Atari column called "Exploring the Atari Frontier". The series ran in SoftSide in 1982–83, and this listing comes from its display-list instalment. In 2022 Luis Baeza put a transcription of the whole series online.
The demo shows two things. First, you can rewrite the display list that BASIC builds, so that one screen mixes ANTIC text lines with four-colour graphics. Second, you can make the operating system draw into any part of that screen. To do that, you change the screen address the OS uses (SAVMSC, locations 88/89) and the number it keeps for the current mode (DINDEX, location 87).
What you need
Any Atari 400/800/XL/XE with Atari BASIC. The listing contains no special characters, so you can type it in or paste it into an emulator exactly as shown.
What you'll see
The top six rows show text (ANTIC mode 2, the GRAPHICS 0 character mode). Below them is a block of coloured GRAPHICS 7 stripes, and two more text rows sit at the bottom. "HELLO" is printed in the bottom text band and again in the top band. A vertical line is drawn through the middle of the graphics area.
How it works
- Line 10:
GRAPHICS 23gives a full-screen GRAPHICS 7 display, 160×96 in four colours with no text window. The program finds the display list through 560/561. It changes the first instruction (load memory scan plus mode D) into "load memory scan plus mode 2", then turns the next five mode lines into mode 2 as well. That makes six 40-byte text rows at the top of screen memory. - Line 20: turns two later lines into text and ends the list early with a jump-and-wait-for-vertical-blank (65) back to the start. Each text line is 8 scan lines tall and each mode D line is only 2, so the list has to be shortened to stay at 192 scan lines.
- Line 30: fills graphics rows 6–69 with colour bands. Those rows in BASIC's numbering are exactly the memory that the mode D lines now show.
- Lines 40–60: work out three addresses: the top text band (ZERO1), the start of the graphics band (SEVEN1, 6×40 bytes in) and the bottom text band (ZERO2, 70×40 bytes in).
- Subroutine 1000: points SAVMSC at one of those addresses. Then
POKE 87,0makes the OS treat the area as GRAPHICS 0 text forPRINT, andPOKE 87,7makes it treat the area as GRAPHICS 7 forPLOT/DRAWTO.
The OS has no idea the display list has changed. It simply writes bytes at SAVMSC plus an offset worked out for whichever mode it has been told it is in.
Variations to try
- Change the
FOR X=2 TO 6range to make the top text band taller or shorter. Then change the 6 in line 50 and the row range in line 30 to match. - Try mode 6 (GRAPHICS 1 style large text, value 6, or 70 with LMS) in the bottom band. Each mode-6 row takes 20 bytes, not 40.
- Press RESET or type
GRAPHICS 0to get a normal screen back.
Listing
10 GRAPHICS 23:DL=PEEK(560)+PEEK(561)*256+4:POKE DL-1,66:FOR X=2 TO 6:POKE DL+X,2:NEXT X:POKE 709,2
20 POKE DL+71,2:POKE DL+72,2:POKE DL+73,65:POKE DL+74,PEEK(560):POKE DL+75,PEEK(561):POKE 710,10:POKE 712,148
30 FOR Y=6 TO 69:COLOR INT((Y+5)/5):PLOT 0,Y:DRAWTO 159,Y:NEXT Y:COLOR 32:PLOT 0,0:POKE 87,0
40 ZERO1=PEEK(88)+PEEK(89)*256
50 SEVEN1=ZERO1+(6*40)
60 ZERO2=ZERO1+(70*40)
70 POKE 752,1
100 X=ZERO2:GOSUB 1000
110 POSITION 2,0:PRINT "HELLO";
200 X=SEVEN1:GOSUB 1000:POKE 87,7
210 COLOR 3:PLOT 79,0:DRAWTO 79,63
300 X=ZERO1:GOSUB 1000:POKE 87,0
310 POSITION 2,0:PRINT "HELLO";
400 END
1000 POKE 89,X/256:PLOT 0,0
1010 POKE 88,X-(256*PEEK(89))
1020 RETURN
Credits
- Program listing: ANTIC and the Display List, Part 3 (Mixed Text and Graphics) — program listing (SoftSide magazine, "Exploring the Atari Frontier" series by Alan J. Zett (1982–83) — ANTIC and the Display List, Part 3) — Alan J. Zett
- Picture: The demo running: text bands above and below a GRAPHICS 7 area, each written by redirecting the OS. — Alan J. Zett (program); screenshot by the site
- Gury's Atari 8-bit Forever — ANTIC and the Display List: Part 3 — Alan J. Zett
- AtariAge forum — Exploring the Atari Frontier (transcription of the SoftSide series) — AtariAge forum members
- Exploring the Atari Frontier, part 3 (online transcription by Luis Baeza) — Luis Baeza; lbaeza.neocities.org
