diff --git a/Components/9918/9918.cpp b/Components/9918/9918.cpp index 14397b054..e0cbe9a5e 100644 --- a/Components/9918/9918.cpp +++ b/Components/9918/9918.cpp @@ -191,11 +191,27 @@ void TMS9918::run_for(const HalfCycles cycles) { // --------------------------------------- // Latch scrolling position, if necessary. // --------------------------------------- - if(write_pointer_.column < 61 && end_column >= 61) { - if(!write_pointer_.row) { - master_system_.latched_vertical_scroll = master_system_.vertical_scroll; + if(is_sega_vdp(personality_)) { + if(write_pointer_.column < 61 && end_column >= 61) { + if(!write_pointer_.row) { + master_system_.latched_vertical_scroll = master_system_.vertical_scroll; + + if(master_system_.mode4_enable) { + mode_timing_.pixel_lines = 192; + if(mode2_enable_ && mode1_enable_) mode_timing_.pixel_lines = 224; + if(mode2_enable_ && mode3_enable_) mode_timing_.pixel_lines = 240; + + mode_timing_.sprite_terminator = 0xd0; + if(mode_timing_.pixel_lines != 192) { + mode_timing_.sprite_terminator = 0xf0; + } + mode_timing_.first_vsync_line = (mode_timing_.total_lines + mode_timing_.pixel_lines) >> 1; + + mode_timing_.end_of_frame_interrupt_position.row = mode_timing_.pixel_lines + 1; + } + } + line_buffer.latched_horizontal_scroll = master_system_.horizontal_scroll; } - line_buffer.latched_horizontal_scroll = master_system_.horizontal_scroll; } diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index f21a99a88..c42c0733a 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -280,9 +280,6 @@ class Base { if(is_sega_vdp(personality_) && master_system_.mode4_enable) { screen_mode_ = ScreenMode::SMSMode4; - mode_timing_.pixel_lines = 192; - if(mode2_enable_ && mode1_enable_) mode_timing_.pixel_lines = 224; - if(mode2_enable_ && mode3_enable_) mode_timing_.pixel_lines = 240; mode_timing_.maximum_visible_sprites = 8; return; }