2 ; Standard joystick driver for the Atari Lynx.
3 ; The Lynx has two fire buttons. So it is not quite "standard".
5 ; Modified by Karri Kaksonen, 2004-09-16
6 ; Ullrich von Bassewitz, 2002-12-20
7 ; Using code from Steve Schmidtke
10 .include "zeropage.inc"
12 .include "joy-kernel.inc"
13 .include "joy-error.inc"
20 ; ------------------------------------------------------------------------
21 ; Header. Includes jump table
27 .byte $6A, $6F, $79 ; "joy"
28 .byte JOY_API_VERSION ; Driver API version number
30 ; Button state masks (8 values)
48 .addr 0 ; IRQ entry unused
50 ; ------------------------------------------------------------------------
53 JOY_COUNT = 1 ; Number of joysticks we support
56 ; ------------------------------------------------------------------------
62 ; ------------------------------------------------------------------------
63 ; INSTALL routine. Is called after the driver is loaded into memory. If
64 ; possible, check if the hardware is present and determine the amount of
66 ; Must return an JOY_ERR_xx code in a/x.
68 ; Here we also flip the joypad in case the display is flipped.
69 ; This install routine should be called after you send the flip code
70 ; to the display hardware.
73 lda __viddma ; Process flipped displays
77 ; Set joypad for flipped display
87 ; Set joypad for normal display
100 ; rts ; Run into UNINSTALL instead
102 ; ------------------------------------------------------------------------
103 ; UNINSTALL routine. Is called before the driver is removed from memory.
104 ; Can do cleanup or whatever. Must not return anything.
111 ; ------------------------------------------------------------------------
112 ; COUNT: Return the total number of available joysticks in a/x.
120 ; ------------------------------------------------------------------------
121 ; READ: Read a particular joystick passed in A.
124 ldx #$00 ; Clear high byte
125 lda JOYSTICK ; Read joystick
126 and #$F3 ; Mask relevant keys