From e37f477ebfdd55b2808c4d66ae636207c7886efa Mon Sep 17 00:00:00 2001 From: TC1995 Date: Sun, 5 Sep 2021 19:53:03 +0200 Subject: [PATCH] S3 dword mode: CRTC14 bit 6 (standard dword mode) has the highest priority over CRTC31 bit 3 (S3 dword mode), so if the latter is enabled while the former is disabled, it's byte mode. Fixes both Duke3D, LXPIC and Win3.1 running at the same time (once and for all). --- src/video/vid_s3.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index 2e6a00e62..d3fb9c468 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -2711,12 +2711,12 @@ static void s3_recalctimings(svga_t *svga) svga->lowres = !((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)); if (((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) || (svga->crtc[0x3a] & 0x10)) { - if (svga->crtc[0x31] & 0x08) { /*If the dword mode bit is not enabled when the S3 dword mode is enabled, enable it*/ - if (!(svga->crtc[0x14] & 0x40)) + if (svga->crtc[0x31] & 0x08) { + if (!(svga->crtc[0x17] & 0x40) && (svga->crtc[0x14] & 0x40)) /*Disable dword mode addressing when CRTC14 bit 6 is not enabled, regardless of the S3 dword mode bit.*/ svga->force_dword_mode = 1; } else svga->force_dword_mode = 0; - + switch (svga->bpp) { case 8: svga->render = svga_render_8bpp_highres; @@ -2853,8 +2853,8 @@ static void s3_trio64v_recalctimings(svga_t *svga) svga->lowres = !((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)); if ((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) { - if (svga->crtc[0x31] & 0x08) { /*If the dword mode bit is not enabled when the S3 dword mode is enabled, enable it*/ - if (!(svga->crtc[0x14] & 0x40)) + if (svga->crtc[0x31] & 0x08) { + if (!(svga->crtc[0x17] & 0x40) && (svga->crtc[0x14] & 0x40)) /*Disable dword mode addressing when CRTC14 bit 6 is not enabled, regardless of the S3 dword mode bit.*/ svga->force_dword_mode = 1; } else svga->force_dword_mode = 0;