diff --git a/src/video/vid_tgui9440.c b/src/video/vid_tgui9440.c index 98f295e45..0b0687326 100644 --- a/src/video/vid_tgui9440.c +++ b/src/video/vid_tgui9440.c @@ -628,6 +628,7 @@ void tgui_recalctimings(svga_t *svga) { tgui_t *tgui = (tgui_t *) svga->priv; + uint8_t ger22lower = (tgui->accel.ger22 & 0xff); uint8_t ger22upper = (tgui->accel.ger22 >> 8); if (!svga->rowoffset) @@ -750,7 +751,8 @@ tgui_recalctimings(svga_t *svga) } switch (svga->hdisp) { case 640: - svga->rowoffset = 80; + if (!ger22lower) + svga->rowoffset = 80; break; } } @@ -1991,17 +1993,25 @@ tgui_accel_out(uint16_t addr, uint8_t val, void *priv) break; case 0x2123: + //pclog("Pitch IO23: val = %02x, rowoffset = %x, pitch = %d.\n", val, svga->rowoffset, tgui->accel.pitch); tgui->accel.ger22 = (tgui->accel.ger22 & 0xff) | (val << 8); if ((val & 0x80) || (((val & 0xc0) == 0x40))) tgui->accel.pitch = svga->rowoffset << 3; - else if (tgui->accel.pitch <= 1024) + else if (tgui->accel.pitch <= 1024) { tgui->accel.pitch = svga->rowoffset << 3; + if (!val) + tgui->accel.pitch = 1024; + } if (tgui->accel.bpp == 1) tgui->accel.pitch >>= 1; else if (tgui->accel.bpp == 3) tgui->accel.pitch >>= 2; + + if (tgui->accel.pitch == 800) + tgui->accel.pitch += 32; + svga_recalctimings(svga); break; @@ -2631,17 +2641,24 @@ tgui_accel_write(uint32_t addr, uint8_t val, void *priv) break; case 0x23: + //pclog("Pitch MM23: val = %02x, rowoffset = %x, pitch = %d.\n", val, svga->rowoffset, tgui->accel.pitch); tgui->accel.ger22 = (tgui->accel.ger22 & 0xff) | (val << 8); if ((val & 0x80) || (((val & 0xc0) == 0x40))) tgui->accel.pitch = svga->rowoffset << 3; - else if (tgui->accel.pitch <= 1024) + else if (tgui->accel.pitch <= 1024) { tgui->accel.pitch = svga->rowoffset << 3; + if (!val) + tgui->accel.pitch = 1024; + } if (tgui->accel.bpp == 1) tgui->accel.pitch >>= 1; else if (tgui->accel.bpp == 3) tgui->accel.pitch >>= 2; + if (tgui->accel.pitch == 800) + tgui->accel.pitch += 32; + svga_recalctimings(svga); break;