Difference between revisions of "PSG"

From Intellivision Wiki
Jump to: navigation, search
(Registers)
(added reg. addr. for Master and ECS in the table)
Line 13: Line 13:
 
<table border>
 
<table border>
  
<tr><th>Register</th><th>Data Bits</th><th>On Bits</th><th>Off Bits</th><th>Description</th></tr>
+
<tr><th rowspan=2>Register</th><th colspan=2>Address</th><th rowspan=2>Data Bits</th><th rowspan=2>On Bits</th><th rowspan=2>Off Bits</th><th rowspan=2>Description</th></tr>
  
<tr><td>[[PSG Registers R0 - R2|R0]]</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Lowest 8 bits of 12-bit period for channel A.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
+
<tr><th>Master</th><th>ECS</th></tr>
  
<tr><td>[[PSG Registers R0 - R2|R1]]</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Lowest 8 bits of 12-bit period for channel B.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
+
<tr><td>[[PSG Registers R0 - R2|R0]]</td><td>$01F0</td><td>$00F0</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Lowest 8 bits of 12-bit period for channel A.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
  
<tr><td>[[PSG Registers R0 - R2|R2]]</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Lowest 8 bits of 12-bit period for channel C.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
+
<tr><td>[[PSG Registers R0 - R2|R1]]</td><td>$01F1</td><td>$00F1</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Lowest 8 bits of 12-bit period for channel B.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
  
<tr><td>[[PSG Register R3|R3]]</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Lowest 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.</td></tr>
+
<tr><td>[[PSG Registers R0 - R2|R2]]</td><td>$01F2</td><td>$00F2</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Lowest 8 bits of 12-bit period for channel C.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
  
<tr><td>[[PSG Registers R4 - R6|R4]]</td><td>$000F</td><td>$0000</td><td>$FFF0</td><td>Upper 4 bits of 12-bit period for channel A.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
+
<tr><td>[[PSG Register R3|R3]]</td><td>$01F3</td><td>$00F3</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Lowest 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.</td></tr>
  
<tr><td>[[PSG Registers R4 - R6|R5]]</td><td>$000F</td><td>$0000</td><td>$FFF0</td><td>Upper 4 bits of 12-bit period for channel B.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
+
<tr><td>[[PSG Registers R4 - R6|R4]]</td><td>$01F4</td><td>$00F4</td><td>$000F</td><td>$0000</td><td>$FFF0</td><td>Upper 4 bits of 12-bit period for channel A.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
  
<tr><td>[[PSG Registers R4 - R6|R6]]</td><td>$000F</td><td>$0000</td><td>$FFF0</td><td>Upper 4 bits of 12-bit period for channel C.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
+
<tr><td>[[PSG Registers R4 - R6|R5]]</td><td>$01F5</td><td>$00F5</td><td>$000F</td><td>$0000</td><td>$FFF0</td><td>Upper 4 bits of 12-bit period for channel B.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
  
<tr><td>[[PSG Register R7|R7]]</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Upper 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.</td></tr>
+
<tr><td>[[PSG Registers R4 - R6|R6]]</td><td>$01F6</td><td>$00F6</td><td>$000F</td><td>$0000</td><td>$FFF0</td><td>Upper 4 bits of 12-bit period for channel C.  Note that a channel period value of zero actually indicates a period of $1000.</td></tr>
  
<tr><td>[[PSG Register R8|R8]]</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Channel enables for tone, noise.  I/O port direction selection.</td></tr>
+
<tr><td>[[PSG Register R7|R7]]</td><td>$01F7</td><td>$00F7</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Upper 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.</td></tr>
<tr><td>[[PSG Register R9|R9]]</td><td>$001F</td><td>$0000</td><td>$FFE0</td><td>Noise period</td></tr>
+
 
<tr><td>[[PSG Register R10|R10]]</td><td>$0000</td><td>$0000</td><td>$FFFF</td><td>Envelope characteristics / trigger register (write only)</td></tr>
+
<tr><td>[[PSG Register R8|R8]]</td><td>$01F8</td><td>$00F8</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>Channel enables for tone, noise.  I/O port direction selection.</td></tr>
<tr><td>[[PSG Registers R11 - R13|R11]]</td><td>$003F</td><td>$0000</td><td>$FFC0</td><td>4-bit Volume / 2-bit Envelope Select for channel A</td></tr>
+
 
