1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Optimises Electron typer speed.

This commit is contained in:
Thomas Harte 2020-02-29 19:26:15 -05:00
parent 41d2062342
commit 3c103506c9
3 changed files with 12 additions and 5 deletions

View File

@ -405,11 +405,11 @@ class ConcreteMachine:
}
HalfCycles get_typer_delay() final {
return m6502_.get_is_resetting() ? Cycles(625*25*128) : Cycles(0); // wait one second if resetting
return m6502_.get_is_resetting() ? Cycles(750'000) : Cycles(0);
}
HalfCycles get_typer_frequency() final {
return Cycles(625*128*2); // accept a new character every two frames
return Cycles(60'000);
}
void type_string(const std::string &string) final {

View File

@ -66,7 +66,7 @@ uint16_t *CharacterMapper::sequence_for_character(char character) {
/* ACK */ X, /* BEL */ X,
/* BS */ KEYS(KeyDelete), /* HT */ X,
/* LF */ KEYS(KeyReturn), /* VT */ X,
/* FF */ X, /* CR */ X,
/* FF */ X, /* CR */ KEYS(KeyReturn),
/* SO */ X, /* SI */ X,
/* DLE */ X, /* DC1 */ X,
/* DC2 */ X, /* DC3 */ X,
@ -123,7 +123,7 @@ uint16_t *CharacterMapper::sequence_for_character(char character) {
/* x */ SHIFT(KeyX), /* y */ SHIFT(KeyY),
/* z */ SHIFT(KeyZ), /* { */ CTRL(KeyUp),
/* | */ SHIFT(KeyRight), /* } */ CTRL(KeyDown),
/* ~ */ CTRL(KeyLeft)
/* ~ */ CTRL(KeyLeft), /* DEL */ KEYS(KeyDelete),
};
#undef KEYS
#undef SHIFT
@ -131,3 +131,7 @@ uint16_t *CharacterMapper::sequence_for_character(char character) {
return table_lookup_sequence_for_character(key_sequences, sizeof(key_sequences), character);
}
bool CharacterMapper::needs_pause_after_key(uint16_t key) {
return key != KeyControl && key != KeyShift && key != KeyFunc;
}

View File

@ -38,7 +38,10 @@ struct KeyboardMapper: public KeyboardMachine::MappedMachine::KeyboardMapper {
};
struct CharacterMapper: public ::Utility::CharacterMapper {
uint16_t *sequence_for_character(char character);
uint16_t *sequence_for_character(char character) override;
bool needs_pause_after_reset_all_keys() override { return false; }
bool needs_pause_after_key(uint16_t key) override;
};
};