 sttl Memory Examine Command
 pag
*
* Examine memory (system)
*
examine
 jsr getadr get low address
 bcs exam99
 std lowadr,u save low limit
 lda #'-
 jsr outch
 jsr getadr get high address
 bcs exam99
 std hiadr,u save high limit
 ldx lowadr,u set up for dump
 ldy hiadr,u
 jsr dumpXY go print dump
exam99 rts
*
* dumpXY - Dump memory from (X) to (Y)
*    (X) - Lowest address to dump
*    (Y) - Highest address to dump
*    jsr dumpXY
*
dumpXY pshs x,y,u save registers
*
* Print one line (16 bytes) of data
*
dump10 jsr pcrlf start a new print line
 lda 0,s print address
 jsr hexbyt
 lda 1,s
 jsr hexbyt
 jsr outsp
 jsr outsp
 ldx 0,s
 ldb #16 print 16 bytes
 pshs b
dump20 lda ,x+ get next byte to print
 jsr hexbyt
 jsr outsp
 dec 0,s done?
 bne dump20 no - go back
 ldx 1,s now print characters
 jsr outsp
 jsr outsp
 ldb #16
 stb 0,s
dump30 lda ,x+ get next byte
 cmpa #$20 printable?
 blo dump35 no
 cmpa #$7F
 blo dump40 go print character
dump35 lda #'. print period for unprintable
dump40 jsr outch print character
 dec 0,s done?
 bne dump30
 leas 1,s clean up stack
 jsr inchck abort if character struck
 bcs dump99
 stx 0,s update address
 cmpx 2,s any more?
 bls dump10 yes - go to it
dump99 bsr pcrlf
 puls x,y,u,pc return
*
* pcrlf - print carriage return/line feed
*
pcrlf pshs d,x save registers
 ldx #CRLF
 jsr pdata
 puls d,x,pc return
CRLF fcc $d,0
