Classic Computer Magazine Archive PROGRAM LISTING: 89-05a/FINGERS.M65


0100 ;BUTTERFINGERS
0110 ;BY KEVIN C. GEVATOSKY
0120 ;(c)1989, ANTIC PUBLISHING INC.
0130 ;
0140 DOSINI = $0C
0150 VKEYBD = $0208  ;KB int. vector.
0160 KBCODE = $D209  ;Current key.
0170 CH1 =   $02F2   ;Prior key.
0180 CH  =   $02FC   ;Last key.
0190 SH_CLR = 118    ;Key codes.
0200 CT_CLR = 182
0210 CT_SH_CLR = 246
0220 ;
0230     *=  $0600
0240 ;
0250 ;This program provides two entry
0260 ;points so that it can be
0270 ;started from DOS or BASIC.
0280 ;
0290 START
0300     JMP INIT    ;For DOS entry.
0310     NOP         ;For BASIC entry
0320     PLA         ;w/ X=USR(1540)
0330 ;
0340 ;Makes the program RESET-proof
0350 ;
0360 INIT
0370     LDA DOSINI  ;Get current DOS
0380     STA NEW_INI+1 ;init address
0390     LDA DOSINI+1 ;and save in
0400     STA NEW_INI+2 ;new vector.
0410     LDA # <NEW_INI ;Put addr of
0420     STA DOSINI  ;new vector in
0430     LDA # >NEW_INI ;old vector.
0440     STA DOSINI+1
0450     BNE SET_KBVEC ;(JUMP)
0460 ;
0470 NEW_INI
0480     JSR $FFFF   ;New DOS init.
0490 ;
0500 ;Jump here on initialization or
0510 ;RESET to setup a new keyboard
0520 ;trap vector.
0530 ;
0540 SET_KBVEC
0550     SEI         ;Kill IRQ's.
0560     LDA VKEYBD  ;Save system KB
0570     STA SYSKBV  ;interrupt addr
0580     LDA VKEYBD+1 ;replace w/the
0590     STA SYSKBV+1 ;addr to our
0600     LDA # <KEY_TRAP ;key-trap
0610     STA VKEYBD  ;routine.
0620     LDA # >KEY_TRAP
0630     STA VKEYBD+1
0640     CLI         ;Restore IRQ's.
0650     RTS 
0660 ;
0670 ;Interrupt routine to replace
0680 ;SHFT+CLEAR and CTRL+CLEAR
0690 ;with SHFT+CTRL+CLEAR.
0700 ;
0710 KEY_TRAP
0720     PHA 
0730     LDA KBCODE  ;Get current key
0740     CMP #SH_CLR ;Filter out the
0750     BEQ GOT_YA  ;standard clear
0760 ;
0770     CMP #CT_CLR ;screen keys.
0780     BEQ GOT_YA
0790 ;
0800     CMP #CT_SH_CLR ; Check for
0810     BNE GO_KB_INT ;  our special
0820 ;                    key
0830 CLR_SCR ;       combination
0840     LDA #SH_CLR
0850     STA CH      ;Put clr-screen
0860     STA CH1     ;code for Editor
0870 GOT_YA
0880     PLA         ;Return from the
0890     PLA         ;interrupt.
0900     RTI 
0910 ;
0920 GO_KB_INT
0930     PLA         ;Pass all other
0940     JMP (SYSKBV) ;keys on to OS
0950 ;
0960 SYSKBV
0970     .DS 2       ;keybd handler.
0980     *=  $02E0   ;DOS RUN address
0990     .WORD START
1000     .END 


Back to previous page