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

Ensures that vertical sync and end-of-visible-lines conditions potentially trigger whenever line_counter_ changes, not only when it increments.

This commit is contained in:
Thomas Harte 2017-08-26 17:54:54 -04:00
parent 6c5a03187b
commit 487fe83dca

View File

@ -75,9 +75,10 @@ template <class T> class CRTC6845 {
0xff, 0x1f, 0x7f, 0x1f, 0x3f, 0xff, 0x3f, 0xff 0xff, 0x1f, 0x7f, 0x1f, 0x3f, 0xff, 0x3f, 0xff
}; };
if(selected_register_ < 16) if(selected_register_ < 16) {
registers_[selected_register_] = value & masks[selected_register_]; registers_[selected_register_] = value & masks[selected_register_];
} }
}
void trigger_light_pen() { void trigger_light_pen() {
registers_[17] = bus_state_.refresh_address & 0xff; registers_[17] = bus_state_.refresh_address & 0xff;
@ -170,6 +171,10 @@ template <class T> class CRTC6845 {
} }
} else { } else {
line_counter_ = (line_counter_ + 1) & 0x7f; line_counter_ = (line_counter_ + 1) & 0x7f;
}
} else {
bus_state_.row_address = (bus_state_.row_address + 1) & 0x1f;
}
// check for start of vertical sync // check for start of vertical sync
if(line_counter_ == registers_[7]) { if(line_counter_ == registers_[7]) {
@ -182,10 +187,6 @@ template <class T> class CRTC6845 {
line_is_visible_ = false; line_is_visible_ = false;
} }
} }
} else {
bus_state_.row_address = (bus_state_.row_address + 1) & 0x1f;
}
}
bus_state_.refresh_address = line_address_; bus_state_.refresh_address = line_address_;
character_counter_ = 0; character_counter_ = 0;