MMC5 initialisation (default prg mode, chr mode etc.)

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
MMC5 initialisation (default prg mode, chr mode etc.)
by on (#174149)
Hi,

I started implemented MMC5 and have most of the code in place (except screen split, fill mode, extended ram use and audio). I have tried to find out about the initial state of the mapper but I couldn't find any documentation. Glancing at some implementations in Github, I have gathered that PRG Mode should initially be 3. I have no idea, however, if I should initialise other settings like banks for PRG Mode 3, or anything for CHR modes.

When trying to run Castlevania III, the first address read from the Reset Vector and set in the program counter is $4920, which clearly seems to be an invalid address since it doesn't point to program ROM.

The mapper logic is working as follows: It redirects the reset vector's value $FFFC to the 8 KB switchable PRG ROM bank addressed by range CPU $E000-$FFFF. This is translated to offset $1FFC of bank 0 within the program rom (a flat array containing all the program rom banks loaded from the .NES file). This translates to the flattened ROM address $2000 x 0 + $1FFC (= $1FFC in the flat ROM array). The word at the locations $1FFC,$1FFD is $4920.

Could anyone help out please? I can share code here as needed. Very likely, I got many things wrong, despite following the MMC5 specs carefully.

Thanks a lot!
Re: MMC5 initialisation (default prg mode, chr mode etc.)
by on (#174150)
It's traditional for NES mappers with 8K bank switching (Namco 108/MMC3, VRC2/4, FME-7) to fix the $E000-$FFFF window to the last bank in the cart. I'd assume MMC5 powers on the same way, even though it does allow switching $E000-$FFFF after power on.
Re: MMC5 initialisation (default prg mode, chr mode etc.)
by on (#174151)
tepples wrote:
It's traditional for NES mappers with 8K bank switching (Namco 108/MMC3, VRC2/4, FME-7) to fix the $E000-$FFFF window to the last bank in the cart. I'd assume MMC5 powers on the same way, even though it does allow switching $E000-$FFFF after power on.


That seems indeed to have been the problem. The last ROM bank for Castlevania III is 31. The first instruction was CLD.. definitely a good sign. I'm now encountering other issues but I think I can proceed from here for now.

Cheers! :)