Skip to content

Commit

Permalink
also add writes while we're at it, we know Gericom's gonna abuse them…
Browse files Browse the repository at this point in the history
… someday :P
  • Loading branch information
Arisotura committed Jan 17, 2024
1 parent f4c8202 commit 7897bd3
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/NDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3182,6 +3182,23 @@ void NDS::ARM9IOWrite8(u32 addr, u8 val)
NDSCartSlot.WriteSPIData(val);
return;

case 0x040001A4:
if (!(ExMemCnt[0] & (1<<11)))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0xFFFFFF00) | val);
return;
case 0x040001A5:
if (!(ExMemCnt[0] & (1<<11)))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0xFFFF00FF) | (val << 8));
return;
case 0x040001A6:
if (!(ExMemCnt[0] & (1<<11)))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0xFF00FFFF) | (val << 16));
return;
case 0x040001A7:
if (!(ExMemCnt[0] & (1<<11)))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0x00FFFFFF) | (val << 24));
return;

case 0x040001A8: if (!(ExMemCnt[0] & (1<<11))) NDSCartSlot.SetROMCommand(0, val); return;
case 0x040001A9: if (!(ExMemCnt[0] & (1<<11))) NDSCartSlot.SetROMCommand(1, val); return;
case 0x040001AA: if (!(ExMemCnt[0] & (1<<11))) NDSCartSlot.SetROMCommand(2, val); return;
Expand Down Expand Up @@ -3311,6 +3328,15 @@ void NDS::ARM9IOWrite16(u32 addr, u16 val)
NDSCartSlot.WriteSPIData(val & 0xFF);
return;

case 0x040001A4:
if (!(ExMemCnt[0] & (1<<11)))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0xFFFF0000) | val);
return;
case 0x040001A6:
if (!(ExMemCnt[0] & (1<<11)))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0x0000FFFF) | (val << 16));
return;

case 0x040001A8:
if (!(ExMemCnt[0] & (1<<11)))
{
Expand Down Expand Up @@ -3954,6 +3980,23 @@ void NDS::ARM7IOWrite8(u32 addr, u8 val)
NDSCartSlot.WriteSPIData(val);
return;

case 0x040001A4:
if (ExMemCnt[0] & (1<<11))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0xFFFFFF00) | val);
return;
case 0x040001A5:
if (ExMemCnt[0] & (1<<11))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0xFFFF00FF) | (val << 8));
return;
case 0x040001A6:
if (ExMemCnt[0] & (1<<11))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0xFF00FFFF) | (val << 16));
return;
case 0x040001A7:
if (ExMemCnt[0] & (1<<11))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0x00FFFFFF) | (val << 24));
return;

case 0x040001A8: if (ExMemCnt[0] & (1<<11)) NDSCartSlot.SetROMCommand(0, val); return;
case 0x040001A9: if (ExMemCnt[0] & (1<<11)) NDSCartSlot.SetROMCommand(1, val); return;
case 0x040001AA: if (ExMemCnt[0] & (1<<11)) NDSCartSlot.SetROMCommand(2, val); return;
Expand Down Expand Up @@ -4059,6 +4102,15 @@ void NDS::ARM7IOWrite16(u32 addr, u16 val)
NDSCartSlot.WriteSPIData(val & 0xFF);
return;

case 0x040001A4:
if (ExMemCnt[0] & (1<<11))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0xFFFFFF00) | val);
return;
case 0x040001A6:
if (ExMemCnt[0] & (1<<11))
NDSCartSlot.WriteROMCnt((NDSCartSlot.GetROMCnt() & 0xFF00FFFF) | (val << 16));
return;

case 0x040001A8:
if (ExMemCnt[0] & (1<<11))
{
Expand Down

0 comments on commit 7897bd3

Please sign in to comment.