1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-02 20:30:00 +00:00

Switch to acknowledgement-after.

This commit is contained in:
Thomas Harte 2024-03-26 14:06:11 -04:00
parent 3ba12630ab
commit bd4ef5ec57

View File

@ -93,7 +93,7 @@ void Bus::signal(Event event) {
const auto enqueue = [&](std::optional<uint8_t> next) { const auto enqueue = [&](std::optional<uint8_t> next) {
if(next) { if(next) {
peripheral_response_ = *next; peripheral_response_ = static_cast<uint16_t>((*next) << 1);
peripheral_bits_ = 9; peripheral_bits_ = 9;
set_state(State::PostingByte); set_state(State::PostingByte);
} else { } else {
@ -131,7 +131,9 @@ void Bus::signal(Event event) {
active_peripheral_->start(input_ & 1); active_peripheral_->start(input_ & 1);
if(input_&1) { if(input_&1) {
enqueue(active_peripheral_->read()); acknowledge();
set_state(State::PostingByte);
// enqueue(active_peripheral_->read());
} else { } else {
acknowledge(); acknowledge();
set_state(State::ReceivingByte); set_state(State::ReceivingByte);
@ -162,6 +164,7 @@ void Bus::signal(Event event) {
return; return;
} }
// Add a new byte (including its acknowledge bit).
enqueue(active_peripheral_->read()); enqueue(active_peripheral_->read());
break; break;
} }