3 ; Standard joystick driver for the PCEngine
6 .include "joy-kernel.inc"
7 .include "joy-error.inc"
12 ; ------------------------------------------------------------------------
13 ; Header. Includes jump table
15 module_header _pce_stdjoy_joy
19 .byte $6A, $6F, $79 ; "joy"
20 .byte JOY_API_VERSION ; Driver API version number
26 ; Button state masks (8 values)
32 .byte $01 ; JOY_FIRE_A
33 .byte $02 ; JOY_FIRE_B
34 .byte $04 ; JOY_SELECT
43 .addr 0 ; IRQ entry unused
45 ; ------------------------------------------------------------------------
48 JOY_COUNT = 4 ; Number of joysticks we support
53 ; ------------------------------------------------------------------------
54 ; INSTALL routine. Is called after the driver is loaded into memory. If
55 ; possible, check if the hardware is present and determine the amount of
57 ; Must return an JOY_ERR_xx code in a/x.
64 ; rts ; Run into DEINSTALL instead
66 ; ------------------------------------------------------------------------
67 ; DEINSTALL routine. Is called before the driver is removed from memory.
68 ; Can do cleanup or whatever. Must not return anything.
75 ; ------------------------------------------------------------------------
76 ; COUNT: Return the total number of available joysticks in a/x.
78 ;unsigned char __fastcall__ joy_count (void);
85 ; ------------------------------------------------------------------------
86 ; READ: Read a particular joystick passed in A.
88 ;unsigned char __fastcall__ joy_read (unsigned char joystick);
94 tax ; Joystick number into X
96 ; return value from buffer
104 ; reset multitap counter
133 sta padbuffer, y ; store new value
143 ora padbuffer, y ; second half of new value
146 sta padbuffer, y ; store new value