-
-
Notifications
You must be signed in to change notification settings - Fork 106
Add description for out of bounds MBC ram access #594
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
base: master
Are you sure you want to change the base?
Conversation
This is based on: - Source code of the SameBoy emulator - Dissassembling Pokemon Pinball which depends on this behavior - Mbc1 schematics - https://www.devrs.com/gb/files/mbc1.gif
Use "modulo max_ram_size" instead of "and (max_ram_size - 1)"? |
Perhaps "depends" is not the best way to phrase it, what I actually saw is that Pokemon Pinball sets the ram bank to a non zero value and since it does not have banked ram, all accesses are clipped (according to the formula). |
What point? I want to try with a 32 KiB cart. |
It depends on the way you are handling this case, originally I just ignored those out of bounds writes, (and returned 0 on reads) with this way it froze after trying to reload a save from sram (boot up -> save -> restart -> load save -> freeze). |
On most of the MBC's in case an out of bounds address is accessed (selecting unmapped RAM bank), | ||
only the mapped bits from the address will be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait--is this talking about address, or bank? I know they are combined to ultimately make a single address passed to the chip; but the entire document is written from the perspective of the GB CPU, since that's the most consistent and generally-useful one, and from that perspective, the bank and address are separate.
This is based on:
Since there are many types of MBC's I added that this is for most of the MBC's