So I made a little MMC3 game (which works on all emulators and on the PowerPak and my friend is trying to make a repro of it. However he always gets a solid gray screen. So I wanted to make sure my MMC3 init code was okay or if it's just him. The game isn't too big (32K PRG / 64K CHR) since I use the MMC3 mostly for the bank sizes and the IRQs.
Here's my MMC3 init code as well as a few things that might help
The reset code, including the mapper configuration, must be at $e000-$ffff, which is always hardwired to the last bank. Also, it appears you're only selecting the CHR banks. You need to select which 8KB PRG banks go at $8000-$bfff before you can use them. It may be obvious which banks go there since you only have 32KB of PRG-ROM, but the mapper doesn't know that.
tepples wrote:Your init code has to be in $E000-$FFFF because the PRG bank registers' values are unspecified at power-on.
Do other similarly sized ROMs work when you try to make a repro?
Ah-ha! It's in the $C000-$DFFF range so that's why it doesn't work probably. I'll try putting it in the $E000-$FFFF range then.
Is this written in the wiki? I think that would be useful information to write in it if it isn't there.
It's general knowledge that registers have unknown values on startup, meaning the MMC3 is in an unknown state on power up. The only MMC3 ROM slot hardwired to the same ROM bank in all configurations is $e000-$ffff. Some mappers don't even have any slots you can count on being mapped to a constant bank, so they need to have the reset code in all banks.
A warning about this is relevant to all mappers, not only the MMC3. You need to read the documentation of the mapper you're using to see if there are any slots guaranteed to point to a constant bank, in which case that's where the reset code must be, otherwise every bank has to include a little reset stub in the same position, so it's guaranteed to be mapped on power on.