2016-10-07 20:48:49 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2016-10-07 20:48:49 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2017-06-16 13:01:08 +00:00
|
|
|
|
.TF /A2OSX.BUILD/BIN/DEV/MEMDUMP
|
2016-10-07 20:48:49 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.BUILD/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/A2OSX.I
|
2016-10-07 20:48:49 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
PAGELEN .EQ 22
|
|
|
|
|
FOOTERLEN .EQ 8
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPPTR1 .EQ ZPBIN
|
|
|
|
|
ZPPTR2 .EQ ZPBIN+2
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* File Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
|
|
|
|
.DA 0
|
2017-09-22 06:38:22 +00:00
|
|
|
|
.DA CS.END-CS.START CS
|
|
|
|
|
.DA DS.END-DS.START DS
|
|
|
|
|
.DA #16 SS
|
|
|
|
|
.DA #4 ZP
|
2016-10-07 20:48:49 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.MSG0 .DA MSG0
|
|
|
|
|
L.MSG1 .DA MSG1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
L.MSG1.BIN .DA MSG1.BIN
|
|
|
|
|
L.MSG1.STR .DA MSG1.STR
|
|
|
|
|
L.MSG1.HEX .DA MSG1.HEX
|
2016-10-07 20:48:49 +00:00
|
|
|
|
L.MSG2 .DA MSG2
|
|
|
|
|
L.MSG3 .DA MSG3
|
|
|
|
|
L.MSG4 .DA MSG4
|
|
|
|
|
L.MSG5 .DA MSG5
|
|
|
|
|
L.MSG6 .DA MSG6
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2016-10-14 15:39:49 +00:00
|
|
|
|
CS.INIT ldy #MEM.COUNT Skip SLOT0
|
2016-10-07 20:48:49 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
inc
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
lda (pPs)
|
|
|
|
|
ora #S.PS.F.EVENT Now accept events
|
|
|
|
|
sta (pPs)
|
|
|
|
|
clc
|
2017-01-28 22:05:20 +00:00
|
|
|
|
rts
|
2016-10-07 20:48:49 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-18 15:43:00 +00:00
|
|
|
|
CS.RUN >SYSCALL GetChar
|
2017-01-28 22:05:20 +00:00
|
|
|
|
bcs .13
|
|
|
|
|
|
|
|
|
|
cmp #3 Ctrl-C ?
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
cmp #19 Ctrl-S ?
|
|
|
|
|
bne .12
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
ldy #bSTOP
|
2017-01-28 22:05:20 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bra .13
|
|
|
|
|
|
|
|
|
|
.12 ldy #bSTOP
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.13 ldy #bSTOP
|
2016-10-07 20:48:49 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
ldy #MEM.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
cmp MemMgr.LastSlot
|
|
|
|
|
beq .10
|
|
|
|
|
|
|
|
|
|
ldy #LINE.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bne .1
|
|
|
|
|
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG0
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
.1 ldy #MEM.COUNT
|
|
|
|
|
lda (pData),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemByID.A
|
2016-10-07 20:48:49 +00:00
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
lda (ZPPTR1)
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
ldy #USED.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
inc
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.2 jsr CS.RUN.PRINTMEM
|
|
|
|
|
|
|
|
|
|
ldy #MEM.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
inc
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.10 ldy #LINE.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
clc
|
|
|
|
|
adc #FOOTERLEN
|
|
|
|
|
cmp #PAGELEN
|
|
|
|
|
bcc .11
|
|
|
|
|
|
|
|
|
|
lda #$FF
|
|
|
|
|
ldy #bSTOP
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
ldy #LINE.COUNT
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.11 ldy #MEM.COUNT
|
|
|
|
|
>PUSHB (pData),y
|
|
|
|
|
ldy #USED.COUNT
|
|
|
|
|
>PUSHB (pData),y
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG2
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW MemMgr.HiMem
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG3
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW MemMgr.Free
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG4
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW MemMgr.LoMem
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG5
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
lda MemMgr.Free
|
|
|
|
|
sec
|
|
|
|
|
sbc MemMgr.LoMem
|
|
|
|
|
tay
|
|
|
|
|
lda MemMgr.Free+1
|
|
|
|
|
sbc MemMgr.LoMem+1
|
|
|
|
|
|
|
|
|
|
>PUSHYA
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG6
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-10-07 20:48:49 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.PRINTMEM ldy #S.MEM.LEN
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
pha
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
ply
|
|
|
|
|
>PUSHYA
|
|
|
|
|
|
|
|
|
|
ldy #S.MEM.PTR
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
pha
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
ply
|
|
|
|
|
>PUSHYA
|
|
|
|
|
|
|
|
|
|
ldy #S.MEM.REFCNT
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
|
|
|
|
|
ldy #S.MEM.OWNERPID
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
|
|
|
|
|
lda (ZPPTR1)
|
|
|
|
|
>PUSHA
|
|
|
|
|
|
|
|
|
|
ldy #MEM.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG1
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2017-01-28 22:05:20 +00:00
|
|
|
|
|
|
|
|
|
lda (ZPPTR1) Free ? assume raw data...
|
|
|
|
|
bpl .10
|
|
|
|
|
|
2016-10-07 20:48:49 +00:00
|
|
|
|
ldy #S.MEM.BIN
|
|
|
|
|
lda (ZPPTR1),y
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bne .7
|
|
|
|
|
****** DATA
|
2017-01-28 22:05:20 +00:00
|
|
|
|
.10 ldy #S.MEM.PTR
|
2016-10-07 20:48:49 +00:00
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
sta ZPPTR2
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
sta ZPPTR2+1
|
2016-10-12 06:28:57 +00:00
|
|
|
|
|
|
|
|
|
lda (ZPPTR2)
|
2016-10-17 15:47:50 +00:00
|
|
|
|
tay
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
.1 lda (ZPPTR2),y Check if it looks like a printable string
|
2016-10-07 20:48:49 +00:00
|
|
|
|
cmp #$20
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bcc .2 not printable....->hex
|
|
|
|
|
dey
|
2016-10-07 20:48:49 +00:00
|
|
|
|
bne .1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW ZPPTR2 String
|
|
|
|
|
>PUSHB (ZPPTR2) Len
|
|
|
|
|
>LDYA L.MSG1.STR
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bra .8
|
|
|
|
|
|
|
|
|
|
.2 ldy #15
|
|
|
|
|
|
|
|
|
|
.3 >PUSHB (ZPPTR2),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .3
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>LDYA L.MSG1.HEX
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bra .8
|
|
|
|
|
****** BIN
|
2017-08-25 06:37:21 +00:00
|
|
|
|
.7 >SYSCALL GetMemPtr.A
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
>LDYA L.MSG1.BIN
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
.8 ldy #LINE.COUNT
|
2016-10-07 20:48:49 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
inc
|
|
|
|
|
sta (pData),y
|
|
|
|
|
cmp #PAGELEN
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bne .9
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
lda #$FF
|
|
|
|
|
ldy #bSTOP
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
ldy #LINE.COUNT
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
.9 rts
|
2016-10-07 20:48:49 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-28 22:05:20 +00:00
|
|
|
|
CS.DOEVENT sec
|
2016-10-07 20:48:49 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-10-14 15:39:49 +00:00
|
|
|
|
CS.QUIT clc
|
2016-10-07 20:48:49 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2017-02-28 16:58:36 +00:00
|
|
|
|
MSG0 >CSTR " # Flags PID REF PTR LEN BINPATH/DATA\r\n"
|
2016-10-26 20:51:06 +00:00
|
|
|
|
MSG1 >CSTR "%03d %b %03d %03d $%H %05D "
|
2017-09-18 15:43:00 +00:00
|
|
|
|
MSG1.BIN >CSTR "!BIN:%41s\r\n"
|
|
|
|
|
MSG1.STR >CSTR "[%02h]:%41s\r\n"
|
2017-02-28 16:58:36 +00:00
|
|
|
|
MSG1.HEX >CSTR "?HEX:%h%h%h%h.%h%h%h%h.%h%h%h%h.%h%h%h%h\r\n"
|
|
|
|
|
MSG2 >CSTR "\r\nAllocated hMem:%d, Total:%d\r\n"
|
|
|
|
|
MSG3 >CSTR "High Memory: $%H\r\n"
|
|
|
|
|
MSG4 >CSTR "Free ULimit: $%H\r\n"
|
|
|
|
|
MSG5 >CSTR "Low Memory: $%H\r\n"
|
|
|
|
|
MSG6 >CSTR "\r\nFree Memory: %D Bytes.\r\n"
|
2016-10-07 20:48:49 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
|
|
|
|
LINE.COUNT .BS 1
|
|
|
|
|
MEM.COUNT .BS 1
|
|
|
|
|
USED.COUNT .BS 1
|
|
|
|
|
bSTOP .BS 1
|
|
|
|
|
DS.END
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/BIN/MEMDUMP.S
|
2016-10-07 20:48:49 +00:00
|
|
|
|
ASM
|