It is currently Sun Dec 10, 2017 5:28 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: APU Step Timing
PostPosted: Sat Oct 15, 2016 6:39 am 
Offline
User avatar

Joined: Tue Apr 23, 2013 5:25 pm
Posts: 22
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.


Top
 Profile  
 
 Post subject: Re: APU Step Timing
PostPosted: Sat Oct 15, 2016 7:07 am 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3967
Are you doing the immediate clocking?
Writing 0x80 should clock the sweep and envelopes immediately, streemerz relies on this.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
 Post subject: Re: APU Step Timing
PostPosted: Sat Oct 15, 2016 7:16 am 
Offline
User avatar

Joined: Tue Apr 23, 2013 5:25 pm
Posts: 22
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group