2004-10-14 16:50:50 +00:00
|
|
|
;
|
|
|
|
; Standard joystick driver for the Atari Lynx.
|
|
|
|
; The Lynx has two fire buttons. So it is not quite "standard".
|
|
|
|
;
|
|
|
|
; Modified by Karri Kaksonen, 2004-09-16
|
|
|
|
; Ullrich von Bassewitz, 2002-12-20
|
|
|
|
; Using code from Steve Schmidtke
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "zeropage.inc"
|
2004-10-14 16:50:50 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "joy-kernel.inc"
|
2004-10-14 16:50:50 +00:00
|
|
|
.include "joy-error.inc"
|
|
|
|
.include "lynx.inc"
|
|
|
|
|
|
|
|
.macpack generic
|
2014-06-04 21:50:18 +00:00
|
|
|
.macpack module
|
2004-10-14 16:50:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
; Header. Includes jump table
|
|
|
|
|
2014-06-04 21:50:18 +00:00
|
|
|
module_header _lynx_stdjoy_joy
|
2004-10-14 16:50:50 +00:00
|
|
|
|
|
|
|
; Driver signature
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.byte $6A, $6F, $79 ; "joy"
|
2004-10-14 16:50:50 +00:00
|
|
|
.byte JOY_API_VERSION ; Driver API version number
|
|
|
|
|
2013-05-31 22:36:08 +00:00
|
|
|
; Library reference
|
|
|
|
|
|
|
|
.addr $0000
|
|
|
|
|
2004-10-14 16:50:50 +00:00
|
|
|
; Jump table.
|
|
|
|
|
2004-11-06 13:51:02 +00:00
|
|
|
.addr INSTALL
|
|
|
|
.addr UNINSTALL
|
|
|
|
.addr COUNT
|
|
|
|
.addr READ
|
2004-10-14 16:50:50 +00:00
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
; Constants
|
|
|
|
|
|
|
|
JOY_COUNT = 1 ; Number of joysticks we support
|
|
|
|
|
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
; Data.
|
|
|
|
|
|
|
|
|
|
|
|
.code
|
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
; INSTALL routine. Is called after the driver is loaded into memory. If
|
|
|
|
; possible, check if the hardware is present and determine the amount of
|
|
|
|
; memory available.
|
|
|
|
; Must return an JOY_ERR_xx code in a/x.
|
|
|
|
;
|
|
|
|
|
|
|
|
INSTALL:
|
2008-04-14 18:56:32 +00:00
|
|
|
lda #<JOY_ERR_OK
|
|
|
|
ldx #>JOY_ERR_OK
|
2013-05-09 11:56:54 +00:00
|
|
|
; rts ; Run into UNINSTALL instead
|
2004-10-14 16:50:50 +00:00
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
|
|
|
; Can do cleanup or whatever. Must not return anything.
|
|
|
|
;
|
|
|
|
|
|
|
|
UNINSTALL:
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
; COUNT: Return the total number of available joysticks in a/x.
|
|
|
|
;
|
|
|
|
|
|
|
|
COUNT:
|
|
|
|
lda #<JOY_COUNT
|
|
|
|
ldx #>JOY_COUNT
|
|
|
|
rts
|
|
|
|
|
|
|
|
; ------------------------------------------------------------------------
|
|
|
|
; READ: Read a particular joystick passed in A.
|
|
|
|
|
|
|
|
READ:
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx #$00 ; Clear high byte
|
2004-10-14 16:50:50 +00:00
|
|
|
lda JOYSTICK ; Read joystick
|
2004-10-14 17:40:09 +00:00
|
|
|
and #$F3 ; Mask relevant keys
|
2004-10-14 16:50:50 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|