+ for (i = 0xAF; i >= 0xA0; i--) { // must apply backwards\r
+ ym2612_write_local(2, i, 0);\r
+ ym2612_write_local(3, ym2612.REGS[i|0x100], 0);\r
+ ym2612_write_local(0, i, 0);\r
+ ym2612_write_local(1, ym2612.REGS[i], 0);\r
+ }\r
+ for (i = 0xB0; i < 0xB8; i++) {\r
+ ym2612_write_local(0, i, 0);\r
+ ym2612_write_local(1, ym2612.REGS[i], 0);\r
+ ym2612_write_local(2, i, 0);\r
+ ym2612_write_local(3, ym2612.REGS[i|0x100], 0);\r
+ }\r
+\r
+#ifdef __GP2X__\r
+ if (PicoOpt & POPT_EXT_FM)\r
+ /*ret = YM2612PicoStateLoad2_940(&tat, &tbt)*/;\r
+ else\r
+#endif\r
+ ret = YM2612PicoStateLoad2(&tat, &tbt);\r
+ if (ret != 0) {\r
+ elprintf(EL_STATUS, "old ym2612 state");\r
+ return; // no saved timers\r
+ }\r
+\r
+ tac = (1024 - ym2612.OPN.ST.TA) << 16;\r
+ tbc = (256 - ym2612.OPN.ST.TB) << 16;\r
+ if (ym2612.OPN.ST.mode & 1)\r
+ timer_a_next_oflow = (double)(tac - tat) / (double)tac * timer_a_step;\r
+ else\r
+ timer_a_next_oflow = TIMER_NO_OFLOW;\r
+ if (ym2612.OPN.ST.mode & 2)\r
+ timer_b_next_oflow = (double)(tbc - tbt) / (double)tbc * timer_b_step;\r
+ else\r
+ timer_b_next_oflow = TIMER_NO_OFLOW;\r
+ elprintf(EL_YMTIMER, "load: %i/%i, timer_a_next_oflow %i", tat>>16, tac>>16, timer_a_next_oflow >> 8);\r
+ elprintf(EL_YMTIMER, "load: %i/%i, timer_b_next_oflow %i", tbt>>16, tbc>>16, timer_b_next_oflow >> 8);\r