mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
sound, improve ym2612 timers implementation
This commit is contained in:
parent
e0c4dac19c
commit
c3d70d1305
4 changed files with 15 additions and 18 deletions
|
@ -872,16 +872,18 @@ void ym2612_pack_state(void);
|
|||
void ym2612_unpack_state(void);
|
||||
|
||||
#define TIMER_NO_OFLOW 0x70000000
|
||||
// tA = 72 * (1024 - NA) / M, with M = mclock/2 -> tick = 72 * 2/mclock
|
||||
#define TIMER_A_TICK_ZCYCLES 17203 // zcycles = Q8*tick*zclock = Q8*77*2*7/15
|
||||
// tB = 1152 * (256 - NA) / M,
|
||||
#define TIMER_B_TICK_ZCYCLES 275251 // zcycles = Q8*1152*2*7/15
|
||||
|
||||
#define timers_cycle() \
|
||||
// NB ~0.2% timers speed up (1/8(A), 2(B) z80 cycles), HACK for A/V sync in OD2
|
||||
// tA = 72 * (1024 - TA) / M, with M = mclock/2
|
||||
#define TIMER_A_TICK_ZCYCLES (cycles_68k_to_z80(256LL* 72*2)-32) // Q8
|
||||
// tB = 16*72 * ( 256 - TB) / M
|
||||
#define TIMER_B_TICK_ZCYCLES (cycles_68k_to_z80(256LL*16*72*2)-32*16) // Q8
|
||||
|
||||
#define timers_cycle(ticks) \
|
||||
if (Pico.t.timer_a_next_oflow > 0 && Pico.t.timer_a_next_oflow < TIMER_NO_OFLOW) \
|
||||
Pico.t.timer_a_next_oflow -= Pico.m.pal ? 70938*256 : 59659*256; \
|
||||
Pico.t.timer_a_next_oflow -= ticks << 8; \
|
||||
if (Pico.t.timer_b_next_oflow > 0 && Pico.t.timer_b_next_oflow < TIMER_NO_OFLOW) \
|
||||
Pico.t.timer_b_next_oflow -= Pico.m.pal ? 70938*256 : 59659*256; \
|
||||
Pico.t.timer_b_next_oflow -= ticks << 8; \
|
||||
ym2612_sync_timers(0, ym2612.OPN.ST.mode, ym2612.OPN.ST.mode);
|
||||
|
||||
#define timers_reset() \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue