nesdev.com
http://forums.nesdev.com/

APU Step Timing
http://forums.nesdev.com/viewtopic.php?f=3&t=14943
Page 1 of 1

Author:  tehcloud [ Sat Oct 15, 2016 6:39 am ]
Post subject:  APU Step Timing

I finished writing an APU last weekend, and during that process I discovered what appears, at least from my perception, to be a discrepancy on the wiki.

https://wiki.nesdev.com/w/index.php/APU shows this (which originally comes from apu_ref.txt):

Code:
mode 0:    mode 1:       function
---------  -----------  -----------------------------
 - - - f    - - - - -    IRQ (if bit 6 is clear)
 - l - l    l - l - -    Length counter and sweep
 e e e e    e e e e -    Envelope and linear counter


Which is different from this concerning 5-step mode: https://wiki.nesdev.com/w/index.php/APU_Frame_Counter

When implemented in code, I discovered that I had my 5-step mode wrong, resulting in warped and cut off sounds in 5-step mode in my emulator. So, I changed it to be something more like this, which matches up with the APU Frame Counter wiki page:

Code:
mode 0:    mode 1:       function
---------  -----------  -----------------------------
 - - - f    - - - - -    IRQ (if bit 6 is clear)
 - l - l    - l - - l    Length counter and sweep
 e e e e    e e e - e    Envelope and linear counter


Am I just misinterpreting this? The way I have things implemented now, everything sounds perfect.

Author:  Dwedit [ Sat Oct 15, 2016 7:07 am ]
Post subject:  Re: APU Step Timing

Are you doing the immediate clocking?
Writing 0x80 should clock the sweep and envelopes immediately, streemerz relies on this.

Author:  tehcloud [ Sat Oct 15, 2016 7:16 am ]
Post subject:  Re: APU Step Timing

By immediate clocking, do you mean on 4017 writes? If so, yes.

If you look closely you'll see I just shifted the position of the first column from the original example. I'm counting down CPU cycles to determine when to clock sweep/length/envelope, which seems to be the way things are described on https://wiki.nesdev.com/w/index.php/APU_Frame_Counter

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/