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

Merge pull request #1287 from TomHarte/ResettingKeyboard

Treat XT keyboard reset as a continuing state.
This commit is contained in:
Thomas Harte 2023-12-25 19:01:41 -05:00 committed by GitHub
commit acee513cd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -362,19 +362,25 @@ class KeyboardController {
//; 00 - force clock line low, resetting keyboard, but on a 01->00 transition,
//; IRQ1 would remain high
void set_mode(uint8_t mode) {
const auto last_mode = mode_;
mode_ = Mode(mode);
switch(mode_) {
case Mode::NormalOperation: break;
case Mode::NoIRQsIgnoreInput:
pic_.apply_edge<1>(false);
break;
case Mode::Reset:
input_.clear();
[[fallthrough]];
case Mode::ClearIRQReset:
pic_.apply_edge<1>(false);
[[fallthrough]];
case Mode::Reset:
reset_delay_ = 15; // Arbitrarily.
break;
}
// If the reset condition ends, start a counter through until reset is complete.
if(last_mode == Mode::Reset && mode_ != Mode::Reset) {
reset_delay_ = 15; // Arbitrarily.
}
}
void run_for(Cycles cycles) {
@ -403,7 +409,7 @@ class KeyboardController {
}
void post(uint8_t value) {
if(mode_ == Mode::NoIRQsIgnoreInput) {
if(mode_ != Mode::NormalOperation || reset_delay_) {
return;
}
input_.push_back(value);