Skip to content

Commit

Permalink
add missing 8/16-bit reads to ROMCnt and ROM SPICnt
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisotura committed Jan 17, 2024
1 parent 740305c commit f4c8202
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/NDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) |
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) |
Expand Down

0 comments on commit f4c8202

Please sign in to comment.