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.
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?
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?
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.
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.