Padding a rom? Will it work with carts?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Padding a rom? Will it work with carts?
by on (#36978)
There is a rom of a game that I want to throw on cart, but the actual size of the rom is a 1.5 meg file, instead of a standard 1 or 2 meg. Is there a way to pad the file to like 2 megs? (Or split the file into A/B and just pad those files up to 1 meg size) would the game still work? Thanks!

by on (#36981)
Yes, there are a few ways to pad the file depending on how the game expects the board to map ROM:

-The mirrored memory way: this is caused by both ROMs being selected from the same decoder. Because the second ROM is smaller than the first ROM, but is still selected in the same size window as the first ROM, it will ignore the more significant address lines and appear mirrored. To fill the 0.5MB with mirrored data, just copy the last 0.5MB from the 1.5MB file and paste it at the end. Likewise if you have a 12M (1.25MB) game, copy the last 2M four times until it fills up 16M (2MB). On the few SNES boards I've seen, this is how they handle unmatched ROMs.

-The open bus way: this is caused by one ROM being selected by a memory decoder, and the second (smaller) ROM being selected by another decoder. From 1.5Mb onwards (probably until 2MB) the values will be "open bus" as a result of nothing responding to that address range. To fill the last 0.5MB with open bus, you'll have to ask a SNES expert who knows what to fill this with. I believe very few games use this method, and do so as a form of copy protection.

-The don't care way: most games just won't care what memory beyond 1.5MB will be, you can fill it with whatever you want because they never access it.

by on (#37013)
How would I do this? There a game I am trying to make, and the rom is a 1.5 meg file, if I split this file to .75 megs, would I just fill those up to the full meg? 1024 ?

Or could I pad the file to 2 megs, and then split the rom and burn the chips that way?

What program/how would I do this? Thanks

by on (#37014)
If you want to pad your rom with zero's. You can use ucon64 to do it and then split it into two 8mbit files.

ucon64 -p rom.smc (do this 4 times)

ucon64 -s rom.smc (do this after the desired size is reached)


If you want to mirror the last chunk of the rom, use snestool to split the rom (8mbit split size). You'll get two files: rom.1 (8mbit) and rom.2 (4mbit). Make sure you use "delete header" on rom.1 before exiting. It will also automatically delete the header on rom.2 as well. Finally do this in command prompt:

copy /b rom.2 + rom.2 rom.2+2

Rom.1 and rom.2+2 should be suitable for burning onto 8mbit eproms.

by on (#38344)
I don't see any reason to pad ROMs for use on real HW unless game wants something from the area beyond ROM as pointed out before... if it works in emulator, it will do so on real HW, unless there's some bugs (in case of homebrew). Emulators don't usually emulate address wrapping and such... at least not MD emulators.

by on (#38349)
Quote:
Emulators don't usually emulate address wrapping and such... at least not MD emulators


All but ZSNES do for the SNES. It's left out there as a speed optimization.

bsnes and SNEeSe also emulate the odd quirks like the new instruction stack wrapping bug in emulation mode.

Anyway, older emulators had copy protection issues in games like MMX. Pad with the last 4mbits doubled. This is what all emulators do now, and I've not heard of any games not working as a result.

by on (#38400)
Ok, good to know... it seems I've got to do some padding on some games as I intend to use my MD flashcart (with an adaptor) on SNES... and its full 4MBytes.... I hate padding ROMs, makes flashing so much longer :P

by on (#38406)
By all accounts your game should work without any extra padding

But if you are using a 2MB chip anyways, you might as well duplicate the last 512k, it wont hurt

I am curious, which games DO need mirroring?

by on (#38407)
For sure Mega Man X. Probably other 10,12,20,24M games with copy protection.

by on (#38435)
I put Mega Man X on my flash cart, and it seemed to work fine playing through the first level with only 1.5 MB

Some games display a nasty message when you start it up with the wrong SaveRAM size. Maybe this is the only thing they look for, since it depends on hardware only and ROM mirroring is easy to fake.

by on (#38440)
It's easy to fake but very few copiers do it, and none have options to model mirroring after actual game boards.

by on (#38445)
In my case, mirroring gets a bit difficult as I have 2x 16Mbit 8-wide chip in parallel for MD... 8MBit games could have mirroring done easily (just one address line gets disconnected) but not above 8Mbit... ROM padding makes things easier in this case.