User Tools

Site Tools


Atari Mini Memory Monitor

Mini Memory Monitor may be particularly useful for those who are curious about the contents of the Atari memory. Pressing the HELP key activates the monitor and shows a single memory page (255 bytes) at a time. The user can change the displayed page with the START and SELECT keys. Pressing the HELP key again puts the monitor into sleep.

Originally, the program was published in the magazine Tajemnice Atari in May 1992 in the column “6 Strona” (“6th Page”).

; Mini Memory Monitor
VVBLKD  = $224 ; vector for the deferred vertical blank routine
DMACTLS = $22F ; DMA control
DLPTRS  = $230 ; vector for the ANTIC display list
HLPFLG  = $2DC ; HELP key status
; hardware registers
CONSOL  = $D01F ; console keys' status
; OS subroutines
SETVBL  = $C272 ; SET Vertical BLank interrupt vectors
; constants 
delval  = 8     ; a delay value for control keys
optkey  = 1     ; OPTION console key 
selkey  = 2     ; SELECT console key 
        ORG $0600
        ; Set a delay for console keys.
start   LDA #delval
        STA delay
        ; Store the address of the deferred OS vertical blank routine.
        ; We will jump to this routine at the end of our custom vertical blank routine.
        LDA VVBLKD
        STA exitvec
        LDA VVBLKD+1
        STA exitvec+1
        ; Set the custom vertical blank routine.    
        LDY #<proc          ; Y - low
        LDX #>proc          ; X - hi
        LDA #7              ; A - vector#7 (VVBLKD)
        JSR SETVBL
        JMP *               ; for now just loop forever TODO: go to BASIC
        ; Check if the monitor is active: 
        ; monflg=0 - monitor inactive
        ; monflg=1 - monitor active
proc    LDA monflg
        BEQ hlptest         ; if the monitor is inactive, test the HELP key's status 
        ; Monitor is active. Read the console keys and change the displayed page.
        ; Delay reading the console keys. Otherwise they would be read too fast.
        DEC delay
        BNE hlptest
        ; Read the console keys (SELECT and OPTION) and change the displayed memory page.
        LDX CONSOL
        AND #selkey         ; test if the SELECT key has been pressed
        BNE notsel       
        INC dl.scmem+1      ; increase the screen memory address in our custom display list 
notsel  TXA
        AND #optkey         ; test if the OPTION key has been pressed
        BNE notopt   
        DEC dl.scmem+1      ; decrease the screen memory address in our custom display list
notopt  LDA dl.scmem+1
        STA pageno          ; keep the current page number (which is the hi byte of screen memory) 
                            ; for conversion to decimal value 
        ; Convert the current page number (pageno) from byte to a decimal value and display it.
        LDY #0
loop1   LDX #0
        LDA pageno
loop2   SEC
        SBC decarr,Y        ; subtract 100, then 10, and then 1
        BCC disp
        STA pageno
        BNE loop2
disp    TXA
        ADC #$10
        STA screen.pgcnt,Y
        CPY #3
        BNE loop1
        ; Set the console key delay to its default value.
        LDA #delval
        STA delay
        ; Monitor is inactive. Just test the HELP key.
        ; Test if HELP has been pressed.
hlptest LDA HLPFLG
        CMP #$11
        BNE exit            ; exit if HELP is not pressed
        ; HELP has been pressed.
        ; Decide if the monitor should be activated or deactivated.
        LDA monflg
        BEQ actmon          ; if the monitor is inactive, activate it  
        ; Deactivate the monitor.
        ; Restore DMA control.
        LDA dmatmp
        ; Restore the display list.
        LDA dltmp
        STA DLPTRS
        LDA dltmp+1
        STA DLPTRS+1
        ; Indicate that the monitor is inactive by changing monflg to 0 (inactive).
        DEC monflg
        BEQ exit
        ; Activate the monitor.
        ; Keep DMA control. 
        STA dmatmp
        ; Keep the address of the current display list.
        LDA DLPTRS
        STA dltmp
        LDA DLPTRS+1
        STA dltmp+1
        ; Set DMA control to %100001
        ; bit0=1 - narrow playfield
        ; bit5=1 - enable ANTIC operation; it enables DMA for fetching the display list instructions
        LDA #$21
        ; Set our custom display list.
        LDA <dl
        STA DLPTRS
        LDA >dl
        STA DLPTRS+1
        ; Indicate that the monitor is active by changing monflg to 1 (active).
        INC monflg
        ; Reset HLPFLG by setting it to a value different than $11.
