Super Mario Unlimited bank switching

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Super Mario Unlimited bank switching
by on (#158949)
Does this game use 32K bankswitching? I have been trying to get it to work with a cart that does NOT support 32k banking (so games like Tetris don't work) and it just loads a black screen. Trying it on another cart that DOES support 32K banking, the game works fine. But that's not the main point... How can I tell what games do and don't use 32k banking?

I've tried in NesMapperReader and FCEUX, and neither state what kind of banking the game uses. Is there another tool out there that could work?
Re: Super Mario Unlimited bank switching
by on (#158950)
Tetris assumes 32 KiB banking (since it was released on SEROM, which forces 32 KiB banking).
The only pertinent variants of MMC1 PCBs are whether it connected CPU A14 (SEROM, SHROM, SH1ROM) or MMC1 A14 (everything else) to PRG A14.

Note that the MMC1 itself already supports 32 KiB banking, it's just that the initial values of the banking register may or may not play well with what the hack expected.

If so, this might be something that depends on the exact MMC1 revision ... or else needs to be fixed by further ROM hacking.


Let me rephrase that. The earlier revisions of the MMC1 can have any 16 KiB slice show up from $C000-$FFFF. While this game seems to be ok with it being any second half (since the PRG appears to be approximately four copies of the SMB1 engine), it doesn't even have the vectors in the bottom half.

The later revisions ensure that it's always the last 16 KiB slice. Using a modified SEROM/SHxROM board is probably the easiest way to fix this.
Re: Super Mario Unlimited bank switching
by on (#158959)
Thanks for the response!

That all makes sense, but how can I check a Rom to determine if it uses 16K or 32K banking? Is there a flag somewhere or some other way to determine this in either a hex editor or debugger?

Also, on that same line, where in a Rom does it control which 16K slice is used? Can I go in there and make it use the second half at all times?
Re: Super Mario Unlimited bank switching
by on (#158966)
Depends on the mapper. In this case, it's MMC1, so the best you can do is use a debugging emulator (Nintendulator, FCEUX) and wait for writes to registers, cross referenced against the wiki...

For original (i.e. NOT romhacks), you can rely on the board names and specific IC revisions mentioned in NesCartDB. As I said, SEROM, SHROM, and SH1ROM don't support PRG banking, and so when naïvely extended they act weird if the MMC1 is programmed to a 16 KiB mode.

Similarly, the MMC1 and MMC1A ICs (I think) don't guarantee the contents of any of the registers on power-up, while the later ones do guarantee (I think...) booting up with the last 16 KiB resident in the top quarter of memory (as though the reset bit had been written).


In any case, the problem here isn't that the game is using 32 KiB banking. It's that it can't handle if the MMC1 boots up with the "Control Register" containing $08-$0B or $18-$1B.
Re: Super Mario Unlimited bank switching
by on (#158967)
getafixx wrote:
That all makes sense, but how can I check a Rom to determine if it uses 16K or 32K banking? Is there a flag somewhere or some other way to determine this in either a hex editor or debugger?

To determine whether a game uses 32K banking mode, watch for writes to $8000. They'll come in groups of five, and if the fourth write of five has bit 0 clear, the banking mode is 32K. Details in MMC1.

To determine whether a game uses SEROM (which forces 32K banking mode), look for 32 KiB PRG ROM and no WRAM.

getafixx wrote:
Also, on that same line, where in a Rom does it control which 16K slice is used?

Through writes to $E000. But the reset vector needs to be valid before the CPU can make any writes to $E000.