Classic Computer Magazine Archive PROGRAM LISTING: 86-05/KEYJOY.M65


0100 ;KEYJOY.M65
0110 ;BY TED STOCKWELL
0120 ;MODIFIED BY PATRICK BASS
0130 ;(c) 1986, ANTIC PUBLISHING
0140 ; V. 010786
0150     .SET 1,20
0160     .TAB 8,12,30
0170 TOTALCODE = ENDCODE-STARTCODE
0180     .OPT NO LIST
0190 ;---------------------------
0200 ;
0210 STARTCODE = $0110
0220 SETVBV = $E45C  ;Set Vector.
0230 SYSVBV = $E45F  ;Do VBlank.
0240 VBSETCODE = 6
0250 STICK0 = $0278  ;Stick shadow.
0260 SPEED = $00     ;Repeat Speed.
0270 CH  =   $02FC
0280 CUR.UP = 142    ;Cursor Values.
0290 CUR.DOWN = 143
0300 CUR.LEFT = 134
0310 CUR.RIGHT = 135
0320 ;
0330 ;---------------------------
0340     *=  STARTCODE
0350 ;
0360 ;To activate, point the VBlank                vector to our routine.
0370 INSTALL
0380     PLA 
0390     LDY # <MAIN
0400     LDX # >MAIN
0410     LDA #VBSETCODE
0420     JSR SETVBV
0430     RTS 
0440 ;
0450 ;------------------------
0460 ;Now every vertical blank                   sends us here first.
0470 MAIN
0480     DEC COUNT   ;Bump down.
0490     BNE DONE    ;Branch out if                         timer still on.
0500     LDA SPEED   ;Else refresh
0510     STA COUNT   ;delay counter.
0520 ;
0530     LDA STICK0  ;Get stick val
0540     EOR #$0F    ;Invert it.
0550     BEQ DONE    ;If 0, no press.
0560 ;
0570     LDX #$FF    ;Otherwise reset                       key selector.
0580 MLOOP
0590     INX         ;point to next                        ;key selection.
0600     LSR A       ;Check for bit.
0610     BCC MLOOP   ;Branch if no                          bit available.
0620     LDA KEYS,X  ;Else grab Key
0630     STA CH      ;Store in shadow
0640 DONE
0650     JMP SYSVBV  ;Do rest of                            Vertical Blank.
0660 ;
0670 ;-----------------------------
0680 KEYS
0690     .BYTE CUR.UP,CUR.DOWN
0700     .BYTE CUR.LEFT,CUR.RIGHT
0710 ;
0720 COUNT
0730     .BYTE 5
0740 ;
0750 ENDCODE
0760     .END 

Back to previous page