exit    LDA #0
        STA HLPFLG      
        JMP (exitvec)       ; continue with the vertical blank routine
        ; Custom display list.
        .LOCAL dl
        .BYTE $70,$70,$70   ; 3x8 blank scanlines
        .BYTE $70,$70,$70   ; 3x8 blank scanlines
        .BYTE $70           ; 8 blank scanlines
        .BYTE $40+2         ; bit6 (load memory scan from the next two bytes) + 2 (one text line in GR.0)
scmem   .BYTE 0,0           ; screen memory (starts from page 0)
        .BYTE 2,2,2,2,2,2,2 ; 7 text lines in GRAPHICS 0 (ANTIC 2) 
        .BYTE $10           ; 2 blank scanlines
        .BYTE $40+2         ; bit6 (load memory scan from the next two bytes) + 2 (one text line in GR.0)
        .BYTE a(screen)     
        .BYTE $41,a(dl)     ; $41 (JVB - Jump and wait for Vertical Blank)
                            ; jump to the location specified by the next two bytes and wait for vertical blank 
        ; A small section below the displayed memory page to show the page number.
        .LOCAL screen  
        .BYTE "        "    ; 8 bytes
        .BYTE "strona nr : "    ; 12 bytes
pgcnt   .BYTE "000"         ; page counter (3 bytes)
        .BYTE "         "       ; 9 bytes
decarr  .BYTE 100,10,1      ; a helper array for byte->dec conversion
monflg  .BYTE 0    
delay   .BYTE 0
pageno  .byte 0         ; a temporary variable to keep the current page number  
exitvec .BYTE 0,0
dmatmp  .BYTE 0
dltmp   .BYTE 0,0
        RUN start

Below, there is a listing of the original program that was published in “Tajemnice Atari”. It loads the Memory Monitor to the 6th page and returns to BASIC. The monitor runs simultaneously with other programs. This allows the users to view the contents of memory in real-time.

10 DIM A$(26):A=1536
20 TRAP 60:READ A$:I=1:H=0:TRAP 20
30 N=ASC(A$(I))-48:N=N-39*(N>9):I=I+1
40 X=16*X+N:H=1-H:IF H=1 THEN 30
50 POKE A,X:X=0:A=A+1:GOTO 30
60 A=USR(1536)
1010 DATA 68a9018df806a9078dfc06ad24
1020 DATA 028dfe06ad25028dff06a020a2
1030 DATA 06a9074c72c2addc02c91108ae
1040 DATA f806caf003caf02c28d0278edc
1050 DATA 02eef806ad2f028df906ad3002
1060 DATA 8dfa06ad31028dfb06a9218d2f
1070 DATA 02a9bd8d3002a9068d3102d05f
1080 DATA 28d01a8edc02adf9068d2f02ad
1090 DATA fa068d3002adfb068d3102cef8
1100 DATA 06d042cefc06d03dae1fd08a29
1110 DATA 01d003eec6068a2902d003cec6
1120 DATA 06adc6068dfd06a000a200adfd
1130 DATA 0638f9f50690068dfd06e8d0f4
1140 DATA 8a18691099e906c8c003d0e3a9
1150 DATA 078dfc066cfe06707070707070
1160 DATA 70420000020202020202021042
1170 DATA d50641bd060000000000000000
1180 DATA 7374726f6e61006e72001a0010
1190 DATA 1010000000000000000000640a
1200 DATA 010000000000000000
notes/atari/mini_memory_monitor.txt · Last modified: 2016/09/02 by admin