From e61dbac103aac78cdf087e791e145beba26e004b Mon Sep 17 00:00:00 2001 From: kub Date: Sat, 27 Apr 2024 10:12:25 +0200 Subject: [PATCH] mcd, fix irq2 handling (not cleared on disable) --- pico/cd/memory.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pico/cd/memory.c b/pico/cd/memory.c index fc4ddb72..17abd049 100644 --- a/pico/cd/memory.c +++ b/pico/cd/memory.c @@ -166,14 +166,15 @@ void m68k_reg_write8(u32 a, u32 d) switch (a) { case 0: d &= 1; - Pico_mcd->m.state_flags &= ~PCD_ST_S68K_IFL2; - if (d) Pico_mcd->m.state_flags |= PCD_ST_S68K_IFL2; + pcd_sync_s68k(SekCyclesDone(), 0); if (d && (Pico_mcd->s68k_regs[0x33] & PCDS_IEN2)) { elprintf(EL_INTS, "m68k: s68k irq 2"); - pcd_sync_s68k(SekCyclesDone(), 0); + Pico_mcd->m.state_flags |= PCD_ST_S68K_IFL2; pcd_irq_s68k(2, 1); - } else + } else { + Pico_mcd->m.state_flags &= ~PCD_ST_S68K_IFL2; pcd_irq_s68k(2, 0); + } return; case 1: d &= 3; @@ -193,6 +194,7 @@ void m68k_reg_write8(u32 a, u32 d) Pico_mcd->m.state_flags &= ~(PCD_ST_S68K_RST|PCD_ST_S68K_POLL|PCD_ST_S68K_SLEEP); elprintf(EL_CDREGS, "m68k: resetting s68k"); SekResetS68k(); + SekCycleCntS68k += 40; } if (((dold & 3) == 1) != ((d & 3) == 1)) { elprintf(EL_INTSW, "m68k: s68k brq %i", d >> 1); -- 2.39.5