From f4c8202b1a4a094680e9e84329bef88c2fc65885 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Wed, 17 Jan 2024 18:50:08 +0100 Subject: [PATCH] add missing 8/16-bit reads to ROMCnt and ROM SPICnt --- src/NDS.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/src/NDS.cpp b/src/NDS.cpp index f67cb84d..de21eb63 100644 --- a/src/NDS.cpp +++ b/src/NDS.cpp @@ -2728,11 +2728,37 @@ u8 NDS::ARM9IORead8(u32 addr) case 0x04000132: return KeyCnt[0] & 0xFF; case 0x04000133: return KeyCnt[0] >> 8; + case 0x040001A0: + if (!(ExMemCnt[0] & (1<<11))) + return NDSCartSlot.GetSPICnt() & 0xFF; + return 0; + case 0x040001A1: + if (!(ExMemCnt[0] & (1<<11))) + return NDSCartSlot.GetSPICnt() >> 8; + return 0; + case 0x040001A2: if (!(ExMemCnt[0] & (1<<11))) return NDSCartSlot.ReadSPIData(); return 0; + case 0x040001A4: + if (!(ExMemCnt[0] & (1<<11))) + return NDSCartSlot.GetROMCnt() & 0xFF; + return 0; + case 0x040001A5: + if (!(ExMemCnt[0] & (1<<11))) + return (NDSCartSlot.GetROMCnt() >> 8) & 0xFF; + return 0; + case 0x040001A6: + if (!(ExMemCnt[0] & (1<<11))) + return (NDSCartSlot.GetROMCnt() >> 16) & 0xFF; + return 0; + case 0x040001A7: + if (!(ExMemCnt[0] & (1<<11))) + return NDSCartSlot.GetROMCnt() >> 24; + return 0; + case 0x040001A8: if (!(ExMemCnt[0] & (1<<11))) return NDSCartSlot.GetROMCommand(0); @@ -2884,6 +2910,15 @@ u16 NDS::ARM9IORead16(u32 addr) return NDSCartSlot.ReadSPIData(); return 0; + case 0x040001A4: + if (!(ExMemCnt[0] & (1<<11))) + return NDSCartSlot.GetROMCnt() & 0xFFFF; + return 0; + case 0x040001A6: + if (!(ExMemCnt[0] & (1<<11))) + return NDSCartSlot.GetROMCnt() >> 16; + return 0; + case 0x040001A8: if (!(ExMemCnt[0] & (1<<11))) return NDSCartSlot.GetROMCommand(0) | @@ -3592,11 +3627,37 @@ u8 NDS::ARM7IORead8(u32 addr) case 0x04000138: return RTC.Read() & 0xFF; + case 0x040001A0: + if (ExMemCnt[0] & (1<<11)) + return NDSCartSlot.GetSPICnt() & 0xFF; + return 0; + case 0x040001A1: + if (ExMemCnt[0] & (1<<11)) + return NDSCartSlot.GetSPICnt() >> 8; + return 0; + case 0x040001A2: if (ExMemCnt[0] & (1<<11)) return NDSCartSlot.ReadSPIData(); return 0; + case 0x040001A4: + if (ExMemCnt[0] & (1<<11)) + return NDSCartSlot.GetROMCnt() & 0xFF; + return 0; + case 0x040001A5: + if (ExMemCnt[0] & (1<<11)) + return (NDSCartSlot.GetROMCnt() >> 8) & 0xFF; + return 0; + case 0x040001A6: + if (ExMemCnt[0] & (1<<11)) + return (NDSCartSlot.GetROMCnt() >> 16) & 0xFF; + return 0; + case 0x040001A7: + if (ExMemCnt[0] & (1<<11)) + return NDSCartSlot.GetROMCnt() >> 24; + return 0; + case 0x040001A8: if (ExMemCnt[0] & (1<<11)) return NDSCartSlot.GetROMCommand(0); @@ -3697,6 +3758,15 @@ u16 NDS::ARM7IORead16(u32 addr) case 0x040001A0: if (ExMemCnt[0] & (1<<11)) return NDSCartSlot.GetSPICnt(); return 0; case 0x040001A2: if (ExMemCnt[0] & (1<<11)) return NDSCartSlot.ReadSPIData(); return 0; + case 0x040001A4: + if (ExMemCnt[0] & (1<<11)) + return NDSCartSlot.GetROMCnt() & 0xFFFF; + return 0; + case 0x040001A6: + if (ExMemCnt[0] & (1<<11)) + return NDSCartSlot.GetROMCnt() >> 16; + return 0; + case 0x040001A8: if (ExMemCnt[0] & (1<<11)) return NDSCartSlot.GetROMCommand(0) |