3 ; Standard joystick driver for the PCEngine
6 .include "joy-kernel.inc"
7 .include "joy-error.inc"
13 ; ------------------------------------------------------------------------
14 ; Header. Includes jump table
16 module_header _pce_stdjoy_joy
20 .byte $6A, $6F, $79 ; "joy"
21 .byte JOY_API_VERSION ; Driver API version number
27 ; Button state masks (8 values)
33 .byte $01 ; JOY_FIRE_A
34 .byte $02 ; JOY_FIRE_B
35 .byte $04 ; JOY_SELECT
44 .addr 0 ; IRQ entry unused
46 ; ------------------------------------------------------------------------
49 JOY_COUNT = 4 ; Number of joysticks we support
54 ; ------------------------------------------------------------------------
55 ; INSTALL routine. Is called after the driver is loaded into memory. If
56 ; possible, check if the hardware is present and determine the amount of
58 ; Must return an JOY_ERR_xx code in a/x.
65 ; rts ; Run into UNINSTALL instead
67 ; ------------------------------------------------------------------------
68 ; DEINSTALL routine. Is called before the driver is removed from memory.
69 ; Can do cleanup or whatever. Must not return anything.
76 ; ------------------------------------------------------------------------
77 ; COUNT: Return the total number of available joysticks in a/x.
79 ;unsigned char __fastcall__ joy_count (void);
86 ; ------------------------------------------------------------------------
87 ; READ: Read a particular joystick passed in A.
89 ;unsigned char __fastcall__ joy_read (unsigned char joystick);
95 tax ; Joystick number into X
97 ; return value from buffer
105 ; reset multitap counter
123 sta JOY_CTRL ; sel = 1
126 nop ; some delay is required
134 sta padbuffer, y ; store new value
140 nop ; some delay is required
145 ora padbuffer, y ; second half of new value
148 sta padbuffer, y ; store new value