incorrect NSF header

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
incorrect NSF header
by on (#199574)
All standalone NSF players and NES emulators take extra info from NSF-header.
But i've found Power Blade NSF (http://akumunsf.good-evil.net/)
that indicates VRC6, VRC7 and FDS are using same time:
Image
But Power Blade is just plain 2A03 tune, so i guess NSF have incorrect header info.

Why all the emulators/players take header info but not detect/display what extra chip really work?
Re: incorrect NSF header
by on (#199578)
I've seen the same thing in some older NSFs. Wolverine had the same issue-
Image
Re: incorrect NSF header
by on (#199580)
Eugene.S wrote:
Why all the emulators/players take header info but not detect/display what extra chip really work?

It's not really easy to detect what extra chips are actually used. You'd have to play through all songs (assuming there are no random elements in them) and check whether they write to any of the audio extension's registers.
Re: incorrect NSF header
by on (#199582)
How much of an NSF player's time is spent emulating the 6502, as opposed to generating the audio waveform? Perhaps when a player loads an NSF, it could emulate each track for 20 seconds and log writes made during that time, in effect converting those first seconds to a logged format analogous to VGM from which actual mapper synth writes can be inferred.
Re: incorrect NSF header
by on (#199583)
tepples wrote:
How much of an NSF player's time is spent emulating the 6502, as opposed to generating the audio waveform? Perhaps when a player loads an NSF, it could emulate each track for 20 seconds and log writes made during that time, in effect converting those first seconds to a logged format analogous to VGM from which actual mapper synth writes can be inferred.

Still, it would be a flaky solution to what is really a non-issue.
Re: incorrect NSF header
by on (#199606)
thefox wrote:
(assuming there are no random elements in them)

There aren't random elements; NSFs are deterministic as far as they don't start using out-of-bounds hardware (e.g. reading the controllers, PPU, open bus areas, etc.) RAM is initialized to 0 before the NSF INIT code runs.

But, yeah, there is no reason to try to detect anything. Just fix the header.
Re: incorrect NSF header
by on (#199607)
rainwarrior wrote:
thefox wrote:
(assuming there are no random elements in them)

There aren't random elements; NSFs are deterministic

I assumed thefox referred to pseudorandom elements, which would cause the NSF not to end or loop within 5 minutes like most NSFs do. Think of a musical improvisation engine that doesn't decide to use a particular expansion until several minutes in.

rainwarrior wrote:
as far as they don't start using out-of-bounds hardware (e.g. reading the controllers, PPU, open bus areas, etc.) RAM is initialized to 0 before the NSF INIT code runs.

Such "out-of-bounds hardware" would include RAM addresses $0101+S through $01FF. From "NSF" on the wiki:
The precise position of the stack on INIT or PLAY is not guaranteed, as the NSF player may need to use the top area of the stack for its own internal purpose. Make sure the tune does not attempt to modify $01F0-01FF directly. (Armed Dragon Villigust did, and was relocated to 2xx for its NSF.)


rainwarrior wrote:
But, yeah, there is no reason to try to detect anything. Just fix the header.

Unless you're writing the tool that audits headers.
Re: incorrect NSF header
by on (#199609)
rainwarrior wrote:
thefox wrote:
(assuming there are no random elements in them)

There aren't random elements;

Could have worded that better. I meant that a randomized song could run infinitely long, making it impractical to play through it. Of course in practice it would be highly unlikely that a song would run for a very long time and only then suddenly decide to write to an expansion audio register. :)