home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_15_1987_Transactor_Publishing.d64
/
trace44.cbm
< prev
next >
Wrap
Text File
|
2023-02-26
|
8KB
|
396 lines
; ** put "0:trace44.cbm"
; ********************************
; * *
; * minitracer *
; * trace and single step *
; * with standard and bitmap *
; * *
; * rev 12/12/85 *
; * jim frost *
; * *
; ********************************
shflag = $028d
hibase = $0288
chrout = $ffd2
bgcol = $d021
org $cb80
; ********************************
; * *
; * screen data *
; * *
; ********************************
mini hex 8d898e89
tracer hex 202020a020625fa0
hex 69625fa069625fa0
hex 2062fea020625f00
hex a020a0a020e220a0
hex 20e220a020a0a0a0
hex 20e2a0a020e22000
hex a020a0a020a07ba0
hex 20a020a0dfe2e9a0
hex 20e2fba020a07b00
msg1 hex 101205131320033d
hex 20140f20140f0707
hex 0c052013090e070c
hex 052d13140510
msg2 hex 1012051313201308
hex 090614200f122001
hex 0e19200b05192014
hex 0f2013140510
pag
; ********************************
; * *
; * variables *
; * *
; ********************************
ssflg ds 1
linlo ds 1
linhi ds 1
bcdhi ds 4
tlnlo ds 1
tlnhi ds 1
ztemp ds 4
count ds 1
; ********************************
; * *
; * colors compatable *
; * with background *
; * *
; ********************************
coltab hex 0100010001010100
hex 0101020101000100
; ********************************
; * *
; * character set for *
; * bit map *
; * *
; ********************************
chrtab hex 3f33333333333f3f ;zero
hex 3c3c0c0c0c0c3f3f ;one
hex 3f33033f30333f3f ;two
hex 3f33030f03333f3f ;three
hex 3333333f03030303 ;four
hex 3f30303f03333f3f ;five
hex 3f33303f33333f3f ;six
hex 3f33030303030303 ;seven
hex 3f33333f33333f3f ;eight
hex 3f33333f03333f3f ;nine
pag
; ********************************
; * *
; * table of bank addresses *
; * *
; ********************************
; banktab hex c0804000
; hex e0a06020
; ********************************
; * *
; * start of wedge *
; * *
; ********************************
start pha ;save a and x on stack
txa
pha
ldx #$00 ;clear temp flag in x
lda $39 ;low byte of current line #
cmp linlo
beq samelo
inx ;set temp flag
sta linlo
samelo lda $3a ;high byte current line #
cmp linhi
beq samehi
inx
sta linhi
samehi cpx #$00 ;if x still 0 then
bne trace ;then we are on same line
jmp quickout
trace ldx #$03
savzp lda $fb,x ;save user zero page
sta ztemp,x ;so trace can share
dex
bpl savzp
nokeys lda shflag ;get special keypress
cmp #$02 ;c= ?
bne tstflg ;no? jump to flag test
lda ssflg ;else toggle the flag
eor #$01
sta ssflg ;and store the new flag
finger lda shflag
bne finger ;wait until fingers are lifted
tstflg lda ssflg
beq nopause ;if ssflg=0 then skip ss
lda $c5 ;check keys
cmp #$40 ;if 40 no keys pressed
bne keyprs ;else keys pressed so continue
lda shflag
beq nokeys ;repeat until keys pressed
keyprs ldx #$30
delay1 lda $d012 ;raster position
bne delay1 ;repeat until raster=0
delay2 lda $d012
beq delay2 ;repeat until raster not zero
pag
lda shflag ;check for request to
cmp #$02 ;exit single step
bne delay3 ;if no request,continue wait
lda #$00 ;else clear flag
sta ssflg
thumb lda shflag ;wait for fingers up
bne thumb
beq nopause ;and resume trace
delay3 dex
bne delay1 ;repeat until x=0
nopause ldx #$02
clrmem lda $38,x ;save basic line #
sta tlnlo-1,x ;clear mem for new bcd numbers
lda #$00
sta bcdhi,x
dex
bne clrmem
sta bcdhi
ldx #$0f
htod asl tlnlo ;get one bit at a time
rol tlnhi ;from the basic
sei ;line # and add it
sed ;to the bcd # being formed
ldy #$02
decadd lda bcdhi,y
adc bcdhi,y
sta bcdhi,y
dey
bpl decadd
cld
cli
dex
bpl htod
lda hibase ;high byte of screen address
sta $fc
lda $dd00 ;video bank in low two bits
and #$03
tax
lda banktab,x
clc
adc $fc
adc #$03
sta $fc
lda #$e0 ;offset to screen bottom
sta $fb
lda $d011
and #$20
beq nobit
jmp bitout
; ********************************
; * *
; * lores line number display *
; * *
; ********************************
nobit ldx #$00
ldy #$00
gethi lda bcdhi,x ;get bcd number
pha ;save it on stack
lsr ;shift high nibble to low
lsr
lsr
lsr
ora #$30 ;convert to screen code
sta ($fb),y ;and poke on screen
iny
pla ;get save bcd number
and #$0f ;throw away high nibble
ora #$30 ;convert to screen code
sta ($fb),y ;poke it on screen
inx
iny
cpx #$03 ;repeat until six digits
bne gethi
col2 ldx #$06
lda bgcol ;check background color
and #$0f
tay
lda coltab,y ;get compatable color from table
cmem1 sta $dbdf,x ;and poke color memory
dex
bne cmem1
ldx #$03
zrest lda ztemp,x
sta $fb,x
dex
bpl zrest
quickout pla ;finish chrget
tax
pla
cmp #$3a
bcs cg1
jmp $80
cg1 jmp $8a
; ********************************
; * *
; * hires line number display *
; * *
; ********************************
bitout lda $d018 ;bit 8 set puts
and #$08 ;bit map in upper half
beq lowbank ;mask unwanted
inx
inx
inx
inx
lowbank lda banktab,x
clc
adc #$1f ;offset to bottom of bitmap
sta $fe
lda #$00
sta $fd
lda #$00
sta count
ldy #$00
getbcd ldx count
lda bcdhi,x ;get bcd number
pha ;save on stack for low nibble
and #$f0 ;mask low nibble
lsr ;high nibble is 16*value
tax ;divide by 2 for 8*value
nextrow lda chrtab,x ;and get indexed character
sta ($fd),y ;poke on bitmap
inx
iny
cpy #$08 ;done with character 1?
beq low ;print box right and left
cpy #$18 ;done with character 3?
beq low
cpy #$28 ;done with character 5?
beq low
bne nextrow
low pla ;fetch bcd for low nibble
and #$0f ;mask high nibble
asl ;multiply by 8
asl
asl
tax
nextlow lda chrtab,x ;get indexed character
sta ($fd),y ;poke on bitmap
inx
iny
cpy #$10 ;done with character 2?
beq countup
cpy #$20 ;done with character 4?
beq countup
cpy #$30 ;done with character 6?
beq scolor
bne nextlow
countup inc count
bne getbcd
scolor ldy #$05
lda #$10
cm1 sta ($fb),y
dey
bpl cm1
jmp col2
; ********************************
; * *
; * initialize chrget *
; * *
; ********************************
lda #$4c ;insert the wedge
sta $7c ;by poking chrget with jmp$cd78
lda #<start ;low byte start address
sta $7d
lda #>start ;high byte of start
sta $7e
ldx #$01 ;white
lda bgcol
and #$0f ;mask high nibble
cmp #$01 ;is background white?
bne white ;no, leave text white
dex ;else change color to black (0)
white txa
ldx #$00
color sta $d800,x
sta $d900,x
inx
bne color
; ********************************
; * *
; * print initial screen *
; * *
; ********************************
lda #$93 ;clear screen
jsr chrout
ldx #$0d
lda #$11
cdwn jsr chrout ;print 13 cursor downs
dex
bne cdwn
lda #$a0
ldx #$f0
rvs1 sta $03ff,x ;print 6 rows of reverse spaces
dex
bne rvs1
ldx #$04
mi1 lda mini-1,x ;print mini
sta $0439,x
dex
bne mi1
ldy #$00 ;print tracer
lda #$03
sta count
lda #$58
sta $fb
lda #$04
sta $fc
tr1 lda tracer,x
beq nxtrow
sta ($fb),y
inx
iny
bne tr1
nxtrow jsr pl40
inx
ldy #$00
dec count
bne tr1
ldy #$1d
ms1 lda msg1,y ;print top message
sta $051d,y
lda msg2,y ;and bottom message
sta $056d,y
dey
bpl ms1
lda #$f0 ;set $fb for printing box
sta $fb
lda #$04
sta $fc
ldx #$04
side ldy #$00
lda #$65 ;left side
sta ($fb),y
ldy #$27
lda #$67 ;right side
sta ($fb),y
jsr pl40 ;add to $fb for next row
dex ;finished when x=0
bne side
ldy #$27 ;print box bottom
lda #$7a ;right side
bott sta ($fb),y
lda #$6f ;bottom
dey
bne bott
lda #$4c ;left side
sta ($fb),y
rts ;back to basic
; ********************************
; * *
; * add 40 to $fb *
; * for next screen row *
; * *
; ********************************
pl40 clc
lda $fb
adc #$28
sta $fb
bcc pl1
inc $fc
pl1 rts