From 3b69cd398b585c86240b1055ec79ff41df7e616c Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 14 Oct 2019 22:28:46 +0200 Subject: [PATCH] SCNKEY can now use joystick port 2 too --- c64/kernal/keyboard/scnkey.s | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index cbe99753..5199427b 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -22,8 +22,7 @@ // XXX add Commodore 128 keyboard support -// XXX add Commodore 65 keybopard support -// XXX fix support for joystick port 2 to move cursor keys +// XXX add Commodore 65 keyboard support #if !CONFIG_SCNKEY_TWW_CTR @@ -45,12 +44,16 @@ SCNKEY: // Check for any activity - lda #$00 - sta CIA1_PRA // connect all the rows - ldx #$FF +#if !CONFIG_JOY2_CURSOR + + ldx #$00 + stx CIA1_PRA // connect all the rows + dex // puts $FF cpx CIA1_PRB beq scnkey_no_keys +#endif + // Retrieve SHIFT / VENDOR / CTRL status // Use .X to detect 2 or more keys pressed (should be $FF now) ldy #$03 @@ -73,7 +76,7 @@ scnkey_bucky_loop: #if CONFIG_JOY2_CURSOR - // XXX why this does not work + // XXX why this does not work ??? // Check for control port 2 activity @@ -82,7 +85,7 @@ scnkey_bucky_loop: lda CIA1_PRA // read the joystick 2 status - ldx #$FF + dex // puts $FF stx CIA1_DDRA // set port back to output and #%00001111 // filter out anything but joystick movement @@ -90,6 +93,12 @@ scnkey_bucky_loop: bne scnkey_joystick_filtered + inx // puts $00 + stx CIA1_PRA // connect all the rows + dex // puts $FF + cpx CIA1_PRB + beq scnkey_no_keys + #endif // Check for control port 1 activity (can interfere with keyboard)