From: kub <derkub@gmail.com>
Date: Sun, 16 Oct 2022 19:27:15 +0000 (+0000)
Subject: core, fix cpu sync regression
X-Git-Tag: v2.00~275
X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c4675a9934b8dce2b07a58cb755aa3e4d7fa230;p=picodrive.git

core, fix cpu sync regression
---

diff --git a/pico/pico_cmn.c b/pico/pico_cmn.c
index b2b34750..27ed5fd3 100644
--- a/pico/pico_cmn.c
+++ b/pico/pico_cmn.c
@@ -118,8 +118,7 @@ static int PicoFrameHints(void)
   // === active display ===
   pv->status |= PVS_ACTIVE;
 
-  lines_vis = (pv->reg[1] & 8) ? 240 : 224;
-  for (y = 0; y < lines_vis; y++)
+  for (y = 0; ; y++)
   {
     pv->v_counter = Pico.m.scanline = y;
     if ((pv->reg[12]&6) == 6) { // interlace mode 2
@@ -128,6 +127,9 @@ static int PicoFrameHints(void)
       pv->v_counter &= 0xff;
     }
 
+    if (y == (pv->reg[1] & 8 ? 240 : 224))
+      break;
+
     PAD_DELAY();
 
     // H-Interrupts:
@@ -175,7 +177,9 @@ static int PicoFrameHints(void)
 #endif
 
   // === VBLANK, 1st line ===
-  pv->status &= ~PVS_ACTIVE;
+  lines_vis = (pv->reg[1] & 8) ? 240 : 224;
+  if (y == lines_vis)
+    pv->status &= ~PVS_ACTIVE;
 
   memcpy(PicoIn.padInt, PicoIn.pad, sizeof(PicoIn.padInt));
   PAD_DELAY();