NESASM Help with NSF playback metroid

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
swee
Posts: 2
Joined: Sun Dec 10, 2017 9:01 am

NESASM Help with NSF playback metroid

Post 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 )
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: NESASM Help with NSF playback metroid

Post 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. :)
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: NESASM Help with NSF playback metroid

Post 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.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: NESASM Help with NSF playback metroid

Post 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. :(
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: NESASM Help with NSF playback metroid

Post 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.
Post Reply