Changes

PSG

253 bytes added, 14 April
/* Input Clock Speed */
The Programmable Sound Generator (PSG) is able to output three separate sound channels (named Channel A, B and C). Each channel can be used to output tones and/or white noise.
 
== Clock Frequency ==
 
The PSG is driven by an external clock at 1MHz provided by the [[Gate Array]]. The AY chip has an internal clock divider by 8 which means that it works internally at 125KHz, outputting 125,000 samples per second for each channel.
== PSG Registers ==
===05h - Channel C Tone Frequency High (4bit)===
The tone (square wave) frequency in Hertz is calculated as follows:
F = 4MHz 1MHz / 64 16 / nn ;with nn in range 1..4095 (nn=0 acts as nn=1)
Possible frequencies are in range from 62500Hz (nn=1) down to approx. 15.26Hz (nn=4095).
The noise frequency in Hertz is calculated as follows:
F = 4MHz 1MHz / 64 16 / nn ;with nn in range 1..31 (nn=0 acts as nn=1)
Noise can be output on all 3 channels, but there is only one noise generator (so all channels share the same noise frequency). The noise generator consists of 17bit shift register, and a 1bit noise level (0=LOW or 1=HIGH). These are updated at the selected frequency as follows:
Envelope step frequency (tone or noise) calculated as follows:
F = 4MHz 1MHz / 64 16 / nn ;with nn in range 1..65535 (nn=0 acts as nn=1)
Depending on the envelope shape, the volume is incremented from 0 to 15, or decremented from 15 to 0. In either case it takes 16 steps to complete, the completion time for 16 steps is therefore:
T = nn*1024 256 / 4MHz 1MHz ;with nn in range 1..65535 (256us .. 16.7 seconds)
=== 0Dh - Volume Envelope Shape (4bit) ===
4,605
edits