2 ; Joystick driver using C128 number pad in 64 mode.
3 ; May be used multiple times when linked to the statically application.
5 ; Stefan Haubenthal, 2004-01-26
6 ; Based on Ullrich von Bassewitz, 2002-12-20
9 .include "zeropage.inc"
11 .include "joy-kernel.inc"
12 .include "joy-error.inc"
19 ; ------------------------------------------------------------------------
20 ; Header. Includes jump table
22 module_header _c64_numpad_joy
26 .byte $6A, $6F, $79 ; "joy"
27 .byte JOY_API_VERSION ; Driver API version number
39 .addr 0 ; IRQ entry unused
41 ; ------------------------------------------------------------------------
44 JOY_COUNT = 1 ; Number of joysticks we support
47 ; ------------------------------------------------------------------------
56 ; <B>utton '5' or ENTER key
96 ; ------------------------------------------------------------------------
97 ; INSTALL routine. Is called after the driver is loaded into memory. If
98 ; possible, check if the hardware is present and determine the amount of
100 ; Must return an JOY_ERR_xx code in a/x.
104 lda #JOY_ERR_OK ; Assume we have a joystick
105 ldx VIC_CLK_128 ; Test for a C128
107 bne @C128 ; Jump if we have one
108 lda #JOY_ERR_NO_DEVICE ; No C128 -> no numpad
109 @C128: ldx #0 ; Set high byte
111 ; rts ; Run into UNINSTALL instead
113 ; ------------------------------------------------------------------------
114 ; UNINSTALL routine. Is called before the driver is removed from memory.
115 ; Can do cleanup or whatever. Must not return anything.
122 ; ------------------------------------------------------------------------
123 ; COUNT: Return the total number of available joysticks in a/x.
126 COUNT: lda #JOY_COUNT
130 ; ------------------------------------------------------------------------
131 ; READ: Read a particular joystick passed in A.
134 READ: tax ; Clear high byte
135 lda #$FD ; For ENTER and '6'
136 ldy #$FE ; For '8', '5', '2', '4'
147 sty VIC_KBD_128 ; Reset to $FF
153 lda masktable,y ; Convert LDRBU to BRLDU