1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Avoid double responsibility for state.

This commit is contained in:
Thomas Harte 2023-01-07 14:34:33 -05:00
parent 56831e02fc
commit dd5b4b484a
2 changed files with 9 additions and 17 deletions

View File

@ -266,7 +266,7 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
LineBuffer &next_line_buffer = this->line_buffers_[this->write_pointer_.row];
// Establish the output mode for the next line.
this->set_current_screen_mode();
this->screen_mode_ = this->current_screen_mode();
// Based on the output mode, pick a line mode.
next_line_buffer.first_pixel_output_column = Timing<personality>::FirstPixelCycle;

View File

@ -298,43 +298,35 @@ template <Personality personality> struct Base {
size_t sprite_generator_table_address;
} master_system_;
void set_current_screen_mode() {
ScreenMode current_screen_mode() const {
if(blank_display_) {
screen_mode_ = ScreenMode::Blank;
return;
return ScreenMode::Blank;
}
if constexpr (is_sega_vdp(personality)) {
if(master_system_.mode4_enable) {
screen_mode_ = ScreenMode::SMSMode4;
mode_timing_.maximum_visible_sprites = 8;
return;
return ScreenMode::SMSMode4;
}
}
mode_timing_.maximum_visible_sprites = 4;
if(!mode1_enable_ && !mode2_enable_ && !mode3_enable_) {
screen_mode_ = ScreenMode::ColouredText;
return;
return ScreenMode::ColouredText;
}
if(mode1_enable_ && !mode2_enable_ && !mode3_enable_) {
screen_mode_ = ScreenMode::Text;
return;
return ScreenMode::Text;
}
if(!mode1_enable_ && mode2_enable_ && !mode3_enable_) {
screen_mode_ = ScreenMode::Graphics;
return;
return ScreenMode::Graphics;
}
if(!mode1_enable_ && !mode2_enable_ && mode3_enable_) {
screen_mode_ = ScreenMode::MultiColour;
return;
return ScreenMode::MultiColour;
}
// TODO: undocumented TMS modes.
screen_mode_ = ScreenMode::Blank;
return ScreenMode::Blank;
}
void do_external_slot(int access_column) {