1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-08-15 14:27:29 +00:00

Limits sync counter size.

This commit is contained in:
Thomas Harte
2017-08-26 12:31:19 -04:00
parent 039aed1bd1
commit 3caa4705ca

View File

@@ -80,7 +80,7 @@ template <class T> class CRTC6845 {
while(cyles_remaining--) { while(cyles_remaining--) {
// check for end of horizontal sync // check for end of horizontal sync
if(bus_state_.hsync) { if(bus_state_.hsync) {
hsync_counter_++; hsync_counter_ = (hsync_counter_ + 1) & 15;
bus_state_.hsync = hsync_counter_ != (registers_[3] & 15); bus_state_.hsync = hsync_counter_ != (registers_[3] & 15);
} }
@@ -122,7 +122,7 @@ template <class T> class CRTC6845 {
inline void do_end_of_line() { inline void do_end_of_line() {
// check for end of vertical sync // check for end of vertical sync
if(bus_state_.vsync) { if(bus_state_.vsync) {
vsync_counter_++; vsync_counter_ = (vsync_counter_ + 1) & 15;
if(vsync_counter_ == (registers_[3] >> 4)) { if(vsync_counter_ == (registers_[3] >> 4)) {
bus_state_.vsync = false; bus_state_.vsync = false;
} }