2016-10-07 20:48:49 +00:00
|
|
|
|
NEW
|
2018-11-17 17:17:13 +00:00
|
|
|
|
PREFIX
|
2017-12-22 21:24:30 +00:00
|
|
|
|
AUTO 4,1
|
2016-10-07 20:48:49 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.TF BIN/DEV/MEMDUMP
|
2016-10-07 20:48:49 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
2016-10-07 20:48:49 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
PAGELEN .EQ 22
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
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
|
2018-08-20 15:15:37 +00:00
|
|
|
|
.DA #64 SS
|
2017-09-22 06:38:22 +00:00
|
|
|
|
.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
|
2017-10-06 15:25:14 +00:00
|
|
|
|
L.MSG1.INV .DA MSG1.INV
|
2016-10-07 20:48:49 +00:00
|
|
|
|
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
|
2017-09-25 15:50:33 +00:00
|
|
|
|
L.MSG.FREE .DA MSG.FREE
|
2016-10-07 20:48:49 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2018-08-20 15:15:37 +00:00
|
|
|
|
CS.INIT lda #0
|
|
|
|
|
>STA.G MEM.COUNT Skip SLOT 0
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
>LEA.G MemStat
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL GetMemStat
|
2017-09-25 15:50:33 +00:00
|
|
|
|
|
2016-10-07 20:48:49 +00:00
|
|
|
|
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
|
|
|
|
|
2018-08-11 10:57:57 +00:00
|
|
|
|
>LDA.G bSTOP
|
2017-01-28 22:05:20 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bra .13
|
|
|
|
|
|
2018-08-11 10:57:57 +00:00
|
|
|
|
.12 >STZ.G bSTOP
|
2017-01-28 22:05:20 +00:00
|
|
|
|
|
2018-08-11 10:57:57 +00:00
|
|
|
|
.13 >LDA.G bSTOP
|
2016-10-07 20:48:49 +00:00
|
|
|
|
bne .8
|
2018-08-21 13:12:47 +00:00
|
|
|
|
|
2018-08-20 15:15:37 +00:00
|
|
|
|
>INC.G MEM.COUNT
|
|
|
|
|
>SYSCALL GetMemByID
|
|
|
|
|
>STYA ZPPTR1
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2018-08-11 10:57:57 +00:00
|
|
|
|
>LDA.G LINE.COUNT
|
2016-10-07 20:48:49 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG0
|
2018-07-24 16:00:24 +00:00
|
|
|
|
>SYSCALL puts
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2018-08-20 15:15:37 +00:00
|
|
|
|
.1 lda (ZPPTR1)
|
2016-10-07 20:48:49 +00:00
|
|
|
|
bpl .2
|
|
|
|
|
|
2017-10-06 15:25:14 +00:00
|
|
|
|
>INC.G USED.COUNT
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
.2 jsr CS.RUN.PRINTMEM
|
|
|
|
|
|
2018-08-20 15:15:37 +00:00
|
|
|
|
>LDA.G MEM.COUNT
|
|
|
|
|
>CMP.G MemStat+S.MSTAT.MLast
|
|
|
|
|
beq .10
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
|
2018-08-20 15:15:37 +00:00
|
|
|
|
.10 >PUSHB.G MEM.COUNT
|
2018-07-24 06:24:23 +00:00
|
|
|
|
>PUSHB.G USED.COUNT
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>PUSHBI 2
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG2
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2018-07-24 06:24:23 +00:00
|
|
|
|
>PUSHW.G MemStat+S.MSTAT.MH
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>PUSHBI 2
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG3
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2018-07-24 06:24:23 +00:00
|
|
|
|
>PUSHW.G MemStat+S.MSTAT.MF
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>PUSHBI 2
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG4
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2018-07-24 06:24:23 +00:00
|
|
|
|
>PUSHW.G MemStat+S.MSTAT.ML
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>PUSHBI 2
|
2016-10-14 15:39:49 +00:00
|
|
|
|
>LDYA L.MSG5
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
sec
|
2017-10-27 06:36:46 +00:00
|
|
|
|
>LDA.G MemStat+S.MSTAT.MF
|
|
|
|
|
>SBC.G MemStat+S.MSTAT.ML
|
2017-09-25 15:50:33 +00:00
|
|
|
|
pha
|
2017-10-27 06:36:46 +00:00
|
|
|
|
>LDA.G MemStat+S.MSTAT.MF+1
|
|
|
|
|
>SBC.G MemStat+S.MSTAT.ML+1
|
2017-09-25 15:50:33 +00:00
|
|
|
|
ply
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
>PUSHYA
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>PUSHBI 2
|
2017-09-25 15:50:33 +00:00
|
|
|
|
>LDYA L.MSG.FREE
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2018-08-11 10:57:57 +00:00
|
|
|
|
lda #0
|
2016-10-07 20:48:49 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-10-06 15:25:14 +00:00
|
|
|
|
CS.RUN.PRINTMEM ldy #S.MEM.LEN+1
|
2018-08-22 15:23:27 +00:00
|
|
|
|
|
|
|
|
|
ldx #4
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2018-08-22 15:23:27 +00:00
|
|
|
|
.13 lda (ZPPTR1),y
|
2017-10-06 15:25:14 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
dey
|
2018-08-22 15:23:27 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .13
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.MEM.REFCNT
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
|
|
|
|
|
ldy #S.MEM.OWNERPID
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
|
2017-10-06 15:25:14 +00:00
|
|
|
|
lda (ZPPTR1) Get flags
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2017-10-06 15:25:14 +00:00
|
|
|
|
ldy #MEM.FLAGS+7
|
|
|
|
|
ldx #7
|
|
|
|
|
|
|
|
|
|
.20 lsr
|
|
|
|
|
pha
|
|
|
|
|
lda #'-'
|
|
|
|
|
bcc .30
|
|
|
|
|
lda MSG.FLAGS,x
|
|
|
|
|
|
|
|
|
|
.30 sta (pData),y
|
|
|
|
|
pla
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .20
|
|
|
|
|
|
|
|
|
|
>PUSHEA.G MEM.FLAGS
|
|
|
|
|
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>PUSHB.G MEM.COUNT
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2017-10-06 15:25:14 +00:00
|
|
|
|
lda (ZPPTR1) Get flags
|
|
|
|
|
bpl .12
|
|
|
|
|
|
|
|
|
|
ldy #S.MEM.OWNERPID
|
|
|
|
|
lda (ZPPTR1),y
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL GetPSStatus
|
2017-10-06 15:25:14 +00:00
|
|
|
|
bcc .12
|
|
|
|
|
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>PUSHBI 0
|
2017-10-06 15:25:14 +00:00
|
|
|
|
>LDYA L.MSG1.INV
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2017-01-28 22:05:20 +00:00
|
|
|
|
|
2018-08-22 15:23:27 +00:00
|
|
|
|
.12 >PUSHBI 9
|
|
|
|
|
>LDYA L.MSG1
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2017-01-28 22:05:20 +00:00
|
|
|
|
|
2018-08-21 13:12:47 +00:00
|
|
|
|
lda (ZPPTR1)
|
|
|
|
|
and #S.MEM.F.CODE
|
2018-08-22 15:23:27 +00:00
|
|
|
|
bne CS.RUN.PRINTMEM.BIN
|
2018-08-21 13:12:47 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
****** DATA
|
2017-10-06 15:25:14 +00:00
|
|
|
|
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
|
|
|
|
|
2017-10-06 15:25:14 +00:00
|
|
|
|
ldy #$0
|
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
|
2017-10-06 15:25:14 +00:00
|
|
|
|
beq .11
|
|
|
|
|
bmi .2
|
2016-10-07 20:48:49 +00:00
|
|
|
|
cmp #$20
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bcc .2 not printable....->hex
|
2017-10-06 15:25:14 +00:00
|
|
|
|
iny
|
2016-10-07 20:48:49 +00:00
|
|
|
|
bne .1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
|
2017-10-06 15:25:14 +00:00
|
|
|
|
.11 tya
|
2017-10-09 05:51:32 +00:00
|
|
|
|
beq .2 Startig with 0...PrintHEX
|
2017-10-06 15:25:14 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>PUSHW ZPPTR2 String
|
2017-10-06 15:25:14 +00:00
|
|
|
|
tya Len
|
|
|
|
|
>PUSHA
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>PUSHBI 3
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>LDYA L.MSG1.STR
|
2018-08-22 15:23:27 +00:00
|
|
|
|
bra CS.RUN.PRINTMEM.EXIT
|
2016-10-17 15:47:50 +00:00
|
|
|
|
|
|
|
|
|
.2 ldy #15
|
|
|
|
|
|
|
|
|
|
.3 >PUSHB (ZPPTR2),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .3
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>PUSHBI 16
|
2017-10-06 15:25:14 +00:00
|
|
|
|
>LDYA L.MSG1.HEX
|
2018-08-22 15:23:27 +00:00
|
|
|
|
bra CS.RUN.PRINTMEM.EXIT
|
|
|
|
|
|
|
|
|
|
CS.RUN.PRINTMEM.BIN
|
|
|
|
|
|
|
|
|
|
ldy #S.MEM.BIN
|
2018-08-21 13:12:47 +00:00
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
>SYSCALL GetMemPtr
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>PUSHYA
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>PUSHBI 2
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>LDYA L.MSG1.BIN
|
2017-10-09 05:51:32 +00:00
|
|
|
|
|
2018-08-22 15:23:27 +00:00
|
|
|
|
CS.RUN.PRINTMEM.EXIT
|
|
|
|
|
>SYSCALL printf
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2017-10-06 15:25:14 +00:00
|
|
|
|
>INC.G LINE.COUNT
|
2016-10-07 20:48:49 +00:00
|
|
|
|
cmp #PAGELEN
|
2017-10-06 15:25:14 +00:00
|
|
|
|
beq .9
|
|
|
|
|
rts
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2017-10-06 15:25:14 +00:00
|
|
|
|
.9 lda #$FF
|
|
|
|
|
>STA.G bSTOP
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2017-10-06 15:25:14 +00:00
|
|
|
|
inc
|
|
|
|
|
>STA.G LINE.COUNT
|
2016-10-07 20:48:49 +00:00
|
|
|
|
|
2017-10-06 15:25:14 +00:00
|
|
|
|
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
|
2018-07-24 16:00:24 +00:00
|
|
|
|
MSG0 .AZ " # Flags PID REF PTR LEN BINPATH/DATA"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
MSG1.INV .AZ "\e[7m"
|
2018-11-28 11:39:33 +00:00
|
|
|
|
MSG1 .AZ "$%h %s %3d %3d $%H %5D "
|
2018-04-11 15:35:51 +00:00
|
|
|
|
MSG1.BIN .AZ "{%s}\e[0m\r\n"
|
|
|
|
|
MSG1.STR .AZ "[%03d:%s]\e[0m\r\n"
|
|
|
|
|
MSG1.HEX .AZ "?HEX:%h%h.%h%h.%h%h.%h%h.%h%h.%h%h.%h%h.%h%h\e[0m\r\n"
|
|
|
|
|
MSG2 .AZ "\r\nAllocated hMem:%d, Total:%d\r\n"
|
|
|
|
|
MSG3 .AZ "High Memory: $%H\r\n"
|
|
|
|
|
MSG4 .AZ "Free ULimit: $%H\r\n"
|
|
|
|
|
MSG5 .AZ "Low Memory: $%H\r\n"
|
|
|
|
|
MSG.FREE .AZ "\r\nFree Memory: %D Bytes.\r\n"
|
2018-08-11 10:57:57 +00:00
|
|
|
|
MSG.FLAGS .AS "UZNAfcds"
|
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
|
2017-10-27 06:36:46 +00:00
|
|
|
|
MemStat .BS S.MSTAT
|
2017-10-06 15:25:14 +00:00
|
|
|
|
MEM.FLAGS .BS 9
|
2016-10-07 20:48:49 +00:00
|
|
|
|
DS.END
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2018-11-28 11:39:33 +00:00
|
|
|
|
SAVE USR/SRC/BIN/DEV/MEMDUMP.S
|
2016-10-07 20:48:49 +00:00
|
|
|
|
ASM
|