2 ; Standard joystick driver for the Plus/4 and C16.
3 ; May be used multiple times when linked statically to an application.
5 ; 2002-12-21, Ullrich von Bassewitz
6 ; 2016-06-18, Greg King
9 .include "joy-kernel.inc"
10 .include "joy-error.inc"
16 ; ------------------------------------------------------------------------
17 ; Header. Includes jump table
19 .if .xmatch ("MODULE_LABEL", .string(MODULE_LABEL))
20 module_header _plus4_stdjoy_joy
22 module_header MODULE_LABEL
27 .byte $6A, $6F, $79 ; ASCII "joy"
28 .byte JOY_API_VERSION ; Driver API version number
40 .addr 0 ; IRQ entry unused
42 ; ------------------------------------------------------------------------
45 JOY_COUNT = 2 ; Number of joysticks we support
48 ; ------------------------------------------------------------------------
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.
64 ; rts ; Run into UNINSTALL instead
66 ; ------------------------------------------------------------------------
67 ; UNINSTALL routine. Is called before the driver is removed from memory.
68 ; Can do cleanup or whatever. Must not return anything.
75 ; ------------------------------------------------------------------------
76 ; COUNT: Return the total number of available joysticks in a/x.
84 ; ------------------------------------------------------------------------
85 ; READ: Read a particular joystick passed in A.
88 READ: ldy #%11111011 ; Load index for joystick #1
89 tax ; Test joystick number
91 ldy #%11111101 ; Load index for joystick #2
92 ldx #>$0000 ; (Return unsigned int)
94 sty TED_KBD ; Read a joystick ...
95 lda TED_KBD ; ... and some keys -- it's unavoidable
99 ; The push buttons are in bits 6 and 7. Both of them cannot be %1 together.
100 ; Therefore, bit 6 can be merged with bit 7.