32x: improved lockstep mode, allows compatibility over 50%
[picodrive.git] / pico / cd / pico.c
index f76a7f9..8b65f4f 100644 (file)
@@ -45,13 +45,12 @@ PICO_INTERNAL int PicoResetMCD(void)
   Reset_CD();
   LC89510_Reset();
   gfx_cd_reset();
-  PicoMemResetCD(1);
 #ifdef _ASM_CD_MEMORY_C
   //PicoMemResetCDdecode(1); // don't have to call this in 2M mode
 #endif
 
   // use SRam.data for RAM cart
-  if (PicoOpt&POPT_EN_MCD_RAMCART) {
+  if (PicoOpt & POPT_EN_MCD_RAMCART) {
     if (SRam.data == NULL)
       SRam.data = calloc(1, 0x12000);
   }
@@ -208,24 +207,20 @@ static __inline void update_chips(void)
        // update gfx chip
        if (Pico_mcd->rot_comp.Reg_58 & 0x8000)
                gfx_cd_update();
-
-       // delayed setting of DMNA bit (needed for Silpheed)
-       if (Pico_mcd->m.state_flags & 2) {
-               Pico_mcd->m.state_flags &= ~2;
-               if (!(Pico_mcd->s68k_regs[3] & 4)) {
-                       Pico_mcd->s68k_regs[3] |=  2;
-                       Pico_mcd->s68k_regs[3] &= ~1;
-#ifdef USE_POLL_DETECT
-                       if ((s68k_poll_adclk&0xfe) == 2) {
-                               SekSetStopS68k(0); s68k_poll_adclk = 0;
-                       }
-#endif
-               }
-       }
 }
 
 
 #define PICO_CD
+#define CPUS_RUN(m68k_cycles,s68k_cycles) \
+{ \
+    if ((PicoOpt&POPT_EN_MCD_PSYNC) && (Pico_mcd->m.busreq&3) == 1) { \
+      SekRunPS(m68k_cycles, s68k_cycles); /* "better/perfect sync" */ \
+    } else { \
+      SekRunM68k(m68k_cycles); \
+      if ((Pico_mcd->m.busreq&3) == 1) /* no busreq/no reset */ \
+        SekRunS68k(s68k_cycles); \
+    } \
+}
 #include "../pico_cmn.c"