1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 16:31:31 +00:00

Ensures updates even when the event queue is empty.

This commit is contained in:
Thomas Harte 2019-10-17 23:59:43 -04:00
parent 696af5c3a6
commit 2e86dada1d

View File

@ -16,6 +16,10 @@ void Line::set_writer_clock_rate(int clock_rate) {
void Line::advance_writer(int cycles) {
remaining_delays_ = std::max(remaining_delays_ - cycles, 0);
if(events_.empty()) {
write_cycles_since_delegate_call_ += cycles;
if(write_cycles_since_delegate_call_ > 256) update_delegate(level_);
} else {
while(!events_.empty()) {
if(events_.front().delay < cycles) {
cycles -= events_.front().delay;
@ -38,8 +42,7 @@ void Line::advance_writer(int cycles) {
break;
}
}
// TODO: some sort of ongoing update_delegate() ?
}
}
void Line::write(bool level) {