core, implement ym2612 busy flag

This commit is contained in:
kub 2024-03-03 22:57:58 +01:00
parent c066c40ba9
commit 83025d7abe
2 changed files with 12 additions and 5 deletions

View file

@ -457,6 +457,7 @@ struct PicoTiming
int timer_a_next_oflow, timer_a_step; // in z80 cycles
int timer_b_next_oflow, timer_b_step;
int ym2612_busy;
int vcnt_wrap, vcnt_adj;
};
@ -897,6 +898,8 @@ void ym2612_unpack_state(void);
#define TIMER_B_TICK_ZCYCLES cycles_68k_to_z80(256LL*16*72*2) // Q8
#define timers_cycle(ticks) \
if (Pico.t.ym2612_busy > 0) \
Pico.t.ym2612_busy -= ticks << 8; \
if (Pico.t.timer_a_next_oflow < TIMER_NO_OFLOW) \
Pico.t.timer_a_next_oflow -= ticks << 8; \
if (Pico.t.timer_b_next_oflow < TIMER_NO_OFLOW) \
@ -904,6 +907,7 @@ void ym2612_unpack_state(void);
ym2612_sync_timers(0, ym2612.OPN.ST.mode, ym2612.OPN.ST.mode);
#define timers_reset() \
Pico.t.ym2612_busy = 0; \
Pico.t.timer_a_next_oflow = Pico.t.timer_b_next_oflow = TIMER_NO_OFLOW; \
Pico.t.timer_a_step = TIMER_A_TICK_ZCYCLES * 1024; \
Pico.t.timer_b_step = TIMER_B_TICK_ZCYCLES * 256; \