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_); } }