diff --git a/src/vid_ati_mach64.c b/src/vid_ati_mach64.c index 4270f1a..3f0ff01 100644 --- a/src/vid_ati_mach64.c +++ b/src/vid_ati_mach64.c @@ -299,6 +299,7 @@ void mach64_recalctimings(svga_t *svga) svga->ma_latch = (mach64->crtc_off_pitch & 0x1fffff) * 2; svga->linedbl = svga->rowcount = 0; svga->split = 0xffffff; + svga->vblankstart = svga->dispend; // svga_htotal <<= 1; // svga_hdisp <<= 1; svga->rowoffset <<= 1; diff --git a/src/vid_et4000w32.c b/src/vid_et4000w32.c index 2bffd96..03adf4b 100644 --- a/src/vid_et4000w32.c +++ b/src/vid_et4000w32.c @@ -236,12 +236,13 @@ void et4000w32p_recalctimings(svga_t *svga) // pclog("Recalc %08X ",svga_ma); svga->ma_latch |= (svga->crtc[0x33] & 0x7) << 16; // pclog("SVGA_MA %08X %i\n", svga_ma, (svga_miscout >> 2) & 3); - if (svga->crtc[0x35] & 0x02) svga->vtotal += 0x400; - if (svga->crtc[0x35] & 0x04) svga->dispend += 0x400; - if (svga->crtc[0x35] & 0x08) svga->vsyncstart += 0x400; - if (svga->crtc[0x35] & 0x10) svga->split += 0x400; - if (svga->crtc[0x3F] & 0x80) svga->rowoffset += 0x100; - if (svga->crtc[0x3F] & 0x01) svga->htotal += 256; + if (svga->crtc[0x35] & 0x01) svga->vblankstart += 0x400; + if (svga->crtc[0x35] & 0x02) svga->vtotal += 0x400; + if (svga->crtc[0x35] & 0x04) svga->dispend += 0x400; + if (svga->crtc[0x35] & 0x08) svga->vsyncstart += 0x400; + if (svga->crtc[0x35] & 0x10) svga->split += 0x400; + if (svga->crtc[0x3F] & 0x80) svga->rowoffset += 0x100; + if (svga->crtc[0x3F] & 0x01) svga->htotal += 256; if (svga->attrregs[0x16] & 0x20) svga->hdisp <<= 1; switch ((svga->miscout >> 2) & 3) diff --git a/src/vid_s3_virge.c b/src/vid_s3_virge.c index 198b09a..5492467 100644 --- a/src/vid_s3_virge.c +++ b/src/vid_s3_virge.c @@ -99,6 +99,7 @@ typedef struct virge_t } streams; } virge_t; +static void s3_virge_recalctimings(svga_t *svga); static void s3_virge_updatemapping(virge_t *virge); static void s3_virge_bitblt(virge_t *virge, int count, uint32_t cpu_dat); @@ -161,6 +162,7 @@ static void s3_virge_out(uint16_t addr, uint8_t val, void *p) if (svga->seqaddr >= 0x10) { svga->seqregs[svga->seqaddr & 0x1f]=val; + s3_virge_recalctimings(svga); return; } if (svga->seqaddr == 4) /*Chain-4 - update banking*/ @@ -321,12 +323,13 @@ static void s3_virge_recalctimings(svga_t *svga) { virge_t *virge = (virge_t *)svga->p; - if (svga->crtc[0x5d] & 0x01) svga->htotal += 0x100; - if (svga->crtc[0x5d] & 0x02) svga->hdisp += 0x100; - if (svga->crtc[0x5e] & 0x01) svga->vtotal += 0x400; - if (svga->crtc[0x5e] & 0x02) svga->dispend += 0x400; - if (svga->crtc[0x5e] & 0x10) svga->vsyncstart += 0x400; - if (svga->crtc[0x5e] & 0x40) svga->split += 0x400; + if (svga->crtc[0x5d] & 0x01) svga->htotal += 0x100; + if (svga->crtc[0x5d] & 0x02) svga->hdisp += 0x100; + if (svga->crtc[0x5e] & 0x01) svga->vtotal += 0x400; + if (svga->crtc[0x5e] & 0x02) svga->dispend += 0x400; + if (svga->crtc[0x5e] & 0x04) svga->vblankstart += 0x400; + if (svga->crtc[0x5e] & 0x10) svga->vsyncstart += 0x400; + if (svga->crtc[0x5e] & 0x40) svga->split += 0x400; svga->interlace = svga->crtc[0x42] & 0x20; if ((svga->crtc[0x67] & 0xc) != 0xc) /*VGA mode*/ @@ -399,7 +402,15 @@ static void s3_virge_recalctimings(svga_t *svga) } } + if (((svga->miscout >> 2) & 3) == 3) + { + int n = svga->seqregs[0x12] & 0x1f; + int r = (svga->seqregs[0x12] >> 5) & 3; + int m = svga->seqregs[0x13] & 0x7f; + double freq = (((double)m + 2) / (((double)n + 2) * (double)(1 << r))) * 14318184.0; + svga->clock = cpuclock / freq; + } } static void s3_virge_updatemapping(virge_t *virge)