added joystick support to MEGA65 keyboard scanner
This commit is contained in:
1 parent
05f57201ba
commit
5c8ac04083
4 files changed
+73
-7
No files matched your search
@@ -13,4 +13,5 @@
|
|||||||
|
|
||||||
;; #ALIAS# kb_matrix_alwaysrepeat = KERNAL_0.kb_matrix_alwaysrepeat
|
;; #ALIAS# kb_matrix_alwaysrepeat = KERNAL_0.kb_matrix_alwaysrepeat
|
||||||
;; #ALIAS# __kb_matrix_alwaysrepeat_end = KERNAL_0.__kb_matrix_alwaysrepeat_end
|
;; #ALIAS# __kb_matrix_alwaysrepeat_end = KERNAL_0.__kb_matrix_alwaysrepeat_end
|
||||||
|
;; #ALIAS# kb_matrix_joy_status = KERNAL_0.kb_matrix_joy_status
|
||||||
|
;; #ALIAS# kb_matrix_joy_keytab_idx = KERNAL_0.kb_matrix_joy_status
|
||||||
@@ -259,7 +259,7 @@ scnkey_joystick_1:
|
|||||||
|
|
||||||
scnkey_joystick_filtered:
|
scnkey_joystick_filtered:
|
||||||
|
|
||||||
; Set appropriate keyboard matrix and key code for joystick event
|
; Decode joystick event using appropriate matrix
|
||||||
|
|
||||||
ldy #$03
|
ldy #$03
|
||||||
@5:
|
@5:
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
;; #LAYOUT# M65 KERNAL_C #TAKE
|
||||||
|
;; #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
;
|
||||||
|
; Matrix for retrieving C64 joystick status and inject is as keyboard event
|
||||||
|
;
|
||||||
|
|
||||||
|
!ifndef CONFIG_JOY1_OR_JOY2_CURSOR {
|
||||||
|
|
||||||
|
kb_matrix_joy_status:
|
||||||
|
|
||||||
|
!byte %00001110 ; up
|
||||||
|
!byte %00001101 ; down
|
||||||
|
!byte %00001011 ; left
|
||||||
|
!byte %00000111 ; right
|
||||||
|
|
||||||
|
kb_matrix_joy_keytab_idx:
|
||||||
|
|
||||||
|
!byte $07 ; up
|
||||||
|
!byte $07 ; down
|
||||||
|
!byte $02 ; left
|
||||||
|
!byte $02 ; right
|
||||||
|
}
|
||||||
|
|
||||||
|
kb_matrix_joy_keytab_lo:
|
||||||
|
|
||||||
|
!byte <__kb_matrix_shift ; up
|
||||||
|
!byte <__kb_matrix_normal ; down
|
||||||
|
!byte <__kb_matrix_shift ; left
|
||||||
|
!byte <__kb_matrix_normal ; right
|
||||||
|
|
||||||
|
kb_matrix_joy_keytab_hi:
|
||||||
|
|
||||||
|
!byte >__kb_matrix_shift ; up
|
||||||
|
!byte >__kb_matrix_normal ; down
|
||||||
|
!byte >__kb_matrix_shift ; left
|
||||||
|
!byte >__kb_matrix_normal ; right
|
||||||
@@ -192,18 +192,46 @@ m65_scnkey_try_joystick:
|
|||||||
|
|
||||||
m65_scnkey_try_joy1:
|
m65_scnkey_try_joy1:
|
||||||
|
|
||||||
+nop
|
lda #$FF
|
||||||
; XXX provide implementation
|
sta CIA1_PRA ; disconnect all the rows to prevent keyboard interference
|
||||||
|
|
||||||
|
lda CIA1_PRB
|
||||||
|
bra m65_scnkey_try_joy_common
|
||||||
|
|
||||||
m65_scnkey_try_joy2:
|
m65_scnkey_try_joy2:
|
||||||
|
|
||||||
+nop
|
lda CIA1_PRA
|
||||||
; XXX provide implementation
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
m65_scnkey_try_joy_common:
|
m65_scnkey_try_joy_common:
|
||||||
|
|
||||||
; XXX provide implementation
|
and #%00001111 ; filter out anything but joystick movement
|
||||||
|
beq m65_scnkey_no_keys ; branch if no joystick movement detected
|
||||||
|
|
||||||
|
; Decode joystick event using appropriate matrix
|
||||||
|
|
||||||
|
ldy #$03
|
||||||
|
@1:
|
||||||
|
cmp kb_matrix_joy_status, y
|
||||||
|
beq @2
|
||||||
|
dey
|
||||||
|
bpl @1
|
||||||
|
|
||||||
|
; Not found
|
||||||
|
|
||||||
bra m65_scnkey_no_keys
|
bra m65_scnkey_no_keys
|
||||||
|
@2:
|
||||||
|
; Found joystick movement
|
||||||
|
|
||||||
|
lda kb_matrix_joy_keytab_lo, y
|
||||||
|
sta KEYTAB+0
|
||||||
|
lda kb_matrix_joy_keytab_hi, y
|
||||||
|
sta KEYTAB+1
|
||||||
|
lda kb_matrix_joy_keytab_idx, y
|
||||||
|
tay
|
||||||
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
m65_scnkey_got_key: ; .Y should now contain the key offset in matrix pointed by KEYTAB
|
m65_scnkey_got_key: ; .Y should now contain the key offset in matrix pointed by KEYTAB
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user