3 ; Standard joystick driver for the PCEngine
5 ; Ullrich von Bassewitz, 2002-12-20
8 ;;.include "zeropage.inc"
10 ;;.include "joy-kernel.inc"
12 ;;.include "joy-error.inc"
14 .include "pcengine.inc"
18 ; ------------------------------------------------------------------------
19 ; Header. Includes jump table
25 ;; .byte $6A, $6F, $79 ; "joy"
26 ;; .byte $00 ; Driver API version number
28 ; Button state masks (8 values)
30 ;extern const unsigned char joy_masks[8];
39 .byte $04 ; ? JOY_FIRE
40 .byte $02 ; ? Future expansion
41 .byte $01 ; ? Future expansion
42 .byte $08 ; ? Future expansion
51 ; ------------------------------------------------------------------------
54 JOY_COUNT = 4 ; Number of joysticks we support
57 ; ------------------------------------------------------------------------
64 ;extern const char joy_stddrv[];
71 .export _joy_load_driver
74 ;unsigned char __fastcall__ joy_unload (void);
75 ;unsigned char __fastcall__ joy_load_driver (const char* driver);
79 ; ------------------------------------------------------------------------
80 ; INSTALL routine. Is called after the driver is loaded into memory. If
81 ; possible, check if the hardware is present and determine the amount of
83 ; Must return an JOY_ERR_xx code in a/x.
90 ; rts ; Run into DEINSTALL instead
92 ; ------------------------------------------------------------------------
93 ; DEINSTALL routine. Is called before the driver is removed from memory.
94 ; Can do cleanup or whatever. Must not return anything.
101 ; ------------------------------------------------------------------------
102 ; COUNT: Return the total number of available joysticks in a/x.
104 ;unsigned char __fastcall__ joy_count (void);
114 ; ------------------------------------------------------------------------
115 ; READ: Read a particular joystick passed in A.
117 ;unsigned char __fastcall__ joy_read (unsigned char joystick);
126 tax ; Joystick number into X
128 ; return value from buffer
138 ; reset multitap counter
167 sta padbuffer, y ; store new value
177 ora padbuffer, y ; second half of new value
180 sta padbuffer, y ; store new value