Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gba: memory.disable is actually memory.biosSwap #176

Merged
merged 1 commit into from
May 4, 2021
Merged

gba: memory.disable is actually memory.biosSwap #176

merged 1 commit into from
May 4, 2021

Conversation

merryhime
Copy link

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.)

@merryhime
Copy link
Author

merryhime commented May 2, 2021

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?

@merryhime
Copy link
Author

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

The reason that IWRAM and EWRAM appear to be disabled is because they were swapped with the BIOS
@Screwtapello Screwtapello merged commit 972fb95 into higan-emu:master May 4, 2021
@Screwtapello
Copy link
Contributor

Thank you for this patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants