1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +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.
BIND(Backspace, KeyDelete);
BIND(Escape, KeyBreak);
BIND(Up, KeyUp);
BIND(Down, KeyDown);
BIND(Left, KeyLeft);
BIND(Right, KeyRight);
BIND(BackTick, KeyEdit); BIND(F1, KeyEdit);
}
#undef BIND
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.
KeyDelete = 0x0801,
KeyBreak = 0x0802,
KeyBreak, KeyLeft, KeyRight, KeyUp, KeyDown, KeyEdit
};
struct KeyboardMapper: public KeyboardMachine::MappedMachine::KeyboardMapper {

View File

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

View File

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