home *** CD-ROM | disk | FTP | other *** search
- ; dump.asm
- ;============================================
- ; Command: dump [[d:]filename]
- ;============================================
- ; Dumps the assembler's symbol table.
- ; Dump with filespec dumps to the named file.
- ; Otherwise dump is to the screen.
- ;
- ; Must be done immediately after running ASM
-
-
- shift = $00d3
- stkey = $0091
- fnadr = $00bb
- fnlen = $00b7
- index1 = $0024
- stkey = $0091
- shift = $00d3
- int04 = $1704
- int0d = $170d
- int0e = $170e
- int13 = $1713
- int09 = $1709
- primm = $ff7d
- chrout = $ffd2
- chkout = $ffc9
- clrchn = $ffcc
-
- star = $0b00
- .wor star
- * = star
-
- jmp dump
- dw Date
-
- dump ldx #1 ; check if there's a %1
- jsr int04 ; get char
- bcs loop ; no parameters...use screen
- jsr int13 ; scratch destination
- ldx #1
- lda #"s" ; and re-open for write
- jsr int09 ; open %1 as seq file
- bcc noerr ; open went ok
- derr jsr clrchn
- jsr primm
- .asc 13,"Disk error: ", 0
- jsr int0d
- jmp int0e
-
- noerr jsr chkout
- bcs derr
- loop lda #>$4000 ; symbol table start
- sta index1+1
- lda #<$4000
- sta index1
- jmp dump6 ; check if done & loop
-
- dump3 ldy #0 ; print 6 char label
- dump4 jsr peek
- and #$7f
- jsr chrout
- iny
- cpy #6
- bne dump4
- ldy #3
- dump5 lda eqwls,y ; print " = $"
- jsr chrout
- dey
- bpl dump5
- ldy #6
- jsr peek ; address hi
- jsr hexa
- iny
- jsr peek ; address lo
- jsr hexa
-
- ;check 1st char of name. Bit 7 flags whether or not it has
- ;ever been used other than when it was defined.
-
- ldy #0
- jsr peek
- bmi used
- lda #" "
- jsr chrout
- lda #" ; " ;flag useless labels
- jsr chrout
-
- used clc ; bump to next label
- lda #$08
- adc index1
- sta index1
- bcc used0
- inc index1+1
- used0 lda #13
- jsr chrout
- chkshf lda shift ; pause on shift
- bne chkshf
- lda stkey ; check stop
- cmp #127
- beq dumpx ; yes then done
-
- ; check for a null in the label
- ; name. if so end of table has
- ; has been reached
-
- dump6 ldy #5
- dump06 jsr peek
- beq dumpx
- dey
- bpl dump06
- bmi dump3
-
- dumpx jsr clrchn ; clear channel
- jmp int0e
-
- eqwls .byt "$ = "
-
- ;=================================
- ;hexout - outputs .x (lo) .y (hi)
- ; as an ascii hex word.
- ;hexa - outputs .a only as hex
- ;=================================
-
- hexout txa ; save lo byt
- pha
- tya ; do hi byt
- jsr hexa
- pla ; now lo byte
- hexa pha ; output .a as hex
- lsr a
- lsr a
- lsr a
- lsr a
- jsr hx1
- tax
- pla
- and #$0f
- jsr hx1
- prtxa pha
- txa
- jsr chrout
- pla
- jmp chrout
-
- hx1 clc
- adc #$f6
- bcc hx2
- adc #$06
- hx2 adc #$3a
- rts
-
- peek sta $ff01
- lda (index1),y
- pha
- lda #0
- sta $ff00
- pla
- rts
-
- .end
-