added timer saving to savestates
[picodrive.git] / Pico / PicoInt.h
index bf5c46d..c2f8b60 100644 (file)
@@ -1,7 +1,7 @@
 // Pico Library - Internal Header File\r
 \r
 // (c) Copyright 2004 Dave, All rights reserved.\r
-// (c) Copyright 2006,2007 Grazvydas "notaz" Ignotas, all rights reserved.\r
+// (c) Copyright 2006-2008 Grazvydas "notaz" Ignotas, all rights reserved.\r
 // Free for non-commercial use.\r
 \r
 // For commercial use, separate licencing terms must be obtained.\r
@@ -185,10 +185,7 @@ extern struct DrZ80 drZ80;
 \r
 #define z80_run(cycles)    ((cycles) - DrZ80Run(&drZ80, cycles))\r
 #define z80_run_nr(cycles) DrZ80Run(&drZ80, cycles)\r
-#define z80_int() { \\r
-  drZ80.z80irqvector = 0xFF; /* default IRQ vector RST opcode */ \\r
-  drZ80.Z80_IRQ = 1; \\r
-}\r
+#define z80_int()          drZ80.Z80_IRQ = 1\r
 \r
 #define z80_cyclesLeft     drZ80.cycles\r
 \r
@@ -479,16 +476,20 @@ extern int timer_a_next_oflow, timer_a_step, timer_a_offset; // in z80 cycles
 extern int timer_b_next_oflow, timer_b_step, timer_b_offset;\r
 \r
 void ym2612_sync_timers(int z80_cycles, int mode_old, int mode_new);\r
+void ym2612_pack_state(void);\r
+void ym2612_unpack_state(void);\r
+\r
+#define TIMER_NO_OFLOW 0x70000000\r
 \r
 #define timers_cycle() \\r
-  if (timer_a_next_oflow > 0 && timer_a_next_oflow < 0x70000000) \\r
+  if (timer_a_next_oflow > 0 && timer_a_next_oflow < TIMER_NO_OFLOW) \\r
     timer_a_next_oflow -= Pico.m.pal ? 70938*256 : 59659*256; \\r
-  if (timer_b_next_oflow > 0 && timer_b_next_oflow < 0x70000000) \\r
+  if (timer_b_next_oflow > 0 && timer_b_next_oflow < TIMER_NO_OFLOW) \\r
     timer_b_next_oflow -= Pico.m.pal ? 70938*256 : 59659*256; \\r
   ym2612_sync_timers(0, ym2612.OPN.ST.mode, ym2612.OPN.ST.mode);\r
 \r
 #define timers_reset() \\r
-  timer_a_next_oflow = timer_b_next_oflow = 0x70000000; \\r
+  timer_a_next_oflow = timer_b_next_oflow = TIMER_NO_OFLOW; \\r
   timer_a_step = timer_a_offset = 16495 * 1024; \\r
   timer_b_step = timer_b_offset = 263912 * 256;\r
 \r