From 6669d259480bd686b388a313c50e6d43733f2e4e Mon Sep 17 00:00:00 2001 From: ekeeke Date: Sun, 19 Nov 2023 16:02:33 +0100 Subject: [PATCH] [Core/CD] fixed memory mode register bits masking when read from MAIN-CPU and SUB-CPU (verified on real hardware, cf. Krikzz's mcd-verificator) --- HISTORY.txt | 1 + core/cd_hw/scd.c | 8 ++++++-- core/mem68k.c | 8 ++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/HISTORY.txt b/HISTORY.txt index 03a8f88..62b27d4 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -49,6 +49,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke) * fixed access to Sub-CPU "read-only" communication registers (fixes Round 5 Boss freeze in Streets of Rage / Sega Classics Arcade Collection) * fixed byte access to memory mode, timer and font color registers at even address (verified on real hardware, cf. Krikzz's mcd-verificator) * fixed byte access to font data registers +* fixed memory mode register bits masking when read from MAIN-CPU and SUB-CPU (verified on real hardware, cf. Krikzz's mcd-verificator) * fixed pending level 1 interrupts when GFX interrupt is disabled (fixes random freezes when exiting "Batman Returns" option menu) * fixed CDD seek command again (Final Fight CD freeze with model 2 BIOS) * fixed CDD status reported during seek/access time (fixes sound effect synchronization issue in Bari Arm) diff --git a/core/cd_hw/scd.c b/core/cd_hw/scd.c index b0c97d5..e59ca74 100644 --- a/core/cd_hw/scd.c +++ b/core/cd_hw/scd.c @@ -558,7 +558,9 @@ static unsigned int scd_read_byte(unsigned int address) if (address == 0x03) { s68k_poll_detect(1<<0x03); - return scd.regs[0x03>>1].byte.l; + + /* mask BK0 and BK1 bits on SUB-CPU side */ + return scd.regs[0x03>>1].byte.l & 0x1f; } /* MAIN-CPU communication flags */ @@ -674,7 +676,9 @@ static unsigned int scd_read_word(unsigned int address) if (address == 0x02) { s68k_poll_detect(1<<0x03); - return scd.regs[0x03>>1].w; + + /* mask BK0 and BK1 bits on SUB-CPU side */ + return scd.regs[0x03>>1].w & 0xff1f; } /* CDC host data (word access only ?) */ diff --git a/core/mem68k.c b/core/mem68k.c index bddc4f3..76de658 100644 --- a/core/mem68k.c +++ b/core/mem68k.c @@ -363,7 +363,9 @@ unsigned int ctrl_io_read_byte(unsigned int address) if (index == 0x03) { m68k_poll_detect(1<<0x03); - return scd.regs[0x03>>1].byte.l; + + /* mask PM0 and PM1 bits on MAIN-CPU side */ + return scd.regs[0x03>>1].byte.l & 0xc7; } /* SUB-CPU communication flags */ @@ -504,7 +506,9 @@ unsigned int ctrl_io_read_word(unsigned int address) if (index == 0x02) { m68k_poll_detect(1<<0x03); - return scd.regs[0x03>>1].w; + + /* mask PM0 and PM1 bits on MAIN-CPU side */ + return scd.regs[0x03>>1].w & 0xffc7; } /* CDC host data (word access only ?) */