mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Reinstated typing ability, albeit with an ugly inline insertion. But I think I can defer dealing with typers to another pull request. The whole issue of keyboard mapping probably needs reappraisal.
This commit is contained in:
parent
681d1e2f8d
commit
8e0736fbe6
@ -27,6 +27,7 @@ namespace {
|
||||
namespace ZX8081 {
|
||||
|
||||
class ConcreteMachine:
|
||||
public Utility::TypeRecipient,
|
||||
public CPU::Z80::BusHandler,
|
||||
public Machine {
|
||||
public:
|
||||
@ -318,7 +319,148 @@ class ConcreteMachine:
|
||||
HalfCycles get_typer_frequency() { return Cycles(390000); }
|
||||
|
||||
uint16_t *sequence_for_character(Utility::Typer *typer, char character) {
|
||||
return nullptr;
|
||||
#define KEYS(...) {__VA_ARGS__, EndSequence}
|
||||
#define SHIFT(...) {KeyShift, __VA_ARGS__, EndSequence}
|
||||
#define X {NotMapped}
|
||||
static KeySequence zx81_key_sequences[] = {
|
||||
/* NUL */ X, /* SOH */ X,
|
||||
/* STX */ X, /* ETX */ X,
|
||||
/* EOT */ X, /* ENQ */ X,
|
||||
/* ACK */ X, /* BEL */ X,
|
||||
/* BS */ SHIFT(Key0), /* HT */ X,
|
||||
/* LF */ KEYS(KeyEnter), /* VT */ X,
|
||||
/* FF */ X, /* CR */ X,
|
||||
/* 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,
|
||||
/* space */ KEYS(KeySpace), /* ! */ X,
|
||||
/* " */ SHIFT(KeyP), /* # */ X,
|
||||
/* $ */ SHIFT(KeyU), /* % */ X,
|
||||
/* & */ X, /* ' */ X,
|
||||
/* ( */ SHIFT(KeyI), /* ) */ SHIFT(KeyO),
|
||||
/* * */ SHIFT(KeyB), /* + */ SHIFT(KeyK),
|
||||
/* , */ SHIFT(KeyDot), /* - */ SHIFT(KeyJ),
|
||||
/* . */ KEYS(KeyDot), /* / */ SHIFT(KeyV),
|
||||
/* 0 */ KEYS(Key0), /* 1 */ KEYS(Key1),
|
||||
/* 2 */ KEYS(Key2), /* 3 */ KEYS(Key3),
|
||||
/* 4 */ KEYS(Key4), /* 5 */ KEYS(Key5),
|
||||
/* 6 */ KEYS(Key6), /* 7 */ KEYS(Key7),
|
||||
/* 8 */ KEYS(Key8), /* 9 */ KEYS(Key9),
|
||||
/* : */ SHIFT(KeyZ), /* ; */ SHIFT(KeyX),
|
||||
/* < */ SHIFT(KeyN), /* = */ SHIFT(KeyL),
|
||||
/* > */ SHIFT(KeyM), /* ? */ SHIFT(KeyC),
|
||||
/* @ */ X, /* A */ KEYS(KeyA),
|
||||
/* B */ KEYS(KeyB), /* C */ KEYS(KeyC),
|
||||
/* D */ KEYS(KeyD), /* E */ KEYS(KeyE),
|
||||
/* F */ KEYS(KeyF), /* G */ KEYS(KeyG),
|
||||
/* H */ KEYS(KeyH), /* I */ KEYS(KeyI),
|
||||
/* J */ KEYS(KeyJ), /* K */ KEYS(KeyK),
|
||||
/* L */ KEYS(KeyL), /* M */ KEYS(KeyM),
|
||||
/* N */ KEYS(KeyN), /* O */ KEYS(KeyO),
|
||||
/* P */ KEYS(KeyP), /* Q */ KEYS(KeyQ),
|
||||
/* R */ KEYS(KeyR), /* S */ KEYS(KeyS),
|
||||
/* T */ KEYS(KeyT), /* U */ KEYS(KeyU),
|
||||
/* V */ KEYS(KeyV), /* W */ KEYS(KeyW),
|
||||
/* X */ KEYS(KeyX), /* Y */ KEYS(KeyY),
|
||||
/* Z */ KEYS(KeyZ), /* [ */ X,
|
||||
/* \ */ X, /* ] */ X,
|
||||
/* ^ */ X, /* _ */ X,
|
||||
/* ` */ X, /* a */ KEYS(KeyA),
|
||||
/* b */ KEYS(KeyB), /* c */ KEYS(KeyC),
|
||||
/* d */ KEYS(KeyD), /* e */ KEYS(KeyE),
|
||||
/* f */ KEYS(KeyF), /* g */ KEYS(KeyG),
|
||||
/* h */ KEYS(KeyH), /* i */ KEYS(KeyI),
|
||||
/* j */ KEYS(KeyJ), /* k */ KEYS(KeyK),
|
||||
/* l */ KEYS(KeyL), /* m */ KEYS(KeyM),
|
||||
/* n */ KEYS(KeyN), /* o */ KEYS(KeyO),
|
||||
/* p */ KEYS(KeyP), /* q */ KEYS(KeyQ),
|
||||
/* r */ KEYS(KeyR), /* s */ KEYS(KeyS),
|
||||
/* t */ KEYS(KeyT), /* u */ KEYS(KeyU),
|
||||
/* v */ KEYS(KeyV), /* w */ KEYS(KeyW),
|
||||
/* x */ KEYS(KeyX), /* y */ KEYS(KeyY),
|
||||
/* z */ KEYS(KeyZ), /* { */ X,
|
||||
/* | */ X, /* } */ X,
|
||||
};
|
||||
|
||||
static KeySequence zx80_key_sequences[] = {
|
||||
/* NUL */ X, /* SOH */ X,
|
||||
/* STX */ X, /* ETX */ X,
|
||||
/* EOT */ X, /* ENQ */ X,
|
||||
/* ACK */ X, /* BEL */ X,
|
||||
/* BS */ SHIFT(Key0), /* HT */ X,
|
||||
/* LF */ KEYS(KeyEnter), /* VT */ X,
|
||||
/* FF */ X, /* CR */ X,
|
||||
/* 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,
|
||||
/* space */ KEYS(KeySpace), /* ! */ X,
|
||||
/* " */ SHIFT(KeyY), /* # */ X,
|
||||
/* $ */ SHIFT(KeyU), /* % */ X,
|
||||
/* & */ X, /* ' */ X,
|
||||
/* ( */ SHIFT(KeyI), /* ) */ SHIFT(KeyO),
|
||||
/* * */ SHIFT(KeyP), /* + */ SHIFT(KeyK),
|
||||
/* , */ SHIFT(KeyDot), /* - */ SHIFT(KeyJ),
|
||||
/* . */ KEYS(KeyDot), /* / */ SHIFT(KeyV),
|
||||
/* 0 */ KEYS(Key0), /* 1 */ KEYS(Key1),
|
||||
/* 2 */ KEYS(Key2), /* 3 */ KEYS(Key3),
|
||||
/* 4 */ KEYS(Key4), /* 5 */ KEYS(Key5),
|
||||
/* 6 */ KEYS(Key6), /* 7 */ KEYS(Key7),
|
||||
/* 8 */ KEYS(Key8), /* 9 */ KEYS(Key9),
|
||||
/* : */ SHIFT(KeyZ), /* ; */ SHIFT(KeyX),
|
||||
/* < */ SHIFT(KeyN), /* = */ SHIFT(KeyL),
|
||||
/* > */ SHIFT(KeyM), /* ? */ SHIFT(KeyC),
|
||||
/* @ */ X, /* A */ KEYS(KeyA),
|
||||
/* B */ KEYS(KeyB), /* C */ KEYS(KeyC),
|
||||
/* D */ KEYS(KeyD), /* E */ KEYS(KeyE),
|
||||
/* F */ KEYS(KeyF), /* G */ KEYS(KeyG),
|
||||
/* H */ KEYS(KeyH), /* I */ KEYS(KeyI),
|
||||
/* J */ KEYS(KeyJ), /* K */ KEYS(KeyK),
|
||||
/* L */ KEYS(KeyL), /* M */ KEYS(KeyM),
|
||||
/* N */ KEYS(KeyN), /* O */ KEYS(KeyO),
|
||||
/* P */ KEYS(KeyP), /* Q */ KEYS(KeyQ),
|
||||
/* R */ KEYS(KeyR), /* S */ KEYS(KeyS),
|
||||
/* T */ KEYS(KeyT), /* U */ KEYS(KeyU),
|
||||
/* V */ KEYS(KeyV), /* W */ KEYS(KeyW),
|
||||
/* X */ KEYS(KeyX), /* Y */ KEYS(KeyY),
|
||||
/* Z */ KEYS(KeyZ), /* [ */ X,
|
||||
/* \ */ X, /* ] */ X,
|
||||
/* ^ */ X, /* _ */ X,
|
||||
/* ` */ X, /* a */ KEYS(KeyA),
|
||||
/* b */ KEYS(KeyB), /* c */ KEYS(KeyC),
|
||||
/* d */ KEYS(KeyD), /* e */ KEYS(KeyE),
|
||||
/* f */ KEYS(KeyF), /* g */ KEYS(KeyG),
|
||||
/* h */ KEYS(KeyH), /* i */ KEYS(KeyI),
|
||||
/* j */ KEYS(KeyJ), /* k */ KEYS(KeyK),
|
||||
/* l */ KEYS(KeyL), /* m */ KEYS(KeyM),
|
||||
/* n */ KEYS(KeyN), /* o */ KEYS(KeyO),
|
||||
/* p */ KEYS(KeyP), /* q */ KEYS(KeyQ),
|
||||
/* r */ KEYS(KeyR), /* s */ KEYS(KeyS),
|
||||
/* t */ KEYS(KeyT), /* u */ KEYS(KeyU),
|
||||
/* v */ KEYS(KeyV), /* w */ KEYS(KeyW),
|
||||
/* x */ KEYS(KeyX), /* y */ KEYS(KeyY),
|
||||
/* z */ KEYS(KeyZ), /* { */ X,
|
||||
/* | */ X, /* } */ X,
|
||||
};
|
||||
#undef KEYS
|
||||
#undef SHIFT
|
||||
#undef X
|
||||
|
||||
if(is_zx81_)
|
||||
return table_lookup_sequence_for_character(zx81_key_sequences, sizeof(zx81_key_sequences), character);
|
||||
else
|
||||
return table_lookup_sequence_for_character(zx80_key_sequences, sizeof(zx80_key_sequences), character);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -32,7 +32,6 @@ enum Key: uint16_t {
|
||||
|
||||
class Machine:
|
||||
public CRTMachine::Machine,
|
||||
public Utility::TypeRecipient,
|
||||
public ConfigurationTarget::Machine {
|
||||
public:
|
||||
static Machine *ZX8081();
|
||||
|
Loading…
Reference in New Issue
Block a user