home *** CD-ROM | disk | FTP | other *** search
- 0100 ; BASIC TRACER¢0110 ; BY KEVIN GEVATOSKY¢0120 ; (c) 1986, ANTIC PUBLISHING¢0130 STMCUR = $8A ;Line # of cur. BASIC statement¢0140 SRCPNT = $CB¢0150 DESPNT = $CD¢0160 TIMVAL = $CF ;Delay timer¢0170 ZPOINT = $D0¢0180 ROMOFF = $FF ;BASIC ROM 'off'¢0190 SDLSTL = $0230¢0200 CH = $02FC¢0210 SOURCE = $A000¢0220 STGO = $A97E¢0230 DESTIN = $5000¢0240 SKCTL = $D20F¢0250 PORTB = $D301 ;ROM switch¢0260 STARTCODE = $0100¢0270 *= $0100¢0280 RAMBAS¢0290 JSR SETUP¢0300 JMP MOVE ;Move BASIC¢0310 SETUP¢0320 LDA # <SOURCE ;Set ZP-pointer to start¢0330 STA SRCPNT ;address of move.¢0340 LDA # >SOURCE¢0350 STA SRCPNT+1¢0360 LDA # <DESTIN ;Set another pointer to¢0370 STA DESPNT ;end address.¢0380 LDA # >DESTIN¢0390 STA DESPNT+1¢0400 LDX #32 ;32 blocks=8K of BASIC code.¢0410 LDY #0¢0420 RTS ¢0430 MOVE¢0440 LDA (SRCPNT),Y ;Copy BASIC ROM to RAM¢0450 STA (DESPNT),Y¢0460 DEY ¢0470 BNE MOVE¢0480 ;¢0490 NXTPAGE¢0500 INC SRCPNT+1¢0510 INC DESPNT+1¢0520 DEX ;Decrement to next block.¢0530 BPL MOVE¢0540 ;¢0550 LDA #ROMOFF ;Turn off BASIC ROM.¢0560 STA PORTB¢0570 JSR SETUP ;Set up pointers for next move.¢0580 MOVE2¢0590 LDA (DESPNT),Y ;Move BASIC source code¢0600 STA (SRCPNT),Y ;to RAM at $A000¢0610 DEY ¢0620 BNE MOVE2¢0630 ;¢0640 NXTPG2¢0650 INC SRCPNT+1¢0660 INC DESPNT+1¢0670 DEX ¢0680 BPL MOVE2¢0690 ;¢0700 SETVEC¢0710 LDA # <VECTOR ;Put a vector in BASIC¢0720 STA $A978 ;which points to our routine.¢0730 LDA # >VECTOR¢0740 STA $A979¢0750 JMP START ;Go set up DL.¢0760 *= $0600¢0770 ;¢0780 ; *** MODIFY DISPLAY LIST ***¢0790 START¢0800 JSR DLSET¢0810 JMP SOURCE ;JuMP to init. RAM-BASIC.¢0820 DLSET¢0830 LDA SDLSTL ;Move start address of DL¢0840 SEC ;back two bytes to make room for¢0850 SBC #2 ;more DL data.¢0860 STA SDLSTL¢0870 STA CHECK ;Save low byte of addr.for later.¢0880 STA ZPOINT ;Set up zero-page pointer¢0890 BCS NODEC ;to point at new DL start addr.¢0900 ;¢0910 DEC SDLSTL+1¢0920 NODEC¢0930 LDA SDLSTL+1¢0940 STA ZPOINT+1¢0950 LDY #0¢0960 NXTBYT¢0970 LDA DLDATA,Y ;Get data to modify DL¢0980 STA (ZPOINT),Y ;and store it at new add.¢0990 INY ¢1000 CPY #5¢1010 BNE NXTBYT ;Do until done.¢1020 ;¢1030 FIND¢1040 LDA (ZPOINT),Y ;Find end of the DL¢1050 CMP #65 ;(65=ANTIC JMP to start of DL.)¢1060 BEQ FOUND ;Got it!¢1070 ;¢1080 INC ZPOINT¢1090 BNE NOINC¢1100 ;¢1110 INC ZPOINT+1¢1120 NOINC¢1130 JMP FIND ;Keep looking until found.¢1140 FOUND¢1150 INY ;Point to byte after ANTIC JMP¢1160 LDA SDLSTL ;Store start adr of new DL¢1170 STA (ZPOINT),Y ;for the ANTIC JMP.¢1180 INY ¢1190 LDA SDLSTL+1¢1200 STA (ZPOINT),Y¢1210 LDA DLDATA+3 ;Set zero pg. ptr. to start¢1220 STA ZPOINT ;of screen RAM for new¢1230 LDA DLDATA+4 ;GR.0 mode line¢1240 STA ZPOINT+1¢1250 LDA #$80 ;Inverse blank¢1260 LDY #39¢1270 INVERT¢1280 STA (ZPOINT),Y ;Store inverse chars¢1290 DEY ¢1300 BPL INVERT ;Do for all 40 bytes.¢1310 ;¢1320 RTS ¢1330 ; *** TRACE ROUTINE ***¢1340 VECTOR¢1350 PHA ;Save reg.A for BASIC.¢1360 LDA CHECK ;Get low byte of DL and¢1370 CMP SDLSTL ;check to see if still same.¢1380 BEQ CONT ;It is, so go on¢1390 ;¢1400 JSR DLSET ;Set up DL again.¢1410 CONT¢1420 LDA #0¢1430 LDX #5¢1440 BLANK¢1450 DEX ;Zero out DECVAL¢1460 STA DECVAL,X¢1470 BNE BLANK¢1480 ;¢1490 NEXT¢1500 LDY #0¢1510 LDA (STMCUR),Y ;Get low byte of BASIC¢1520 STA LOBYTE ;and save it.¢1530 INY ¢1540 LDA (STMCUR),Y ;Get hi byte¢1550 STA HIBYTE¢1560 LDY #0¢1570 ;Convert binary to decimal.¢1580 SUBTRACT¢1590 LDA LOBYTE¢1600 SEC ¢1610 SBC DECPLC,Y ;Subtract decimal value¢1620 STA TEMPLO ;from binary value.¢1630 LDA HIBYTE¢1640 SBC DECPLC+1,Y¢1650 STA TEMPHI¢1660 BCS DECSTOW ;Branch if OK¢1670 ;¢1680 INY ;Increment to next dec. place¢1690 INY ¢1700 INX ;and increment counter.¢1710 CPX #5 ;All done?¢1720 BEQ DECOUT ;Yes? Then put it on screen.¢1730 ;¢1740 BNE SUBTRACT ;No? Subtract next dec. place¢1750 ;¢1760 DECSTOW¢1770 INC DECVAL,X¢1780 LDA TEMPLO¢1790 STA LOBYTE¢1800 LDA TEMPHI¢1810 STA HIBYTE¢1820 JMP SUBTRACT¢1830 DECOUT¢1840 LDX #4¢1850 LDY #22 ;Pos. on screen.¢1860 NXTCH¢1870 LDA DECVAL,X ;Get decimal value.¢1880 ORA #$90 ;Convert to ATASCII¢1890 STA (ZPOINT),Y ;& display it.¢1900 DEY ¢1910 DEX ¢1920 BPL NXTCH ;Do until done.¢1930 ;¢1940 NODEL¢1950 LDA SKCTL ;Check keypress.¢1960 CMP #$FF¢1970 BEQ RESTOR ;If no keypress¢1980 ;¢1990 LDA CH¢2000 CMP #156 ;Check CTRL-ESC¢2010 BEQ EXIT ;If pressed then skip delay.¢2020 ;¢2030 RESTOR¢2040 LDA #$FF ;Restore CH¢2050 STA CH¢2060 LDY #0 ;Zero timer.¢2070 STY 20¢2080 DELAY¢2090 LDA 20 ;Get timer value.¢2100 LSR A ;Divide by 2 for better resolution¢2110 CMP TIMVAL¢2120 BNE DELAY ;Delay until time is up.¢2130 ;¢2140 EXIT¢2150 PLA ;Give Acc. A back to BASIC¢2160 JMP STGO¢2170 DECVAL .DS 5¢2180 TEMPLO .DS 1¢2190 TEMPHI .DS 1¢2200 LOBYTE .DS 1¢2210 HIBYTE .DS 1¢2220 CHECK .DS 1¢2230 DLDATA .BYTE $70,$70,$42,$00,$04¢2240 DECPLC .WORD 10000,1000,100,10,1¢2250 *= $02E0¢2260 .WORD STARTCODE¢