From 58daf2a553241d7da20898c071b2d46226b6c4fc Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 18 Oct 2019 19:22:21 +0200 Subject: [PATCH] more C128 keyboard support tweaks --- CONFIG.md | 4 ++-- c64/,,config_generic.s | 2 +- c64/aliases/,aliases_config.s | 3 --- c64/kernal/keyboard/scnkey.s | 16 ++++++++++++++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 0817127b..d4c868e4 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -123,9 +123,9 @@ Needs about 130 bytes more space in KERNAL segment. If unsure - disable. ### `CONFIG_KEYBOARD_C128_CAPS_LOCK` -If C128 keyboard support is selected, allows to additionally support it's CAPS LOCK keys. Support is C64-safe (there is a protection against false-positive reading on the C64). +Allows to use CAPS LOCK key on the C128 keyboard, this is independent from `CONFIG_KEYBOARD_C128`. Support is C64-safe (there is a protection against false-positive reading on the C64). -Needs about 47 bytes more space in KERNAL segment. +Needs about 50 bytes more space in KERNAL segment. If unsure - disable. ### `CONFIG_KEY_REPEAT_DEFAULT` diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 5d062164..be1d0ccd 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -50,7 +50,7 @@ // #define CONFIG_LEGACY_SCNKEY #define CONFIG_KEYBOARD_C128 -// #define CONFIG_KEYBOARD_C128_CAPS_LOCK +#define CONFIG_KEYBOARD_C128_CAPS_LOCK // #define CONFIG_KEY_REPEAT_DEFAULT #define CONFIG_KEY_REPEAT_ALWAYS #define CONFIG_KEY_FAST_SCAN diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 0f8c30c0..771b5df1 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -121,9 +121,6 @@ #if CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C128 .error "CONFIG_LEGACY_SCNKEY and CONFIG_KEYBOARD_C128 are mutually exclusive" #endif -#if CONFIG_KEYBOARD_C128_CAPS_LOCK && !CONFIG_KEYBOARD_C128 - .error "CONFIG_KEYBOARD_C128_CAPS_LOCK requires CONFIG_KEYBOARD_C128" -#endif } diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 4c0575ab..e7c4d736 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -58,6 +58,9 @@ SCNKEY: // First check if this is really a C128 - to avoid false positive lda #$00 +#if !CONFIG_KEYBOARD_C128 + tax +#endif sta VIC_XSCAN lda #$FF cmp VIC_XSCAN @@ -71,6 +74,10 @@ SCNKEY: sta SHFLAG !: +#if !CONFIG_KEYBOARD_C128 + stx VIC_XSCAN // disconnect C128 keys if no C128 keyboard is supported +#endif + #endif ldy #(__kb_matrix_bucky_confmask_end - kb_matrix_bucky_confmask - 1) @@ -297,6 +304,8 @@ scnkey_output_key: // !: // lda KEY_TAB_BW // bne scnkey_got_petscii if CAPS LOCK is handled +#endif // CONFIG_KEYBOARD_C128_CAPS_LOCK + #if CONFIG_KEYBOARD_C128_CAPS_LOCK // Check if we need special handling for a CAPS LOCK key @@ -304,7 +313,10 @@ scnkey_output_key: scnkey_handle_caps_lock: - tax +#if !CONFIG_KEYBOARD_C128 + lda (KEYTAB), y +#endif + tax lda SHFLAG and #(%00000111 + KEY_CAPS_LOCK) cmp #KEY_CAPS_LOCK @@ -324,7 +336,7 @@ scnkey_handle_caps_lock: #endif // CONFIG_KEYBOARD_C128_CAPS_LOCK -#else +#if !CONFIG_KEYBOARD_C128 && !CONFIG_KEYBOARD_C128_CAPS_LOCK lda (KEYTAB), y