Atari Memory Map Highlights: The Addresses Every Programmer Uses

Atari programming has always gone hand in hand with PEEK and POKE. The machine's custom chips, the operating system and BASIC all keep their settings at fixed addresses, and knowing a few dozen of them unlocks colours, sound, joysticks, the cursor, fonts and much more. When Ian Chadwick's Mapping the Atari was serialised in Antic in 1989, the magazine called it "one of the key reference sources for Atari 8-bit programmers since 1983", and it is still the book to keep beside you. This guide is a map of the map: the big regions first, then the locations you will actually use.

You need: Atari BASIC (to try the examples) and any 400/800/XL/XE. XL/XE differences are flagged.

1. The big picture

The 6502 addresses 64K. On every model the layout looks like this:

Range Hex Contents
0–127 $00–$7F OS page-zero variables
128–255 $80–$FF BASIC (128–209) and floating point (212–255)
256–511 $100–$1FF 6502 stack
512–1023 $200–$3FF OS vectors, shadow registers, DCB, HATABS, IOCBs
1024–1535 $400–$5FF Cassette buffer, BASIC/FP buffers
1536–1791 $600–$6FF Page 6: free for the user
1792– $700– DOS (if booted), then your program; MEMLO marks the first free byte
… up to MEMTOP Free RAM, then the display list and screen just below RAMTOP
40960–49151 $A000–$BFFF BASIC or cartridge ROM (RAM if neither is present on 48K+ machines)
49152–53247 $C000–$CFFF 400/800: empty. XL/XE: part of the OS ROM (RAM underneath)
53248–55295 $D000–$D7FF Hardware: GTIA $D0xx, POKEY $D2xx, PIA $D3xx, ANTIC $D4xx
55296–57343 $D800–$DFFF Floating-point ROM
57344–58367 $E000–$E3FF Standard character set (1K)
58368–65535 $E400–$FFFF OS ROM: handlers, jump vectors at $E450+, 6502 vectors at $FFFA

De Re Atari sums up the usable programming area as "$0600 to $BFFF". On XL/XE machines with 64K, the RAM hidden under the OS and BASIC ROMs can be switched in through PORTB (54017). The 130XE's extra 64K appears in a window at $4000–$7FFF; see 130XE bank switching.

2. Shadow registers: the most important idea

Many chip registers are write-only, and many are rewritten by the OS sixty times a second. For each important one, the OS keeps a shadow copy in RAM and copies it to the chip during every vertical blank. The rule, with CHACT as the example: change the shadow (755), not the hardware (54273). POKE 54273 and you get the desired effect — for 1/60 of a second. The hardware addresses are for machine language working within a frame, or for display list interrupts.

Shadow Hardware What
559 SDMCTL 54272 DMACTL Screen/PM DMA on/off, playfield width
560–561 SDLSTL 54274–5 DLISTL Display list address
623 GPRIOR 53275 PRIOR Player/playfield priority, GTIA modes
704–707 PCOLR0–3 53266–9 Player colours
708–712 COLOR0–4 53270–4 Playfield and background colours
755 CHACT 54273 CHACTL Inverse/blank/upside-down text
756 CHBAS 54281 CHBASE Character set page
16 POKMSK 53774 IRQEN Enabled IRQs

3. The locations you will use most

Page zero (0–255)

Dec Hex Name Use
9 $09 BOOT? Boot success flags
10–11 $0A DOSVEC Where BASIC's DOS command jumps
12–13 $0C DOSINI Called on SYSTEM RESET; the hook for reset-proof code
16 $10 POKMSK IRQ enable shadow. POKE 16,112 and 53774,112 disables BREAK
17 $11 BRKKEY 0 when BREAK is pressed
18–20 $12–$14 RTCLOK Frame counter; 20 counts jiffies (see timers)
65 $41 SOUNDR POKE 65,0 silences I/O beeps
66 $42 CRITIC Non-zero during time-critical I/O
77 $4D ATRACT Attract-mode timer; POKE 77,0 keeps colours from cycling
82, 83 $52, $53 LMARGN, RMARGN Text margins (defaults 2 and 39)
84 $54 ROWCRS Cursor row
85–86 $55 COLCRS Cursor column
87 $57 DINDEX Current screen mode
88–89 $58 SAVMSC Address of screen memory
106 $6A RAMTOP Top of RAM in pages. Lower it to reserve memory
128–129 $80 LOMEM Start of BASIC's memory
130–131 $82 VNTP BASIC variable name table
134–135 $86 VVTP BASIC variable value table
136–137 $88 STMTAB Start of the tokenised program
140–141 $8C STARP String/array area
144–145 $90 MEMTOP (BASIC) End of program plus data
186–187 $BA STOPLN Line where an error/STOP/TRAP happened
195 $C3 ERRSAVE Last error number
201 $C9 PTABW Tab width for PRINT commas
203–209 $CB–$D1 (free) "The only page zero bytes uncontestably left free by BASIC"

Pages 2–3: vectors, shadows, I/O

