Memory Window

Type
Utility
Category
Memory viewer / custom display list
Author
Dave Mentley (based on a program by Mike Morey)
Published in
Antic, April 1984 (Vol. 3, No. 1)
Year
1984
Language
Atari BASIC
Requirements
16K RAM, Atari BASIC; joystick optional
A split screen: a narrow GRAPHICS 0 window at the top showing 'current memory= 40000 TO 40255' and 'PAGE= 156', and below it the same text in large green and red GRAPHICS 1 and 2 letters

About the program

"If you've ever wondered what the inside of your computer's memory looks like, this program may help satisfy your curiosity." Dave Mentley, a flat-panel display consultant and former president of ABACUS, a San Francisco Atari user group, based this short program on one by Mike Morey. It splits the screen in two. The top half is a window of eight 32-character text lines showing exactly 256 bytes, one page of memory, as Atari characters. The bottom half shows which addresses you are looking at. You can move the window anywhere in the 64K address space with the keyboard or a joystick.

What you need

Any Atari with Atari BASIC and 16K. A joystick is optional.

Typing it in

Plain ASCII, 28 lines. The display list is the DATA in line 280. Check it carefully, because a wrong value there can scramble the screen or hang the machine. The program disables the BREAK key (line 70), so SAVE before you RUN. To stop it, press RESET.

How to use it

When you RUN it, the window starts at the GRAPHICS 0 screen memory itself, so you see the "current memory" message twice: once as text and once as raw bytes in the window. Then:

  • > or joystick forward: forward one page (256 bytes).
  • < or joystick back: back one page.
  • Up/down arrow keys (or joystick right/left): one byte at a time.
  • . or the fire button: jump to page zero.

Bytes are shown as their internal Atari character codes. Try page 224 ($E000) to see the ROM character set itself, or page 6 to see the program's own display list.

How it works

  • A home-made display list. Line 90 POKEs a 28-byte display list into page 6 (1536). It has three blank-line instructions, then a mode 2 (GRAPHICS 0) line with an LMS address, followed by seven more mode 2 lines. Line 80 sets a narrow 32-column playfield (POKE 559,33), so eight lines are exactly 256 bytes. After two blank lines, a second LMS instruction points the lower section, a mix of mode 7, 2 and 6 lines (GRAPHICS 2, 0 and 1 sizes), back at the normal screen memory for the status text. The list ends with a jump back to its start (65).
  • Line 150 switches ANTIC to the new list by POKEing its address into 560–561.
  • Moving the window is just two POKEs (line 250): the new address goes into the LMS operand at 1540–1541, and ANTIC shows the new memory on the next frame.
  • Lines 180–220 read the joystick and also PEEK location 764 for key codes (34 ., 55 >, 54 <, 14 up, 15 down). POKE 16,64 and POKE 53774,64 turn off the BREAK-key interrupt, and TRAP 270 makes any error simply restart the program.

Listing

10 REM MEMORY WINDOW
20 REM BY DAVE MENTLEY, BASED ON A
30 REM PROGRAM BY MIKE MOREY
40 REM ANTIC MAGAZINE APRIL 1984
70 GRAPHICS 0:TRAP 270:POKE 16,64:POKE 53774,64:POKE 82,0:POKE 83,30
80 POKE 752,1:POKE 559,33
90 FOR A=1536 TO 1563:READ B:POKE A,B:NEXT A
100 DLST5=1540:DLST6=1541
110 SCRLO=PEEK(88):SCRHI=PEEK(89)
120 POKE DLST5,SCRLO:POKE DLST6,SCRHI
130 POKE 1552,SCRLO:POKE 1553,SCRHI
140 MEM=SCRHI*256+SCRLO
150 POKE 560,0:POKE 561,6
160 ? CHR$(125):? "        current memory=":? MEM;" TO ";MEM+255
170 ? "        PAGE= ";INT(MEM/256)
180 IF STRIG(0)=0 OR PEEK(764)=34 THEN MEM=0:POKE 764,0
190 IF STICK(0)=14 OR PEEK(764)=55 THEN MEM=MEM+256:POKE 764,0
200 IF STICK(0)=13 OR PEEK(764)=54 THEN MEM=MEM-256:POKE 764,0
210 IF STICK(0)=7 OR PEEK(764)=14 THEN MEM=MEM+1:POKE 764,0
220 IF STICK(0)=11 OR PEEK(764)=15 THEN MEM=MEM-1:POKE 764,0
230 IF MEM<0 OR MEM>65280 THEN MEM=65280
240 MEMHI=INT(MEM/256):MEMLO=MEM-256*MEMHI
250 POKE DLST5,MEMLO:POKE DLST6,MEMHI
260 GOTO 160
270 RUN
280 DATA 112,112,112,66,0,0,2,2,2,2,2,2,2,0,0,71,0,0,0,2,7,7,7,2,6,65,0,6

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: MEMWINDO.BAS.

Credits