mirror of
https://github.com/cc65/cc65.git
synced 2024-06-07 23:29:39 +00:00
Reflect that the Apple //c supports only one joystick.
This commit is contained in:
parent
15e2afcdf3
commit
7b2e4d0c7f
|
@ -44,25 +44,37 @@ PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y
|
||||||
|
|
||||||
; Library reference
|
; Library reference
|
||||||
|
|
||||||
.addr $0000
|
libref: .addr $0000
|
||||||
|
|
||||||
; Jump table
|
; Jump table
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
.addr UNINSTALL
|
.addr UNINSTALL
|
||||||
.addr COUNT
|
.addr COUNT
|
||||||
.addr READJOY
|
.addr READ
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
.code
|
.data
|
||||||
|
|
||||||
|
maxnum: .byte $00 ; Maximum joystick number (0 or 1)
|
||||||
|
|
||||||
; INSTALL routine. Is called after the driver is loaded into memory. If
|
; INSTALL routine. Is called after the driver is loaded into memory. If
|
||||||
; possible, check if the hardware is present and determine the amount of
|
; possible, check if the hardware is present and determine the amount of
|
||||||
; memory available.
|
; memory available.
|
||||||
; Must return an JOY_ERR_xx code in a/x.
|
; Must return an JOY_ERR_xx code in a/x.
|
||||||
INSTALL:
|
INSTALL:
|
||||||
lda #<JOY_ERR_OK
|
lda libref
|
||||||
|
ldx libref+1
|
||||||
|
sta ostype+1
|
||||||
|
stx ostype+2
|
||||||
|
ostype: jsr $0000
|
||||||
|
and #$F0 ; Mask variants
|
||||||
|
cmp #$50 ; Any Apple //c
|
||||||
|
beq :+ ; Only one joystick
|
||||||
|
inc maxnum
|
||||||
|
|
||||||
|
: lda #<JOY_ERR_OK
|
||||||
ldx #>JOY_ERR_OK
|
ldx #>JOY_ERR_OK
|
||||||
; Fall through
|
; Fall through
|
||||||
|
|
||||||
|
@ -71,16 +83,22 @@ INSTALL:
|
||||||
UNINSTALL:
|
UNINSTALL:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
; COUNT: Return the total number of available joysticks in a/x.
|
; COUNT: Return the total number of available joysticks in a/x.
|
||||||
COUNT:
|
COUNT:
|
||||||
lda #$02 ; Number of joysticks we support
|
ldx maxnum
|
||||||
|
inx
|
||||||
|
txa ; Number of joysticks we support
|
||||||
ldx #$00
|
ldx #$00
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; READ: Read a particular joystick passed in A.
|
; READ: Read a particular joystick passed in A.
|
||||||
READJOY:
|
READ:
|
||||||
bit $C082 ; Switch in ROM
|
bit $C082 ; Switch in ROM
|
||||||
and #$01 ; Restrict joystick number
|
and maxnum ; Restrict joystick number
|
||||||
|
|
||||||
; Read horizontal paddle
|
; Read horizontal paddle
|
||||||
asl ; Joystick number -> paddle number
|
asl ; Joystick number -> paddle number
|
||||||
|
|
8
libsrc/apple2/joyref.s
Normal file
8
libsrc/apple2/joyref.s
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
;
|
||||||
|
; Oliver Schmidt, 2020-06-04
|
||||||
|
;
|
||||||
|
|
||||||
|
.export joy_libref
|
||||||
|
.import _get_ostype
|
||||||
|
|
||||||
|
joy_libref := _get_ostype
|
|
@ -2,11 +2,10 @@
|
||||||
; Oliver Schmidt, 2013-05-31
|
; Oliver Schmidt, 2013-05-31
|
||||||
;
|
;
|
||||||
|
|
||||||
.export em_libref, joy_libref, mouse_libref, ser_libref, tgi_libref
|
.export em_libref, mouse_libref, ser_libref, tgi_libref
|
||||||
.import _exit
|
.import _exit
|
||||||
|
|
||||||
em_libref := _exit
|
em_libref := _exit
|
||||||
joy_libref := _exit
|
|
||||||
mouse_libref := _exit
|
mouse_libref := _exit
|
||||||
ser_libref := _exit
|
ser_libref := _exit
|
||||||
tgi_libref := _exit
|
tgi_libref := _exit
|
||||||
|
|
Loading…
Reference in New Issue
Block a user