arthurln wrote:
1. 00000000AH changes from "13 80"(30592) to "4E 86"(30598). I knew that the value means [init address of data], so it points to the begin of the data in file right? The header's length doesn't change why the value changed?
0x0A is the init address for what gets run, 0x08 is where the data in the file starts getting put into memory. It's not uncommon for data running later in an NSF to refer to data or run code that's prior to the init code. I really can't understand 0x0A changing on an optimized NSF.
arthurln wrote:
2. How can I know when a track ends? Is every track have a fix length or Is it ends with something like EOF?
It's simply beyond the realm of reason to expect to know when a song ends in an NSF. Data logging is ineffective for this, song part similarity as well. Your only real bet to get all the data is to run it for about 7 minutes and hope you get all the song data.
arthurln wrote:
3. How can I know that one track uses some other user supplied tracks? When that happens should I copy the user supplied track's data there?
To supply a track to an NSF, you'd need to understand the format of the data, compose something in this format, and add it to the game's code. You'd often have to remove an existing track from the set as well.
arthurln wrote:
4. Every file's end are differences. Is that means that there is no specified end format and only header and data.
This is simple. If you optimize data, and remove the unused stuff, you can just cut it off the end. If the last byte in the file is 00, you can remove that byte. Repeat until last byte != 00. When you optimize, any unused data is set to 00.
Beyond answering specific questions, I should mention that optimizing single songs isn't very useful. Separation of songs from an NSF can go wrong. Space used by an NSF increases as you copy data with required null data in it, with this null data duplicated across several NSF files. If you're desperate to have individual tracks, it can be done with NotsoFatso or even NEZPlug, I think. For NotsoFatso, right-click the file in the winamp playlist you want as single-track entries, go to the 'View File Info' option, then 'Shadow -> Winamp' for a playlist of the nsf in winamp, or 'Shadow -> File' to export a playlist you can play for individual tracks.
Either way, do as you wish. I just see a way around this if I was interested in having some individual-track playlists.