This is what makes Nerdtracker II really great; it gives one the capability to hear your music on a real NES system. If you want to make an NES game or demo, this is a good way to get music in your program quickly if you're not planning on writing your own music program. The only downside is the lack of simultaneous music and sound effect playback, though that could be possible with some kind of code modifications.

The playback code, like NT2 itself, was designed and written by Bananmos. For your convenience, here is the replay code, with the CA65 assembler included.

The source code compiles with the CA65 assembler by Ullrich von Bassewitz. The .NED files are not used directly by the replay program. Instead, NT2 creates these 2 files when you press ENTER while your song is loaded:

  • TEMP.DAT
    (pattern, order, and instrument data)

  • TEMP.IHD
    (DPCM samples and DPCM note-table)

You'll then run the temp.ihd file through the makedtt.exe program. For example:

makedtt temp.ihd temp.dtt temp.dmc 0

... would take the temp.ihd file and create temp.dtt (DPCM note-table), temp.dmc (DPCM sample data) and set up the sample location to start at ROM address $C000. The NES normally can only play samples located higher than $C000. (But it actually wraps-around to $8000. See Brad Taylor's delta modulation doc for a complete description of its various features and functions.)

The latest version of the replay code includes a convenient built-in NSF header so you can throw it directly into your favorite NES sound emulator.

If you want to play more than one song with the program, you probably have the songs.asm file that Memblers created for Solar Wars' soundtrack. Simply edit the .incbin commands to include your own .DAT files. If they use samples, they must all have the PCM instruments and note-tables set up in the same way in each song, because they will all be using the same note-table.

If you're putting it into a ROM, put it in at the NSF's load address if it's without the header, or (load address-$80) if the NSF header is present. Then to initialize a song, load the accumulator with the song number to play, and the X register with 0 if you want NTSC speed or 1 if you want PAL speed, then do a JSR to the init address in the NSF header. Then you JSR to the play address every frame (60hz NTSC or 50hz PAL) to play the music. If you want to stop the music with silence, stop running the play code and clear the sound registers (you could probably get away with only clearing $4015).