Page 1 of 1

NESASM Help with NSF playback metroid

Posted: Mon Dec 11, 2017 12:00 pm
by swee
I have been struggling with getting a NSF file to playback with my code. I have been looking at https://wiki.nesdev.com/w/index.php/NSF , and used the metroid.nsf like in the example.

But i have gotten stuck at this:
" so we set up our ROM image with contiguous data starting from $080 in the file.
This NSF has 6 4k banks in it, numbered 0 through 5. It specifies that each of the 8 memory regions should be switched to bank 5, which begins at $05 * $1000 bytes in the ROM image."

How do i suppose load in the nsf file and where? i tried $8000 becuse its the load address, couldn't get that to work. Tried $5000 becuse "It specifies that each of the 8 memory regions should be switched to bank 5" wich i do not really understand... but didn't work either :P
Should i load in part of the nsf at $8000, and the some other part in $5000 becuse of the bank switching? And how do i split up the file in NESASM code?

I used:
.org $8000
.incbin "metroid-NOHEADER.nsf"

when loading in the file

( i'm new to this )

Re: NESASM Help with NSF playback metroid

Posted: Wed Dec 13, 2017 2:52 pm
by unregistered
Hello swee,

When I tried to make music work in the game I'm working on, was referred to use famitone. Now famitone2 is out. Shiru created them. There is a file in the tools folder called nsf2data.exe. I'm unsure if you can use it to convert your nsf file into assembly code because Shiru, in the readme.txt, only talks about using nsf2data.exe for converting sound effects. I don't think you can just use nsf files in assembly... only assembly codes can be used in assembly. The readme.txt file suggests using FamiTracker to create your own song and then converting that into assembly.

Actually, I remember learning that converting nsf music files into assembly isn't allowed because that could enable copyright infringement. :)

Re: NESASM Help with NSF playback metroid

Posted: Wed Dec 13, 2017 3:29 pm
by rainwarrior
Metroid is a bankswitching NSF, it's not going to work like that.

You need to try with a non-bankswitching NSF instead.

Re: NESASM Help with NSF playback metroid

Posted: Fri Dec 15, 2017 9:00 pm
by unregistered
So if he chooses a non-bankswitching NSF, he could use that in his assembly code? If so, I apologize for my post. :(

Re: NESASM Help with NSF playback metroid

Posted: Fri Dec 15, 2017 9:16 pm
by rainwarrior
Well copyright infringement is a whole other thing, but yes you can take a non-bankswitching NSF, stick its binary data into an NES ROM, and write some kind of player stub that calls its INIT routine, then once per frame calls its PLAY routine.

If you want to use the homebrew "NSF style" mapper 31 you could even use a bankswitching NSF, actually.

I even made a tool that does this.

However I wouldn't really recommend doing this to get music into a game. It's much better if the music code and data are assembled as part of your game and can be moved around, rewritten, etc. as needed. Otherwise if you try to stick an NSF binary into your game, you have to get out of the way of all of its RAM use, memory layout, etc. it really puts a lot of impositions on you. Not a great way to get music in there, but it can be done this way.