1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-22 16:34:15 +00:00
C02/include/c64/joystk.a02

23 lines
633 B
Plaintext
Raw Normal View History

;Joystick Assembly Language Module for C64
JYSTKS EQU $02 ;Number of Joysticks
;Joystick Bit Masks
JOYUP EQU $01 ;Bit 0 - Up
JOYDN EQU $02 ;Bit 1 - Down
JOYLF EQU $04 ;Bit 2 - Left
JOYRT EQU $08 ;Bit 3 - Right
JOYB0 EQU $10 ;Bit 4 - Button
;Read Joystick
JOYSTK: CMP #JYSTKS ;If Invalid Joystick#
BCS JOYSTZ ; Return Error
EOR #1 ;Invert Joystick #
2018-11-07 05:11:09 +00:00
TAX ;Copy Joystick # to X
LDA $DC00,X ;Read Joystick Shadow Register
EOR #$FF ;Invert and
AND #$1F ;Mask Bits
JOYSTX: RTS
JOYSTZ: LDA #$FF ;Return Error
RTS