Skip to content

joystick_get driver documentation error? #122

@jimmyor

Description

@jimmyor

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).

;---------------------------------------------------------------
; joystick_get
;
; 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions