Makefile revert
[picodrive.git] / Pico / Memory.c
index d3b931c..509fead 100644 (file)
@@ -267,13 +267,16 @@ u32 OtherRead16(u32 a, int realsize)
   }\r
   // |=0x80 for Shadow of the Beast & Super Offroad; rotate fakes next fetched instruction for Time Killers\r
   if (a==0xa11100) {\r
-    extern int z80stopCycle; // TODO: tidy\r
     d=Pico.m.z80Run&1;\r
+#if 0\r
     if (!d) {\r
+      // do we need this?\r
+      extern int z80stopCycle; // TODO: tidy\r
       int stop_before = SekCyclesDone() - z80stopCycle;\r
-      if (stop_before > 0 && stop_before <= 16*2) // Gens uses 16 here\r
+      if (stop_before > 0 && stop_before <= 16) // Gens uses 16 here\r
         d = 1; // bus not yet available\r
     }\r
+#endif\r
     d=(d<<8)|0x8000|Pico.m.rotate++;\r
     dprintf("get_zrun: %04x [%i|%i] @%06x", d, Pico.m.scanline, SekCyclesDone(), SekPc);\r
     goto end; }\r
@@ -316,14 +319,16 @@ static void OtherWrite8(u32 a,u32 d,int realsize)
     //int lineCycles=(488-SekCyclesLeft)&0x1ff;\r
     d&=1; d^=1;\r
     if(!d) {\r
-       // hack: detect a nasty situation where Z80 was enabled and disabled in the same 68k timeslice (Golden Axe III)\r
-      // if((PicoOpt&4) && Pico.m.z80Run==1) z80_run(20); // FIXME: movies\r
-      z80stopCycle = SekCyclesDone();\r
-      //z80ExtraCycles += (lineCycles>>1)-(lineCycles>>5); // only meaningful in PicoFrameHints()\r
+      // this is for a nasty situation where Z80 was enabled and disabled in the same 68k timeslice (Golden Axe III)\r
+      if (Pico.m.z80Run) {\r
+        int lineCycles=(488-SekCyclesLeft)&0x1ff;\r
+        z80stopCycle = SekCyclesDone();\r
+        lineCycles=(lineCycles>>1)-(lineCycles>>5);\r
+        z80_run(lineCycles);\r
+      }\r
     } else {\r
       z80startCycle = SekCyclesDone();\r
       //if(Pico.m.scanline != -1)\r
-      //z80ExtraCycles -= (lineCycles>>1)-(lineCycles>>5)+16;\r
     }\r
     dprintf("set_zrun: %02x [%i|%i] @%06x", d, Pico.m.scanline, SekCyclesDone(), /*mz80GetRegisterValue(NULL, 0),*/ SekPc);\r
     Pico.m.z80Run=(u8)d; return;\r
@@ -569,7 +574,9 @@ static void CPU_CALL PicoWrite8(u32 a,u8 d)
   //  dprintf("w8 : %06x,   %02x @%06x", a&0xffffff, d, SekPc);\r
 \r
 \r
-  if ((a&0xe00000)==0xe00000) { u8 *pm=(u8 *)(Pico.ram+((a^1)&0xffff)); pm[0]=d; return; } // Ram\r
+  if ((a&0xe00000)==0xe00000) {\r
+         if((a&0xffff)==0xf62a) dprintf("(f62a) = %02x [%i|%i] @ %x", d, Pico.m.scanline, SekCyclesDone(), SekPc);\r
+          u8 *pm=(u8 *)(Pico.ram+((a^1)&0xffff)); pm[0]=d; return; } // Ram\r
 \r
   a&=0xffffff;\r
   OtherWrite8(a,d,8);\r
@@ -616,7 +623,7 @@ static void CPU_CALL PicoWrite32(u32 a,u32 d)
 \r
 \r
 // -----------------------------------------------------------------\r
-int PicoMemInit()\r
+void PicoMemSetup()\r
 {\r
 #ifdef EMU_C68K\r
   // Setup memory callbacks:\r
@@ -628,7 +635,6 @@ int PicoMemInit()
   PicoCpu.write16=PicoWrite16;\r
   PicoCpu.write32=PicoWrite32;\r
 #endif\r
-  return 0;\r
 }\r
 \r
 #ifdef EMU_A68K\r