I'm trying to make my NSF player pass blargg's apu_mixer tests, starting with the square wave. The section of output that is meant to be silent is quiet, but certainly not silent. Visual inspection of the waveform shows a train of alternating positive and negative spikes, leading me to believe it's a phase issue, and logging the exact cycle of each transition shows that each channel is exactly four cycles out of phase: first the PCM, then Pulse 1, then Pulse 2.
But looking at the test source, I see this:
But looking at the test source, I see this:
Code:
ldx #$6F ; period = 896*2
ldy #$00
stx $4002
stx $4006
sty $4003
sty $4007
The phase-resetting writes occur exactly four cycles apart. Does this mean the output I'm hearing is an artifact of the test, or is there an obscure timing issue in the APU I'm not emulating properly?ldy #$00
stx $4002
stx $4006
sty $4003
sty $4007