From a1e2646301877f5d356dd30b5fddca88aad6bac6 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 10 Aug 2017 14:58:24 -0400 Subject: [PATCH] Imposed counter size limits. --- Components/6845/CRTC6845.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Components/6845/CRTC6845.hpp b/Components/6845/CRTC6845.hpp index 5a87c649c..419c4dc63 100644 --- a/Components/6845/CRTC6845.hpp +++ b/Components/6845/CRTC6845.hpp @@ -104,7 +104,7 @@ template class CRTC6845 { bus_state_.row_address = 0; bool is_at_end_of_frame = line_counter_ == registers_[4]; - line_counter_++; + line_counter_ = (line_counter_ + 1) & 0x7f; // check for end of visible lines if(line_counter_ == registers_[6]) { @@ -131,7 +131,7 @@ template class CRTC6845 { line_counter_ = 0; } } else { - bus_state_.row_address++; + bus_state_.row_address = (bus_state_.row_address + 1) & 0x1f; } bus_state_.refresh_address = line_address_; } @@ -141,6 +141,7 @@ template class CRTC6845 { } bus_state_.display_enable = character_is_visible_ && line_is_visible_; + bus_state_.refresh_address &= 0x3fff; bus_handler_.perform_bus_cycle(bus_state_); } }