Skip to content

Commit 4544509

Browse files
alloncmavivaceISSOtm
authored
Add description for out of bounds MBC ram access (#594)
* Add description for out of bounds MBC ram access 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 * Change mbc ram access formula * Rephrased explanation to be oriented to the CPU memory bus (instead the MBC) * Fix internal address formula * Update src/MBCs.md Co-authored-by: Eldred Habert <me@eldred.fr> * Update src/MBCs.md --------- Co-authored-by: Antonio Vivace <avivace4@gmail.com> Co-authored-by: Eldred Habert <me@eldred.fr>
1 parent 66b965b commit 4544509

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/MBCs.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ so, it might be nevertheless possible to use Double Speed during periods
2020
which use only code and data which is located in internal RAM. Despite the
2121
above, a self-made MBC1-EPROM card appears to work stable and fine even in
2222
Double Speed Mode.
23+
24+
## MBC Unmapped RAM Bank Access
25+
26+
In most MBCs, if an unmapped RAM bank is selected (which would be translate to an out of bounds RAM address by the MBC controller),
27+
the MBC will simply wrap around the internal ram address and would access a valid RAM address.
28+
29+
The MBC internal address being accessed can be calculated using this formula: `((address - external_ram_start_address) + (active_ram_bank * ram_bank_size)) % max_external_ram_size`.

0 commit comments

Comments
 (0)