From a89dc5501bbaea82f0905bf86a8ec5e8d494d4f6 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 19 Oct 2026 17:44:48 +1000 Subject: [PATCH] Bus: Fix memory control register write masks Base address bits 24-31 are fixed at 1Fh, and only DEV0 delay/size has bit 31. --- src/core/bus.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/bus.cpp b/src/core/bus.cpp index 7b412484d..a1a5fc586 100644 --- a/src/core/bus.cpp +++ b/src/core/bus.cpp @@ -1723,7 +1723,11 @@ void Bus::HWHandlers::MemCtrlWrite(PhysicalMemoryAddress address, u32 value) value = FIXUP_WORD_WRITE_VALUE(size, offset, value); - const u32 write_mask = (index < 2) ? 0xFFFFFFFFu : ((index == 8) ? COMDELAY::WRITE_MASK : MEMDELAY::WRITE_MASK); + // Bits 24-31 of the base addresses are fixed at 1Fh, and only the DEV0 delay register has a writable wait bit. + const u32 write_mask = + (index < 2) ? + 0x00FFFFFFu : + ((index == 8) ? COMDELAY::WRITE_MASK : (MEMDELAY::WRITE_MASK & ((index == 2) ? 0xFFFFFFFFu : 0x7FFFFFFFu))); const u32 new_value = (s_locals.MEMCTRL.regs[index] & ~write_mask) | (value & write_mask); if (s_locals.MEMCTRL.regs[index] != new_value) {