Closed merryhime closed 3 years ago
While I implemented it as a bit-flip (since this was likely how it was implemented in hardware and first came to mind), one could also modify the main block of if
statements like so instead:
if(addr < 0x0100'0000) word = memory.biosSwap ? readEWRAM(mode, addr) : bios.read(mode, addr);
else if(addr < 0x0200'0000) word = memory.biosSwap ? readIWRAM(mode, addr) : bios.read(mode, addr);
else if(addr < 0x0300'0000) word = memory.biosSwap ? bios.read(mode, addr) : readEWRAM(mode, addr);
else if(addr < 0x0400'0000) word = memory.biosSwap ? bios.read(mode, addr) : readIWRAM(mode, addr);
Which would be preferrable?
This has been tested to produce a correct BIOS dump when utilizing memory swap with the prefetch exploit: https://gitdab.com/LunarLambda/gba-bios-dump
Thank you for this patch!
The reason that IWRAM and EWRAM appear to be disabled is because they were swapped with the BIOS.
(Thanks to kevtris for disclosure of this behaviour.)