NES -> SNES ROM convertor?

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

emu_enthusiast
Posts: 14
Joined: Tue Dec 08, 2009 9:45 pm

NES -> SNES ROM convertor?

Post by emu_enthusiast » Thu Dec 10, 2009 12:56 am

Ok I'm slowly learning C++, and teaching myself how to make a NES emulator at the same time.
But I also have an idea for a little side/project.

What I want to try is to make a program that can convert NES games to SNES games.

Why do you ask?
Especially when there are already plenty of both NES and SNES emalutors around?

Just for the challenge...

I had thought about just trying to write a program that converts the ROMS to exe files instead.
But, well, thats kind of boring tbh.
And obviously wouldn't work so well unless the end user had the same or a very similar system to my own.

So anyway, has anyone ever done something similar?
Where the program takes the input of a NES ROM and outputs a functional and compliant SNES ROM?

I looked, but I couldn't find anything that does this. But maybe I was just using the wrong search terms.

User avatar
oRBIT2002
Posts: 634
Joined: Sun Mar 19, 2006 3:06 am
Location: Gothenburg/Sweden

Post by oRBIT2002 » Thu Dec 10, 2009 2:53 am

If I am not mistaken, people have already done this a few years back. I'm pretty sure I've seen NES games that runs in SNES format, atleast some mapper 0 games like "Mario Bros" and similar..
I am not sure how it was done. Perhaps using the 8-bit mode on the SNES.

emu_enthusiast
Posts: 14
Joined: Tue Dec 08, 2009 9:45 pm

Post by emu_enthusiast » Thu Dec 10, 2009 3:57 am

Well so far I've seen that people have done this by hand, but I've yet to come across any apps written that automate the process.

Not saying that they don't exist though...

Coldberg
Posts: 34
Joined: Fri Jul 18, 2008 9:12 am

Post by Coldberg » Thu Dec 10, 2009 4:13 am

wasn't the snes built to be compatible with nes games ? so that's probably a possible thing
tho i don't see how you'd trivially convert nes roms into a native windows executable unless you just append a rom to an emulator
since translating the rom into something x86 can would be anything but trivial

emu_enthusiast
Posts: 14
Joined: Tue Dec 08, 2009 9:45 pm

Post by emu_enthusiast » Thu Dec 10, 2009 4:41 am

Coldberg wrote:wasn't the snes built to be compatible with nes games ? so that's probably a possible thing
The SNES was originally supposed to be compatible with NES ROMS, but apparently Nintendo had a lot of prob at the time getting it working, and so it never happened.

Both the NES and SNES CPU are the similar architecture + endian-wise, so that is in my favour too.
Coldberg wrote:tho i don't see how you'd trivially convert nes roms into a native windows executable unless you just append a rom to an emulator
since translating the rom into something x86 can would be anything but trivial
That's not entirely what I had in mind.
Perhaps a better example would be to think of it as a "ROM mapper" of sorts.

I imagine the breakdown would go something like this:

* map sprites
* map backgrounds
* map animation/char movement
* map sound
* pad rom as appropriate

So there would be no actual executing req'd as the new emulator/console would simply play the new rom as if it was created for it.

Converting the sprites/backgrounds would be fairly straight fwd. Re-assembling the levels AND maps would be a bit more tricky, I'd imagine. But the actual character movement/reponses... That's where I imagine it would start to get problematic.

I'm not even considering the sound at this stage. That would be something that I would prob leave off for a very long time...

User avatar
Disch
Posts: 1849
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch » Thu Dec 10, 2009 11:57 am

emu_enthusiast wrote:Well so far I've seen that people have done this by hand, but I've yet to come across any apps written that automate the process.

Not saying that they don't exist though...
You haven't seen one because they don't exist.

They don't exist because it's not possible to fully automate the process.

NES and SNES share a similar processor architecture, but from a standpoint of a conversion program, that is the end of their similarities.

The register map is totally different, the timing is different, the PPU is different, and APU uses an entirely different processor with its own instruction set and memory map, etc, etc.



At best you'll be able to hack together a program to automatically convert 1 NES game to a functional SNES game. But in all likelyhood that program will only work for that one game.

LocalH
Posts: 180
Joined: Thu Mar 02, 2006 12:30 pm

Post by LocalH » Thu Dec 10, 2009 1:06 pm

It's possible to be semi-automated for a certain subclass of NES games - for example, CNROM games only. One could make build the necessary SNES-side code and build a tool that would convert everything necessary - it would probably either require ROM detection (to know where data and code are in the ROM) or include a built-in emulator that logged every address that was code. This would require the user to play the game under such emulation and thorooughly exhaust every branch of game code that they could possibly do. Still wouldn't be 100%, so the user would have to manually ensure that all code was marked as code, graphic tiles marked as graphics, and sound driver marked as sound. Then an automated tool could take that external information and build an SNES ROM.

