diff --git a/Components/9918/Implementation/9918.cpp b/Components/9918/Implementation/9918.cpp index 5ebe4761b..39c78b843 100644 --- a/Components/9918/Implementation/9918.cpp +++ b/Components/9918/Implementation/9918.cpp @@ -265,7 +265,8 @@ void TMS9918::run_for(const HalfCycles cycles) { this->write_pointer_.row = (this->write_pointer_.row + 1) % this->mode_timing_.total_lines; LineBuffer &next_line_buffer = this->line_buffers_[this->write_pointer_.row]; - // Establish the output mode for the next line. + // Establish the current screen output mode, which will be captured as a + // line mode momentarily. this->screen_mode_ = this->current_screen_mode(); // Based on the output mode, pick a line mode. @@ -274,9 +275,13 @@ void TMS9918::run_for(const HalfCycles cycles) { this->mode_timing_.maximum_visible_sprites = 4; switch(this->screen_mode_) { case ScreenMode::Text: - next_line_buffer.line_mode = LineMode::Text; - next_line_buffer.first_pixel_output_column = Timing::FirstTextCycle; - next_line_buffer.next_border_column = Timing::LastTextCycle; + if constexpr (Timing::SupportsTextMode) { + next_line_buffer.line_mode = LineMode::Text; + next_line_buffer.first_pixel_output_column = Timing::FirstTextCycle; + next_line_buffer.next_border_column = Timing::LastTextCycle; + } else { + next_line_buffer.line_mode = LineMode::Refresh; + } break; case ScreenMode::SMSMode4: next_line_buffer.line_mode = LineMode::SMS; diff --git a/Components/9918/Implementation/ClockConverter.hpp b/Components/9918/Implementation/ClockConverter.hpp index 8dd6c9c5f..a9d562aca 100644 --- a/Components/9918/Implementation/ClockConverter.hpp +++ b/Components/9918/Implementation/ClockConverter.hpp @@ -31,6 +31,10 @@ struct Timing> { /// Pixels implicitly run from here to the end of the line. constexpr static int FirstPixelCycle = 86; + /// Indicates whether text modes are supported by this VDP. If so then + /// values for First & Last TextCycle are required. If not then they can be omitted. + constexpr static bool SupportsTextMode = true; + /// The first internal cycle at which pixels will be output text mode. constexpr static int FirstTextCycle = 94; @@ -43,6 +47,7 @@ struct Timing> { constexpr static int CyclesPerLine = 1368; constexpr static int VRAMAccessDelay = 6; constexpr static int FirstPixelCycle = 344; + constexpr static bool SupportsTextMode = true; constexpr static int FirstTextCycle = 376; constexpr static int LastTextCycle = 1336; }; @@ -52,8 +57,7 @@ struct Timing { constexpr static int CyclesPerLine = 3420; constexpr static int VRAMAccessDelay = 6; constexpr static int FirstPixelCycle = 860; - constexpr static int FirstTextCycle = 940; - constexpr static int LastTextCycle = 3340; + constexpr static bool SupportsTextMode = false; }; constexpr int TMSAccessWindowsPerLine = 171;