This almost seems like a joke. You're joking, right?
So you incbin'ed an NSF and then JSR to it... Taking a look at the header of the NSF shows "NESMxxxxx" which the NES interprets as code and eventually runs into a BRK instruction.
Since I love NSFs and NES music, I'll help you out:
First, look at the header of the NSF, using a hex editor. Write down the bytes stored from 0x08-0x0D in the file. Those are the load address, init address, and play address, respectively (stored in 6502/Intel byte order). Then, using the same hex editor, remove the 128-byte header of the NSF, and save the remaining binary file in the same directory as your ASM code.
Incbin THAT binary file with the same origin ORG... as what the load address was of the NSF. You may have to put your own ASM code at a different location so the music code does not write overtop of it.
In your ASM code, set up two EQUs (constants, whatever) INIT_ADDR, and PLAY_ADDR and set those to the addresses you got from the NSF bytes 0x0A,0x0B and 0x0C,0x0D. Be sure to write it the right way, eg: INIT_ADD EQU $8000
In your ASM code when you set up RAM, etc, you type this in:
Code: Select all
lda #$01 ;or whatever number song you want
and inside your NMI/Vblank routine, you simply do this:
There's usually no need for you to set $4015 or anything. Just make sure your ASM code's RAM use doesn't conflict with the NSF's RAM use.