adjust z80 timing a bit
[picodrive.git] / pico / pico_int.h
index 743ecb4..89cccc7 100644 (file)
@@ -211,20 +211,13 @@ extern struct DrZ80 drZ80;
 \r
 #define Z80_STATE_SIZE 0x60\r
 \r
-extern unsigned int last_z80_sync;\r
-extern int z80_cycle_cnt;        /* 'done' z80 cycles before z80_run() */\r
-extern int z80_cycle_aim;\r
-extern int z80_scanline;\r
-extern int z80_scanline_cycles;  /* cycles done until z80_scanline */\r
-\r
 #define z80_resetCycles() \\r
-  last_z80_sync = SekCyclesDone(); \\r
-  z80_cycle_cnt = z80_cycle_aim = z80_scanline = z80_scanline_cycles = 0;\r
+  timing.z80c_cnt = timing.z80c_aim = timing.z80_scanline = 0\r
 \r
 #define z80_cyclesDone() \\r
-  (z80_cycle_aim - z80_cyclesLeft)\r
+  (timing.z80c_aim - z80_cyclesLeft)\r
 \r
-#define cycles_68k_to_z80(x) ((x)*957 >> 11)\r
+#define cycles_68k_to_z80(x) ((x) * 3823 >> 13)\r
 \r
 // ----------------------- SH2 CPU -----------------------\r
 \r
@@ -599,6 +592,15 @@ struct Pico32xMem
   unsigned short pwm_fifo[2][4];        // [0] - current raw, others - fifo entries\r
 };\r
 \r
+struct PicoTiming\r
+{\r
+  unsigned int m68c_frame_start;        // m68k cycles\r
+  unsigned int z80c_cnt;                // z80 cycles done (this frame)\r
+  unsigned int z80c_aim;\r
+  int z80_scanline;\r
+};\r
+extern struct PicoTiming timing;\r
+\r
 // area.c\r
 extern void (*PicoLoadStateHook)(void);\r
 \r
@@ -1092,3 +1094,4 @@ void pevt_dump(void);
 \r
 #endif // PICO_INTERNAL_INCLUDED\r
 \r
+// vim:shiftwidth=2:ts=2:expandtab\r