diff --git a/Machines/Acorn/BBCMicro/Keyboard.hpp b/Machines/Acorn/BBCMicro/Keyboard.hpp index 6b12ad4c7..b2c888c50 100644 --- a/Machines/Acorn/BBCMicro/Keyboard.hpp +++ b/Machines/Acorn/BBCMicro/Keyboard.hpp @@ -49,7 +49,7 @@ enum class BBCKey: uint16_t { // // Break; a key, but not on the keyboard matrix. // - Break = 0xfffd, + Break = 0xfffc, // // Master only keys. diff --git a/Machines/Acorn/Electron/Keyboard.cpp b/Machines/Acorn/Electron/Keyboard.cpp index 7c972f3b9..b710c26d9 100644 --- a/Machines/Acorn/Electron/Keyboard.cpp +++ b/Machines/Acorn/Electron/Keyboard.cpp @@ -10,7 +10,7 @@ using namespace Electron; -uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const { +uint16_t KeyboardMapper::mapped_key_for_key(const Inputs::Keyboard::Key key) const { #define BIND(source, dest) case Inputs::Keyboard::Key::source: return Electron::Key::dest switch(key) { default: break; @@ -70,7 +70,7 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const { return MachineTypes::MappedKeyboardMachine::KeyNotMapped; } -const uint16_t *CharacterMapper::sequence_for_character(char character) const { +const uint16_t *CharacterMapper::sequence_for_character(const char character) const { #define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence} #define SHIFT(...) {KeyShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence} #define CTRL(...) {KeyControl, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence} @@ -148,6 +148,6 @@ const uint16_t *CharacterMapper::sequence_for_character(char character) const { return table_lookup_sequence_for_character(key_sequences, character); } -bool CharacterMapper::needs_pause_after_key(uint16_t key) const { +bool CharacterMapper::needs_pause_after_key(const uint16_t key) const { return !is_modifier(Key(key)); } diff --git a/Machines/Acorn/Electron/Keyboard.hpp b/Machines/Acorn/Electron/Keyboard.hpp index fcb25d042..1b1baf20e 100644 --- a/Machines/Acorn/Electron/Keyboard.hpp +++ b/Machines/Acorn/Electron/Keyboard.hpp @@ -32,7 +32,7 @@ enum Key: uint16_t { // Virtual keys. KeyF1 = 0xfff0, KeyF2, KeyF3, KeyF4, KeyF5, KeyF6, KeyF7, KeyF8, KeyF9, KeyF0, - KeyBreak = 0xfffd, + KeyBreak = 0xfffc, }; constexpr bool is_modifier(const Key key) { diff --git a/Machines/Commodore/Vic-20/Keyboard.hpp b/Machines/Commodore/Vic-20/Keyboard.hpp index efdc9b5a1..2d2eca599 100644 --- a/Machines/Commodore/Vic-20/Keyboard.hpp +++ b/Machines/Commodore/Vic-20/Keyboard.hpp @@ -44,7 +44,7 @@ enum Key: uint16_t { KeyF8 = 0xfff5, // Physical keys not within the usual matrix. - KeyRestore = 0xfffd, + KeyRestore = 0xfffc, }; struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper { diff --git a/Machines/KeyboardMachine.hpp b/Machines/KeyboardMachine.hpp index 5fc8b37b6..d8944bb52 100644 --- a/Machines/KeyboardMachine.hpp +++ b/Machines/KeyboardMachine.hpp @@ -137,6 +137,12 @@ public: */ static constexpr uint16_t KeyNotMapped = 0xfffe; + /*! + Indicates that a key is not mapped (for the keyboard mapper) or that a + character cannot be typed (for the character mapper). + */ + static constexpr uint16_t DelaySlot = 0xfffd; + /*! Allows individual machines to provide the mapping between host keys as per Inputs::Keyboard and their native scheme. diff --git a/Machines/Oric/Keyboard.hpp b/Machines/Oric/Keyboard.hpp index 0468f5a0f..e7173f9ca 100644 --- a/Machines/Oric/Keyboard.hpp +++ b/Machines/Oric/Keyboard.hpp @@ -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 = 0xfffd, - KeyJasminReset = 0xfffc, + KeyNMI = 0xfffc, + KeyJasminReset = 0xfffb, }; struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper { diff --git a/Machines/Utility/Typer.cpp b/Machines/Utility/Typer.cpp index bb1b6e53f..4396530ee 100644 --- a/Machines/Utility/Typer.cpp +++ b/Machines/Utility/Typer.cpp @@ -96,7 +96,7 @@ uint16_t Typer::try_type_next_character() { delegate_->clear_all_keys(); if(character_mapper_.needs_pause_after_reset_all_keys() || (string_pointer_ > 0 && string_[string_pointer_ - 1] == string_[string_pointer_])) { - return 0xffff; // Arbitrarily. Anything non-zero will do. + return MachineTypes::MappedKeyboardMachine::DelaySlot; } ++phase_; }