Classic Computer Magazine Archive PROGRAM LISTING: 82-04/KEYMASK.SRC


;;;    .TITLE"KEY MASK 1.0"
;********************************
;***        KEY MASK 1.0      ***
;***(c) 1982 by, Matt Loveless***
;***  written especially for  ***
;***      ANTIC magazine      ***
;********************************
;
;*** EQUATES ***
;
KBCODE EQU  $D209     ; Key board code
VKEYBD EQU  $0208     ; Keyboard IRQ ve
TABLE  EQU  $CB       ; Free zero Page locations
;
;=========================================================
;  INIT ROUTINE:  Puts my keyboard handler online
;=========================================================
       ORG  $0600     ; Page 6
BEGIN  SEI            ; Disable IRQ's
       LDA  VKEYBD    ; Point the keyboard vector to my
       STA  JMPLOC+1  ; routine, and set my routine's JMP
       LDA  VKEYBD+1  ; instruction to point to the OS's
       STA  JMPLOC+2  ; routine
       LDA  #>MYRTN   ; Lo byte of my routine
       STA  VKEYBD
       LDA  #<MYRTN   ; Hi byte of my routine
       STA  VKEYBD+1
       PLA            ; Remove USR amount byte
       PLA            ; Get hi byte of the mask string
       STA  TABLE+1
       PLA            ; Get lo byte
       STA  TABLE
       CLI            ; Re-Enable IRO's !
       RTS            ; Return to BASIC
;=========================================================
;THE NEW KEYBOARD INTERRUPT ROUTINE
;=========================================================
MYRTN  TYA            ; Keyboard IRQ vector points here
       PHA            ; Save Y-register
       LDY  KBCODE    ; Get the key code
       LDA  (TABLE),Y ; and use it to index into the string
       BNE  GONORM    ; Is it masked out?
       PLA            ; YES - then ignore key and
       TAY            ; restore registers
       PLA
       RTI            ; Exit the keyboard interrupt
GONORM PLA            ; Restore Y-register
       TAY
JMPLOC JMP  $0000     ; Go to normal system keyboard routine
;;;    END


Back to previous page