APU Misc: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
mNo edit summary
(per some of Quietust's recent discoveries in Talk:APU Sweep, Talk:APU Noise, and Talk:APU DMC)
Line 1: Line 1:
All [[APU|NES APU]] channels have some form of frequency control. The term '''frequency''' is used where larger register value(s) correspond with higher frequencies, and the term '''period''' is used where smaller register value(s) correspond with higher frequencies.
All [[APU]] channels have some form of frequency control. The term '''frequency''' is used where larger register value(s) correspond with higher frequencies, and the term '''period''' is used where smaller register value(s) correspond with higher frequencies.


In the block diagrams, a '''gate''' takes the input on the left and outputs it on the right, unless the control input on top tells the gate to ignore the input and always output 0.
In the block diagrams, a '''gate''' takes the input on the left and outputs it on the right, unless the control input on top tells the gate to ignore the input and always output 0.


Some [[APU|NES APU]] units use one or more of the following building blocks:
Some [[APU]] units use one or more of the following building blocks:


A '''divider''' outputs a clock every n input clocks, where n is the divider's period. It contains a counter which is decremented on the arrival of each clock. When the counter reaches 0, it is reloaded with the period and an output clock is generated. A divider can also be forced to reload its counter immediately, but this ''does not'' output a clock. When a divider's period is changed, the current count ''is not'' affected.
A '''divider''' outputs a clock every n input clocks, where n is the divider's period. It contains a counter which is decremented on the arrival of each clock. When the counter reaches 0, it is reloaded with the period and an output clock is generated. A divider can also be forced to reload its counter immediately, but this ''does not'' output a clock. When a divider's period is changed, the current count ''is not'' affected.
A divider may be implemented as a down counter (5, 4, 3, ...) or as a [[wikipedia:linear feedback shift register|linear feedback shift register]] (LFSR).
The dividers in the pulse and triangle channels are linear down-counters.
The dividers for noise, DMC, and the APU Frame Counter are implemented as LFSRs to save gates compared to the equivalent down counter.


A '''sequencer''' continuously loops over a sequence of values or events. When clocked, the next item in the sequence is generated.
A '''sequencer''' continuously loops over a sequence of values or events. When clocked, the next item in the sequence is generated.


A '''timer''' is used in each of the five channels to control the sound frequency. It contains a divider which is clocked by the [[CPU|CPU clock]]. The timer's period is simply the period of the divider.
A '''timer''' is used in each of the five channels to control the sound frequency. It contains a divider which is clocked by the [[CPU]] clock. The triangle channel's timer is clocked on every CPU cycle, but the pulse, noise, and DMC timers are clocked only on every second CPU cycle and thus produce only even periods.

Revision as of 22:19, 18 May 2011

All APU channels have some form of frequency control. The term frequency is used where larger register value(s) correspond with higher frequencies, and the term period is used where smaller register value(s) correspond with higher frequencies.

In the block diagrams, a gate takes the input on the left and outputs it on the right, unless the control input on top tells the gate to ignore the input and always output 0.

Some APU units use one or more of the following building blocks:

A divider outputs a clock every n input clocks, where n is the divider's period. It contains a counter which is decremented on the arrival of each clock. When the counter reaches 0, it is reloaded with the period and an output clock is generated. A divider can also be forced to reload its counter immediately, but this does not output a clock. When a divider's period is changed, the current count is not affected.

A divider may be implemented as a down counter (5, 4, 3, ...) or as a linear feedback shift register (LFSR). The dividers in the pulse and triangle channels are linear down-counters. The dividers for noise, DMC, and the APU Frame Counter are implemented as LFSRs to save gates compared to the equivalent down counter.

A sequencer continuously loops over a sequence of values or events. When clocked, the next item in the sequence is generated.

A timer is used in each of the five channels to control the sound frequency. It contains a divider which is clocked by the CPU clock. The triangle channel's timer is clocked on every CPU cycle, but the pulse, noise, and DMC timers are clocked only on every second CPU cycle and thus produce only even periods.