function keys, RUN and HELP are now programmable at compile time

This commit is contained in:
FeralChild64 committed 2019-10-27 17:59:53 +01:00
1 parent 15362c29b4
commit d0ac49b2b6
22 files changed
+320 -22

No files matched your search

+7 -1
View File
@@ -161,7 +161,13 @@ Needs 13 bytes more space in KERNAL segment. Only disable if you are running out
Joystick movement also moves the cursor.
Needs about 65 bytes of ROM space to handle both joysticks.
Needs about 65 bytes of ROM space in KERNAL segment to handle both joysticks.
### `CONFIG_PROGRAMMABLE_KEYS`
Allows to assign command to any function key, `RUN` key and `HELP` key (if selected keybaord has one) - just fill-in appropriate `CONFIG_KEYCMD_*` variable(s). Keys not present on the selected keyboard are ignored.
Needs 25 bytes more space in KERNAL segment for the code. In addition, each configured key takes 3 bytes + length of the command.
## Eye candy
+1
View File
@@ -5,6 +5,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8
* improved keyboard scanning, resistant to ghosting and joystick interference (one variant even supports multi-keyy rollover), supports additional C128 keys
* joystick can be used to move text cursor
* pre-defined function keys
* uses RAM under ROM and I/O: 61438 bytes free
* cold/warm start silences multiple SID chips - all $D4xx and $D5xx addresses
* wark start due to BRK prints out the instruction address
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+23
View File
@@ -1,5 +1,6 @@
.const CONFIG_ID = $00 // should be 1 byte, different for each config file!
.encoding "petscii_upper"
//
// Please read CONFIG.md before modifying this file!
@@ -62,6 +63,28 @@
#define CONFIG_JOY1_CURSOR
#define CONFIG_JOY2_CURSOR
#define CONFIG_PROGRAMMABLE_KEYS
.const CONFIG_KEYCMD_RUN = @"LOAD\"*\""
.const CONFIG_KEYCMD_F1 = @"@"
.const CONFIG_KEYCMD_F2 = @""
.const CONFIG_KEYCMD_F3 = @"RUN:"
.const CONFIG_KEYCMD_F4 = @""
.const CONFIG_KEYCMD_F5 = @"LOAD"
.const CONFIG_KEYCMD_F6 = @""
.const CONFIG_KEYCMD_F7 = @"@$"
.const CONFIG_KEYCMD_F8 = @""
.const CONFIG_KEYCMD_HELP = @"LIST"
.const CONFIG_KEYCMD_F9 = @""
.const CONFIG_KEYCMD_F10 = @""
.const CONFIG_KEYCMD_F11 = @""
.const CONFIG_KEYCMD_F12 = @""
.const CONFIG_KEYCMD_F13 = @""
.const CONFIG_KEYCMD_F14 = @""
// Eye candy
+24 -1
View File
@@ -1,5 +1,6 @@
.const CONFIG_ID = $01 // should be 1 byte, different for each config file!
.encoding "petscii_upper"
//
// Please read CONFIG.md before modifying this file!
@@ -33,7 +34,7 @@
// #define CONFIG_CPU_WDC_65816
// Memory model configuration
// Memory model
#define CONFIG_MEMORY_MODEL_38K
// #define CONFIG_MEMORY_MODEL_60K
@@ -64,6 +65,28 @@
#define CONFIG_JOY1_CURSOR
#define CONFIG_JOY2_CURSOR
#define CONFIG_PROGRAMMABLE_KEYS
.const CONFIG_KEYCMD_RUN = @"LOAD\"*\""
.const CONFIG_KEYCMD_F1 = @"@"
.const CONFIG_KEYCMD_F2 = @""
.const CONFIG_KEYCMD_F3 = @"RUN:"
.const CONFIG_KEYCMD_F4 = @""
.const CONFIG_KEYCMD_F5 = @"LOAD"
.const CONFIG_KEYCMD_F6 = @""
.const CONFIG_KEYCMD_F7 = @"@$"
.const CONFIG_KEYCMD_F8 = @""
.const CONFIG_KEYCMD_HELP = @"LIST"
.const CONFIG_KEYCMD_F9 = @""
.const CONFIG_KEYCMD_F10 = @""
.const CONFIG_KEYCMD_F11 = @""
.const CONFIG_KEYCMD_F12 = @""
.const CONFIG_KEYCMD_F13 = @""
.const CONFIG_KEYCMD_F14 = @""
// Eye candy
+24 -1
View File
@@ -1,5 +1,6 @@
.const CONFIG_ID = $F0 // should be 1 byte, different for each config file!
.encoding "petscii_upper"
//
// Please read CONFIG.md before modifying this file!
@@ -32,7 +33,7 @@
// #define CONFIG_CPU_WDC_65816
// Memory model configuration
// Memory model
// #define CONFIG_MEMORY_MODEL_38K
#define CONFIG_MEMORY_MODEL_60K
@@ -63,6 +64,28 @@
#define CONFIG_JOY1_CURSOR
#define CONFIG_JOY2_CURSOR
#define CONFIG_PROGRAMMABLE_KEYS
.const CONFIG_KEYCMD_RUN = @"LOAD\"*\""
.const CONFIG_KEYCMD_F1 = @"@"
.const CONFIG_KEYCMD_F2 = @""
.const CONFIG_KEYCMD_F3 = @"RUN:"
.const CONFIG_KEYCMD_F4 = @""
.const CONFIG_KEYCMD_F5 = @"LOAD"
.const CONFIG_KEYCMD_F6 = @""
.const CONFIG_KEYCMD_F7 = @"@$"
.const CONFIG_KEYCMD_F8 = @""
.const CONFIG_KEYCMD_HELP = @"LIST"
.const CONFIG_KEYCMD_F9 = @""
.const CONFIG_KEYCMD_F10 = @""
.const CONFIG_KEYCMD_F11 = @""
.const CONFIG_KEYCMD_F12 = @""
.const CONFIG_KEYCMD_F13 = @""
.const CONFIG_KEYCMD_F14 = @""
// Eye candy
+23 -1
View File
@@ -1,5 +1,6 @@
.const CONFIG_ID = $02 // should be 1 byte, different for each config file!
.encoding "petscii_upper"
//
// Please read CONFIG.md before modifying this file!
@@ -31,7 +32,7 @@
// #define CONFIG_CPU_WDC_65816
// Memory model configuration
// Memory model
#define CONFIG_MEMORY_MODEL_38K
// #define CONFIG_MEMORY_MODEL_60K
@@ -62,6 +63,27 @@
#define CONFIG_JOY1_CURSOR
#define CONFIG_JOY2_CURSOR
#define CONFIG_PROGRAMMABLE_KEYS
.const CONFIG_KEYCMD_RUN = @"LOAD\"*\""
.const CONFIG_KEYCMD_F1 = @"@"
.const CONFIG_KEYCMD_F2 = @""
.const CONFIG_KEYCMD_F3 = @"RUN:"
.const CONFIG_KEYCMD_F4 = @""
.const CONFIG_KEYCMD_F5 = @"LOAD"
.const CONFIG_KEYCMD_F6 = @""
.const CONFIG_KEYCMD_F7 = @"@$"
.const CONFIG_KEYCMD_F8 = @""
.const CONFIG_KEYCMD_HELP = @"LIST"
.const CONFIG_KEYCMD_F9 = @""
.const CONFIG_KEYCMD_F10 = @""
.const CONFIG_KEYCMD_F11 = @""
.const CONFIG_KEYCMD_F12 = @""
.const CONFIG_KEYCMD_F13 = @""
.const CONFIG_KEYCMD_F14 = @""
// Eye candy
+41 -7
View File
@@ -6,7 +6,6 @@
// Check that platform configuration is correct
{
.var selected = 0;
@@ -20,7 +19,6 @@
// Check that motherboard extras configuration is correct
{
.var selected = 0;
@@ -44,7 +42,6 @@
// Check that brand configuration is correct
{
.var selected = 0;
@@ -74,7 +71,6 @@
// Check that processor configuration is correct
{
.var selected = 0;
@@ -97,7 +93,6 @@
// Check that memory model configuration is correct
{
.var selected = 0;
@@ -114,7 +109,6 @@
// Check that startup banner configuration is correct
{
.var selected = 0;
@@ -143,7 +137,11 @@
// Check if keyboard options are correct
.function CHECK_KEYCMD(keycmd)
{
.if (keycmd.size() > 0) .return 1
.return 0
}
{
#if CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C128_CAPS_LOCK || CONFIG_KEYBOARD_C65 || CONFIG_KEYBOARD_C65_CAPS_LOCK)
.error "CONFIG_LEGACY_SCNKEY and CONFIG_KEYBOARD_C128* / CONFIG_KEYBOARD_C65* are mutually exclusive"
@@ -155,6 +153,42 @@
#if CONFIG_MB_ULTIMATE_64 && (CONFIG_KEYBOARD_C65 || CONFIG_KEYBOARD_C65_CAPS_LOCK)
.error "Selected CONFIG_MB_* is not compatible with CONFIG_KEYBOARD_C65*"
#endif
.var num_pkeys_base = 0
.var num_pkeys_ext1 = 0
.var num_pkeys_ext2 = 0
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_RUN)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F1)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F2)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F3)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F4)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F5)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F6)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F7)
.eval num_pkeys_base += CHECK_KEYCMD(CONFIG_KEYCMD_F8)
.eval num_pkeys_ext1 += CHECK_KEYCMD(CONFIG_KEYCMD_HELP)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F9)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F10)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F11)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F12)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F13)
.eval num_pkeys_ext2 += CHECK_KEYCMD(CONFIG_KEYCMD_F14)
.var num_pkeys = num_pkeys_base
#if !CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65)
.eval num_pkeys += num_pkeys_ext1
#endif
#if !CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C65
.eval num_pkeys += num_pkeys_ext2
#endif
#if CONFIG_PROGRAMMABLE_KEYS
.if (num_pkeys == 0) .error "CONFIG_PROGRAMMABLE_KEYS requires at least one defined key"
#endif
}
+6 -6
View File
@@ -54,12 +54,12 @@
.const KEY_RUN = $83
.const KEY_F1 = $85
.const KEY_F2 = $86
.const KEY_F3 = $87
.const KEY_F4 = $88
.const KEY_F5 = $89
.const KEY_F6 = $8A
.const KEY_F7 = $8B
.const KEY_F2 = $89
.const KEY_F3 = $86
.const KEY_F4 = $8A
.const KEY_F5 = $87
.const KEY_F6 = $8B
.const KEY_F7 = $88
.const KEY_F8 = $8C
#if CONFIG_KEYBOARD_C65
+2
View File
@@ -3,6 +3,8 @@
// Startup banner, to be displayed during cold start
//
.encoding "petscii_upper"
.macro BANNER_TEXT() {
+2
View File
@@ -133,6 +133,8 @@ wedge_dos_x1:
rts
wedge_dos_status:
jsr print_return
jsr wedge_dos_status_get
// FALLTROUGH
+3
View File
@@ -3,6 +3,9 @@
// Messages to be prined out by Kernal
//
.encoding "petscii_upper"
// Double underscore prevents labels from being passed to VICE (would confuse monitor)
.label __MSG_KERNAL_SEARCHING_FOR = __msg_kernalsearching_for - __msg_kernal_first
+38 -5
View File
@@ -91,10 +91,10 @@ read_from_keyboard:
cmp #$0D
bne not_enter
chrin_enter:
jsr cursor_disable
jsr pop_keyboard_buffer
jsr cursor_hide_if_visible
// It was enter.
@@ -140,12 +140,45 @@ empty_line:
not_enter:
// Print character
lda KEYD
// XXX add support for SHIFT + RUN/STOP ($84) and function keys (should be configurable)
jsr CHROUT
#if CONFIG_PROGRAMMABLE_KEYS
ldx #(__programmable_keys_codes_end - programmable_keys_codes - 1)
chrin_programmable_loop:
cmp programmable_keys_codes, x
beq chrin_programmable_key
dex
bpl chrin_programmable_loop
// FALLTROUGH
#endif // CONFIG_PROGRAMMABLE_KEYS
chrin_print_character:
jsr CHROUT
jsr pop_keyboard_buffer
// Keep looking for input from keyboard until carriage return
jmp chrin_repeat
#if CONFIG_PROGRAMMABLE_KEYS
chrin_programmable_key:
// .X contains index of the key code, we need offset to key string instead
lda programmable_keys_offsets, x
tax
// Print all the characters assigned to key
!:
lda programmable_keys_strings, x
beq chrin_enter
jsr CHROUT // our implementation preserves .X too
inx
bne !- // jumps always
#endif // CONFIG_PROGRAMMABLE_KEYS
+1
View File
@@ -6,6 +6,7 @@
// - [CM64] Compute's Mapping the Commodore 64 - page 228
//
// CPU registers that has to be preserved (see [RG64]): .Y
// Additionally we have to preserve .X for out CHRIN implementation
//
CHROUT:
+125
View File
@@ -0,0 +1,125 @@
//
// Command string definitions for programmable keys
//
#if CONFIG_PROGRAMMABLE_KEYS
.macro PROGRAMMABLE_KEY_CODE(STR, CODE)
{
.if (STR.size() > 0)
{
.byte CODE
}
}
.macro PROGRAMMABLE_KEY_STRING(STR)
{
.if (STR.size() > 0)
{
.text STR
.byte $00
}
}
.macro PROGRAMMABLE_KEY_OFFSET(STR, LABEL)
{
.if (STR.size() > 0)
{
.byte LABEL - programmable_keys_strings
}
}
programmable_keys_codes:
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_RUN, KEY_RUN)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F1, KEY_F1)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F2, KEY_F2)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F3, KEY_F3)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F4, KEY_F4)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F5, KEY_F5)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F6, KEY_F6)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F7, KEY_F7)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F8, KEY_F8)
#if !CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_HELP, KEY_HELP)
#endif
#if !CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C65
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F9, KEY_F9)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F10, KEY_F10)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F11, KEY_F11)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F12, KEY_F12)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F13, KEY_F13)
PROGRAMMABLE_KEY_CODE(CONFIG_KEYCMD_F14, KEY_F14)
#endif
__programmable_keys_codes_end:
programmable_keys_strings:
__str_offset_RUN: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_RUN)
__str_offset_F1: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F1)
__str_offset_F2: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F2)
__str_offset_F3: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F3)
__str_offset_F4: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F4)
__str_offset_F5: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F5)
__str_offset_F6: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F6)
__str_offset_F7: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F7)
__str_offset_F8: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F8)
#if !CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65)
__str_offset_HELP: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_HELP)
#endif
#if !CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C65
__str_offset_F9: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F9)
__str_offset_F10: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F10)
__str_offset_F11: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F11)
__str_offset_F12: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F12)
__str_offset_F13: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F13)
__str_offset_F14: PROGRAMMABLE_KEY_STRING(CONFIG_KEYCMD_F14)
#endif
__programmable_keys_strings_end:
{
.var offset = __programmable_keys_strings_end - programmable_keys_strings
.if (offset >= 255) .error "Programmable keys took too much space"
}
programmable_keys_offsets:
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_RUN, __str_offset_RUN)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F1, __str_offset_F1)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F2, __str_offset_F2)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F3, __str_offset_F3)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F4, __str_offset_F4)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F5, __str_offset_F5)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F6, __str_offset_F6)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F7, __str_offset_F7)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F8, __str_offset_F8)
#if !CONFIG_LEGACY_SCNKEY && (CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_HELP, __str_offset_HELP)
#endif
#if !CONFIG_LEGACY_SCNKEY && CONFIG_KEYBOARD_C65
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F9, __str_offset_F9)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F10, __str_offset_F10)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F11, __str_offset_F11)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F12, __str_offset_F12)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F13, __str_offset_F13)
PROGRAMMABLE_KEY_OFFSET(CONFIG_KEYCMD_F14, __str_offset_F14)
#endif
#endif // CONFIG_PROGRAMMABLE_KEYS