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
40 ; ------------------------------------------------------------------------
43 JOY_COUNT = 1 ; Number of joysticks we support
46 ; ------------------------------------------------------------------------
55 ; <B>utton '5' or ENTER key
95 ; ------------------------------------------------------------------------
96 ; INSTALL routine. Is called after the driver is loaded into memory. If
97 ; possible, check if the hardware is present and determine the amount of
99 ; Must return an JOY_ERR_xx code in a/x.
103 lda #JOY_ERR_OK ; Assume we have a joystick
104 ldx VIC_CLK_128 ; Test for a C128
106 bne @C128 ; Jump if we have one
107 lda #JOY_ERR_NO_DEVICE ; No C128 -> no numpad
108 @C128: ldx #0 ; Set high byte
110 ; rts ; Run into UNINSTALL instead
112 ; ------------------------------------------------------------------------
113 ; UNINSTALL routine. Is called before the driver is removed from memory.
114 ; Can do cleanup or whatever. Must not return anything.
121 ; ------------------------------------------------------------------------
122 ; COUNT: Return the total number of available joysticks in a/x.
125 COUNT: lda #JOY_COUNT
129 ; ------------------------------------------------------------------------
130 ; READ: Read a particular joystick passed in A.
133 READ: tax ; Clear high byte
134 lda #$FD ; For ENTER and '6'
135 ldy #$FE ; For '8', '5', '2', '4'
146 sty VIC_KBD_128 ; Reset to $FF
152 lda masktable,y ; Convert LDRBU to BRLDU