some more risky timing changes
[picodrive.git] / pico / pico.c
index 23f7efb..f0c54d1 100644 (file)
@@ -22,7 +22,6 @@ int PicoAutoRgnOrder;
 \r
 struct PicoSRAM SRam;\r
 int emustatus;         // rapid_ym2612, multi_ym_updates\r
-int scanlines_total;\r
 \r
 void (*PicoWriteSound)(int len) = NULL; // called at the best time to send sound buffer (PsndOut) to hardware\r
 void (*PicoResetHook)(void) = NULL;\r
@@ -227,29 +226,24 @@ void PicoLoopPrepare(void)
     // force setting possibly changed..\r
     Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0;\r
 \r
-  // FIXME: PAL has 313 scanlines..\r
-  scanlines_total = Pico.m.pal ? 312 : 262;\r
-\r
   Pico.m.dirtyPal = 1;\r
   rendstatus_old = -1;\r
 }\r
 \r
-\r
-// dma2vram settings are just hacks to unglitch Legend of Galahad (needs <= 104 to work)\r
-// same for Outrunners (92-121, when active is set to 24)\r
-// 96 is VR hack\r
+// this table is wrong and should be removed\r
+// keeping it for now to compensate wrong timing elswhere, mainly for Outrunners\r
 static const int dma_timings[] = {\r
-  167, 167, 166,  83, // vblank: 32cell: dma2vram dma2[vs|c]ram vram_fill vram_copy\r
-  102, 205, 204, 102, // vblank: 40cell:\r
-  16,   16,  15,   8, // active: 32cell:\r
-  24,   18,  17,   9  // ...\r
+   83, 166,  83,  83, // vblank: 32cell: dma2vram dma2[vs|c]ram vram_fill vram_copy\r
+  102, 204, 102, 102, // vblank: 40cell:\r
+    8,  16,   8,   8, // active: 32cell:\r
+   17,  18,   9,   9  // ...\r
 };\r
 \r
 static const int dma_bsycles[] = {\r
-  (488<<8)/167, (488<<8)/167, (488<<8)/166, (488<<8)/83,\r
-  (488<<8)/102, (488<<8)/233, (488<<8)/204, (488<<8)/102,\r
-  (488<<8)/16,  (488<<8)/16,  (488<<8)/15,  (488<<8)/8,\r
-  (488<<8)/24,  (488<<8)/18,  (488<<8)/17,  (488<<8)/9\r
+  (488<<8)/83,  (488<<8)/166, (488<<8)/83,  (488<<8)/83,\r
+  (488<<8)/102, (488<<8)/204, (488<<8)/102, (488<<8)/102,\r
+  (488<<8)/8,   (488<<8)/16,  (488<<8)/8,   (488<<8)/8,\r
+  (488<<8)/9,   (488<<8)/18,  (488<<8)/9,   (488<<8)/9\r
 };\r
 \r
 // grossly inaccurate.. FIXME FIXXXMEE\r
@@ -304,8 +298,8 @@ PICO_INTERNAL void PicoSyncZ80(unsigned int m68k_cycles_done)
   pprof_start(z80);\r
 \r
   elprintf(EL_BUSREQ, "z80 sync %i (%u|%u -> %u|%u)", cnt,\r
-    z80_cycle_cnt, z80_cycle_cnt / 288,\r
-    z80_cycle_aim, z80_cycle_aim / 288);\r
+    z80_cycle_cnt, z80_cycle_cnt / 228,\r
+    z80_cycle_aim, z80_cycle_aim / 228);\r
 \r
   if (cnt > 0)\r
     z80_cycle_cnt += z80_run(cnt);\r