PHenegan / GameboyEmulator

A gameboy emulator written in Rust
0 stars 0 forks source link

MBC1 Cartridge Controller #8

Closed PHenegan closed 2 months ago

PHenegan commented 2 months ago

https://gbdev.io/pandocs/MBC1.html#00003fff--rom-bank-x0-read-only

^^ Using this for documentation but there is some conflicting information:

In particular the banking mode is confusing me:

In its default configuration, MBC1 supports up to 512 KiB ROM with up to 32 KiB of banked RAM.

The banking mode can be: 0 = simple (default): 00003FFF and A000BFFF are locked to bank 0 of ROM and SRAM respectively. 1 = advanced: 00003FFF and A000-BFFF can be bank-switched via the 40005FFF register.

Basically - the only way to access banks where the lower 5 bits are 0 (bank 32/0x20, 64/0x40, 96/0x60, 128/0x80) is by first writing to the bank, and then switching the mode of the cartridge so that it switches the first half of the ROM.

PHenegan commented 2 months ago

Note about reading from the ROM

This assumes there are more than 32 banks: