diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 049ac84b..bfe8029d 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -48,8 +48,10 @@ // Keyboard settings -// #define CONFIG_SCNKEY_TWW_CTR // XXX document this -// #define CONFIG_KEY_REPEAT // XXX document this +// #define CONFIG_LEGACY_SCNKEY // XXX document this +// #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this +// #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this +#define CONFIG_KEY_FAST_SCAN // XXX document this #define CONFIG_JOY1_CURSOR // XXX document this #define CONFIG_JOY2_CURSOR // XXX document this diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 0bc2c86c..8f874fb1 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -50,8 +50,10 @@ // Keyboard settings -#define CONFIG_SCNKEY_TWW_CTR // XXX document this -// #define CONFIG_KEY_REPEAT // XXX document this +#define CONFIG_LEGACY_SCNKEY // XXX document this +// #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this +// #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this +#define CONFIG_KEY_FAST_SCAN // XXX document this #define CONFIG_JOY1_CURSOR // XXX document this #define CONFIG_JOY2_CURSOR // XXX document this diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index a993bd6e..9b37ebab 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -48,8 +48,10 @@ // Keyboard settings -// #define CONFIG_SCNKEY_TWW_CTR // XXX document this -// #define CONFIG_KEY_REPEAT // XXX document this +// #define CONFIG_LEGACY_SCNKEY // XXX document this +// #define CONFIG_KEY_REPEAT_DEFAULT // XXX document this +// #define CONFIG_KEY_REPEAT_ALWAYS // XXX document this +#define CONFIG_KEY_FAST_SCAN // XXX document this #define CONFIG_JOY1_CURSOR // XXX document this #define CONFIG_JOY2_CURSOR // XXX document this diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index bc83aa76..905446dc 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -104,7 +104,7 @@ .label CNTDN = $A5 // -- NOT IMPLEMENTED -- .label BUFPNT = $A6 // -- NOT IMPLEMENTED -- .label INBIT = $A7 // -- NOT IMPLEMENTED -- -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY .label BITCI = $A8 // -- NOT IMPLEMENTED -- .label RINONE = $A9 // -- NOT IMPLEMENTED -- .label RIDDATA = $AA // -- NOT IMPLEMENTED -- @@ -114,11 +114,11 @@ .label EAL = $AE // $AE-$AF -- NOT IMPLEMENTED -- [!] used also by screen editor, for temporary color storage when scrolling .label CMP0 = $B0 // $B0-$B1 temporary tape storage, [!] here used for BRK instruction address .label TAPE1 = $B2 // $B2-$B3 tape buffer pointer -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY .label BITTS = $B4 // -- NOT IMPLEMENTED -- #endif .label NXTBIT = $B5 // -- NOT IMPLEMENTED -- -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY .label RODATA = $B6 // -- NOT IMPLEMENTED -- #endif @@ -172,7 +172,7 @@ .label BUF = $200 // $200-$250, BASIC line editor input buffer (81 bytes) // $250-$258 is the 81st - 88th characters in BASIC input, a carry over from VIC-20 - // and not used on C64 - they are used if CONFIG_SCNKEY_TWW_CTR is enabled. + // and not used on C64 - they are used if CONFIG_LEGACY_SCNKEY is enabled. // [!] XXX document $251-$258 usage .label LAT = $259 // $259-$262, logical file numbers (table, 10 bytes) @@ -194,7 +194,7 @@ .label KEYLOG = $28F // $28F-$290 routine to setup keyboard decoding .label MODE = $291 // flag, is case switch allowed .label AUTODN = $292 // -- NOT IMPLEMENTED -- screen scroll disable -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY .label M51CRT = $293 // -- NOT IMPLEMENTED -- mock 6551 .label M51CDR = $294 // -- NOT IMPLEMENTED -- mock 6551 .label M51AJB = $295 // $295-$296 -- NOT IMPLEMENTED -- mock 6551 diff --git a/c64/kernal/cint_real.s b/c64/kernal/cint_real.s index 3a096a63..54b03723 100644 --- a/c64/kernal/cint_real.s +++ b/c64/kernal/cint_real.s @@ -75,7 +75,7 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? // Enable cursor repeat - XXX make it configurable -#if CONFIG_KEY_REPEAT +#if CONFIG_KEY_REPEAT_DEFAULT && !CONFIG_KEY_REPEAT_ALWAYS lda #$80 sta RPTFLG @@ -84,7 +84,7 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? // Set keyboard decode vector (Compute's Mapping the 64 p215) -#if CONFIG_SCNKEY_TWW_CTR +#if CONFIG_LEGACY_SCNKEY // Set initial variables for our improved keyboard scan routine lda #$FF diff --git a/c64/kernal/keyboard/kb_matrix_alwaysrepeat.s b/c64/kernal/keyboard/kb_matrix_alwaysrepeat.s index 3a6caa78..ffb80e02 100644 --- a/c64/kernal/keyboard/kb_matrix_alwaysrepeat.s +++ b/c64/kernal/keyboard/kb_matrix_alwaysrepeat.s @@ -7,7 +7,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY && !CONFIG_KEY_REPEAT_ALWAYS kb_matrix_alwaysrepeat: @@ -20,4 +20,4 @@ kb_matrix_alwaysrepeat: __kb_matrix_alwaysrepeat_end: -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY and no CONFIG_KEY_REPEAT_ALWAYS diff --git a/c64/kernal/keyboard/kb_matrix_bucky.s b/c64/kernal/keyboard/kb_matrix_bucky.s index 6ca59589..32150a3a 100644 --- a/c64/kernal/keyboard/kb_matrix_bucky.s +++ b/c64/kernal/keyboard/kb_matrix_bucky.s @@ -7,7 +7,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY kb_matrix_bucky_confmask: // values to be written to CIA1_PRA @@ -33,4 +33,4 @@ kb_matrix_bucky_shflag: // mask to be ORed to SHFLAG to mark key status .byte KEY_FLAG_CTRL -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/kb_matrix_bucky_filter.s b/c64/kernal/keyboard/kb_matrix_bucky_filter.s index 21ebe02f..0e2a9b36 100644 --- a/c64/kernal/keyboard/kb_matrix_bucky_filter.s +++ b/c64/kernal/keyboard/kb_matrix_bucky_filter.s @@ -7,7 +7,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY kb_matrix_bucky_filter: @@ -24,4 +24,4 @@ kb_matrix_bucky_filter: .byte %00100100 // VENDOR + CONTROL -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/kb_matrix_joy.s b/c64/kernal/keyboard/kb_matrix_joy.s index 50c9d501..8f9deaab 100644 --- a/c64/kernal/keyboard/kb_matrix_joy.s +++ b/c64/kernal/keyboard/kb_matrix_joy.s @@ -4,7 +4,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR && (CONFIG_JOY1_CURSOR || CONFIG_JOY2_CURSOR) +#if !CONFIG_LEGACY_SCNKEY && (CONFIG_JOY1_CURSOR || CONFIG_JOY2_CURSOR) kb_matrix_joy_status: diff --git a/c64/kernal/keyboard/kb_matrix_lookup.s b/c64/kernal/keyboard/kb_matrix_lookup.s index 93477737..9e1b8f34 100644 --- a/c64/kernal/keyboard/kb_matrix_lookup.s +++ b/c64/kernal/keyboard/kb_matrix_lookup.s @@ -7,7 +7,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY kb_matrix_lookup: diff --git a/c64/kernal/keyboard/kb_matrix_lookup_tww_ctr.s b/c64/kernal/keyboard/kb_matrix_lookup_legacy.s similarity index 88% rename from c64/kernal/keyboard/kb_matrix_lookup_tww_ctr.s rename to c64/kernal/keyboard/kb_matrix_lookup_legacy.s index cc7d6e09..62f2a932 100644 --- a/c64/kernal/keyboard/kb_matrix_lookup_tww_ctr.s +++ b/c64/kernal/keyboard/kb_matrix_lookup_legacy.s @@ -12,9 +12,9 @@ // This lookup table is used by TWW/CTR keyboard routine only! -#if CONFIG_SCNKEY_TWW_CTR +#if CONFIG_LEGACY_SCNKEY -kb_matrix_lookup_tww_ctr: +kb_matrix_lookup: .byte $00 // Normal .byte $40 // Shifted @@ -25,4 +25,4 @@ kb_matrix_lookup_tww_ctr: .byte $80 // Vendor + CTRL .byte $80 // Vendor + CTRL + SHIFT -#endif // CONFIG_SCNKEY_TWW_CTR +#endif // CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/kb_matrix_row_keys.s b/c64/kernal/keyboard/kb_matrix_row_keys.s index f4284108..cf09dfc7 100644 --- a/c64/kernal/keyboard/kb_matrix_row_keys.s +++ b/c64/kernal/keyboard/kb_matrix_row_keys.s @@ -7,7 +7,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY kb_matrix_row_keys: @@ -25,4 +25,4 @@ kb_matrix_row_keys: .byte %01111111 -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/kb_matrix_row_offsets.s b/c64/kernal/keyboard/kb_matrix_row_offsets.s index 8710ab09..efc2ceaf 100644 --- a/c64/kernal/keyboard/kb_matrix_row_offsets.s +++ b/c64/kernal/keyboard/kb_matrix_row_offsets.s @@ -4,7 +4,7 @@ // -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY kb_matrix_row_offsets: @@ -20,4 +20,4 @@ kb_matrix_row_offsets: .byte 6*8 .byte 7*8 -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 5199427b..c4454dd2 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -25,7 +25,7 @@ // XXX add Commodore 65 keyboard support -#if !CONFIG_SCNKEY_TWW_CTR +#if !CONFIG_LEGACY_SCNKEY // Routine takes some ideas from TWW/CTR proposal, see here: // - http://codebase64.org/doku.php?id=base:scanning_the_keyboard_the_correct_and_non_kernal_way @@ -44,7 +44,7 @@ SCNKEY: // Check for any activity -#if !CONFIG_JOY2_CURSOR +#if !CONFIG_JOY2_CURSOR && CONFIG_KEY_FAST_SCAN ldx #$00 stx CIA1_PRA // connect all the rows @@ -93,13 +93,17 @@ scnkey_bucky_loop: bne scnkey_joystick_filtered +#if CONFIG_KEY_FAST_SCAN + inx // puts $00 stx CIA1_PRA // connect all the rows dex // puts $FF cpx CIA1_PRB beq scnkey_no_keys -#endif +#endif // CONFIG_KEY_FAST_SCAN + +#endif // CONFIG_JOY2_CURSOR // Check for control port 1 activity (can interfere with keyboard) @@ -262,6 +266,8 @@ scnkey_done: scnkey_try_repeat: +#if !CONFIG_KEY_REPEAT_ALWAYS + // Check whether we should repeat keys - first the flag, afterwards hardcoded list lda RPTFLG @@ -278,6 +284,8 @@ scnkey_try_repeat: scnkey_handle_repeat: +#endif // no CONFIG_KEY_REPEAT_ALWAYS + // Countdown before first repeat lda DELAY @@ -309,4 +317,4 @@ via_keylog: jmp (KEYLOG) -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/scnkey_tww_ctr.s b/c64/kernal/keyboard/scnkey_legacy.s similarity index 99% rename from c64/kernal/keyboard/scnkey_tww_ctr.s rename to c64/kernal/keyboard/scnkey_legacy.s index bf2d55f6..6da6c43a 100644 --- a/c64/kernal/keyboard/scnkey_tww_ctr.s +++ b/c64/kernal/keyboard/scnkey_legacy.s @@ -9,7 +9,7 @@ // -#if CONFIG_SCNKEY_TWW_CTR +#if CONFIG_LEGACY_SCNKEY // Scan the keyboard.. @@ -116,7 +116,7 @@ accept_key: tax pla and #$3f - ora kb_matrix_lookup_tww_ctr,x + ora kb_matrix_lookup,x tax lda kb_matrix,x // But don't insert $00 characters @@ -521,4 +521,4 @@ KeyRepeatWait: jmp ConsiderNextKey -#endif // CONFIG_SCNKEY_TWW_CTR +#endif // CONFIG_LEGACY_SCNKEY diff --git a/c64/kernal/keyboard/scnkey_set_keytab.s b/c64/kernal/keyboard/scnkey_set_keytab.s index 4f9781aa..6c9a03b1 100644 --- a/c64/kernal/keyboard/scnkey_set_keytab.s +++ b/c64/kernal/keyboard/scnkey_set_keytab.s @@ -9,7 +9,7 @@ scnkey_set_keytab: -#if CONFIG_SCNKEY_TWW_CTR // routine not compatible with legacy SCNKEY +#if CONFIG_LEGACY_SCNKEY // routine not compatible with legacy SCNKEY rts @@ -54,7 +54,7 @@ scnkey_valid_offset: // FALLTROUGH -#endif // no CONFIG_SCNKEY_TWW_CTR +#endif // no CONFIG_LEGACY_SCNKEY scnkey_toggle_if_needed: // entry for SCNKEY (TWW/CTR version)