Just trying to understand how the NES pulse generator works.
Does the NES APU actually have two square wave generators in hardware or just one handling two channels on opposing clock cycles?
The reason I ask is because in documentation and source I have found the timer period is multiplied by two whereas to me it would make more sense to just have one and output on opposing clock cycles therefore eliminating the need to multiply by 2.
for example:
cycle 0: Square 0
cycle 1: Square 1
cycle 2: Square 0
cycle 3: Square 1
Pulse (Square) Generation
Moderator: Moderators
- cpow
- NESICIDE developer
- Posts: 1097
- Joined: Mon Oct 13, 2008 7:55 pm
- Location: Minneapolis, MN
- Contact:
Re: Pulse (Square) Generation
Well it has to have at least two period counter registers because obviously the two channels can be at two different frequencies at the same time. Given that really all you need is a period counter and a clock to generate a square wave, I'd say that's pretty much evidence that it has two independent square wave generators. The divide-by-two is probably cheaper in chip real-estate than would be having a 16-step sequence to accomplish the same thing that a /2 and an 8-step sequence does.Overload wrote: Does the NES APU actually have two square wave generators in hardware or just one handling two channels on opposing clock cycles?
To me the most interesting part is the difference in the two channels' sweep generators.
Re: Pulse (Square) Generation
Yeah, the only place I can think of that being really noticable was in The Guardian Legend, with the 'alarm' sound effect it makes before you fight a boss. It sounded all wrong before that was emulated.cpow wrote: To me the most interesting part is the difference in the two channels' sweep generators.
I don't know that details of the hardware exactly, but my observation is that seems like they aren't clocked at exactly the same time because you can't do something like use the same freqs in both channels in a way that would make them cancel each-other out. You can get different types of phasing (and a thin almost-cancelled one), but never silence. Not sure if that helps with the question though.
Re: Pulse (Square) Generation
That is handy to know.Memblers wrote: I don't know that details of the hardware exactly, but my observation is that seems like they aren't clocked at exactly the same time because you can't do something like use the same freqs in both channels in a way that would make them cancel each-other out. You can get different types of phasing (and a thin almost-cancelled one), but never silence. Not sure if that helps with the question though.
I figure the NES APU incorporates a 4 channel mixer, cycling square 0 on even cycles and square 1 on odd cycles.
I don't think there's any evidence that it swaps channels every cycle, otherwise someone could have noticed that in a high-speed recording.
As for the sweep thing, Square Channel 1 adds 1 to the period when sweeping higher (decreasing period), and square channel #2 does not. That creates the phaser effects.
As for the sweep thing, Square Channel 1 adds 1 to the period when sweeping higher (decreasing period), and square channel #2 does not. That creates the phaser effects.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!