1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-22 01:31:33 +00:00

Tested and debugged joystk module for C64

This commit is contained in:
Curtis F Kaylor 2019-11-15 13:38:08 -05:00
parent 508533b148
commit 3154b80ae4

View File

@ -1,6 +1,6 @@
;Joystick Assembly Language Module for C64 ;Joystick Assembly Language Module for C64
JYSTKS EQU $04 ;Number of Joysticks JYSTKS EQU $02 ;Number of Joysticks
;Joystick Bit Masks ;Joystick Bit Masks
JOYUP EQU $01 ;Bit 0 - Up JOYUP EQU $01 ;Bit 0 - Up
@ -12,14 +12,11 @@ JOYB0 EQU $10 ;Bit 4 - Button
;Read Joystick ;Read Joystick
JOYSTK: CMP #JYSTKS ;If Invalid Joystick# JOYSTK: CMP #JYSTKS ;If Invalid Joystick#
BCS JOYSTZ ; Return Error BCS JOYSTZ ; Return Error
EOR #1 ;Invert Joystick #
TAX ;Copy Joystick # to X TAX ;Copy Joystick # to X
LDA $0284,X ;Read Trigger Control Register
ROR ;Move Bit 0 into Carry
LDA $DC00,X ;Read Joystick Shadow Register LDA $DC00,X ;Read Joystick Shadow Register
EOR #$FF ;Invert and EOR #$FF ;Invert and
AND #$0F ;Mask Bits AND #$1F ;Mask Bits
BCS JOYSTX ;If Trigger Pressed JOYSTX: RTS
ORA #$10 ; Set Bit 4
HOYSTX: RTS
JOYSTZ: LDA #$FF ;Return Error JOYSTZ: LDA #$FF ;Return Error
RTS RTS