chrismaltby / gbspack

GBSPack is a command line tool used to pack GBDK2020 data files created by GB Studio into chunks that will fit in Game Boy ROM banks.
MIT License
14 stars 1 forks source link

Avoid banks 0x20, 0x40, 0x60? #4

Closed chrismaltby closed 3 years ago

chrismaltby commented 3 years ago

In GB Studio there is a line where it currently handles banking the data to skip banks 32, 64 and 96

const MBC1_DISALLOWED_BANKS = [0x20, 0x40, 0x60];

Which I've found a reference to in a forum post at

https://gbdev.gg8.se/forums/viewtopic.php?id=527

The 125 banks instead of 128 banks stem from the fact that writing 0x00 to ROMB isn't allowed, so banks 0x20, 0x40 and 0x60 cannot be used, as they will select banks 0x21, 0x41 and 0x61 respectively regardless.

It sounds like MBC1 doesn't like them, should gbspack be skipping those three banks? @untoxa do you know?

untoxa commented 3 years ago

yes, that is handy for MBC1. universal tool must support this.

btw, there is no reason to use MBC1 at all. MBC5 has no issues with CGB, within 256 banks you can use MBC1 switching macros - they are compatible.

https://gbdev.io/pandocs/#mbc5

note, that bank numbers larger that 255 are not supported by GBDK - i mean bank tracking variable is byte. you can still switch them manually, but tracking is not working with them and trampoline functions do not reach them either. Manual switching to bank higher than 255 is possible: SWITCH_ROM_MBC5_8M, but is not atomic - you should use that with care.

suggestion is simple: hardware with MBC5, use it as if it is MBC1.

chrismaltby commented 3 years ago

Ah I see, I've made this optional then, the flag --mbc1 in 1.2.0 now skips those banks for if anyone uses MBC1 hardware https://github.com/chrismaltby/gbspack/releases/tag/v1.2.0