mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-13 22:30:49 +00:00
joystick: test actually works
not sure how we're going to make it fit 3f9-438 = 3F = 63 644-671 = 30 = 48 ===== 111 bytes
This commit is contained in:
parent
adab361181
commit
8b73c22efc
@ -12,6 +12,7 @@ UPPER_THRESHOLD = 128
|
||||
PADDL1 = $C065
|
||||
|
||||
handle_joystick:
|
||||
lda #0
|
||||
|
||||
; Read both paddles simultaneously
|
||||
asl ; Joystick number -> paddle number
|
||||
@ -38,6 +39,8 @@ nop1: ; - -
|
||||
cpy #UPPER_THRESHOLD+1
|
||||
bne loop
|
||||
|
||||
rts
|
||||
|
||||
value0: .byte $00
|
||||
value1: .byte $00
|
||||
|
||||
|
@ -1,9 +1,61 @@
|
||||
JS_BUTTON_STATE = $01
|
||||
|
||||
;==============================
|
||||
; Handle Keypress
|
||||
;==============================
|
||||
handle_keypress:
|
||||
|
||||
|
||||
handle_joystick_first:
|
||||
|
||||
check_button:
|
||||
lda PADDLE_BUTTON0
|
||||
bpl button_clear
|
||||
|
||||
lda JS_BUTTON_STATE
|
||||
bne js_check
|
||||
|
||||
lda #1
|
||||
sta JS_BUTTON_STATE
|
||||
lda #' '
|
||||
jmp check_sound
|
||||
|
||||
button_clear:
|
||||
lda #0
|
||||
sta JS_BUTTON_STATE
|
||||
|
||||
js_check:
|
||||
jsr handle_joystick
|
||||
|
||||
js_check_left:
|
||||
lda value0
|
||||
cmp #$20
|
||||
bcs js_check_right ; if less than 32, left
|
||||
lda #'A'
|
||||
bne check_sound
|
||||
|
||||
js_check_right:
|
||||
cmp #$40
|
||||
bcc js_check_up
|
||||
lda #'D'
|
||||
bne check_sound
|
||||
|
||||
js_check_up:
|
||||
lda value1
|
||||
cmp #$20
|
||||
bcs js_check_down
|
||||
lda #'W'
|
||||
bne check_sound
|
||||
|
||||
js_check_down:
|
||||
cmp #$40
|
||||
bcc done_joystick
|
||||
lda #'S'
|
||||
bne check_sound
|
||||
|
||||
|
||||
done_joystick:
|
||||
|
||||
lda KEYPRESS
|
||||
bmi keypress
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user