mirror of
https://github.com/TomHarte/CLK.git
synced 2026-01-23 16:16:16 +00:00
Reserve entire FF page; simplify logic.
This commit is contained in:
@@ -49,13 +49,13 @@ enum class Key: uint16_t {
|
||||
//
|
||||
// Break; a key, but not on the keyboard matrix.
|
||||
//
|
||||
Break = 0xfffc,
|
||||
Break = 0xfe00,
|
||||
|
||||
//
|
||||
// Fictional keys to aid key entry.
|
||||
//
|
||||
SwitchOffCaps = 0xfffb,
|
||||
RestoreCaps = 0xfffa,
|
||||
SwitchOffCaps = 0xfe01,
|
||||
RestoreCaps = 0xfe02,
|
||||
|
||||
//
|
||||
// Master only keys.
|
||||
|
||||
@@ -30,9 +30,8 @@ enum Key: uint16_t {
|
||||
KeyShift = 0x00d0 | 0x08, KeyControl = 0x00d0 | 0x04, KeyFunc = 0x00d0 | 0x02, KeyEscape = 0x00d0 | 0x01,
|
||||
|
||||
// Virtual keys.
|
||||
KeyF1 = 0xfff0, KeyF2, KeyF3, KeyF4, KeyF5, KeyF6, KeyF7, KeyF8, KeyF9, KeyF0,
|
||||
|
||||
KeyBreak = 0xfffc,
|
||||
KeyF1 = 0xfe00, KeyF2, KeyF3, KeyF4, KeyF5, KeyF6, KeyF7, KeyF8, KeyF9, KeyF0,
|
||||
KeyBreak,
|
||||
};
|
||||
|
||||
constexpr bool is_modifier(const Key key) {
|
||||
|
||||
@@ -36,15 +36,15 @@ enum Key: uint16_t {
|
||||
Key9 = key(0, 0x10), KeyPlus = key(0, 0x20), KeyGBP = key(0, 0x40), KeyDelete = key(0, 0x80),
|
||||
|
||||
// Virtual keys.
|
||||
KeyUp = 0xfff0,
|
||||
KeyLeft = 0xfff1,
|
||||
KeyF2 = 0xfff2,
|
||||
KeyF4 = 0xfff3,
|
||||
KeyF6 = 0xfff4,
|
||||
KeyF8 = 0xfff5,
|
||||
KeyUp = 0xfe00,
|
||||
KeyLeft,
|
||||
KeyF2,
|
||||
KeyF4,
|
||||
KeyF6,
|
||||
KeyF8,
|
||||
|
||||
// Physical keys not within the usual matrix.
|
||||
KeyRestore = 0xfffc,
|
||||
KeyRestore,
|
||||
};
|
||||
|
||||
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||
|
||||
@@ -31,8 +31,8 @@ enum Key: uint16_t {
|
||||
KeyEquals = 0x0700 | 0x80, KeyReturn = 0x0700 | 0x20, KeyRightShift = 0x0700 | 0x10,
|
||||
KeyForwardSlash = 0x0700 | 0x08, Key0 = 0x0700 | 0x04, KeyL = 0x0700 | 0x02, Key8 = 0x0700 | 0x01,
|
||||
|
||||
KeyNMI = 0xfffc,
|
||||
KeyJasminReset = 0xfffb,
|
||||
KeyNMI = 0xfe00,
|
||||
KeyJasminReset,
|
||||
};
|
||||
|
||||
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||
|
||||
@@ -107,15 +107,12 @@ uint16_t Typer::try_type_next_character() {
|
||||
++phase_;
|
||||
}
|
||||
|
||||
// If the sequence is over, stop.
|
||||
if(sequence[phase_ - 2] == MachineTypes::MappedKeyboardMachine::KeyEndSequence) {
|
||||
return MachineTypes::MappedKeyboardMachine::KeyEndSequence;
|
||||
// Don't forward ::KeyEndSequence.
|
||||
const auto next = sequence[phase_ - 2];
|
||||
if(next != MachineTypes::MappedKeyboardMachine::KeyEndSequence) {
|
||||
delegate_->set_key_state(sequence[phase_ - 2], true);
|
||||
}
|
||||
|
||||
// Otherwise, type the key.
|
||||
delegate_->set_key_state(sequence[phase_ - 2], true);
|
||||
|
||||
return sequence[phase_ - 2];
|
||||
return next;
|
||||
}
|
||||
|
||||
bool Typer::type_next_character() {
|
||||
|
||||
Reference in New Issue
Block a user