News:

11 March 2016 - Forum Rules

Main Menu

(U)NROM to MMC1?

Started by YSBunny573, January 06, 2017, 09:58:14 PM

Previous topic - Next topic

YSBunny573

Is it possible to to convert (U)NROM to MMC1? I'm converting NES games to GC memory card format and the emulator only supports MMC1 titles.

Bregalad

Quote from: Starz Lol on January 06, 2017, 09:58:14 PM
Is it possible to to convert (U)NROM to MMC1?
Indeed it is possible, but completely pointless in my honnest opinion.

QuoteI'm converting NES games to GC memory card format and the emulator only supports MMC1 titles.
If you could elaborate what is a GC memory card it'd help. Do you mention Game Cube ? Any emulator who cannot emulate UNROM is probably extremely retarded. It's one of the simplest mapper to emulate and is simpler than MMC1. In addition to that it's extremely common and a lot of games uses it.

YSBunny573

Quote from: Bregalad on January 07, 2017, 01:08:27 PM
If you could elaborate what is a GC memory card it'd help. Do you mention Game Cube ? Any emulator who cannot emulate UNROM is probably extremely retarded. It's one of the simplest mapper to emulate and is simpler than MMC1. In addition to that it's extremely common and a lot of games uses it.
GameCube Memory Card.
Also I don't know why it only works with MMC1. Most likely because it was only designed to work with Zelda 1 and 2. Also I'll have to mention the game has to be either 128 KB or 256 KB (depends on whether you're using Zelda 1 or Zelda 2 as a base).

Disch

If the emulator only bothers to support 2 games, you might have a bigger problem with CHR-RAM.  Before trying to convert an UNROM game, first try an MMC1 game that uses CHR-RAM.  Final Fantasy is an easy one.  Battle of Olympus is another one.

If those games don't work, you've got a very big (and depending on the game, maybe impossible without heavy graphical compromises) job ahead of you.

Bregalad

Quote from: Disch on January 07, 2017, 04:31:11 PM
If the emulator only bothers to support 2 games, you might have a bigger problem with CHR-RAM.  Before trying to convert an UNROM game, first try an MMC1 game that uses CHR-RAM.  Final Fantasy is an easy one.  Battle of Olympus is another one.
The first Zelda uses CHR-RAM, so it's fine.

Disch


YSBunny573

Great! So all we need to do is convert a NROM or UNROM to MMC1 and somehow extend it to either 128kb or 256kb. What do we do though?
I already converted SMB2 to GameCube memory card format (GCI) since it was already 128kb.

Disch

Doing a mapper hack requires you understand what mappers actually do.  And for that you need to be reasonably comfortable with assembly.

For Converting UNROM to MMC1... the short version is this:
1) Cut into the game's Reset routine and prep the MMC1 to be in the proper mode and whatnot (general rule is write to all mapper regs at least 1 to get them in a known state)
2) Find all instances of the game doing a write to an UNROM reg and replace it with the equivalent MMC1 version of that write.

That's pretty much all there is to it.  If you understand assembly and are familiar with NES architecture, it's not particularly complicated.  But if you're a newbie to all this stuff, it'll probably be super confusing (but still possible).


NROM is simpler because it's effectively "no mapper" which means you can skip step 2.  In fact it's pretty easy to create a generic "shell" to convert any NROM game to an MMC1 game.




Tools you'll need:
- Documentation on UNROM and MMC1
- FCEUX
- An injection assembler, like xkas, bass, (or schasm)


You can ignore the assembler and do everything in a hex editor if you want.  But then you have to manually insert opcodes... so you'll need a 6502 reference sheet



Again, even though a veteran could probably crank this out in less than an hour, for a novice this is going to be quite a difficult task because there's a lot you have to learn and get familiar with.

Start small.  NROM is much, much easier, so I'd start with that.  Convert something like Donkey Kong or something.

Bregalad

Quote from: Disch on January 08, 2017, 05:07:38 PM
2) Find all instances of the game doing a write to an UNROM reg and replace it with the equivalent MMC1 version of that write.
The problem is that interrupts will potentially make this a nightmare. UNROM can have attomic writes to mapper registers, while MMC1 needs 5 writes, and if an interrupt happens within those writes *and* also try to switch a bank, it'll switch the wrong bank and crash the game. This CAN happen, I tried to convert Mega Man 1 to MMC1 and I had such issues back then.

So, you have to implement what pretty much all MMC1 games do, disable interrupts during bankswitching and re-enable after.

KingMike

By interrupt, NMI is the one you'd have to worry about (since IRQ is not used by default, only by certain mappers and I don't think MMC1 is one of those).
In Momotarou Densetsu, when I did a 512K expansion hack, I had to wait for NMI to pass before swapping to the second half where I added my text, to be sure it wouldn't hit NMI again before I swapped back.
"My watch says 30 chickens" Google, 2018