In the documentation for the X16 driver for the joystick, the comment block for joystick_get refers to passing 0-3 in A. Sending A with a 0 seems to correspond to providing the "keyboard SNES controller" output, and presumably 1-4 provide output for joysticks 1-4 if they are attached to the hardware. Should the comment block say 0-4 and clarify that 0 is keyboard? (The actual code below the comment block seems to match what I say above).
;---------------------------------------------------------------
; joystickget
;
; Function: Return the state of a given joystick.
;
; Pass: a number of joystick (0-3) <---this is what I'm referring to_
; Return: a byte 0: | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
; SNES | B | Y |SEL|STA|UP |DN |LT |RT |
;
; x byte 1: | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
; SNES | A | X | L | R | 1 | 1 | 1 | 1 |
; y byte 2:
; $00 = joystick present
; $FF = joystick not present
;
; Note: * Presence can be detected by checking byte 2.
;---------------------------------------------------------------
joystick_get:
KVARS_START_TRASH_X_NZ
tax
beq @0 ; -> joy0
dex
beq @1 ; -> joy1
dex
beq @2 ; -> joy2
dex
beq @3 ; -> joy3
dex
beq @4 ; -> joy4
lda #$ff
tax
tay
bra @5
In the documentation for the X16 driver for the joystick, the comment block for joystick_get refers to passing 0-3 in A. Sending A with a 0 seems to correspond to providing the "keyboard SNES controller" output, and presumably 1-4 provide output for joysticks 1-4 if they are attached to the hardware. Should the comment block say 0-4 and clarify that 0 is keyboard? (The actual code below the comment block seems to match what I say above).
;--------------------------------------------------------------- ; joystickget ; ; Function: Return the state of a given joystick. ; ; Pass: a number of joystick (0-3) <---this is what I'm referring to_ ; Return: a byte 0: | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ; SNES | B | Y |SEL|STA|UP |DN |LT |RT | ; ; x byte 1: | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ; SNES | A | X | L | R | 1 | 1 | 1 | 1 | ; y byte 2: ; $00 = joystick present ; $FF = joystick not present ; ; Note: * Presence can be detected by checking byte 2. ;--------------------------------------------------------------- joystick_get: KVARS_START_TRASH_X_NZ tax beq @0 ; -> joy0 dex beq @1 ; -> joy1 dex beq @2 ; -> joy2 dex beq @3 ; -> joy3 dex beq @4 ; -> joy4 lda #$ff tax tay bra @5