From a64be0bfea14d50e8e9acd7194d48059af6d7ef3 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 22 Oct 2022 01:29:18 +0200 Subject: [PATCH] Fixed IM1024 timings calculation. --- src/video/vid_pgc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/video/vid_pgc.c b/src/video/vid_pgc.c index dddbaee45..0decb8e65 100644 --- a/src/video/vid_pgc.c +++ b/src/video/vid_pgc.c @@ -2131,12 +2131,17 @@ void pgc_recalctimings(pgc_t *dev) { double disptime, _dispontime, _dispofftime; - double pixel_clock = (cpuclock * (double) (1ull << 32)) / (dev->cga_selected ? 25175000.0 : dev->native_pixel_clock); + double pixel_clock = (cpuclock / (dev->cga_selected ? 25175000.0 : dev->native_pixel_clock) * (double) (1ull << 32)); + uint8_t crtc0 = 97, crtc1 = 80; /* Values from MDA, taken from there due to the 25 MHz refresh rate. */ + /* Multiply pixel clock by 8. */ + pixel_clock *= 8.0; /* Use a fixed 640x400 display. */ - disptime = dev->screenw + 11; - _dispontime = dev->screenw * pixel_clock; - _dispofftime = (disptime - dev->screenw) * pixel_clock; + disptime = crtc0 + 1; + _dispontime = crtc1; + _dispofftime = disptime - _dispontime; + _dispontime *= pixel_clock; + _dispofftime *= pixel_clock; dev->dispontime = (uint64_t) (_dispontime); dev->dispofftime = (uint64_t) (_dispofftime); }