]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Correct calculation of vertical period if NTSC + LOLDIS.
authorToni Wilen <twilen@winuae.net>
Wed, 27 Mar 2024 18:15:32 +0000 (20:15 +0200)
committerToni Wilen <twilen@winuae.net>
Wed, 27 Mar 2024 18:15:32 +0000 (20:15 +0200)
custom.cpp

index e86fbc10f1ba7559435f8c53bbbf44f5038b5392..6942e25240408c88ddeacf0fb0775118c74180c3 100644 (file)
@@ -7112,9 +7112,10 @@ static void init_beamcon0(bool fakehz)
                hardwired_vbstrt = maxvpos;
                equ_vblank_endline = EQU_ENDLINE_NTSC;
                equ_vblank_toggle = false;
-               vblank_hz_shf = clk / ((maxvpos + 0.0f) * (maxhpos + 0.5f));
-               vblank_hz_lof = clk / ((maxvpos + 1.0f) * (maxhpos + 0.5f));
-               vblank_hz_lace = clk / ((maxvpos + 0.5f) * (maxhpos + 0.5f));
+               float half = (beamcon0 & BEAMCON0_LOLDIS) ? 0 : 0.5f;
+               vblank_hz_shf = clk / ((maxvpos + 0.0f) * (maxhpos + half));
+               vblank_hz_lof = clk / ((maxvpos + 1.0f) * (maxhpos + half));
+               vblank_hz_lace = clk / ((maxvpos + 0.5f) * (maxhpos + half));
        }
 
        dmal_htotal_mask = 0xffff;
@@ -7393,10 +7394,11 @@ static void init_beamcon0(bool fakehz)
        }
 
        if (beamcon0 & BEAMCON0_VARBEAMEN) {
-               vblank_hz_nom = vblank_hz = clk / (maxvpos * maxhpos);
+               float half = (beamcon0 & BEAMCON0_PAL) ? 0: ((beamcon0 & BEAMCON0_LOLDIS) ? 0 : 0.5f);
+               vblank_hz_nom = vblank_hz = clk / (maxvpos * (maxhpos + half));
                vblank_hz_shf = vblank_hz;
-               vblank_hz_lof = clk / ((maxvpos + 1.0f) * maxhpos);
-               vblank_hz_lace = clk / ((maxvpos + 0.5f) * maxhpos);
+               vblank_hz_lof = clk / ((maxvpos + 1.0f) * (maxhpos + half));
+               vblank_hz_lace = clk / ((maxvpos + 0.5f) * (maxhpos + half));
 
                maxvpos_nom = maxvpos;
                maxvpos_display = maxvpos;