How to include .nsf file in our game?

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
Emperor
Posts: 3
Joined: Mon Mar 15, 2010 9:45 am

How to include .nsf file in our game?

Post by Emperor »

Hi all,

I want to include a .nsf file in my game but I am not able to do so. Is there a code available which includes .nsf file and I just need to change the .nsf file to play it?

(I found one here, but it does not work :( : http://0xabad1dea.net/main/doku.php?id=nsf-asm-player )

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

Post by tepples »

It's possible to include the code from an NSF in a game. But first, I'll need to know 1. what part of ROM address space the NSF covers, 2. what part of RAM its playback engine uses, and 3. how much CPU time it uses. Do you know how to measure these?
Emperor
Posts: 3
Joined: Mon Mar 15, 2010 9:45 am

Post by Emperor »

No...I am not completely aware of those terms.....

Can we manually set the Loading, playing address of the NFS file?

if we open the NFS file in Nestopia and the see its info ...there we see ROM address that is covered right?

I am not sure of other things u mentioned.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Post by GradualGames »

Maybe we need a bit more information. Are you just trying to include someone else's nsf in your game, or did you write it? It'd be a little easier to achieve your goal if you wrote the nsf yourself, with Famitracker for example. It can write out both nsf's, and raw binary data for use in your own NES programs. If you export raw binary data, then you can use the driver provided with Famitracker to play your music in your own program/game. I have a little demo sitting around demonstrating how to do this if you're interested.
User avatar
MottZilla
Posts: 2835
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

Any NSF you include in your own program is going to use parts of RAM for itself. If your program uses these RAM areas too, bad things happen. Either the NSF won't play or your program will mess up or both. You must know where the NSF wants to be located at in memory along with all RAM it ever accesses to reserve that in your program for the NSF.
Roth
Posts: 400
Joined: Wed Aug 03, 2005 3:15 pm
Contact:

Post by Roth »

Here's an older topic that describes the steps necessary:

http://nesdev.com/bbs/viewtopic.php?t=2 ... hlight=nsf

You may have to refer to a doc called nsfspec.txt (I think that's the proper name). Hope this helps!
Post Reply