Page 1 of 2

There is an NSF compiler?

Posted: Thu Nov 04, 2010 9:29 pm
by SatoshiMatrix
Hi, I have a fairly simple question I hope someone can help with. Is there a program that can compile multiple NSF tracks into one NSF file? The powerpak is a great NSF player, but unless multiple tracks are compiled into one master track, you need to restart the powerpak when you want to play another track.

Thanks for any help.

Posted: Thu Nov 04, 2010 10:44 pm
by Dwedit
There's nothing like that out there.
NSF files are basically roms. This would mostly be the same process as making a multicart.

Posted: Fri Nov 05, 2010 6:14 am
by tepples
Dwedit wrote:NSF files are basically roms. This would mostly be the same process as making a multicart.
But because all NSFs use the same mapper (4 KiB PRG banks in $8000-$FFFF controlled by $5FF8-$5FFF), and this mapper supports switching the entire PRG area, it's not as hard as one might think. NSFs that don't bankswitch would just need a front-end that bankswitches to the right NSF during init, but NSFs that do bankswitch would need their $5FFx writes patched to add a constant.

Posted: Sat Nov 06, 2010 12:34 pm
by SatoshiMatrix
Sorry guys, I guess maybe I wasn't very clear on what I'm asking, so I'll try again.


I have found most .nsf files for various games are the game's entire soundtrack, from titlescreen to staff roll. These .nsf files contain the game's ENTIRE soundtrack.

I have a few .nsf files that are just individual tracks, and would like to know if there's any way to put them all together in one master .nsf like what is most common.

In particular, I found RushJet1's excellent Megaman 9.5 original arrangement split all up into individual tracks on Capcommunity here:

http://www.capcom-unity.com/mega_man/go ... post_num=1

So what I'm asking here is if someone could possibly combine these nsf files into a single master nsf whose tracks could be scrolled through using the Powerpak?

Sorry if this is confusing, I'm not sure how else to explain it.

Posted: Sat Nov 06, 2010 2:03 pm
by RushJet1
SatoshiMatrix wrote:So what I'm asking here is if someone could possibly combine these nsf files into a single master nsf whose tracks could be scrolled through using the Powerpak?

Sorry if this is confusing, I'm not sure how else to explain it.
You could do it by gluing the NSFs together with some wrapper code probably, but it'd be huge (8K times however many songs there are, thanks to the padding and the engine being reproduced over and over). However, as the one who wrote the songs, I can compile a special version if you want it. This was my first time trying this so hopefully nothing is really wrong with it.

Posted: Sun Nov 07, 2010 6:27 am
by Gil-Galad
tepples wrote:But because all NSFs use the same mapper (4 KiB PRG banks in $8000-$FFFF controlled by $5FF8-$5FFF), and this mapper supports switching the entire PRG area, it's not as hard as one might think. NSFs that don't bankswitch would just need a front-end that bankswitches to the right NSF during init, but NSFs that do bankswitch would need their $5FFx writes patched to add a constant.
No offense, but I'd like to make a small addendum to what you said so that others know. If you also use the FDS setting in the NSF header, you can use $6000 - $FFFF. Which includes the following registers; $5FF6 and $5FF7 to control $6000 - $6FFF and $7000 - $7FFF respectively. This feature can also be used for NSFs that are not specifically FDS or those that do not have FDS sound.

-----------------------------------------------

As far as merging other NSFs together, be it one song each or more.

What you want to do is designate a hardwired bank that is always loaded. There is where you would keep your initialization code. Also, if the NSFs have different play entry points, you need to designate a variable to switch the play address entry point. Using this variable and checking it for certain numbers and then load the appropriate play entry point address.

For example;

If you want to merge many Megaman tunes together from various games 1-6. The music code and data is located at $8000 - $BFFF. Init: $8003, play: $8000, load $8000.

Each NSF bank is 4KB. So we'll do the following;

0- $8000 - $8FFF

1- $9000 - $9FFF

2- $A000 - $AFFF

3- $B000 - $BFFF

4- $C000 - $CFFF (hardwired bank)

Set the NSF header at 70h to $00,$01,$02,$03,$04

This is telling the player to load these banks first when the NSF is loaded or when the tune is switched. You can also eliminate other banks, whatever is not used. But that's beyond the basic description of what I'm telling for you to get started.

So, we would have Megaman 1 first. Then we want to append the Megaman 2 banks to the NSF file.

5- $8000 - $8FFF

6- $9000 - $9FFF

7- $A000 - $AFFF

8- $B000 - $BFFF

So, now you have the banks set up.

The code can be written in many different ways, but to try and keep it simple I'll do it this way.

Init:

TAX
LDA TUNE_INDEX,X
STA CORE_CHECK
CMP #$03 ; 4th song is from Megaman 2
BCS SWITCH_BANK
JMP AUDIOIN

SWITCH_BANK:

LDA #$05
STA $5FF8
LDA #$06
STA $5FF9
LDA #$07
STA $5FFA
LDA #$08
STA $5FFB
LDA CORE_CHECK
JMP AUDIOIN_1

TUNE_INDEX:

.DB $00,$01,$02,$03,$04,$05,$06,$07,etc

If there are more than one play entry point addresses, do the following or otherwise just set the play address in the header.

LDA CORE_CHECK
CMP #$03
BCS DRIVER_1
JMP AUDIOIN

DRIVER_1:
JMP AUDIOIN_1

This is just one way to do it. You'll have to get creative in dealing with NSFs that are already bankswitching and those that have banks in other address ranges than I described. I don't really feel like writing out all the possibilities. However, this is enough to get you started if you want to do other NSFs yourself. Even though, I know you asked others to do it for you and it was done.

