From 3caa4705cae22bc9115d9649f5ddfae107a3050b Mon Sep 17 00:00:00 2001 From: Thomas Harte <thomas.harte@gmail.com> Date: Sat, 26 Aug 2017 12:31:19 -0400 Subject: [PATCH] Limits sync counter size. --- Components/6845/CRTC6845.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Components/6845/CRTC6845.hpp b/Components/6845/CRTC6845.hpp index e75a61c7f..44eee1f80 100644 --- a/Components/6845/CRTC6845.hpp +++ b/Components/6845/CRTC6845.hpp @@ -80,7 +80,7 @@ template <class T> class CRTC6845 { while(cyles_remaining--) { // check for end of horizontal sync if(bus_state_.hsync) { - hsync_counter_++; + hsync_counter_ = (hsync_counter_ + 1) & 15; bus_state_.hsync = hsync_counter_ != (registers_[3] & 15); } @@ -122,7 +122,7 @@ template <class T> class CRTC6845 { inline void do_end_of_line() { // check for end of vertical sync if(bus_state_.vsync) { - vsync_counter_++; + vsync_counter_ = (vsync_counter_ + 1) & 15; if(vsync_counter_ == (registers_[3] >> 4)) { bus_state_.vsync = false; }