Classic Computer Magazine Archive PROGRAM LISTING: 88-01/SSIJOY8.M65


0100 ; SSI JOYSTICK DRIVER (8-WAY)
0110 ; BY RICH MOORE
0120 ; (c)1987, ANTIC PUBLISHING
0130 ;
0140 ;Uses deferred Vertical Blank to
0150 ;enter a keycode based on the
0160 ;deflection of the joystick and
0170 ;whether the trigger is pressed.
0180 ;
0190 ;Replaces "XRENAME" in DOS 2.0
0200 ;
0210 ; System equates
0220 ;
0230 SETVBV = 58460
0240 XITVBV = 58466
0250 STICK0 = 632
0260 STRIG0 = 644
0270 INITAD = 738
0280 CH  =   764
0290 ;
0300 ; DOS 2.0 equates
0310 XRENAME = $0BD9 ; Start of
0320 ;                  "XRENAME"
0330 ERDVDC = $12BF  ;Command error
0340 ;                  routine
0350     *=  XRENAME
0360 ;
0370     JMP ERDVDC  ;Jump to error
0380 ;               ;routine if
0390 ;                XRENAME called
0400 ;                by CIO or DOS
0410 ;
0420 INSTALL ;       Link joystick
0430     LDY # <VBD  ;into the deffrd
0440     LDX # >VBD  ;Vertical Blank
0450     LDA #7
0460     JMP SETVBV
0470 ;
0480 VBD
0490     LDA STICK0
0500     AND #15     ;Mask-out upper
0510 ;                four bits,
0520     CMP #15     ;exit if stick
0530 ;                is centered.
0540     BEQ DONE
0550 ;
0560     LDX STRIG0  ;If pressed,
0570     BEQ D0      ;check diagonal.
0580 ;
0590     LDX #3      ;Check for
0600 L1  ;           Cardinal (NESW)
0610     LDY KEY1,X  ;direction.
0620     CMP CARD,X
0630     BEQ DELAY
0640 ;
0650     DEX 
0660     BPL L1
0670     BMI DONE    ;Exit if no match
0680 ;
0690 D0  ;           Check for
0700     LDX #3      ;diagonals
0710 D1
0720     LDY KEY2,X
0730     CMP DIAG,X
0740     BEQ DELAY
0750     DEX 
0760     BPL D1
0770     BMI DONE
0780 ;
0790 DELAY
0800     DEC TIMER
0810     BPL DONE
0820     LDX #3
0830     STX TIMER
0840 ;
0850 PRESS
0860     STY CH      ;Enter the code
0870 DONE
0880     JMP XITVBV  ;and exit.
0890 ;
0900 TIMER
0910     .BYTE 3
0920 ;
0930 KEY1
0940     .BYTE 31    ;"1"
0950     .BYTE 26    ;"3"
0960     .BYTE 29    ;"5"
0970     .BYTE 51    ;"7"
0980 CARD
0990     .BYTE 14    ;NORTH
1000     .BYTE 7     ;EAST
1010     .BYTE 13    ;SOUTH
1020     .BYTE 11    ;WEST
1030 ;
1040 KEY2
1050     .BYTE 30    ;"2"
1060     .BYTE 24    ;"4"
1070     .BYTE 27    ;"6"
1080     .BYTE 53    ;"8"
1090 DIAG
1100     .BYTE 6     ;NE
1110     .BYTE 5     ;SE
1120     .BYTE 9     ;SW
1130     .BYTE 10    ;NW
1140 ;
1150 ;
1160     *=  INITAD  ;Execute as soon
1170 ;                as segment
1180 ;                is loaded so
1190     .WORD INSTALL ; it can be
1200 ;               ;the first part
1210 ;               ; of an
1220 ;               AUTORUN.SYS file
1230     .END 

Back to previous page