\r
// Pico/Memory.c\r
PICO_INTERNAL void PicoMemSetupPico(void);\r
+PICO_INTERNAL unsigned int ym2612_read_local_68k(void);\r
\r
// Pico.c\r
extern struct Pico Pico;\r
extern short cdda_out_buffer[2*1152];\r
extern int PsndLen_exc_cnt;\r
extern int PsndLen_exc_add;\r
-extern int timer_a_next_oflow, timer_a_step; // in z80 cycles\r
+extern int timer_a_next_oflow, timer_a_step, timer_a_offset; // in z80 cycles\r
+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
\r
#define timers_cycle() \\r
- if (timer_a_next_oflow > 0) timer_a_next_oflow -= Pico.m.pal ? 70938*256 : 59659*256\r
+ if (timer_a_next_oflow > 0 && timer_a_next_oflow < 0x70000000) \\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
+ 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 = 0x80000000\r
+ timer_a_next_oflow = timer_b_next_oflow = 0x70000000; \\r
+ timer_a_step = timer_a_offset = 16495 * 1024; \\r
+ timer_b_step = timer_b_offset = 263912 * 256;\r
+\r
\r
// VideoPort.c\r
PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d);\r
#define EL_HVCNT 0x00000001 /* hv counter reads */\r
#define EL_SR 0x00000002 /* SR reads */\r
#define EL_INTS 0x00000004 /* ints and acks */\r
-#define EL_YM2612R 0x00000008 /* 68k ym2612 reads */\r
+#define EL_YMTIMER 0x00000008 /* ym2612 timer stuff */\r
#define EL_INTSW 0x00000010 /* log irq switching on/off */\r
#define EL_ASVDP 0x00000020 /* VDP accesses during active scan */\r
#define EL_VDPDMA 0x00000040 /* VDP DMA transfers and their timing */\r