"During count sequences 0..3, the linear (triangle) and envelope decay (square & noise) counters recieve a clock for each count. This means that both these counters are clocked once immediately after $4017.7 is written with a value of 1."
And in Blargg's APU reference doc http://nesdev.com/apu_ref.txt it states:
"If the mode flag is clear, the 4-step sequence is selected, otherwise the
5-step sequence is selected and the sequencer is immediately clocked once."
It seems like there is something "special" about the 5-step sequence (mode 1) and ensuring that it is clocked *immediately*, but I can't figure out what it is. If you look at the following diagram in Blargg's document, the envelope and linear counters (specified with the 'e') get updated in both 4-step mode and 5-step mode *immediately* in step 0. What is so special about the 5-step mode??
Code: Select all
f = set interrupt flag
l = clock length counters and sweep units
e = clock envelopes and triangle's linear counter
mode 0: 4-step effective rate (approx)
---------------------------------------
- - - f 60 Hz
- l - l 120 Hz
e e e e 240 Hz
mode 1: 5-step effective rate (approx)
---------------------------------------
- - - - - (interrupt flag never set)
l - l - - 96 Hz
e e e e - 192 Hz
------
And one more question while I'm at it - this might have something to do with the above question but I can't be sure. Does anyone know why Brad Taylor specifies the following counter sequence for mode 0?
Code: Select all
$4017.7 sequence
------- --------
0 4, 0,1,2,3, 0,1,2,3,..., etc.
1 0,1,2,3,4, 0,1,2,3,4,..., etc.

Thanks for the help!!
P.S. My website is finally back up now! https://rm-rfroot.net/nes_fpga/