<tr><td>[[PSG Registers R11 - R13|R12]]</td><td>$003F</td><td>$0000</td><td>$FFC0</td><td>4-bit Volume / 2-bit Envelope Select for channel B</td></tr>
+
<tr><td>[[PSG Register R9|R9]]</td><td>$01F9</td><td>$00F9</td><td>$001F</td><td>$0000</td><td>$FFE0</td><td>Noise period</td></tr>
<tr><td>[[PSG Registers R11 - R13|R13]]</td><td>$003F</td><td>$0000</td><td>$FFC0</td><td>4-bit Volume / 2-bit Envelope Select for channel C</td></tr>
+
 
<tr><td>[[PSG Regosters R14 - R15|R14]]</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>8 bit I/O port A</td></tr>
+
<tr><td>[[PSG Register R10|R10]]</td><td>$01FA</td><td>$00FA</td><td>$0000</td><td>$0000</td><td>$FFFF</td><td>Envelope characteristics / trigger register (write only)</td></tr>
<tr><td>[[PSG Registers R14 - R15|R15]]</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>8 bit I/O port B</td></tr>
+
 
 +
<tr><td>[[PSG Registers R11 - R13|R11]]</td><td>$01FB</td><td>$00FB</td><td>$003F</td><td>$0000</td><td>$FFC0</td><td>4-bit Volume / 2-bit Envelope Select for channel A</td></tr>
 +
 
 +
<tr><td>[[PSG Registers R11 - R13|R12]]</td><td>$01FC</td><td>$00FC</td><td>$003F</td><td>$0000</td><td>$FFC0</td><td>4-bit Volume / 2-bit Envelope Select for channel B</td></tr>
 +
 
 +
<tr><td>[[PSG Registers R11 - R13|R13]]</td><td>$01FD</td><td>$00FD</td><td>$003F</td><td>$0000</td><td>$FFC0</td><td>4-bit Volume / 2-bit Envelope Select for channel C</td></tr>
 +
 
 +
<tr><td>[[PSG Regosters R14 - R15|R14]]</td><td>$01FE</td><td>$00FE</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>8 bit I/O port A</td></tr>
 +
<tr><td>[[PSG Registers R14 - R15|R15]]</td><td>$01FF</td><td>$00FF</td><td>$00FF</td><td>$0000</td><td>$FF00</td><td>8 bit I/O port B</td></tr>
 
</table>
 
</table>
  

Revision as of 12:08, 1 February 2005

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

The PSG has 16 registers, numbered R0 through R15. They appear consecutively in the CP1610's address map, with R0 at the starting address for the PSG, and R15 at the last address for the PSG. The Master Component's PSG registers appear at $01F0 - $01FF in the memory map, and the ECS's PSG registers appear at $00F0 - $00FF in the memory map.

Note: A related part, the AY-3-8910, uses different register numbers and has a different memory map. The AY-3-8910 and AY-3-8914 are otherwise nearly equivalent. Be aware of the memory map differences if you happen across AY-3-8910 documentation.

RegisterAddressData BitsOn BitsOff BitsDescription
MasterECS
R0$01F0$00F0$00FF$0000$FF00Lowest 8 bits of 12-bit period for channel A. Note that a channel period value of zero actually indicates a period of $1000.
R1$01F1$00F1$00FF$0000$FF00Lowest 8 bits of 12-bit period for channel B. Note that a channel period value of zero actually indicates a period of $1000.
R2$01F2$00F2$00FF$0000$FF00Lowest 8 bits of 12-bit period for channel C. Note that a channel period value of zero actually indicates a period of $1000.
R3$01F3$00F3$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.
R4$01F4$00F4$000F$0000$FFF0Upper 4 bits of 12-bit period for channel A. Note that a channel period value of zero actually indicates a period of $1000.
R5$01F5$00F5$000F$0000$FFF0Upper 4 bits of 12-bit period for channel B. Note that a channel period value of zero actually indicates a period of $1000.
R6$01F6$00F6$000F$0000$FFF0Upper 4 bits of 12-bit period for channel C. Note that a channel period value of zero actually indicates a period of $1000.
R7$01F7$00F7$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.
R8$01F8$00F8$00FF$0000$FF00Channel enables for tone, noise. I/O port direction selection.
R9$01F9$00F9$001F$0000$FFE0Noise period
R10$01FA$00FA$0000$0000$FFFFEnvelope characteristics / trigger register (write only)
R11$01FB$00FB$003F$0000$FFC04-bit Volume / 2-bit Envelope Select for channel A
R12$01FC$00FC$003F$0000$FFC04-bit Volume / 2-bit Envelope Select for channel B
R13$01FD$00FD$003F$0000$FFC04-bit Volume / 2-bit Envelope Select for channel C
R14$01FE$00FE$00FF$0000$FF008 bit I/O port A
R15$01FF$00FF$00FF$0000$FF008 bit I/O port B

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.