PSG

From Intellivision Wiki
Revision as of 23:00, 20 January 2005 by Pingaso (talk | contribs) (Channels)
Jump to: navigation, search

Various PSGs were used in the Intellivision from the AY-3-891x family, including the AY-3-8914, AY-3-8916 and AY-3-8917.

The text below is just a bunch of notes for now, to be organized into something meaningful eventually.

Clock speed is 3579545/16 (223721.5625 Hz)

Registers

RegisterData BitsOn BitsOff BitsDescription
$00$00FF$0000$FF00Lowest 8 bits of 12-bit period for channel 1. Note that a channel period value of zero actually indicates a period of $1000.
$01$00FF$0000$FF00Lowest 8 bits of 12-bit period for channel 2. Note that a channel period value of zero actually indicates a period of $1000.
$02$00FF$0000$FF00Lowest 8 bits of 12-bit period for channel 3. Note that a channel period value of zero actually indicates a period of $1000.
$03$00FF$0000$FF00Lowest 8 bits of 16-bit envelope period. The envelope period value is multiplied by two to determine the actual period. Note that an envelope period value of zero actually indicates a true envelope period of $20000.
$04$000F$0000$FFF0Upper 4 bits of 12-bit period for channels 1. Note that a channel period value of zero actually indicates a period of $1000.
$05$000F$0000$FFF0Upper 4 bits of 12-bit period for channels 2. Note that a channel period value of zero actually indicates a period of $1000.
$06$000F$0000$FFF0Upper 4 bits of 12-bit period for channels 3. Note that a channel period value of zero actually indicates a period of $1000.
$07$00FF$0000$FF00Upper 8 bits of 16-bit envelope period. The envelope period value is multiplied by two to determine the actual period. Note that an envelope period value of zero actually indicates a true envelope period of $20000.

Channels

The PSG contains 3 independent channels, a single noise generator, and a single envelope generator. Each channel includes a square wave tone generator and is capable of mixing any combination of the output from its respective tone generator with the noise generator and the envelope generator. Output from each of the 3 channels is then mixed together to produce the final audio output.
Channel periods are 12-bit values indicating a range of period from 1 PSG clock cycle up to 4096 PSG clock cycles. This translates to a frequency range from. Note that a channel period value of zero actually indicates a period of 4096.
In the simplest case, where channel output is affected only by its respective tone generator and not by either noise or envelope, the PSG generates channel output by counting the number of PSG clock cycles indicated by the channel period and then toggling the channel output between zero (0) and the currently selected volume for that channel.
square wave output optionally modified by the envelope generator and/or the noise generator
Volume (0-15) Period (1-4096) Tone Enabled Envelope Enabled Noise Enabled

16 volume levels, independent to each channel

Envelope Generator

Period Atak, Cont, Hold, Altr Volume (0-15) 16-bit period value multiplied by two, from 2 PSG clock cycles to $20000


Noise Generator

The random noise generator adheres to the following formula once per PSG clock cycle.

   noise = (noise >> 1) ^ ((noise & 1) ? 0x14000 : 0);

The lowest bit resulting from this calculation is used to add noise to any channel with noise enabled.