From 16b646ad2e45624f6e844ff3f02049c79f4ea806 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 25 Dec 2023 18:43:35 -0500 Subject: [PATCH 1/2] Treat reset as a continuing state. --- Machines/PCCompatible/PCCompatible.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Machines/PCCompatible/PCCompatible.cpp b/Machines/PCCompatible/PCCompatible.cpp index c0ce68025..3bed28766 100644 --- a/Machines/PCCompatible/PCCompatible.cpp +++ b/Machines/PCCompatible/PCCompatible.cpp @@ -362,19 +362,26 @@ 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) { + printf("Mode: %02x\n", 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 +410,7 @@ class KeyboardController { } void post(uint8_t value) { - if(mode_ == Mode::NoIRQsIgnoreInput) { + if(mode_ != Mode::NormalOperation || reset_delay_) { return; } input_.push_back(value); From 14e9ae014cb18bf89699c4159035915391d44214 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 25 Dec 2023 18:44:11 -0500 Subject: [PATCH 2/2] Remove caveman log. --- Machines/PCCompatible/PCCompatible.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Machines/PCCompatible/PCCompatible.cpp b/Machines/PCCompatible/PCCompatible.cpp index 3bed28766..fb51daf42 100644 --- a/Machines/PCCompatible/PCCompatible.cpp +++ b/Machines/PCCompatible/PCCompatible.cpp @@ -362,7 +362,6 @@ 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) { - printf("Mode: %02x\n", mode); const auto last_mode = mode_; mode_ = Mode(mode); switch(mode_) {