1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Adds virtual key for EDIT.

This commit is contained in:
Thomas Harte 2020-03-02 21:44:15 -05:00
parent 1a539521f2
commit dc47a2b7d7
4 changed files with 20 additions and 12 deletions

View File

@ -32,6 +32,11 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
// Virtual keys follow. // Virtual keys follow.
BIND(Backspace, KeyDelete); BIND(Backspace, KeyDelete);
BIND(Escape, KeyBreak); BIND(Escape, KeyBreak);
BIND(Up, KeyUp);
BIND(Down, KeyDown);
BIND(Left, KeyLeft);
BIND(Right, KeyRight);
BIND(BackTick, KeyEdit); BIND(F1, KeyEdit);
} }
#undef BIND #undef BIND
return KeyboardMachine::MappedMachine::KeyNotMapped; return KeyboardMachine::MappedMachine::KeyNotMapped;

View File

@ -26,7 +26,7 @@ enum Key: uint16_t {
// Add some virtual keys; these do not exist on a real ZX80 or ZX81. They're just a convenience. // Add some virtual keys; these do not exist on a real ZX80 or ZX81. They're just a convenience.
KeyDelete = 0x0801, KeyDelete = 0x0801,
KeyBreak = 0x0802, KeyBreak, KeyLeft, KeyRight, KeyUp, KeyDown, KeyEdit
}; };
struct KeyboardMapper: public KeyboardMachine::MappedMachine::KeyboardMapper { struct KeyboardMapper: public KeyboardMachine::MappedMachine::KeyboardMapper {

View File

@ -353,19 +353,22 @@ template<bool is_zx81> class ConcreteMachine:
const auto line = key >> 8; const auto line = key >> 8;
// Check for special cases. // Check for special cases.
if(line == 8) { if(line > 7) {
switch(key) { switch(key) {
case KeyDelete: #define ShiftedKey(source, base) \
// Map delete to shift+0. case source: \
set_key_state(KeyShift, is_pressed); set_key_state(KeyShift, is_pressed); \
set_key_state(Key0, is_pressed); set_key_state(base, is_pressed); \
break; break;
case KeyBreak: ShiftedKey(KeyDelete, Key0);
// Map break to shift+space. ShiftedKey(KeyBreak, KeySpace);
set_key_state(KeyShift, is_pressed); ShiftedKey(KeyUp, Key7);
set_key_state(KeySpace, is_pressed); ShiftedKey(KeyDown, Key6);
break; ShiftedKey(KeyLeft, Key5);
ShiftedKey(KeyRight, Key8);
ShiftedKey(KeyEdit, Key1);
#undef ShiftedKey
} }
} else { } else {
if(is_pressed) if(is_pressed)

View File

@ -67,7 +67,7 @@
</Testables> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Release" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableASanStackUseAfterReturn = "YES" enableASanStackUseAfterReturn = "YES"