General Instrument AY-3-8910
|Problems playing this file? See media help.|
The AY-3-8910 is a 3-voice Programmable Sound Generator (PSG) designed by General Instrument, initially for use with their 16-bit CP1610 or one of the PIC1650 series of 8-bit microcomputers. The AY-3-8910 and its variants became popular chips in many arcade games, and were used on, among others, the Intellivision and Vectrex video game consoles and the MSX, Amstrad CPC, Oric 1, Colour Genie, Elektor TV Games Computer and Sinclair ZX Spectrum 128/+2/+3 home computers as well as the Mockingboard and Cricket sound cards for the Apple II family. It was also produced under license by Yamaha (with minor modifications, i.e. a selectable clock divider pin, and a double-resolution but double-rate volume envelope table) as the YM2149F; the Atari ST uses this version.
It produced very similar results to the Texas Instruments SN76489 and was on the market for a similar period.
The chips are no longer made, but a declining stock is still obtainable for servicing vintage machines. A VHDL equivalent description has been written, for use in FPGA recreations of arcade machines and others like those mentioned above. The VHDL source code is available on the Internet, and compiles to fill about 10% of a Xilinx XC2S300 FPGA.
The AY-3-8910 was essentially a state machine, with the state being set up in a series of sixteen 8-bit registers. These were programmed over an 8-bit bus that was used both for addressing and data by toggling one of the external pins. For instance, a typical setup cycle would put the bus into "address mode" to select a register, and then switch to "data mode" to set the contents of that register. This bus was implemented natively on GI's own CPUs, but it had to be recreated in glue logic or with the help of an additional interface adapter such as the MOS Technology 6522 when the chip was used with the much more common MOS Technology 6502 or Zilog Z80 CPUs.
Six registers controlled the pitches produced in the three primary channels. The wavelength to generate was held in two eight-bit registers dedicated to each channel, but the value was limited to 12-bits for other reasons, for a total of 4095 (the register value is used as the frequency divider and 0 is treated as 1) different pitches. Another register controlled the period of a pseudo-random noise generator, while another controlled the mixing of this noise into the three primary channels.
Three additional registers controlled the volume of the channels, as well as turning on or off the optional envelope controls on them. Finally the last three registers controlled the times of the ADSR envelope controller, by setting the lengths of time for each stage of the cycle. Unlike most systems, the 8910 used fixed times for the sustain and release, and a repeatable attack and decay pattern. For instance, the system could repeat the AD cycle of the sound over and over, or alternately invert it, starting loud and reducing to the sustain level without any attack phase.
Although there are only 16 registers, the four MSB bits of the 8-bit bus must be set to the factory default '0000' value when selecting a register. Incorrectly setting the MSB bits causes the chip to ignore the register change. General Instruments did take orders for customized MSB bits (factory set to other than '0000'). The chips made with customize-set MSB register bits allow the same processor to control more than one AY chip on the same bus (e.g. Mockingbird sound card). There are many new-old-stock (NOS) chips on the secondary market with MSB bits factory set to a non-'0000' value. The non-0000 value can cause significant developmental troubles for designers and repair technicians. Software must be written to identify the correct value of the MSB bits on any given chip. Also, software must be changed or hardware added to allow these factory set MSB chips to be used in place of the default '0000' chips.
The AY-3-8910 generates tones with base frequencies of upto 125kHz (4MHz input clock, or 8MHz divided by 2 with the YM2149F, divided by 32 x 1), well beyond human perception and into the ultrasonic range, and too high to be recorded even with the most modern digital sampling standards, as it would require a 250kHz sample rate, vs the 192kHz usually available from ultra-high-end sound hardware. This is not as wasteful as it may first appear, however, as it offers a finer frequency resolution than would otherwise be available under the frequency-divider scheme whilst only sacrificing a few of the total 4096 values; dividers of 6 thru 9 imply frequencies from a borderline-ultrasonic 20.8kHz down to a decidedly audible 13.9kHz. Frequencies equivalent to the top octave of a piano keyboard (about the limits of musical scale perception) can be defined with reasonable accuracy versus the accepted note values for even-tempered scale, to nearly 1Hz precision in the A440 range, and even more finely at lower pitches. Despite the high maximum frequency, the ability to divide that figure by 4096 means the lowest directly definable output frequency, with a 4MHz (or 8MHz) input clock, is 30.6Hz, approximately half that of the mains AC hum, roughly equal to B0, the third lowest note on a normal 88-key piano, and as good as subsonic with everyday speaker systems. In essence, the chip is able to span the entire range of human hearing, and produce decently musical output at all reasonable pitches found in most compositions; it can run a full 13-semitone scale, if an unevenly tempered one, from 4808 to 9615Hz, 4 to 5 octaves above middle D/D# (ie, D8/D#8), and well beyond the top notes of an 88-key piano. The high base sampling rate also makes for finer pseudo-white-noise output, and the ability to produce simulated PCM output at effectively any arbitrary rate, albeit with a rather coarse effective bit-depth.
By contrast, the SN76489 only has 10 bits of precision for its frequency divider. Despite having similar maximum frequencies (125kHz with a 4MHz base clock, but 111.6kHz if using an NTSC master crystal), the lowest available natively-generated note is, of course, 4x higher, at 108-122Hz, only an octave and a half below middle C and not even off the bottom of a standard bass-clef musical stave, which may compromise the potential range of musical expression.
The 8910 silicon chip was sold in three different packages.
The AY-3-8910 has two general-purpose 8-bit parallel I/O ports, A and B, and these are available in the 40-pin package of the same name.
The AY-3-8912 is the same chip in a 28-pin package, with parallel port B simply not connected to any pins. Smaller packages save cost and board space. The 8912 was the most widely used variant.
The AY-3-8913 is the same chip in a 24-pin package, with both parallel ports not connected. Some users thought the small reduction in pin count over the 8912 made it less interesting, however, the I/O registers were rarely used by designers so General Instruments created this fully functional 24 pin alternative and released it approximately 6 months after the 8910 and 8912 chips. The goal was to reduced complexity for the designer and reduce the foot print on the PCB.
The Yamaha YM2149F 'SSG' chip has the same pinout as the AY-3-8910, with the minor difference that pin 26 could halve the master clock if pulled low. If left unconnected, as it would be if replacing an AY-3-8910 chip, an internal resistor pulls the pin high, so the master clock is not halved.
The Yamaha YM3439 is a CMOS version of the YM2149F. It exist in two packages: 40-pin DIP (YM3439-D) and 44-pin QFP (YM3439-F).
The Yamaha YMZ294 is one of the newest variants of the YM2149, but in an 18-pin package. Has no parallel ports and only one sound output with the three channels mixed.
The Yamaha YMZ284 is an even smaller variation of the YM2149, in a 16-pin package. It's basically YMZ294 without the 4/8 MHz selection pin and the /TEST pin.
The Yamaha YMZ285 has a 28-pin package and features a built-in PCM. Has no parallel ports and two sound outputs: one with the three SSG channels mixed, other with the PCM output.
The AY-3-8914 has the same pinout and is in the same 40-pin package as the AY-3-8910, except the control registers on the chip are shuffled around, and the 'expected input' on the A9 pin may be different. Otherwise it is exactly the same as the AY-3-8910. It was used on the Mattel Intellivision.
The AY-3-8930, also known as AY8930, is an enhanced but mostly-backwards-compatible version of the AY-3-8910. The function of the BC2 pin is changed (it is ignored and assumed to be 0 regardless of the pin state), otherwise the pinout is the same as the AY-3-8910. This variant of the chip adds a number of major enhancements, such as separate envelopes for the three channels (as opposed to one shared envelope), variable duty-cycles, more bits of precision for note frequency, volume, and envelope frequency, and a much more configurable noise generator. It was used on the Covox Sound Master sound card for the IBM-PC. Very few games took advantage of it beyond the normal AY-3-8910 features. This chip may have only been produced by Microchip Technology.
Although the chip wasn't designed to handle raw PCM data (digital sound), the effect could be simulated. The chip used a simple OR based mixing function for combining noise and tone on its three channels and could be persuaded to produce a level non-zero wave. By altering the volume this level wave could be shaped into a waveform. Obviously, this involved more CPU usage than chips designed for this purpose (such as the MOS Technology 8364 "Paula" as used in the Commodore Amiga), but it was nevertheless a technique widely used on platforms such as the Atari ST and less frequently the Amstrad CPC to play sampled music, and on the ZX Spectrum 128 and MSX to play short audio samples, in some games.
Doing the same thing fewer times per second (in the order of 30 to 300 per second) allows the use of an arbitrary software-defined envelope on each of the three channels individually. This takes negligible CPU power (provided there is some timer interrupt or vertical blank interrupt) and can be used in games.
In turn, the now useless envelope functionality can be set to very high frequency, actually generating a waveform that is not the usual square wave, thanks to the timbre-altering effects of amplitude modulation. However, to obtain harmonic results, the modulating envelope must be related to the pitch of the desired note, and because the granularity by which high-frequency envelopes can be set is low, music composed for the chip generally uses this technique only for bass lines.
Another method was to set one channel output to idle high, then use the volume control as a simple logarithmic 4-bit Digital-to-Analog Converter. This however resulted in poor audio quality, because it only had 16 output levels and these were logarithmically spaced.
A more sophisticated method was to use all three channels wired together, and exploit the non-linearity of the mixing to produce many intermediate output levels. Having modeled the non-linearity of the three channels, developers had to find suitable values by exhaustive search. Having done so, they produced an 8-bit to 3×4-bit lookup table. This allowed 8-bit audio samples to be played fairly adequately, though not as well as a real 8-bit D/A converter. The problem of this technique is that the player cannot change the volume of the three channels as a single operation. This implies unwanted output levels between two successive samples.
In 2006, two MSX developers created an advanced encoder that converts a wave file to optimal PSG channel transitions using a Viterbi search. They replayed a 44.1 kHz wave file on a 23-year-old MSX and achieved a higher signal-to-noise ratio than an 8-bit DAC. The Viterbi search is rather CPU intensive, so even though it would have been theoretically possible to use this method already in the 80's, there were no computers powerful enough to perform the analysis required.
The AY chip has been used by a number of groups, such as the AY Riders (see external link below). Some of the works by such groups are in the style of computer game music from the era, while others are art music in their own right.
Some programs have been created specifically for writing AY chip music, such as Vortex Tracker.
Yamaha used the YM2149 core to produce a whole family of music chips which were used in mobile phones, home computers, home and arcade video game systems, etc. For example, the YM2203 (also known as OPN) is a YM2149 plus FM. As well as its far more advanced successors: the YM2608 (also known as OPNA) which retained all previous features and greatly expanded upon those, the YM2612 (also known as OPN2) which was a cut-down YM2608 and removed many features including the YM2149 sound channels and I/O ports, and the YM2610 (OPNB) which added other features and retained the YM2149 sound but not the I/O ports.
|This article does not cite any references or sources. (June 2008)|
- AY-3-8914, AY-3-8916 and AY-3-8917
- AY Music and Audio at DMOZ
- ST SOUND, Hearing the AY-3-8910 chip
- AY-3-8910, AY-3-8912 and YM2149 Homepage (AY chip emulator for Win32, big archive of AY music
- Some VHDL implementations of Arcade Machines in FPGA
- Documentations for Amstrad CPC including AY Datasheets
- AY-Riders AY-Riders
- YM Rockerz YM Rockerz
- YM Digital YM Digital
- Blog of Dr. Stack van Hay (in german) Huge microscopic image of AY-3-8910 die and function blocks
- Dual AY-3-8913 chips in the Cricket! soundbox for Apple //c