mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-25 03:32:01 +00:00
Treat reset as a continuing state.
This commit is contained in:
parent
35f000f93c
commit
16b646ad2e
@ -362,19 +362,26 @@ class KeyboardController {
|
|||||||
//; 00 - force clock line low, resetting keyboard, but on a 01->00 transition,
|
//; 00 - force clock line low, resetting keyboard, but on a 01->00 transition,
|
||||||
//; IRQ1 would remain high
|
//; IRQ1 would remain high
|
||||||
void set_mode(uint8_t mode) {
|
void set_mode(uint8_t mode) {
|
||||||
|
printf("Mode: %02x\n", mode);
|
||||||
|
const auto last_mode = mode_;
|
||||||
mode_ = Mode(mode);
|
mode_ = Mode(mode);
|
||||||
switch(mode_) {
|
switch(mode_) {
|
||||||
case Mode::NormalOperation: break;
|
case Mode::NormalOperation: break;
|
||||||
case Mode::NoIRQsIgnoreInput:
|
case Mode::NoIRQsIgnoreInput:
|
||||||
pic_.apply_edge<1>(false);
|
pic_.apply_edge<1>(false);
|
||||||
break;
|
break;
|
||||||
|
case Mode::Reset:
|
||||||
|
input_.clear();
|
||||||
|
[[fallthrough]];
|
||||||
case Mode::ClearIRQReset:
|
case Mode::ClearIRQReset:
|
||||||
pic_.apply_edge<1>(false);
|
pic_.apply_edge<1>(false);
|
||||||
[[fallthrough]];
|
|
||||||
case Mode::Reset:
|
|
||||||
reset_delay_ = 15; // Arbitrarily.
|
|
||||||
break;
|
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) {
|
void run_for(Cycles cycles) {
|
||||||
@ -403,7 +410,7 @@ class KeyboardController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void post(uint8_t value) {
|
void post(uint8_t value) {
|
||||||
if(mode_ == Mode::NoIRQsIgnoreInput) {
|
if(mode_ != Mode::NormalOperation || reset_delay_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
input_.push_back(value);
|
input_.push_back(value);
|
||||||
|
Loading…
Reference in New Issue
Block a user