diff --git a/core/system.c b/core/system.c index b718bb2..53a730b 100644 --- a/core/system.c +++ b/core/system.c @@ -404,11 +404,23 @@ void system_frame_gen(int do_skip) /* active screen height */ if (reg[1] & 0x04) { - bitmap.viewport.h = 224 + ((reg[1] & 0x08) << 1); - bitmap.viewport.y = (config.overscan & 1) * ((240 + 48*vdp_pal - bitmap.viewport.h) >> 1); + /* Mode 5 */ + if (reg[1] & 0x08) + { + /* 240 active lines */ + bitmap.viewport.h = 240; + bitmap.viewport.y = (config.overscan & 1) * 24 * vdp_pal; + } + else + { + /* 224 active lines */ + bitmap.viewport.h = 224; + bitmap.viewport.y = (config.overscan & 1) * (8 + (24 * vdp_pal)); + } } else { + /* Mode 4 (192 active lines) */ bitmap.viewport.h = 192; bitmap.viewport.y = (config.overscan & 1) * 24 * (vdp_pal + 1); } diff --git a/core/vdp_ctrl.c b/core/vdp_ctrl.c index f8f2d67..0f2ed16 100644 --- a/core/vdp_ctrl.c +++ b/core/vdp_ctrl.c @@ -1659,17 +1659,8 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles) /* Mode 5 only */ if (d & 0x04) { - if (status & 8) - { - /* Changes should be applied on next frame */ - bitmap.viewport.changed |= 2; - } - else - { - /* Update active display height */ - bitmap.viewport.h = 224 + ((d & 8) << 1); - bitmap.viewport.y = (config.overscan & 1) * (8 - (d & 8) + 24*vdp_pal); - } + /* Changes should be applied on next frame */ + bitmap.viewport.changed |= 2; /* Update vertical counter max value */ vc_max = vc_table[(d >> 2) & 3][vdp_pal];