audio fixes for overdrive demo

This commit is contained in:
kub 2020-01-26 20:12:18 +01:00
parent 43e1401008
commit 7aab476859
5 changed files with 15 additions and 11 deletions

View file

@ -278,6 +278,7 @@ Cz80_Check_Interrupt:
CPU->ICount -= CPU->ExtraCycles;
CPU->ExtraCycles = 0;
}
if (!CPU->HaltState)
goto Cz80_Exec;
}
}

View file

@ -687,7 +687,6 @@ OP_CCF:
OP(0x76): // HALT
OP_HALT:
CPU->HaltState = 1;
// CPU->ICount = 0;
goto Cz80_Check_Interrupt;
OP(0xf3): // DI

View file

@ -733,8 +733,10 @@ static void PicoWrite8_vdp(u32 a, u32 d)
static void PicoWrite16_vdp(u32 a, u32 d)
{
if ((a & 0x00f9) == 0x0010) // PSG Sound
if ((a & 0x00f9) == 0x0010) { // PSG Sound
psg_write_68k(d);
return;
}
if ((a & 0x00e0) == 0x0000) {
PicoVideoWrite(a, d);
return;
@ -898,10 +900,10 @@ void ym2612_sync_timers(int z80_cycles, int mode_old, int mode_new)
int xcycles = z80_cycles << 8;
/* check for overflows */
if ((mode_old & 4) && xcycles > Pico.t.timer_a_next_oflow)
if ((mode_old & 4) && xcycles >= Pico.t.timer_a_next_oflow)
ym2612.OPN.ST.status |= 1;
if ((mode_old & 8) && xcycles > Pico.t.timer_b_next_oflow)
if ((mode_old & 8) && xcycles >= Pico.t.timer_b_next_oflow)
ym2612.OPN.ST.status |= 2;
/* update timer a */

View file

@ -822,10 +822,10 @@ void ym2612_pack_state(void);
void ym2612_unpack_state(void);
#define TIMER_NO_OFLOW 0x70000000
// tA = 72 * (1024 - NA) / M
#define TIMER_A_TICK_ZCYCLES 17203
// tB = 1152 * (256 - NA) / M
#define TIMER_B_TICK_ZCYCLES 262800 // 275251 broken, see Dai Makaimura
// 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() \
if (Pico.t.timer_a_next_oflow > 0 && Pico.t.timer_a_next_oflow < TIMER_NO_OFLOW) \
@ -837,7 +837,8 @@ void ym2612_unpack_state(void);
#define timers_reset() \
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;
Pico.t.timer_b_step = TIMER_B_TICK_ZCYCLES * 256; \
ym2612.OPN.ST.status &= ~3;
// videoport.c

View file

@ -206,8 +206,9 @@
.macro update_ssg_eg
ldrh r0, [r5,#0x30] @ ssg+ssgn
ldrb r2, [r5,#0x17] @ state
and r3, r0, #0x08
cmp r3, #0x08 @ ssg enabled &&
ldrh r3, [r5,#0x1a] @ volume
cmp r0, #0x08 @ ssg enabled &&
cmpge r2, #EG_REL+1 @ state > EG_REL &&
cmpge r3, #0x200 @ volume >= 0x200?
blt 9f