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

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
colinvella
Posts: 74
Joined: Sun Jun 05, 2016 1:41 pm

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

Post by colinvella »

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!
Tile IDE and tile engine for XNA: http://tide.codeplex.com/
Fancy Fish Mod - Minecraft Mod: http://fancyfishmod.weebly.com/
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

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

Post by tepples »

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.
User avatar
colinvella
Posts: 74
Joined: Sun Jun 05, 2016 1:41 pm

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

Post by colinvella »

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! :)
Tile IDE and tile engine for XNA: http://tide.codeplex.com/
Fancy Fish Mod - Minecraft Mod: http://fancyfishmod.weebly.com/
Post Reply