From 4a84316ecd82da12c399243e982041ad7834c088 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 4 Dec 2020 01:07:18 +0100 Subject: [PATCH] various keyboard related fixes --- STATUS.md | 1 + src/basic/basic_commands/cmd_rem.s | 5 +++++ src/kernal/board_m65/mega65_imports_C.s | 1 - src/kernal/keyboard/eb48.interop | 2 ++ ...cnkey_set_keytab.s => eb48.scnkey_set_keytab.s} | 0 src/kernal/keyboard/kb_matrix_bucky.s | 6 +----- .../keyboard_m65/mega65_kb_matrix_bucky_shflag.s | 14 ++++++++++++++ src/kernal/keyboard_m65/mega65_scnkey.s | 12 ++++++------ 8 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 src/kernal/keyboard/eb48.interop rename src/kernal/keyboard/{scnkey_set_keytab.s => eb48.scnkey_set_keytab.s} (100%) create mode 100644 src/kernal/keyboard_m65/mega65_kb_matrix_bucky_shflag.s diff --git a/STATUS.md b/STATUS.md index c0f6d372..28b0ab74 100644 --- a/STATUS.md +++ b/STATUS.md @@ -386,6 +386,7 @@ Not all of them - only these we want to have implemented. | `$EA31` | default IRQ | PARTIAL | | | `$EA7E` | ack CIA1 + below | DONE | | | `$EA81` | ret from IRQ/NMI | DONE | | +| `$EB48` | set keyboard mapping table | DONE | | | `$F142` | get key from buffer | DONE | | | `$F3F6` | (unknown) | NOT DONE | | | `$F646` | IEC close | NOT DONE | | diff --git a/src/basic/basic_commands/cmd_rem.s b/src/basic/basic_commands/cmd_rem.s index 9a4cf91c..8b9bc74f 100644 --- a/src/basic/basic_commands/cmd_rem.s +++ b/src/basic/basic_commands/cmd_rem.s @@ -7,6 +7,11 @@ cmd_rem: + lda LSTX + jsr print_hex_byte + jmp cmd_rem + + ; XXX do we need these PHA's? pha diff --git a/src/kernal/board_m65/mega65_imports_C.s b/src/kernal/board_m65/mega65_imports_C.s index 9ebbef07..d98a7946 100644 --- a/src/kernal/board_m65/mega65_imports_C.s +++ b/src/kernal/board_m65/mega65_imports_C.s @@ -11,7 +11,6 @@ ;; #ALIAS# scnkey_buffer_full = KERNAL_0.scnkey_buffer_full ;; #ALIAS# scnkey_toggle_if_needed = KERNAL_0.scnkey_toggle_if_needed -;; #ALIAS# kb_matrix_bucky_shflag = KERNAL_0.kb_matrix_bucky_shflag ;; #ALIAS# kb_matrix_alwaysrepeat = KERNAL_0.kb_matrix_alwaysrepeat ;; #ALIAS# __kb_matrix_alwaysrepeat_end = KERNAL_0.__kb_matrix_alwaysrepeat_end diff --git a/src/kernal/keyboard/eb48.interop b/src/kernal/keyboard/eb48.interop new file mode 100644 index 00000000..2800f4bb --- /dev/null +++ b/src/kernal/keyboard/eb48.interop @@ -0,0 +1,2 @@ +This routine is pointed by a vector - it has to be available at the same location as in the original ROM, +otherwise programs frozem with (for example) Action Replay might crash after loading. \ No newline at end of file diff --git a/src/kernal/keyboard/scnkey_set_keytab.s b/src/kernal/keyboard/eb48.scnkey_set_keytab.s similarity index 100% rename from src/kernal/keyboard/scnkey_set_keytab.s rename to src/kernal/keyboard/eb48.scnkey_set_keytab.s diff --git a/src/kernal/keyboard/kb_matrix_bucky.s b/src/kernal/keyboard/kb_matrix_bucky.s index 7dde75b1..f128b340 100644 --- a/src/kernal/keyboard/kb_matrix_bucky.s +++ b/src/kernal/keyboard/kb_matrix_bucky.s @@ -61,11 +61,7 @@ kb_matrix_bucky_shflag: ; mask to be ORed to SHFLAG to mark key status !byte KEY_FLAG_SHIFT !byte KEY_FLAG_VENDOR !byte KEY_FLAG_CTRL -!ifdef CONFIG_MB_M65 { - !byte KEY_FLAG_ALT - !byte KEY_FLAG_NO_SCRL - !byte KEY_FLAG_CAPSL -} else ifdef CONFIG_KEYBOARD_C128 { +!ifdef CONFIG_KEYBOARD_C128 { !byte KEY_FLAG_ALT !byte KEY_FLAG_NO_SCRL } diff --git a/src/kernal/keyboard_m65/mega65_kb_matrix_bucky_shflag.s b/src/kernal/keyboard_m65/mega65_kb_matrix_bucky_shflag.s new file mode 100644 index 00000000..effe7910 --- /dev/null +++ b/src/kernal/keyboard_m65/mega65_kb_matrix_bucky_shflag.s @@ -0,0 +1,14 @@ +;; #LAYOUT# M65 KERNAL_C #TAKE +;; #LAYOUT# * * #IGNORE + + + +kb_matrix_bucky_shflag: ; mask to be ORed to SHFLAG to mark key status + + !byte KEY_FLAG_SHIFT + !byte KEY_FLAG_SHIFT + !byte KEY_FLAG_CTRL + !byte KEY_FLAG_VENDOR + !byte KEY_FLAG_ALT + !byte KEY_FLAG_NO_SCRL + !byte KEY_FLAG_CAPSL \ No newline at end of file diff --git a/src/kernal/keyboard_m65/mega65_scnkey.s b/src/kernal/keyboard_m65/mega65_scnkey.s index 2d25e372..0153811e 100644 --- a/src/kernal/keyboard_m65/mega65_scnkey.s +++ b/src/kernal/keyboard_m65/mega65_scnkey.s @@ -169,11 +169,11 @@ m65_scnkey_next_1: ; No new key - check if the last one is still pressed ldy LSTX - cmp M65_KB_PRESSED+0 + cpy M65_KB_PRESSED+0 beq m65_scnkey_got_key_skip_cmp - cmp M65_KB_PRESSED+1 + cpy M65_KB_PRESSED+1 beq m65_scnkey_got_key_skip_cmp - cmp M65_KB_PRESSED+2 + cpy M65_KB_PRESSED+2 beq m65_scnkey_got_key_skip_cmp ; Nope, previous key is not pressed @@ -331,11 +331,11 @@ m65_scnkey_compare_with_old: ; Compare key index with the ones from previous scan - cmp M65_KB_PRESSED+0 + cmp M65_KB_PRESSED_OLD+0 beq @1 - cmp M65_KB_PRESSED+1 + cmp M65_KB_PRESSED_OLD+1 beq @1 - cmp M65_KB_PRESSED+2 + cmp M65_KB_PRESSED_OLD+2 @1: rts