mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-26 13:49:21 +00:00
23 lines
636 B
Plaintext
23 lines
636 B
Plaintext
;Joystick Assembly Language Module for Atari 400 & 800
|
|
|
|
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 #$01 ;Invert Joystick Number
|
|
TAX ;and Copy to X Register
|
|
LDA $DC00,X ;Read Joystick
|
|
EOR #$FF ;Invert and
|
|
AND #$1F ;Mask Bits
|
|
RTS
|
|
JOYSTZ: LDA #$FF ;Return Error
|
|
RTS
|