Posted: Sun Nov 07, 2010 12:16 pm
by SatoshiMatrix
RushJet1 wrote:
SatoshiMatrix wrote:So what I'm asking here is if someone could possibly combine these nsf files into a single master nsf whose tracks could be scrolled through using the Powerpak?

Sorry if this is confusing, I'm not sure how else to explain it.
You could do it by gluing the NSFs together with some wrapper code probably, but it'd be huge (8K times however many songs there are, thanks to the padding and the engine being reproduced over and over). However, as the one who wrote the songs, I can compile a special version if you want it. This was my first time trying this so hopefully nothing is really wrong with it.

Oh wow, thank you! this is exactly what I was hoping to find, and from the composer himself! This is really fantastic, among your best work. Must have taken ages to made this.

RushJet1, did you make this using Famitracker? These tracks are really damn impressive .nsf work.

Once again, thank you for doing this!

Posted: Sun Nov 07, 2010 10:32 pm
by Dwedit
In [url=http://nesdev.com/bbs/viewtopic.php?p=69549#69549]this post[/url], RushJet1 wrote:You could do it by gluing the NSFs together with some wrapper code probably, but it'd be huge (8K times however many songs there are, thanks to the padding and the engine being reproduced over and over). However, as the one who wrote the songs, I can compile a special version if you want it. This was my first time trying this so hopefully nothing is really wrong with it.
Doesn't song #16 sound a little like it was ripped out of Battle Kid?

Posted: Mon Nov 08, 2010 4:14 am
by thefox
Dwedit wrote:
RushJet1 wrote:You could do it by gluing the NSFs together with some wrapper code probably, but it'd be huge (8K times however many songs there are, thanks to the padding and the engine being reproduced over and over). However, as the one who wrote the songs, I can compile a special version if you want it. This was my first time trying this so hopefully nothing is really wrong with it.
Doesn't song #16 sound a little like it was ripped out of Battle Kid?
Yeah, who ripped who?

Posted: Mon Nov 08, 2010 6:46 pm
by RushJet1
thefox wrote:
Dwedit wrote:
RushJet1 wrote: You could do it by gluing the NSFs together with some wrapper code probably, but it'd be huge (8K times however many songs there are, thanks to the padding and the engine being reproduced over and over). However, as the one who wrote the songs, I can compile a special version if you want it. This was my first time trying this so hopefully nothing is really wrong with it.
Doesn't song #16 sound a little like it was ripped out of Battle Kid?
Yeah, who ripped who?
I posted this at several sites (2a03, theshizz, ocr) on November 4, 2008. Sivak posted this on January 9, 2009. I didn't notice how similar his song sounded to mine until July 19, and as a result I (kinda jokingly) posted this. It's kinda close, isn't it? I messaged him and said it was fine that he clearly pulled some inspiration from that song, whether knowingly or subconsciously :X

Posted: Mon Nov 08, 2010 6:47 pm
by RushJet1
SatoshiMatrix wrote:RushJet1, did you make this using Famitracker?
PPMCK.. and thanks for the comments ;P

Posted: Mon Nov 08, 2010 7:14 pm
by Banshaku
I can see after hearing it that there is a lot of similarity that were pulled from your song. Those statements aside, I never heard about that soundtrack before until today. It's very good! It feel so "from the days" that I have a hard time to not mix with one of the original soundtrack from the nes mega man ;)

edit:

I just finished listening to it. Wow. Even thought it was an alternate soundtrack for mm9 it gives me inspiration to make a platformer with that music. That music should be in a game, it's written all over it.

Posted: Tue Nov 09, 2010 5:29 am
by thefox
RushJet1 wrote:
thefox wrote:Yeah, who ripped who?
I posted this at several sites (2a03, theshizz, ocr) on November 4, 2008. Sivak posted this on January 9, 2009. I didn't notice how similar his song sounded to mine until July 19, and as a result I (kinda jokingly) posted this. It's kinda close, isn't it? I messaged him and said it was fine that he clearly pulled some inspiration from that song, whether knowingly or subconsciously :X
Yeah, I thought it was like that. There's no dispute that Sivak copied A LOT. I hate when people don't acknowledge other peoples work and instead make claims like "All programming and music composition is by me.". They should ask for the permission BEFORE posting/using the copycat version, not after they get caught.

For the record, I like your version better. :)

Posted: Tue Nov 09, 2010 6:33 am
by tepples
thefox wrote:I hate when people don't acknowledge other peoples work and instead make claims like "All programming and music composition is by me.".
It's not always easy to tell where "standing on the shoulders of giants", as Bernard of Chartres put it and as Isaac Newton popularized it, ends and copying begins.
They should ask for the permission BEFORE posting/using the copycat version, not after they get caught.
So you ask for permission in one medium, and the copyright owner grants it in that medium. But a new medium is developed afterward, and the copyright owner declines in that medium. The result is the DVD versions of WKRP in Cincinnati, which ended up with the Jimmy Hart version of most songs.

And what exactly should one do when he doesn't know he's copying until he is caught? George Harrison got burned for this in Bright Tunes Music v. Harrisongs Music, the case of "My Sweet Lord".

Posted: Tue Nov 09, 2010 5:20 pm
by Banshaku
tepples wrote:And what exactly should one do when he doesn't know he's copying until he is caught?
Tepples the armchair lawyer spoke! Here we go again with the impartial argument ;) Now on a serious note thought it's pretty obvious that the song was "inspired" by the one from rushjet. There is so many similarity that it cannot be a coincidence. You cannot stay gray in that case.

What you don't realize it that it now affect your judgment on the content since it was never mentioned from the start. Now you start to doubt things like "is it the only one that was 'inspired' that way?". It's sad in a way that now I won't listen to the soundtrack (BT) without doubting the other songs. It should have been mentioned from the get go and proper credit should have been given, especially when you sell the product after.