From 52b96db2b9a97d8d2effc7956b4d5d0861e08155 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 1 Jul 2021 21:18:15 -0400 Subject: [PATCH] Correct syntax, mapping and inter-key timing. --- Machines/Enterprise/Enterprise.cpp | 2 +- Machines/Enterprise/Keyboard.cpp | 96 +++++++++++++++--------------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Machines/Enterprise/Enterprise.cpp b/Machines/Enterprise/Enterprise.cpp index 528c6cacc..0a2fe1f15 100644 --- a/Machines/Enterprise/Enterprise.cpp +++ b/Machines/Enterprise/Enterprise.cpp @@ -590,7 +590,7 @@ template class ConcreteMachine: } HalfCycles get_typer_frequency() const final { - return HalfCycles(60'000); + return HalfCycles(80'000); } void type_string(const std::string &string) final { diff --git a/Machines/Enterprise/Keyboard.cpp b/Machines/Enterprise/Keyboard.cpp index 56e0b81dd..c14156054 100644 --- a/Machines/Enterprise/Keyboard.cpp +++ b/Machines/Enterprise/Keyboard.cpp @@ -76,26 +76,26 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const { const uint16_t *CharacterMapper::sequence_for_character(char character) const { #define KEYS(x) {uint16_t(x), MachineTypes::MappedKeyboardMachine::KeyEndSequence} #define SHIFT(x) {uint16_t(Key::LeftShift), uint16_t(x), MachineTypes::MappedKeyboardMachine::KeyEndSequence} -#define X {MachineTypes::MappedKeyboardMachine::KeyNotMapped} +#define _ {MachineTypes::MappedKeyboardMachine::KeyNotMapped} static KeySequence key_sequences[] = { - /* NUL */ X, /* SOH */ X, - /* STX */ X, /* ETX */ X, - /* EOT */ X, /* ENQ */ X, - /* ACK */ X, /* BEL */ X, - /* BS */ KEYS(Key::Erase), /* HT */ X, - /* LF */ KEYS(Key::Enter), /* VT */ X, - /* FF */ X, /* CR */ KEYS(Key::Enter), - /* SO */ X, /* SI */ X, - /* DLE */ X, /* DC1 */ X, - /* DC2 */ X, /* DC3 */ X, - /* DC4 */ X, /* NAK */ X, - /* SYN */ X, /* ETB */ X, - /* CAN */ X, /* EM */ X, - /* SUB */ X, /* ESC */ X, - /* FS */ X, /* GS */ X, - /* RS */ X, /* US */ X, + /* NUL */ _, /* SOH */ _, + /* STX */ _, /* ETX */ _, + /* EOT */ _, /* ENQ */ _, + /* ACK */ _, /* BEL */ _, + /* BS */ KEYS(Key::Erase), /* HT */ KEYS(Key::Tab), + /* LF */ KEYS(Key::Enter), /* VT */ _, + /* FF */ _, /* CR */ KEYS(Key::Enter), + /* SO */ _, /* SI */ _, + /* DLE */ _, /* DC1 */ _, + /* DC2 */ _, /* DC3 */ _, + /* DC4 */ _, /* NAK */ _, + /* SYN */ _, /* ETB */ _, + /* CAN */ _, /* EM */ _, + /* SUB */ _, /* ESC */ KEYS(Key::Escape), + /* FS */ _, /* GS */ _, + /* RS */ _, /* US */ _, /* space */ KEYS(Key::Space), /* ! */ SHIFT(Key::k1), - /* " */ SHIFT(Key::k2), /* # */ X, + /* " */ SHIFT(Key::k2), /* # */ _, /* $ */ SHIFT(Key::k4), /* % */ SHIFT(Key::k5), /* & */ SHIFT(Key::k6), /* ' */ SHIFT(Key::k7), /* ( */ SHIFT(Key::k8), /* ) */ SHIFT(Key::k9), @@ -110,42 +110,42 @@ const uint16_t *CharacterMapper::sequence_for_character(char character) const { /* : */ KEYS(Key::Colon), /* ; */ KEYS(Key::Semicolon), /* < */ SHIFT(Key::Comma), /* = */ SHIFT(Key::Hyphen), /* > */ SHIFT(Key::FullStop), /* ? */ SHIFT(Key::ForwardSlash), - /* @ */ KEYS(Key::At), /* A */ KEYS(Key::A), - /* B */ KEYS(Key::B), /* C */ KEYS(Key::C), - /* D */ KEYS(Key::D), /* E */ KEYS(Key::E), - /* F */ KEYS(Key::F), /* G */ KEYS(Key::G), - /* H */ KEYS(Key::H), /* I */ KEYS(Key::I), - /* J */ KEYS(Key::J), /* K */ KEYS(Key::K), - /* L */ KEYS(Key::L), /* M */ KEYS(Key::M), - /* N */ KEYS(Key::N), /* O */ KEYS(Key::O), - /* P */ KEYS(Key::P), /* Q */ KEYS(Key::Q), - /* R */ KEYS(Key::R), /* S */ KEYS(Key::S), - /* T */ KEYS(Key::T), /* U */ KEYS(Key::U), - /* V */ KEYS(Key::V), /* W */ KEYS(Key::W), - /* X */ KEYS(Key::X), /* Y */ KEYS(Key::Y), - /* Z */ KEYS(Key::Z), /* [ */ KEYS(Key::OpenSquareBracket), + /* @ */ KEYS(Key::At), /* A */ SHIFT(Key::A), + /* B */ SHIFT(Key::B), /* C */ SHIFT(Key::C), + /* D */ SHIFT(Key::D), /* E */ SHIFT(Key::E), + /* F */ SHIFT(Key::F), /* G */ SHIFT(Key::G), + /* H */ SHIFT(Key::H), /* I */ SHIFT(Key::I), + /* J */ SHIFT(Key::J), /* K */ SHIFT(Key::K), + /* L */ SHIFT(Key::L), /* M */ SHIFT(Key::M), + /* N */ SHIFT(Key::N), /* O */ SHIFT(Key::O), + /* P */ SHIFT(Key::P), /* Q */ SHIFT(Key::Q), + /* R */ SHIFT(Key::R), /* S */ SHIFT(Key::S), + /* T */ SHIFT(Key::T), /* U */ SHIFT(Key::U), + /* V */ SHIFT(Key::V), /* W */ SHIFT(Key::W), + /* X */ SHIFT(Key::X), /* Y */ SHIFT(Key::Y), + /* Z */ SHIFT(Key::Z), /* [ */ KEYS(Key::OpenSquareBracket), /* \ */ KEYS(Key::Backslash), /* ] */ KEYS(Key::CloseSquareBracket), /* ^ */ SHIFT(Key::Caret), /* _ */ SHIFT(Key::k0), - /* ` */ SHIFT(Key::At), /* a */ SHIFT(Key::A), - /* b */ SHIFT(Key::B), /* c */ SHIFT(Key::C), - /* d */ SHIFT(Key::D), /* e */ SHIFT(Key::E), - /* f */ SHIFT(Key::F), /* g */ SHIFT(Key::G), - /* h */ SHIFT(Key::H), /* i */ SHIFT(Key::I), - /* j */ SHIFT(Key::J), /* k */ SHIFT(Key::K), - /* l */ SHIFT(Key::L), /* m */ SHIFT(Key::M), - /* n */ SHIFT(Key::N), /* o */ SHIFT(Key::O), - /* p */ SHIFT(Key::P), /* q */ SHIFT(Key::Q), - /* r */ SHIFT(Key::R), /* s */ SHIFT(Key::S), - /* t */ SHIFT(Key::T), /* u */ SHIFT(Key::U), - /* v */ SHIFT(Key::V), /* w */ SHIFT(Key::W), - /* x */ SHIFT(Key::X), /* y */ SHIFT(Key::Y), - /* z */ SHIFT(Key::Z), /* { */ SHIFT(Key::OpenSquareBracket), + /* ` */ SHIFT(Key::At), /* a */ KEYS(Key::A), + /* b */ KEYS(Key::B), /* c */ KEYS(Key::C), + /* d */ KEYS(Key::D), /* e */ KEYS(Key::E), + /* f */ KEYS(Key::F), /* g */ KEYS(Key::G), + /* h */ KEYS(Key::H), /* i */ KEYS(Key::I), + /* j */ KEYS(Key::J), /* k */ KEYS(Key::K), + /* l */ KEYS(Key::L), /* m */ KEYS(Key::M), + /* n */ KEYS(Key::N), /* o */ KEYS(Key::O), + /* p */ KEYS(Key::P), /* q */ KEYS(Key::Q), + /* r */ KEYS(Key::R), /* s */ KEYS(Key::S), + /* t */ KEYS(Key::T), /* u */ KEYS(Key::U), + /* v */ KEYS(Key::V), /* w */ KEYS(Key::W), + /* x */ KEYS(Key::X), /* y */ KEYS(Key::Y), + /* z */ KEYS(Key::Z), /* { */ SHIFT(Key::OpenSquareBracket), /* | */ SHIFT(Key::Backslash), /* } */ SHIFT(Key::CloseSquareBracket), /* ~ */ SHIFT(Key::Caret) }; -#undef KEYS +#undef _ #undef SHIFT -#undef X +#undef KEYS return table_lookup_sequence_for_character(key_sequences, character); }