News:

11 March 2016 - Forum Rules

Main Menu

Ripping An NES File

Started by ultimaweapon, December 17, 2018, 02:33:42 AM

Previous topic - Next topic

ultimaweapon

Does anyone know how to rip an NES file down to its individual components? I want to remove certain song files from a game and replace it with others, but I cannot file any details on how to do this.
Trust in the Heart of the Cards

Psyklax

Ha, good one. Oh wait, you're serious..  well, NES games don't have files, they're one big chunk of data. Somewhere in that data is the graphics, music, sound effects and game code. If you want to rip music, it's not stored in files, rather a set of instructions for the sound hardware that's buried amongst instructions for everything else.

If you want to go about ripping and replacing music, get ready to do some debugging and assembly. Disk-based games (floppy, CD etc) do use files and work this way, but ROMs do not.

FAST6191

Quote from: Psyklax on December 17, 2018, 03:19:49 AMIf you want to go about ripping and replacing music, get ready to do some debugging and assembly. Disk-based games (floppy, CD etc) do use files and work this way, but ROMs do not.

Most things from the DS on upwards (some GBA homebrew has such things as well https://pineight.com/mw/index.php?title=GBFS ) do have a file system that you can break down and fiddle with things in.

That said yeah anything GBA or older that did not come on a floppy disc or CD will tend to be all bundled into one giant blob, even some games on the exceptions and later things still favoured or used the blob approach or raw addresses on a disc.
There are some shortcuts and easier things you can try that might gain you something if you just want to rip data, to say nothing of people maybe coming before you and noting what they found ( http://datacrystal.romhacking.net/ , and if it is an arcade game there are usually so few of those that MAME will host the info for them), but there are no real options to pull apart a game into nicely named or extensioned files and folders for the older systems.
Altering music on the other hand is harder -- again if you are more used to the later Nintendo systems or something where the vast majority of games will use a well known format then it is not the case here. Music programmers back in the day were just that and often some top tier programmers in their own right that made all sorts of custom stuff on a game by game basis.

ultimaweapon

Thanks for the responses. At lease I know that task I want is even harder than I imagined. LOL! Who would have ever thought changing 1 song and 1 sound could be a pain! LOL! I do have a disassembly for the game I'm working on, so I'm going to tinker with it a bit to see what I can learn. I don't know anything about ASM, so I'll probably be stuck outside of changing some tones.
Trust in the Heart of the Cards

Disch

Might help if you told us what game you were working on.  Someone here might be familiar with it.

Psyklax

Quote from: Disch on December 17, 2018, 03:39:26 PM
Might help if you told us what game you were working on.  Someone here might be familiar with it.

That really is one of my pet hates on the forum. Why can people never give enough info? So coy. The more info we know, the more we can help. :)

But anyway, I think changing the music in an NES game is probably beyond your level at this stage, so I'm not sure I'd go down that path. But experiment, by all means. ;)

ultimaweapon

Oh my apologies! I'm working on Zelda 2. I want to replace the palace music and sound of the flute with a different sound.
Trust in the Heart of the Cards

phonymike

I believe NES music is handled differently for each game. Just like the game's engine, the NES sound engines are pretty unique. So much that the NSF music format stores the game's music engine (program code) and sound data together. They are ripped by hand like a rom hack. To play back NSF music you need to emulate the NES processor (6502) and sound hardware. NES music is not a data stream like a WAV or even compressed like MP3. It is code that is executed and then outputs audio with the NES sound hardware.

Luckily, Zelda 2 has the NSF music ripped over at Zophar's.

So if the sound engine is in that, maybe with an NES debugger and learning some 6502 asm you could figure out enough of how the sound engine works. FCEUX has a debugger and plays NSF files. It might help you. Check out 6502.html here, it's a crash course, or Y0SHi's nes doc has some sound registers in it so you see how the NES asm code communicates with the sound hardware. In the debugger, click "Step Into" to see each instruction execute. The NES will execute thousands of instructions in a second so there's a bit to go through.

ultimaweapon

Thanks phonymike. This is some helpful info. I'm going to review and study and use to my advantage.
Trust in the Heart of the Cards