Classic Computer Magazine Archive PROGRAM LISTING: 88-02/FASTJUMP.M65


0100 ; FAST JUMP
0110 ; BY BILL BODENSTEIN
0120 ; (c)1987, ANTIC PUBLISHING
0130 ;
0140 ; EQUATES
0150 ;
0160 PORTB = $D301   ;Toggle ROM here
0170 BASIC.ON = 253
0180 ;
0190 JSR =   32      ;Decimal opcodes
0200 NOP =   234
0210 STMTAB = $88    ;Start of prog
0220 STMCUR = $8A    ;Current line
0230 FORLN = $A0     ;Lnno saved here
0240 ;
0250 PUT.PATCH = $A000 ;Mem for patch
0260 JSR.HERE = PUT.PATCH+6 ;Actual
0270 ;                       code
0280 ;
0290     *=  $0600   ;Relocatable but
0300 ;                could be called
0310 ;                via USR(1536)
0320 STARTCODE
0330     PLA         ;Remove # args
0340 ;
0350 ;Before searching for line,
0360 ;jump to patch.
0370 MODIFY.BASIC
0380     LDA #JSR    ;JSR PATCH
0390     STA $A9AA
0400     LDA # <JSR.HERE
0410     STA $A9AB
0420     LDA # >JSR.HERE
0430     STA $A9AC
0440     LDA #NOP    ;NOP
0450     STA $A9AD
0460 ;
0470 ;Install patch in unused (except
0480 ;with NEW) BASIC RAM.
0490     LDX #ENDCODE-PATCH-1
0500     LDY #ENDCODE-STARTCODE-1
0510 LOOP
0520     LDA ($D4),Y ;Move bytes from
0530     STA PUT.PATCH,X ;USR code
0540     DEY 
0550     DEX 
0560     BPL LOOP    ;Done when patch
0570     RTS         ;installed
0580 ;
0590 ;Patch to be installed in BASIC
0600 ;RAM. If NEW occurs, BASIC ROM
0610 ;is enabled so that patch isn't
0620 ;accidently executed.
0630 ;(Remember: With FAST-STACK, ROM
0640 ;is always enabled in direct
0650 ;mode.)
0660 PATCH
0670     NOP 
0680     LDX #BASIC.ON
0690     STX PORTB
0700 ;
0710     LDY #1      ;Is lnno >= curr
0720     LDA FORLN+1 ; lnno???
0730     CMP (STMCUR),Y
0740     BCC NORMAL
0750     BNE FAST
0760 ;
0770     DEY 
0780     LDA FORLN
0790     CMP (STMCUR),Y
0800     BCC NORMAL
0810 ;
0820 FAST
0830     LDA STMCUR+1 ;Yes,start from
0840     LDY STMCUR  ; current line
0850     RTS 
0860 NORMAL
0870     LDA STMTAB+1 ;No,start from
0880     LDY STMTAB  ; first line
0890     RTS 
0900 ENDCODE

Back to previous page