Not easy, but not impossible either. Wouldn't work for later games that used mappers, one would have to basically "unroll" the mapper and generate a flat memory map that the tool could use to convert the game.

Much easier to just port the game yourself, as has been done with the few NES-to-SNES ROMs that are floating around.

tepples
Posts: 22278
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples » Thu Dec 10, 2009 1:08 pm

LocalH wrote:t would probably either require ROM detection (to know where data and code are in the ROM) or include a built-in emulator that logged every address that was code. This would require the user to play the game under such emulation and thorooughly exhaust every branch of game code that they could possibly do.
Some of the FCE Ultra derivatives can save such an access log.

LocalH
Posts: 180
Joined: Thu Mar 02, 2006 12:30 pm

Post by LocalH » Thu Dec 10, 2009 1:13 pm

That's good, as such a log could be used. It would still require the user to manually attempt to access every possible valid code path in the original ROM. This was how the first Sonic disassemblies were worked on.

As a side effect, such a project could also make working towards a disassembly easier for a given ROM.

User avatar
Memblers
Site Admin
Posts: 3897
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers » Thu Dec 10, 2009 1:23 pm

I'd be happy to contribute my NES sound emulator to such a project. I released the source under a license that is pretty close to public domain (if it isn't that exactly). But I'd be interested in updating a few things in it, if there was any point to doing so.

I wanted to write an emulator/auto-converter like you're talking about. But the sound was the most different part, and the most interesting to me, so that's as far as I ever took it.

I agree with Disch that it won't be possible to fully automate the process. I think there would be a pretty good success-rate though for auto-patching the NES register writes. The odds that it would get a false-positive and patch a 3-byte string of data instead of code are low, but significant (I can think of some stupid tricks that would reduce it, but it's surely easier to just manually hack the odd ones).

A while back I was considering the timing differences. On the SNES you could increment a counter every scanline, and use that to time-stamp the NES PPU writes (i.e., create an HDMA table, which also means the video will be one frame behind). The confusing thing is that the SNES CPU doesn't run at a constant speed, so I don't know if that can be worked out. Also, all this extra processing could would mean you could very, very easily run out of CPU time to finish the frame.

Overall, I believe that it's a lot easier than it looks.

emu_enthusiast
Posts: 14
Joined: Tue Dec 08, 2009 9:45 pm

Post by emu_enthusiast » Thu Dec 10, 2009 3:16 pm

Hehe. I didn't expect this sort of a response. :oops:

It was more of a "would this be possible," rather than anything concrete.
tbh I am nowhere near skilled enough coding-wise to be able to pull something like this off yet, or even any time soon.

User avatar
MottZilla
Posts: 2835
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla » Thu Dec 10, 2009 3:29 pm

You're better off doing it by hand. For PC-Engine someone has actually made a NES emulation wrapper that allows NES games to run with relatively minor changes. I know Mega Man, Contra, and Castlevania were working on it. All UNROM.

User avatar
Near
Founder of higan project
Posts: 1553
Joined: Mon Mar 27, 2006 5:23 pm

Post by Near » Thu Dec 10, 2009 5:27 pm

There's also Super Sleuth, which is really novel.

It's an SNES emulator, but it redirects NES registers to their SNES "roughly" equivalents, and uses the SNES CPU. With only a little bit of code, it runs Super Mario Bros.

emu_enthusiast
Posts: 14
Joined: Tue Dec 08, 2009 9:45 pm

Post by emu_enthusiast » Thu Dec 10, 2009 6:13 pm

byuu wrote:There's also Super Sleuth, which is really novel.

It's an SNES emulator, but it redirects NES registers to their SNES "roughly" equivalents, and uses the SNES CPU. With only a little bit of code, it runs Super Mario Bros.
That's pretty cool. Thanks for the link.

User avatar
Hamtaro126
Posts: 777
Joined: Thu Jan 19, 2006 5:08 pm

Post by Hamtaro126 » Sat Dec 12, 2009 10:22 am

byuu wrote:There's also Super Sleuth, which is really novel.

It's an SNES emulator, but it redirects NES registers to their SNES "roughly" equivalents, and uses the SNES CPU. With only a little bit of code, it runs Super Mario Bros.
What do you mean by ''A little bit of code''?

Do you mean Graphics, Palette, **IRQ and ***Mapper Registers?

If so, Prove that SuperSleuth will run a modded SMB1 rom via SMBDIS with these modifications. Screenshots will tell the results

** It uses Sprite 0, You may need to replace it with an IRQ for it to work properly

*** Mappers do not apply to an unmodified NROM version of SMB1
AKA SmilyMZX/AtariHacker.

Post Reply