32-Columns Mode

Type
Utility
Category
Display list / narrow screen utility
Author
Jason Grant
Published in
Atari User (UK), 4/1986; reprinted via the Czech club bulletin "Ol. zprav." 3–4/89 and the Flop disk magazine, issue 3 (1989)
Year
1986
Language
Atari BASIC
Requirements
Any 8-bit Atari with Atari BASIC (the REMs say "for all Atari XL/XE"); uses page 6 ($0600)
The program's own listing displayed in a narrow 32-column text screen

About the program

This short routine has an unusual family tree, and its REM lines record all of it. Line 60 credits Atari User 4/1986 and line 70 names the author, Jason Grant. Line 20 (in Czech: PODLE OL.ZPRAV. 3-4/89) says the version was taken from issue 3–4/89 of "Ol. zprav.", almost certainly Atari Zpravodaj Olomouc, the club bulletin from Olomouc that GIA Software also credits in its version of Polar Plotter II. Line 40 adds "1989 BY GIA SOFTWARE", the Czech group that prepared it, and line 50 (PRO VSECHNY ATARI XL/XE) means "for all Atari XL/XE". It was distributed on Flop 3, an issue of FLOP, the long-running Czech diskette magazine for 8-bit Ataris.

The result is a GRAPHICS 0 screen that is 32 characters wide, not 40. That gives bigger borders, which helps on TVs that crop the edges of the picture, and a neat column width for menus or a 32-byte-wide memory dump.

Typing it in

The listing is plain ASCII with no special characters. It is short enough to tack onto the front of another program. Keep the POKE 82/POKE 83 margins in line 100 ahead of the GRAPHICS 0 call.

How it works

ANTIC can fetch a narrow playfield of 32 bytes per line instead of the normal 40. This is set by the low two bits of DMACTL (shadow register 559): POKE 559,33 turns on display-list DMA (32) with the narrow width (1). The OS screen editor, though, still lays the screen out as 40 bytes per line. So the program builds its own display list in page 6 (1536 = $0600):

  • Line 140: three "8 blank lines" instructions (112) at the top.
  • Lines 150–210: 24 mode-2 text lines, each with the load-memory-scan bit set (66 = 64 + 2). Each one is followed by the address of the next 40-byte row of the real screen (DS=DS+40). Every row therefore starts where the editor expects it, and ANTIC simply shows the first 32 bytes of it.
  • Lines 230–250: a jump-and-wait-for-VBLANK (65) back to $0600, then the display list pointer at 560/561 is set to the new list.
  • Line 100: sets the left margin (82) to 0 and the right margin (83) to 31, so the cursor and PRINT stay inside the visible 32 columns.

Gotchas

  • Any later GRAPHICS statement, or a press of RESET, puts back the OS display list and DMACTL. Run the routine again afterwards.
  • Page 6 is also a popular home for small machine-language routines. Don't combine this with a program that uses $0600–$064D (the 78-byte display list).
  • With RMARGN at 31, PRINT wraps at column 32. A program that positions text with POSITION beyond column 31 will draw into the hidden part of the row.

Variations to try

  • Try POKE 559,34 instead of 33 in line 220 to return to the normal 40-byte width without touching the display list. You'll see the hidden eight columns of each row reappear.
  • Change line 140 to fewer blank lines to move the text block up.

Listing

10 REM 32 - COLUMNS MODE
20 REM PODLE OL.ZPRAV. 3-4/89
40 REM 1989 BY GIA SOFTWARE
50 REM PRO VSECHNY ATARI XL/XE
60 REM ATARI USER 4/1986
70 REM JASON GRANT
80 REM MODIFY DISPLAY LIST
100 POKE 82,0:POKE 83,31
110 GRAPHICS 0
120 DS=PEEK(88)+PEEK(89)*256
130 DL=1539
140 FOR I=1536 TO 1538:POKE I,112:NEXT I
150 FOR I=1 TO 24
160 POKE DL,66
170 POKE DL+2,INT(DS/256)
180 POKE DL+1,DS-256*PEEK(DL+2)
190 DS=DS+40
200 DL=DL+3
210 NEXT I
220 POKE 559,33
230 POKE DL,65:POKE DL+1,0
240 POKE DL+2,6
250 POKE 560,0:POKE 561,6

Credits