Dec Hex Name Use
512–513 $200 VDSLST Display list interrupt vector
536–545 $218–$221 CDTMV1–5 Countdown timers
546, 548 $222, $224 VVBLKI, VVBLKD VBI vectors
559 $22F SDMCTL POKE 559,0 blanks the screen and speeds the CPU (default 34)
560–561 $230 SDLSTL Display list pointer
580 $244 COLDST Non-zero = a reset becomes a cold start
623 $26F GPRIOR Priority / GTIA modes
624–631 $270 PADDL0–7 Paddle values (0–228)
632–635 $278 STICK0–3 Joystick directions (15 = centred)
644–647 $284 STRIG0–3 Triggers (0 = pressed)
704–712 $2C0–$2C8 PCOLR0–3, COLOR0–4 Colour shadows; 712 is background/border
741–742 $2E5 MEMTOP (OS) Highest free RAM below the display
743–744 $2E7 MEMLO Lowest free RAM above DOS
752 $2F0 CRSINH POKE 752,1 hides the cursor
755 $2F3 CHACT Text display mode (default 2)
756 $2F4 CHBAS Character set page (224 = ROM set at 57344)
764 $2FC CH Last key pressed (internal code); POKE 764,255 clears it
768–779 $300 DCB SIO device control block (SIO explained)
794 $31A HATABS Device handler table
832–959 $340–$3BF IOCB0–7 I/O control blocks (CIO explained)

Hardware registers

Dec Hex Name Use
53248– $D000 HPOSP0… GTIA: player positions (write), collisions (read)
53268 $D014 PAL Read: NTSC/PAL detection
53279 $D01F CONSOL Console keys: 7 none, 6 START, 5 SELECT, 3 OPTION
53760–53767 $D200 AUDF1–4/AUDC1–4 Sound (POKEY sound)
53768 $D208 AUDCTL Sound options
53770 $D20A RANDOM Read: random byte 0–255
53775 $D20F SKCTL/SKSTAT Serial/keyboard control
54016 $D300 PORTA Joysticks 1 and 2 raw bits
54017 $D301 PORTB 400/800: joysticks 3–4. XL/XE: memory control
54272 $D400 DMACTL ANTIC DMA (use shadow 559)
54276–54277 $D404–5 HSCROL, VSCROL Fine scroll registers
54279 $D407 PMBASE Player/missile memory page
54281 $D409 CHBASE Character set page (use shadow 756)
54282 $D40A WSYNC Write: wait for end of scan line (DLIs)
54283 $D40B VCOUNT Read: scan line ÷ 2
54286 $D40E NMIEN Enable DLIs (bit 7) and VBI (bit 6)

4. Five tricks to try right now

10 REM WHERE IS THE SCREEN? POKE A CHARACTER INTO IT
20 S=PEEK(88)+256*PEEK(89)
30 POKE S,33:REM INTERNAL CODE 33 = "A" IN THE TOP LEFT CORNER
10 REM RANDOM NUMBERS WITHOUT RND
20 FOR I=1 TO 10:PRINT PEEK(53770):NEXT I
10 REM WAIT FOR START, SELECT OR OPTION
20 POKE 764,255
30 C=PEEK(53279):IF C=7 THEN 30
40 IF C=6 THEN PRINT "START"
50 IF C=5 THEN PRINT "SELECT"
60 IF C=3 THEN PRINT "OPTION"
10 REM HOW MUCH MEMORY? WHERE DOES IT START?
20 PRINT "RAMTOP: ";PEEK(106)*256
30 PRINT "MEMLO:  ";PEEK(743)+256*PEEK(744)
40 PRINT "FREE:   ";FRE(0)
10 REM NO CURSOR, WIDER TEXT, COLOURED BORDER
20 POKE 752,1:POKE 82,0:POKE 712,148
30 PRINT CHR$(125);"FULL-WIDTH TEXT, NO CURSOR"

Cursor changes only show after the cursor next moves, which is why line 30 clears the screen. Value 148 is hue 9, luminance 4 (the OS default for COLOR2 is 148).

5. XL/XE notes

  • $C000–$CFFF and $D800–$FFFF hold OS ROM on XL/XE machines. Clearing PORTB bit 0 swaps in the RAM underneath, but the system will crash at the next interrupt unless you have provided your own OS and disabled interrupts first.
  • BASIC is built in. PORTB bit 1 switches it in and out. Holding OPTION at power-up disables it.
  • Self-test ROM can be mapped at $5000–$57FF by clearing PORTB bit 7. You can run it with X=USR(20480), though typing BYE does the same.
  • The XL OS moved many internal routines. Programs that jump directly into the OS ROM instead of using the official vectors broke on XLs, which is exactly what De Re Atari warned against: "if your software does not use these ROM vectors, but instead jumps directly into the OS ROM, then it will almost certainly crash on future versions of the OS."

Troubleshooting

  • A POKE has no visible effect. You wrote a hardware register that the OS overwrites every frame. Use its shadow.
  • A POKE crashed the machine. Some locations are vectors or OS state. Note the address and look it up in a memory map such as Mapping the Atari before experimenting further. Page 2 vectors are especially dangerous.
  • Addresses from a magazine don't work on my XL. Pre-1983 articles sometimes used OS-internal ROM addresses that changed. Stick to the documented RAM locations and ROM vectors.

Further reading

  • Mapping the Atari by Ian Chadwick (Small System Services, 1983; revised edition with XL/XE coverage): the full reference, location by location.
  • Master Memory Map (Educational Software, 1982): a lighter, beginner-friendly memory map.
  • De Re Atari (Atari, Inc., 1982), Chapter 8 and the Programmer's Reference Card.
  • On this site: Page 6, Display lists explained.

Credits