added CAPS LOCK key support on C128

This commit is contained in:
FeralChild64 committed 2019-10-18 19:11:30 +02:00
1 parent e9565c9724
commit 6e38c8a4b9
7 files changed
+76 -7

No files matched your search

+8 -2
View File
@@ -113,13 +113,19 @@ Original keyboard support routine is just horrible. It does nothing to prevent g
Uses old Open ROMs keyboard scanning routine, which is basically example routine by TWW/CTR, hacked to work within Kernal. It's greatest advantage is multi-key rollover, it's disadvantages - it's much less compatible (uses several bytes of memory which are normally free for user software - thus, it is considered legacy for now), does not support all the system variables (`RPTFLG` and `KEYLOG` are unsupported), and ignores the configuration options - this can be changed, but it requires some effort.
Needs 70-250 more space in KERNAL segment (depending on the features enabled for current default routine). If unsure - disable.
Needs 30-250 more space in KERNAL segment (depending on the features enabled for current default routine). If unsure - disable.
### `CONFIG_KEYBOARD_C128`
Allows to use additional keys found on the C128 keyboard. NOTE: might be buggy, on VICE emulator I can't get all the keys working.
Needs about 125 bytes more space in KERNAL segment. If unsure - disable.
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).
Needs about 47 bytes more space in KERNAL segment.
### `CONFIG_KEY_REPEAT_DEFAULT`
+1
View File
@@ -50,6 +50,7 @@
// #define CONFIG_LEGACY_SCNKEY
#define CONFIG_KEYBOARD_C128
// #define CONFIG_KEYBOARD_C128_CAPS_LOCK
// #define CONFIG_KEY_REPEAT_DEFAULT
#define CONFIG_KEY_REPEAT_ALWAYS
#define CONFIG_KEY_FAST_SCAN
+1
View File
@@ -52,6 +52,7 @@
#define CONFIG_LEGACY_SCNKEY
// #define CONFIG_KEYBOARD_C128
// #define CONFIG_KEYBOARD_C128_CAPS_LOCK
// #define CONFIG_KEY_REPEAT_DEFAULT
// #define CONFIG_KEY_REPEAT_ALWAYS
#define CONFIG_KEY_FAST_SCAN
+1
View File
@@ -50,6 +50,7 @@
// #define CONFIG_LEGACY_SCNKEY
// #define CONFIG_KEYBOARD_C128
// #define CONFIG_KEYBOARD_C128_CAPS_LOCK
// #define CONFIG_KEY_REPEAT_DEFAULT
// #define CONFIG_KEY_REPEAT_ALWAYS
#define CONFIG_KEY_FAST_SCAN
+13
View File
@@ -115,6 +115,19 @@
// Check if keyboard options are correct
{
#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
}
// Handle processor configuration
#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816
+3 -2
View File
@@ -15,8 +15,9 @@
.const KEY_FLAG_SHIFT = %00000001
.const KEY_FLAG_VENDOR = %00000010
.const KEY_FLAG_CTRL = %00000100
.const KEY_FLAG_ALT = %00001000 // C65 / C128 XXX implement this
.const KEY_FLAG_NO_SCRL = %00100000 // C65 / C128, Open ROMs unofficial XXX implement this
.const KEY_FLAG_ALT = %00001000 // C65 / C128
.const KEY_CAPS_LOCK = %00010000 // C65 / C128
.const KEY_FLAG_NO_SCRL = %00100000 // C65 / C128, Open ROMs unofficial
// Note - the following PETSCII codes are currently unassigned, can be used for further extensions:
+49 -3
View File
@@ -52,7 +52,26 @@ SCNKEY:
#endif
// Retrieve SHIFT / VENDOR / CTRL status
// Retrieve SHIFT / VENDOR / CTRL / ALT / CAPS LOCK status
#if CONFIG_KEYBOARD_C128_CAPS_LOCK
// First check if this is really a C128 - to avoid false positive
lda #$00
sta VIC_XSCAN
lda #$FF
cmp VIC_XSCAN
beq !+ // branch if C64, C128 will keep some bits cleared
lda CPU_R6510
and #$40
bne !+ // branch if no CAPS LOCK
lda #KEY_CAPS_LOCK
sta SHFLAG
!:
#endif
ldy #(__kb_matrix_bucky_confmask_end - kb_matrix_bucky_confmask - 1)
scnkey_bucky_loop:
@@ -269,14 +288,41 @@ scnkey_output_key:
// XXX this will be needed for extended screen editor
// cmp KEY_TAB_FW // special handling for SHIFT+TAB
// bne scnkey_got_petscii
// bne scnkey_got_petscii // XXX or to scnkey_handle_caps_lock
// lda SHFLAG // special handling for SHIFT+TAB
// and #KEY_FLAG_SHIFT
// bne !+
// lda KEY_TAB_FW
// bne scnkey_got_petscii // branch alWAYS
// !:
// lda KEY_TAB_BW
// lda KEY_TAB_BW // bne scnkey_got_petscii if CAPS LOCK is handled
#if CONFIG_KEYBOARD_C128_CAPS_LOCK
// Check if we need special handling for a CAPS LOCK key
// This is shorter than a separate set of tables
scnkey_handle_caps_lock:
tax
lda SHFLAG
and #(%00000111 + KEY_CAPS_LOCK)
cmp #KEY_CAPS_LOCK
bne !+ // branch if no special CAPS LOCK handling needed
cpx #$41 // 'A'
bcc !+
cpx #$5B // 'Z' + 1
bcs !+
txa
clc
adc #$20 // turn lowercase into uppercase
tax
!:
txa
#endif // CONFIG_KEYBOARD_C128_CAPS_LOCK
#else