1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-16 18:30:32 +00:00

Shift output even if nobody is listening.

This commit is contained in:
Thomas Harte 2020-11-11 20:04:48 -05:00
parent a15af1df5e
commit 80358cf5bd

View File

@ -263,13 +263,14 @@ void IWM::run_for(const Cycles cycles) {
} break;
case ShiftMode::Writing:
if(drives_[active_drive_] && drives_[active_drive_]->is_writing()) {
while(cycles_since_shift_ + integer_cycles >= bit_length_) {
const auto cycles_until_write = bit_length_ - cycles_since_shift_;
if(drives_[active_drive_]) {
drives_[active_drive_]->run_for(cycles_until_write);
// Output a flux transition if the top bit is set.
drives_[active_drive_]->write_bit(shift_register_ & 0x80);
}
shift_register_ <<= 1;
integer_cycles -= cycles_until_write.as_integral();
@ -284,8 +285,7 @@ void IWM::run_for(const Cycles cycles) {
// LOG("Next byte: " << PADHEX(2) << int(shift_register_));
} else {
write_handshake_ &= ~0x40;
drives_[active_drive_]->end_writing();
// printf("\n");
if(drives_[active_drive_]) drives_[active_drive_]->end_writing();
LOG("Overrun; done.");
select_shift_mode();
}
@ -296,9 +296,6 @@ void IWM::run_for(const Cycles cycles) {
if(drives_[active_drive_] && integer_cycles) {
drives_[active_drive_]->run_for(cycles_since_shift_);
}
} else {
if(drives_[active_drive_]) drives_[active_drive_]->run_for(cycles);
}
break;
case ShiftMode::CheckingWriteProtect: