How to clear APU sweep unit reload flag

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
How to clear APU sweep unit reload flag
by on (#126572)
wiki says(Sorry,I'm not sure it should be says or say or said) Each sweep unit contains the following: divider, reload flag.
The reload flag is set when write $4001 or $4005.
But when clear it?
Thanks for your answer.
Re: How to clear APU sweep unit reload flag
by on (#126574)
It gets reset (cleared) when the Sweep Unit is clocked by the Frame Sequencer.
Re: How to clear APU sweep unit reload flag
by on (#126575)
Disch wrote:
It gets reset (cleared) when the Sweep Unit is clocked by the Frame Sequencer.

It seems no. wiki describes SET only. Please see the pic.
Re: How to clear APU sweep unit reload flag
by on (#126576)
nesdevwiki wrote:
If the reload flag is set, the divider's counter is set to the period P. If the divider's counter was zero before the reload and the sweep is enabled, the pulse's period is also adjusted (if the target period is in range; see below).
I think there is a missing "The reload flag is then cleared" after the above quoted text, but I am not familiar with the mechanism of the sweep units.
Re: How to clear APU sweep unit reload flag
by on (#126577)
Thanks to everyone. I decide to read neswiki, 2A03 technical reference and apu_ref simultaneously to seek the result.
Re: How to clear APU sweep unit reload flag
by on (#126587)
Yes, the reload flag is cleared when the sweep unit is clocked. I will add that to the text.

If you want to clear the reload flag, you can manually clock the APU frame sequencer by writing $4017 with bit 7 set.
Re: How to clear APU sweep unit reload flag
by on (#126592)
rainwarrior wrote:
Yes, the reload flag is cleared when the sweep unit is clocked. I will add that to the text.

If you want to clear the reload flag, you can manually clock the APU frame sequencer by writing $4017 with bit 7 set.


Thank you. Recently, I am implementing APU for my emulator, so I try my best to confirm any info about APU.