EGA, MDA, and Sigma: Fix timings.

This commit is contained in:
OBattler
2025-08-14 13:13:32 +02:00
parent 3a8fa196a8
commit 2f7de1d23d
3 changed files with 10 additions and 6 deletions

View File

@@ -643,9 +643,10 @@ ega_recalctimings(ega_t *ega)
crtcconst *= mdiv;
} else {
if (ega->vidclock)
crtcconst = (ega->seqregs[1] & 1) ? MDACONST : (MDACONST * (9.0 / 8.0));
crtcconst = (cpuclock / 16257000.0 * (double) (1ULL << 32));
else
crtcconst = (ega->seqregs[1] & 1) ? CGACONST : (CGACONST * (9.0 / 8.0));
crtcconst = (cpuclock / (157500000.0 / 11.0) * (double) (1ULL << 32));
crtcconst *= mdiv;
}
ega->dot_clock = crtcconst / mdiv;

View File

@@ -130,8 +130,8 @@ mda_recalctimings(mda_t *mda)
double _dispontime;
double _dispofftime;
double disptime;
disptime = mda->crtc[MDA_CRTC_HTOTAL] + 1;
_dispontime = mda->crtc[MDA_CRTC_HDISP];
disptime = (mda->crtc[MDA_CRTC_HTOTAL] + 1) << 1;
_dispontime = (mda->crtc[MDA_CRTC_HDISP]) << 1;
_dispofftime = disptime - _dispontime;
_dispontime *= MDACONST;
_dispofftime *= MDACONST;

View File

@@ -234,6 +234,8 @@ sigma_out(uint16_t addr, uint8_t val, void *priv)
case 0x2D8:
sigma->sigmamode = val;
sigma->fullchange = changeframecount;
sigma_recalctimings(sigma);
return;
case 0x2D9:
sigma->sigma_ctl = val;
@@ -392,6 +394,7 @@ sigma_recalctimings(sigma_t *sigma)
double disptime;
double _dispontime;
double _dispofftime;
double crtcconst = (cpuclock / 22440000.0 * (double) (1ULL << 32)) * 8.0;
if (sigma->sigmamode & MODE_80COLS) {
disptime = (sigma->crtc[0] + 1) << 1;
@@ -402,8 +405,8 @@ sigma_recalctimings(sigma_t *sigma)
}
_dispofftime = disptime - _dispontime;
_dispontime *= CGACONST;
_dispofftime *= CGACONST;
_dispontime *= crtcconst;
_dispofftime *= crtcconst;
sigma->dispontime = (uint64_t) (_dispontime);
sigma->dispofftime = (uint64_t) (_dispofftime);
}