return ym2612.OPN.ST.status;\r
}\r
\r
-int ym2612_pack_timers(void *buf, size_t size)\r
+void ym2612_pack_state_old(void)\r
{\r
// timers are saved as tick counts, in 16.16 int format\r
int tac, tat = 0, tbc, tbt = 0, busy = 0;\r
- size_t b = 0;\r
+\r
tac = 1024 - ym2612.OPN.ST.TA;\r
tbc = 256 - ym2612.OPN.ST.TB;\r
if (Pico.t.ym2612_busy > 0)\r
tbt = ((Pico.t.timer_b_step - Pico.t.timer_b_next_oflow) * ((1LL<<32)/TIMER_B_TICK_ZCYCLES+1))>>16;\r
elprintf(EL_YMTIMER, "save: timer a %i/%i", tat >> 16, tac);\r
elprintf(EL_YMTIMER, "save: timer b %i/%i", tbt >> 16, tbc);\r
+\r
#ifdef __GP2X__\r
if (PicoIn.opt & POPT_EXT_FM)\r
YM2612PicoStateSave2_940(tat, tbt);\r
else\r
#endif\r
- {\r
- //YM2612PicoStateSave2(tat, tbt, busy);\r
- assert(size >= 16);\r
- save_u16(buf, &b, ym2612.OPN.ST.TA);\r
- save_u16(buf, &b, ym2612.OPN.ST.TB);\r
- save_u32(buf, &b, tat);\r
- save_u32(buf, &b, tbt);\r
- save_u32(buf, &b, busy);\r
- }\r
+ YM2612PicoStateSave2(tat, tbt, busy);\r
+}\r
+\r
+int ym2612_pack_timers(void *buf, size_t size)\r
+{\r
+ // timers are saved as tick counts, in 16.16 int format\r
+ int tac, tat = 0, tbc, tbt = 0, busy = 0;\r
+ size_t b = 0;\r
+ tac = 1024 - ym2612.OPN.ST.TA;\r
+ tbc = 256 - ym2612.OPN.ST.TB;\r
+ if (Pico.t.ym2612_busy > 0)\r
+ busy = cycles_z80_to_68k(Pico.t.ym2612_busy);\r
+ if (Pico.t.timer_a_next_oflow != TIMER_NO_OFLOW)\r
+ tat = ((Pico.t.timer_a_step - Pico.t.timer_a_next_oflow) * ((1LL<<32)/TIMER_A_TICK_ZCYCLES+1))>>16;\r
+ if (Pico.t.timer_b_next_oflow != TIMER_NO_OFLOW)\r
+ tbt = ((Pico.t.timer_b_step - Pico.t.timer_b_next_oflow) * ((1LL<<32)/TIMER_B_TICK_ZCYCLES+1))>>16;\r
+ elprintf(EL_YMTIMER, "save: timer a %i/%i", tat >> 16, tac);\r
+ elprintf(EL_YMTIMER, "save: timer b %i/%i", tbt >> 16, tbc);\r
+\r
+ assert(size >= 16);\r
+ save_u16(buf, &b, ym2612.OPN.ST.TA);\r
+ save_u16(buf, &b, ym2612.OPN.ST.TB);\r
+ save_u32(buf, &b, tat);\r
+ save_u32(buf, &b, tbt);\r
+ save_u32(buf, &b, busy);\r
return b;\r
}\r
\r
CHECKED_WRITE(CHUNK_PICO_PCM, len, buf2);\r
CHECKED_WRITE(CHUNK_PICO, sizeof(PicoPicohw), &PicoPicohw);\r
} else {\r
+#ifdef __GP2X__\r
+ ym2612_pack_state_old();\r
+ ym_regs = YM2612GetRegs();\r
+ CHECKED_WRITE(CHUNK_FM, 0x200+4, ym_regs);\r
+#else\r
// write fm state first since timer load needs OPN.ST.mode\r
len = YM2612PicoStateSave3(buf2, CHUNK_LIMIT_W);\r
CHECKED_WRITE(CHUNK_FMv3, len, buf2);\r
len = ym2612_pack_timers(buf2, CHUNK_LIMIT_W);\r
CHECKED_WRITE(CHUNK_FM_TIMERS, len, buf2);\r
+#endif\r
}\r
\r
if (!(PicoIn.opt & POPT_DIS_IDLE_DET))\r