Merge pull request #5938 from 86Box/tc1995

8514/A (and XGA) compatible refresh rate fixes.
This commit is contained in:
Miran Grča
2025-08-11 22:56:27 +02:00
committed by GitHub
2 changed files with 30 additions and 27 deletions

View File

@@ -2928,10 +2928,12 @@ mach_recalctimings(svga_t *svga)
dev->h_disp_time = dev->hdisp >> 3;
svga->clock_8514 = (cpuclock * (double) (1ULL << 32)) / svga->getclock((mach->accel.clock_sel >> 2) & 0x0f, svga->clock_gen);
svga->clock_8514 = (cpuclock * (double) (1ULL << 32)) / svga->getclock((mach->accel.clock_sel >> 2) & 0x0f, svga->clock_gen) / 2;
if (mach->accel.clock_sel & 0x40)
svga->clock_8514 *= 2;
mach_log("8514/A clock sel=%x, divide reg ibm=%02x, divide reg vga=%02x.\n", clock_sel, mach->accel.clock_sel & 0x40, mach->regs[0xb8] & 0xc0);
if (dev->interlace)
dev->dispend >>= 1;
@@ -3060,29 +3062,29 @@ mach_recalctimings(svga_t *svga)
if (!svga->scrblank && (svga->crtc[0x17] & 0x80) && svga->attr_palette_enable) {
mach_log("GDCREG5=%02x, ATTR10=%02x, ATI B0 bit 5=%02x, ON=%d.\n",
svga->gdcreg[5] & 0x60, svga->attrregs[0x10] & 0x40, mach->regs[0xb0] & 0x20, dev->on);
svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock(clock_sel, svga->clock_gen);
mach_log("VGA clock sel=%x, divide reg=%02x.\n", clock_sel, mach->regs[0xb8] & 0xc0);
if (ATI_MACH32) {
if (mach->regs[0xb8] & 0x40)
svga->clock *= 2;
} else {
switch (mach->regs[0xb8] & 0xc0) {
case 0x40:
svga->clock *= 2;
break;
case 0x80:
svga->clock *= 3;
break;
case 0xc0:
svga->clock *= 4;
break;
default:
break;
}
}
if ((svga->gdcreg[6] & 0x01) || (svga->attrregs[0x10] & 0x01)) {
if ((svga->gdcreg[5] & 0x40) || (svga->attrregs[0x10] & 0x40) || (mach->regs[0xb0] & 0x20)) {
svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock(clock_sel, svga->clock_gen);
mach_log("VGA clock=%02x.\n", mach->regs[0xa7] & 0x80);
if (ATI_MACH32) {
if (mach->regs[0xb8] & 0x40)
svga->clock *= 2;
} else {
switch (mach->regs[0xb8] & 0xc0) {
case 0x40:
svga->clock *= 2;
break;
case 0x80:
svga->clock *= 3;
break;
case 0xc0:
svga->clock *= 4;
break;
default:
break;
}
}
svga->map8 = svga->pallook;
mach_log("Lowres=%x, seqreg[1]bit3=%x.\n", svga->lowres, svga->seqregs[1] & 8);
if (svga->lowres)

View File

@@ -799,9 +799,10 @@ svga_recalctimings(svga_t *svga)
if ((svga->bpp <= 8) || ((svga->gdcreg[5] & 0x60) <= 0x20)) {
if ((svga->gdcreg[5] & 0x60) == 0x00) {
if (svga->seqregs[1] & 8) /*Low res (320)*/
if (svga->seqregs[1] & 8) { /*Low res (320)*/
svga->render = svga_render_4bpp_lowres;
else
svga_log("4 bpp low res.\n");
} else
svga->render = svga_render_4bpp_highres;
} else if ((svga->gdcreg[5] & 0x60) == 0x20) {
if (svga->seqregs[1] & 8) { /*Low res (320)*/
@@ -1045,11 +1046,11 @@ svga_recalctimings(svga_t *svga)
crtcconst = svga->clock * svga->char_width;
if (ibm8514_active && (svga->dev8514 != NULL)) {
if (dev->on)
crtcconst8514 = svga->clock_8514;
crtcconst8514 = svga->clock_8514 * 8;
}
if (xga_active && (svga->xga != NULL)) {
if (xga->on)
crtcconst_xga = svga->clock_xga;
crtcconst_xga = svga->clock_xga * svga->char_width;
}
#ifdef ENABLE_SVGA_LOG
@@ -1093,7 +1094,6 @@ svga_recalctimings(svga_t *svga)
if (dev->on) {
disptime8514 = dev->h_total;
_dispontime8514 = dev->h_disp_time;
svga_log("HTOTAL=%d, HDISP=%d.\n", dev->h_total, dev->h_disp);
}
}
@@ -1135,6 +1135,7 @@ svga_recalctimings(svga_t *svga)
case 1: /*Plus 8514/A*/
if (dev->on) {
_dispofftime8514 = disptime8514 - _dispontime8514;
svga_log("DISPTIME8514=%lf, off=%lf, DISPONTIME8514=%lf, CRTCCONST8514=%lf.\n", disptime8514, _dispofftime8514, _dispontime8514, crtcconst8514);
_dispontime8514 *= crtcconst8514;
_dispofftime8514 *= crtcconst8514;