home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_15_1987_Transactor_Publishing.d64 / trace44.cbm < prev    next >
Text File  |  2023-02-26  |  8KB  |  396 lines

  1. ; ** put "0:trace44.cbm"
  2. ; ********************************
  3. ; *                              *
  4. ; *          minitracer          *
  5. ; *    trace and single step     *
  6. ; *   with standard and bitmap   *
  7. ; *                              *
  8. ; *         rev 12/12/85         *
  9. ; *          jim frost           *
  10. ; *                              *
  11. ; ********************************
  12. shflag = $028d
  13. hibase = $0288
  14. chrout = $ffd2
  15. bgcol = $d021
  16. org $cb80
  17. ; ********************************
  18. ; *                              *
  19. ; *        screen data           *
  20. ; *                              *
  21. ; ********************************
  22. mini   hex 8d898e89
  23. tracer hex 202020a020625fa0
  24. hex    69625fa069625fa0
  25. hex    2062fea020625f00
  26. hex    a020a0a020e220a0
  27. hex    20e220a020a0a0a0
  28. hex    20e2a0a020e22000
  29. hex    a020a0a020a07ba0
  30. hex    20a020a0dfe2e9a0
  31. hex    20e2fba020a07b00
  32. msg1   hex 101205131320033d
  33. hex 20140f20140f0707
  34. hex 0c052013090e070c
  35. hex 052d13140510
  36. msg2 hex 1012051313201308
  37. hex 090614200f122001
  38. hex 0e19200b05192014
  39. hex 0f2013140510
  40. pag
  41. ; ********************************
  42. ; *                              *
  43. ; *         variables            *
  44. ; *                              *
  45. ; ********************************
  46. ssflg ds 1
  47. linlo ds 1
  48. linhi ds 1
  49. bcdhi ds 4
  50. tlnlo ds 1
  51. tlnhi ds 1
  52. ztemp ds 4
  53. count ds 1
  54. ; ********************************
  55. ; *                              *
  56. ; *      colors compatable       *
  57. ; *       with background        *
  58. ; *                              *
  59. ; ********************************
  60. coltab hex 0100010001010100
  61. hex 0101020101000100
  62. ; ********************************
  63. ; *                              *
  64. ; *      character set for       *
  65. ; *          bit map             *
  66. ; *                              *
  67. ; ********************************
  68. chrtab hex 3f33333333333f3f ;zero
  69. hex 3c3c0c0c0c0c3f3f ;one
  70. hex 3f33033f30333f3f ;two
  71. hex 3f33030f03333f3f ;three
  72. hex 3333333f03030303 ;four
  73. hex 3f30303f03333f3f ;five
  74. hex 3f33303f33333f3f ;six
  75. hex 3f33030303030303 ;seven
  76. hex 3f33333f33333f3f ;eight
  77. hex 3f33333f03333f3f ;nine
  78. pag
  79. ; ********************************
  80. ; *                              *
  81. ; *   table of bank addresses    *
  82. ; *                              *
  83. ; ********************************
  84. ; banktab hex c0804000
  85. ; hex e0a06020
  86. ; ********************************
  87. ; *                              *
  88. ; *        start of wedge        *
  89. ; *                              *
  90. ; ********************************
  91. start pha ;save a and x on stack
  92. txa
  93. pha
  94. ldx #$00 ;clear temp flag in x
  95. lda $39 ;low byte of current line #
  96. cmp linlo
  97. beq samelo
  98. inx  ;set temp flag
  99. sta linlo
  100. samelo lda $3a ;high byte current line #
  101. cmp linhi
  102. beq samehi
  103. inx
  104. sta linhi
  105. samehi cpx #$00 ;if x still 0 then
  106. bne trace ;then we are on same line
  107. jmp quickout
  108. trace ldx #$03
  109. savzp lda $fb,x ;save user zero page
  110. sta ztemp,x ;so trace can share
  111. dex
  112. bpl savzp
  113. nokeys lda shflag ;get special keypress
  114. cmp #$02 ;c= ?
  115. bne tstflg ;no? jump to flag test
  116. lda ssflg ;else toggle the flag
  117. eor #$01
  118. sta ssflg ;and store the new flag
  119. finger lda shflag
  120. bne finger ;wait until fingers are lifted
  121. tstflg lda ssflg
  122. beq nopause ;if ssflg=0 then skip ss
  123. lda $c5 ;check keys
  124. cmp #$40 ;if 40 no keys pressed
  125. bne keyprs ;else keys pressed so continue
  126. lda shflag
  127. beq nokeys ;repeat until keys pressed
  128. keyprs ldx #$30
  129. delay1 lda $d012 ;raster position
  130. bne delay1 ;repeat until raster=0
  131. delay2 lda $d012
  132. beq delay2 ;repeat until raster not zero
  133. pag
  134. lda shflag ;check for request to
  135. cmp #$02 ;exit single step
  136. bne delay3 ;if no request,continue wait
  137. lda #$00 ;else clear flag
  138. sta ssflg
  139. thumb lda shflag ;wait for fingers up
  140. bne thumb
  141. beq nopause ;and resume trace
  142. delay3 dex
  143. bne delay1 ;repeat until x=0
  144. nopause ldx #$02
  145. clrmem lda $38,x ;save basic line #
  146. sta tlnlo-1,x ;clear mem for new bcd numbers
  147. lda #$00
  148. sta bcdhi,x
  149. dex
  150. bne clrmem
  151. sta bcdhi
  152. ldx #$0f
  153. htod asl tlnlo ;get one bit at a time
  154. rol tlnhi ;from the basic
  155. sei  ;line # and add it
  156. sed  ;to the bcd # being formed
  157. ldy #$02
  158. decadd lda bcdhi,y
  159. adc bcdhi,y
  160. sta bcdhi,y
  161. dey
  162. bpl decadd
  163. cld
  164. cli
  165. dex
  166. bpl htod
  167. lda hibase ;high byte of screen address
  168. sta $fc
  169. lda $dd00 ;video bank in low two bits
  170. and #$03
  171. tax
  172. lda banktab,x
  173. clc
  174. adc $fc
  175. adc #$03
  176. sta $fc
  177. lda #$e0 ;offset to screen bottom
  178. sta $fb
  179. lda $d011
  180. and #$20
  181. beq nobit
  182. jmp bitout
  183. ; ********************************
  184. ; *                              *
  185. ; *   lores line number display  *
  186. ; *                              *
  187. ; ********************************
  188. nobit ldx #$00
  189. ldy #$00
  190. gethi lda bcdhi,x ;get bcd number
  191. pha  ;save it on stack
  192. lsr  ;shift high nibble to low
  193. lsr
  194. lsr
  195. lsr
  196. ora #$30 ;convert to screen code
  197. sta ($fb),y ;and poke on screen
  198. iny
  199. pla  ;get save bcd number
  200. and #$0f ;throw away high nibble
  201. ora #$30 ;convert to screen code
  202. sta ($fb),y ;poke it on screen
  203. inx
  204. iny
  205. cpx #$03 ;repeat until six digits
  206. bne gethi
  207. col2 ldx #$06
  208. lda bgcol ;check background color
  209. and #$0f
  210. tay
  211. lda coltab,y ;get compatable color from table
  212. cmem1 sta $dbdf,x ;and poke color memory
  213. dex
  214. bne cmem1
  215. ldx #$03
  216. zrest lda ztemp,x
  217. sta $fb,x
  218. dex
  219. bpl zrest
  220. quickout pla  ;finish chrget
  221. tax
  222. pla
  223. cmp #$3a
  224. bcs cg1
  225. jmp $80
  226. cg1 jmp $8a
  227. ; ********************************
  228. ; *                              *
  229. ; *   hires line number display  *
  230. ; *                              *
  231. ; ********************************
  232. bitout lda $d018 ;bit 8 set puts
  233. and #$08 ;bit map in upper half
  234. beq lowbank ;mask unwanted
  235. inx
  236. inx
  237. inx
  238. inx
  239. lowbank lda banktab,x
  240. clc
  241. adc #$1f ;offset to bottom of bitmap
  242. sta $fe
  243. lda #$00
  244. sta $fd
  245. lda #$00
  246. sta count
  247. ldy #$00
  248. getbcd ldx count
  249. lda bcdhi,x ;get bcd number
  250. pha  ;save on stack for low nibble
  251. and #$f0 ;mask low nibble
  252. lsr  ;high nibble is 16*value
  253. tax  ;divide by 2 for 8*value
  254. nextrow lda chrtab,x ;and get indexed character
  255. sta ($fd),y ;poke on bitmap
  256. inx
  257. iny
  258. cpy #$08 ;done with character 1?
  259. beq low ;print box right and left
  260. cpy #$18 ;done with character 3?
  261. beq low
  262. cpy #$28 ;done with character 5?
  263. beq low
  264. bne nextrow
  265. low pla  ;fetch bcd for low nibble
  266. and #$0f ;mask high nibble
  267. asl  ;multiply by 8
  268. asl
  269. asl
  270. tax
  271. nextlow lda chrtab,x ;get indexed character
  272. sta ($fd),y ;poke on bitmap
  273. inx
  274. iny
  275. cpy #$10 ;done with character 2?
  276. beq countup
  277. cpy #$20 ;done with character 4?
  278. beq countup
  279. cpy #$30 ;done with character 6?
  280. beq scolor
  281. bne nextlow
  282. countup inc count
  283. bne getbcd
  284. scolor ldy #$05
  285. lda #$10
  286. cm1 sta ($fb),y
  287. dey
  288. bpl cm1
  289. jmp col2
  290. ; ********************************
  291. ; *                              *
  292. ; *     initialize chrget        *
  293. ; *                              *
  294. ; ********************************
  295. lda #$4c ;insert the wedge
  296. sta $7c ;by poking chrget with jmp$cd78
  297. lda #<start ;low byte start address
  298. sta $7d
  299. lda #>start ;high byte of start
  300. sta $7e
  301. ldx #$01 ;white
  302. lda bgcol
  303. and #$0f ;mask high nibble
  304. cmp #$01 ;is background white?
  305. bne white ;no, leave text white
  306. dex  ;else change color to black (0)
  307. white txa
  308. ldx #$00
  309. color sta $d800,x
  310. sta $d900,x
  311. inx
  312. bne color
  313. ; ********************************
  314. ; *                              *
  315. ; *     print initial screen     *
  316. ; *                              *
  317. ; ********************************
  318. lda #$93 ;clear screen
  319. jsr chrout
  320. ldx #$0d
  321. lda #$11
  322. cdwn jsr chrout ;print 13 cursor downs
  323. dex
  324. bne cdwn
  325. lda #$a0
  326. ldx #$f0
  327. rvs1 sta $03ff,x ;print 6 rows of reverse spaces
  328. dex
  329. bne rvs1
  330. ldx #$04
  331. mi1 lda mini-1,x ;print mini
  332. sta $0439,x
  333. dex
  334. bne mi1
  335. ldy #$00 ;print tracer
  336. lda #$03
  337. sta count
  338. lda #$58
  339. sta $fb
  340. lda #$04
  341. sta $fc
  342. tr1 lda tracer,x
  343. beq nxtrow
  344. sta ($fb),y
  345. inx
  346. iny
  347. bne tr1
  348. nxtrow jsr pl40
  349. inx
  350. ldy #$00
  351. dec count
  352. bne tr1
  353. ldy #$1d
  354. ms1 lda msg1,y ;print top message
  355. sta $051d,y
  356. lda msg2,y ;and bottom message
  357. sta $056d,y
  358. dey
  359. bpl ms1
  360. lda #$f0 ;set $fb for printing box
  361. sta $fb
  362. lda #$04
  363. sta $fc
  364. ldx #$04
  365. side ldy #$00
  366. lda #$65 ;left side
  367. sta ($fb),y
  368. ldy #$27
  369. lda #$67 ;right side
  370. sta ($fb),y
  371. jsr pl40 ;add to $fb for next row
  372. dex  ;finished when x=0
  373. bne side
  374. ldy #$27 ;print box bottom
  375. lda #$7a ;right side
  376. bott sta ($fb),y
  377. lda #$6f ;bottom
  378. dey
  379. bne bott
  380. lda #$4c ;left side
  381. sta ($fb),y
  382. rts  ;back to basic
  383. ; ********************************
  384. ; *                              *
  385. ; *        add 40 to $fb         *
  386. ; *     for next screen row      *
  387. ; *                              *
  388. ; ********************************
  389. pl40 clc
  390. lda $fb
  391. adc #$28
  392. sta $fb
  393. bcc pl1
  394. inc $fc
  395. pl1 rts
  396.