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)
28 ;extern const unsigned char joy_masks[8];
37 .byte $02 ; JOY_FIRE A ; FIXME: is this correct?
38 .byte $01 ; JOY_FIRE B ; FIXME: is this correct?
39 .byte $04 ; JOY_START ; FIXME: is this correct?
40 .byte $08 ; JOY_SELECT ; FIXME: is this correct?
48 .addr 0 ; IRQ entry unused
50 ; ------------------------------------------------------------------------
53 JOY_COUNT = 4 ; Number of joysticks we support
58 ; ------------------------------------------------------------------------
59 ; INSTALL routine. Is called after the driver is loaded into memory. If
60 ; possible, check if the hardware is present and determine the amount of
62 ; Must return an JOY_ERR_xx code in a/x.
69 ; rts ; Run into DEINSTALL instead
71 ; ------------------------------------------------------------------------
72 ; DEINSTALL routine. Is called before the driver is removed from memory.
73 ; Can do cleanup or whatever. Must not return anything.
80 ; ------------------------------------------------------------------------
81 ; COUNT: Return the total number of available joysticks in a/x.
83 ;unsigned char __fastcall__ joy_count (void);
90 ; ------------------------------------------------------------------------
91 ; READ: Read a particular joystick passed in A.
93 ;unsigned char __fastcall__ joy_read (unsigned char joystick);
99 tax ; Joystick number into X
101 ; return value from buffer
109 ; reset multitap counter
138 sta padbuffer, y ; store new value
148 ora padbuffer, y ; second half of new value
151 sta padbuffer, y ; store new value