Lex Van AY-3-8910 PSG
AY-3-8910 sound generator and joy stick port design by Lex Van Sonderen first published in ACE User 4 1983.
The AY-3-8910 is a 3-voice programmable sound generator (PSG) designed by General Instrument, initially for use with their 16-bit CP1610 and other 8-bit microcomputers. The chip also has two general-purpose 8-bit parallel I/O ports, A and B. Its the same chip that's used in the sound card made by Essex Micro Electronic and also in AMI (more AY-3-8910 details can be found here on the AMI page).
Components are: Qty A Y-3-8910 PSG 1 79 LS 02 1 79 LS 32 1 LM 386 1 I/O SOCKET to fit ATARI-type joystick 1 3.5 mm SOCKET (Base and switch) 1 L S. 8 Ohm 1 Resistor 2.7 Ohm 1 470 Ohm 2 1 k Ohm 11 Variable resistor 1k Ohm 1 Capacitor 47uF 1 100uf 2 0.1uf 5 330pF 1 23-Way Edge Connector 1
In Holland this cost me about £18 I think it will cost about £12-15 in the UK (1984 prices).
The programmable sound generator contains 16 registers, and is addressed with the commands
221 OUT 223 OUT 221 IN
Entering N 221 OUT (N=0 to 15) selects the current register, and N 223 OUT puts value N in registers last pointed to by N 221 OUT.
I use : REG 221 OUT ; : SET 223 OUT ; : REG? REG 221 IN ; EG. 6 REG points to register 6, and 25 SET puts 25 into register 6. 6 REG? returns the current value of register 6
Register # | Use | Values |
1 & 0 | Low and High bytes of channel A pitch. | 0-255 0-31 |
2 & 3 | Low and High bytes of channel B pitch. | 0-255 0-31 |
4 & 5 | Low and High bytes of channel C pitch. | 0-255 0-31 |
3 | Noise period on all channels | 0-31 |
7 | On-Off selection (see below) | (see below) |
8 | Volume of channel A | 0-15 |
9 | Volume of channel B | 0-15 |
10 | Volume of channel C | 0-15 |
11 & 12 | Low and High bytes of Envelope Duration | 0-255 0-255 |
13 | Envelope Shape (see below) | (see below) |
14 | I/O port A data register | |
15 | I/O port B data register | |
Register 7 details: | ||||||||
Decimal | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Use | B I/O |
A I/O |
C Noise |
B Noise |
A Noise |
A Tone |
B Tone |
C Tone |
When BITs 0-5 are set (1) the channel is OFF , When BITs 0-5 are reset (0) the channel is ON so any combination of tone and noise channels is possible. When BITs 6 & 7 are SET (1) the ports are OUTPUT, When reset (0) the ports are INPUT |
Register 8-10 details: | ||||||||
Decimal | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Use | X | X | X | E | V | V | V | V |
X - Not Used, E - Envelope enable (set (1) on, reset (0) off, V - General volume control 0-15 |
Register 13 Envelope shape | |||||
Dec | Bit 3 | Bit 2 | Bit 1 | Bit 0 | Shape |
0-3 | 0 | 0 | x | x | |
4-7 | 0 | 1 | x | x | |
8 | 1 | 0 | 0 | 0 | |
9 | 1 | 0 | 0 | 1 | |
10 | 1 | 0 | 1 | 0 | |
11 | 1 | 0 | 1 | 1 | |
12 | 1 | 1 | 0 | 0 | |
13 | 1 | 1 | 0 | 1 | |
14 | 1 | 1 | 1 | 0 | |
15 | 1 | 1 | 1 | 1 | |
Envelope control is switched on by setting bit 4 of the volume register of the required channel, see Register 8-10 details above. |
I wish you a lot of success building it.
When you think it works, enter the following:
: REG 221 OUT ;
: SET 223 OUT ;
: REG? 221 OUT 221 IN ;
Try the following:
0 REG 200 SET
7 REG 254 SET
8 REG 8 SET
IN
It should produce a continuous tone
if it fails, enter:
0 REG?
7 REG?
8 REG?
It should print 200
It should print 254
It should print 8
If not, your PSG is not properly connected. When it is, and if it still fault , the amplifier part or the clock part is not, properly connected. To put all sound off:
Some Examples:
6 REG 8 SET
7 REG 247 SET
8 REG 16 SET
12 REG 20 SET
13 REG I SET
( Shot. )
0 REG 16 SET 7 REG 247 SET 8 REG 16 SET 12 REG 10 SET 13 REG 4 SET (Snap as in Pacman)
7 REG 255 SET 6 REG 28 SET 7 REG 247 SET 8 REG 16 SET 12 REG 20 SET 13 REG 1 SET ( Explode)
6 REG 20 SET 7 REG 247 SET 8 REG 16 SET 12 REG' 50 SET 13 REG 10 SET (Sea Waves)
0 REG 200 SET 7 REG 254 SET 8 REG 16 SET 12 REG 20 SET 13 REG 1 SET (Ping)
0 REG 200 SET
2 REG 201 SET
4 REG 100 SET
7 REG 248 SET
8 REG 16 SET
9 REG 16 SET
10 REG 16 SET
12 REG 20 SET
13 REG 8 SET
(Twangy Piano)