Zepper wrote:
- It prints "Channel: 0". Well, I have no clue what's up. Here's a copy of my
emulator log.
- Let me know if you have some question.
Line 52546: Shouldn't this be 7456 cycles elapsed, not 7458?
Code:
Mode 0:
Sequence step: 1 2 3 4 5 6
Cycles to next: 7459 7456 7458 7458 7458 7458
Next step: 2 3 4 5 6 2
Cycles elapsed: 0 7459 14915 22373 29831 37289
On cycle 37289, for mode 0, I reset the APU cycle counter to 7459 so that the next sequence tick will happen 7456 APU cycles later, as expected.
Line 55661: Confused how you get to APU cycle 7460?
In my thinking on this topic it helps and is easier to think of it in terms of an APU "frame" even though we're shy to use the word "frame" when talking about the APU because it implies alignment with something else, such as the PPU "frame" being aligned with the video signal. If you think of it as in mode 0 an APU frame is 37289 APU [or CPU] cycles long, and you write your APU to trigger the expected sequence of events at the "frame-relative" cycle numbers, instead of worrying about whether you need to count 7456, 7458, or 7459 cycles between, it makes things much easier. This is why, when I get to cycle 37289 in mode 0 I reset the APU cycle counter to 7459 and not 0...because then my mode 0 implementation doesn't need to concern itself with whether or not the sequence was reset and what that means for how many "inter-sequence" ticks I need to count before doing the next sequence tick.