2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 11.08.1998
|
|
|
|
;
|
2015-03-13 11:35:47 +00:00
|
|
|
; char* __cdecl__ DbgMemDump (unsigend Addr, char* Buf, unsigned char Length);
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export _DbgMemDump
|
|
|
|
.import addysp1
|
|
|
|
.import __hextab
|
|
|
|
.importzp sp, tmp2, tmp3, tmp4, ptr3, ptr4
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
_DbgMemDump:
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #0
|
|
|
|
lda (sp),y ; Get length
|
|
|
|
sta tmp4
|
|
|
|
iny
|
|
|
|
lda (sp),y ; Get the string buffer
|
|
|
|
sta ptr3
|
|
|
|
iny
|
|
|
|
lda (sp),y
|
|
|
|
sta ptr3+1
|
|
|
|
iny
|
|
|
|
lda (sp),y ; Get the address
|
|
|
|
sta ptr4
|
|
|
|
iny
|
|
|
|
lda (sp),y
|
|
|
|
sta ptr4+1
|
|
|
|
jsr addysp1 ; Drop the parameters
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
lda #0
|
|
|
|
sta tmp2 ; String index
|
|
|
|
sta tmp3 ; Byte index
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Print the address
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
lda ptr4+1 ; Hi address byte
|
|
|
|
jsr dump ; Print address
|
|
|
|
lda ptr4 ; Lo address byte
|
|
|
|
jsr dump
|
|
|
|
jsr putspace ; Add a space
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
dump1: dec tmp4 ; Bytes left?
|
|
|
|
bmi dump9 ; Jump if no
|
|
|
|
jsr putspace ; Add a space
|
|
|
|
ldy tmp3
|
|
|
|
inc tmp3
|
|
|
|
lda (ptr4),y
|
|
|
|
jsr dump
|
|
|
|
jmp dump1
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
dump9: lda #0
|
|
|
|
ldy tmp2
|
|
|
|
sta (ptr3),y ; Add string terminator
|
|
|
|
lda ptr3
|
|
|
|
ldx ptr3+1 ; We assume this is not zero
|
|
|
|
rts
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Dump one hex byte
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
dump: pha
|
|
|
|
lsr a
|
|
|
|
lsr a
|
|
|
|
lsr a
|
|
|
|
lsr a
|
|
|
|
tax
|
|
|
|
lda __hextab,x
|
|
|
|
jsr putc
|
|
|
|
pla
|
|
|
|
and #$0F
|
|
|
|
tax
|
|
|
|
lda __hextab,x
|
|
|
|
putc: ldy tmp2
|
|
|
|
inc tmp2
|
|
|
|
sta (ptr3),y
|
|
|
|
rts
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
putspace:
|
2013-05-09 11:56:54 +00:00
|
|
|
lda #$20
|
|
|
|
bne putc
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|