I can't find any description of this in apu_ref.txt or any of the wiki articles, but every emulator I've checked sets the length counter of a channel to 0 when its $4015 enable bit is written with a 0. As far as I can tell this is correct; I discovered I was missing this behaviour from Legend of Zelda.NSF track 7 which halts the squares and triangle by writing enable with 0 then with 1 in the same frame.
The question I have is whether setting the triangle enable bit to 0 also clears its linear counter. There is differing behaviour among the emulators I've looked at:
NotSoFato: just length counter
Nestopia: just length counter
VirtuaNES: also resets linear counter, clears halt flag
NezPlug++: also resets linear counter, clears halt flag
If I am thinking about this correctly, clearing the halt flag is unnecessary, since the channel will be off until the length counter is reloaded ($400B) which will set halt anyway.
But... does anyone know offhand whether the linear counter should be cleared?
If not, I can probably rig up a hardware test on my PowerPak but it'll require a bit of thought.
The question I have is whether setting the triangle enable bit to 0 also clears its linear counter. There is differing behaviour among the emulators I've looked at:
NotSoFato: just length counter
Nestopia: just length counter
VirtuaNES: also resets linear counter, clears halt flag
NezPlug++: also resets linear counter, clears halt flag
If I am thinking about this correctly, clearing the halt flag is unnecessary, since the channel will be off until the length counter is reloaded ($400B) which will set halt anyway.
But... does anyone know offhand whether the linear counter should be cleared?
If not, I can probably rig up a hardware test on my PowerPak but it'll require a bit of thought.