Code: Select all
;***********************************************************************************;
;
; perform DUMP
L7861 JSR CPYWORD ; copy word in zero page
.BYT VARTAB,TMPPTR ; copy start of variables to temporary pointer
L7866 LDA TMPPTR ; get temporary pointer low byte
CMP ARYTAB ; compare with end of variables low byte
LDA TMPPTR+1 ; get temporary pointer high byte
SBC ARYTAB+1 ; subtract end of variables high byte
BCC L7873 ; more variables, continue
JMP DOREADY ; set immediate mode and do BASIC warm start
L7873 LDY #$00 ; clear .Y
STY TMPSTO ; clear variable type flags
INY ; increment index to second variable name byte
L7878 LDA (TMPPTR),Y ; get variable name byte
ASL ; shift top bit into Cb
ROL TMPSTO ; shift top bit into variable type
LSR ; restore variable name byte, Cb was clear
STA VARNAM,Y ; set variable name byte
DEY ; decrement index
BPL L7878 ; loop for both variable name bytes
LDX TMPSTO ; get variable type
BEQ L78B1 ; both top bits were clear, floating-point
DEX
BEQ L78F0 ; first byte was set, second clear, invalid type
DEX
BEQ L78C9 ; top bit of first byte was clear, string
; integer variable
JSR PRTVNAM ; display variable name
LDA #'%'
JSR $CB47 ; display character
LDA #'='
JSR $CB47 ; display character
LDY #$02 ; offset to value high byte
LDA (TMPPTR),Y ; get value high byte
PHA ; save value high byte
INY ; increment to offset to value low byte
LDA (TMPPTR),Y ; get value low byte
TAY ; copy value low byte to .Y
PLA ; restore value high byte
JSR MAKFP ; convert fixed integer .A.Y to float FAC1
L78A8 JSR FLTASC ; convert FAC1 to ASCII string result in (.A.Y)
JSR PRTSTR ; print null terminated string
JMP L78ED ; print CR/LF
; floating-point variable
L78B1 JSR PRTVNAM ; display variable name
LDA #'='
JSR $CB47 ; display character
JSR RETVP ; return variable
LDA VARPNT ; get current variable address low byte
LDY VARPNT+1 ; get current variable address high byte
JSR LODFAC ; unpack memory (.A.Y) into FAC1
JMP L78A8 ; convert FAC1 to ASCII and print
L78C6 .BYT $22,"=$"
; string variable
L78C9 JSR PRTVNAM ; display variable name
LDX #$02 ; string length - 1
L78CE LDA L78C6,X ; get string byte
JSR $CB47 ; display character
DEX ; decrement index
BPL L78CE ; loop until all done
LDY #$04 ; index to value address high byte
LDA (TMPPTR),Y ; get value address high byte
STA INDEX+1 ; set utility pointer high byte
DEY ; decrement to value address low byte
LDA (TMPPTR),Y ; get value address low byte
STA INDEX ; set utility pointer low byte
DEY ; decrement to value length
LDA (TMPPTR),Y ; get value length
JSR $CB24 ; print string from utility pointer
LDA #$22 ; double quote
JSR $CB47 ; display character
L78ED JSR $CAD7 ; print CR/LF
L78F0 JSR STOP ; scan the stop key
BNE L78F8 ; branch if not [STOP]
JMP DOREADY ; set immediate mode and do BASIC warm start
L78F8 LDA SHFLAG ; get keyboard shift/control flag
BNE L78F8 ; loop while a modifier down
CLC
LDA TMPPTR ; get temporary pointer low byte
ADC #$07 ; add length of each variable definition
STA TMPPTR ; set temporary pointer low byte
BCC L7908 ; no carry, skip high byte increment
INC TMPPTR+1 ; increment temporary pointer high byte
L7908 JMP L7866 ; check if end of variables reached
;***********************************************************************************;
;
; display variable name
PRTVNAM
LDA VARNAM ; get current variable name first byte
JSR $CB47 ; display character
LDA VARNAM+1 ; get current variable name second byte
BEQ L7929 ; skip if zero
JMP $CB47 ; display character