Sound Chips in 8-bit Computers

Part 1

In this article, we will get familiar with all important sound and music chips that have been used in 8-bit gaming consoles and home microcomputers. It is noteworthy that some of these chips have prevailed to the era of 16-bit and 32-bit machines. For each chip described, I will try to make a comparison with the POKEY chip, undoubtedly a chip well known by all FLOP readers (a detailed documentation describing all important features of the chip was published in issue 39).

Integrated circuits designed to generate sound and music are integral part and important element of the history of the gaming consoles and 8-bit home computers. Apart from few exceptions, namely the original ZX Spectrum and all computers manufactured in Czechoslovakia, these chips were present in virtually all successful gaming consoles and microcomputers manufactured from late 1970s to early 1990s when 16-bit and 32-bit started dominating the market. To certain extent, the properties and features of the sound chips have been determining popularity of the platforms.

In this part, I will describe the TIA integrated circuit used mainly in the Atari 2600 and Atari 7800 gaming consoles.

General Information

Before describing the various chips, I have to clarify that when I say "sound chip" or "music chip", I can have three distinct types of circuits on my mind. The simplest circuits are named PSGs – Programmable Sound Generators. Chips with more complex internals are chips with FM synthesis. Later, with increased RAM capacities, circuits for playing and mixing samples (PCM) became predominant. In this text, we will focus on the first group that is the most interesting one. What is more, the PSGs are typical for the era of the 8-bit home computers and gaming consoles.

All PSGs I will describe in the text are based on processing of the input clock signal. The clock signal controls internal modules of the PSGs. The PSGs can generate square or rectangular waveform of selectable frequency (and sometimes configurable duty cycle), and noise of selectable frequency. Some PSGs can generate triangle or sawtooth waveform (for sound of the musical instruments, the sawtooth waveform is more appropriate). The PSG type determines the presence of so called envelope generator or eventually various filters and band-passes.

In case the clock signal is connected to a counter with output connected to a T flip-flop, the module will generate a rectangular waveform with a frequency determined by the initial value of the counter. The internals of the counters can differ. However, in most cases, they count towards zero and underflow results in an impulse going to the flip-flop. Atarians do not need lengthy explanations of a rectangular waveform created this way. Much more interesting is to discover what a triangle waveform is.

To generate a triangle or sawtooth waveform, several PSGs are using a 4-bit counter (16 levels) with output connected to a speaker through a 4-bit D/A converter. This means that an oscilloscope will show a staircase signal rather than a triangle waveform. The resulting waveform is of course affected by the filters and the amplifier, both making the staircase signal little bit smoother.

Noise generation, for the most of the PSGs, is based on usage of linear-feedback shift register (LFSR, poly-counter), where the number of bits of the shift register determines what will be the sound of the noise. If the noise will be truly "random", or if it will have a period so short, resulting in just a distorted tone. LFSRs of various designs and number of bits (from 4 to 17) are used in the PSGs.

TIA, Integrated Circuit Used in Atari 2600 (VCS) and Atari 7800

I will describe sound capabilities of the TIA chip (Television Interface Adaptor). It is one of the only three ICs that were the core components of Atari 2600, very popular gaming console of its time.

Apart from generating the graphics image, TIA handles the sound synthesis. From today's perspective, the synthesis is a rather peculiar one.

On one hand, the synthesis is simplistic and similar to the synthesis used in the POKEY chip for 8-bit Atari computers several years later. The simplicity is given by generation of rectangular signals only (regular, or irregular yet still periodical). Amplitude of these signals can be set to values of 0 to 15 (controlled by 4 bits).

On the other hand, the connection of the LFSRs allows a great number of combinations not found in the POKEY chip that is, in terms of sound and music generation, considered to be the TIA's successor.

Provided that the TIA chip handles both video signal generation and sound synthesis, some modules are shared. This mainly affects generation of the clock signal (in fact a pair of signals) that is entering the sound system. The frequency of tones played back is derived from those signals.

The fundamental source of all signals controlling the whole Atari 2600 console is an oscillator. The NTSC model generates a 3,579545 MHz clock signal. The PAL model generates somehow lower frequency of 3,546894 MHz. This base signal is called pixel clock (sometimes also color clock), because apart from other functions, it controls generation of pixels in the TV lines (NTSC – 262 lines, almost 60 frames per second; PAL – 312 lines, almost 50 frames per second). The signal is divided by three and the resulting signal (NTSC – 1.193182 MHz; PAL – 1.182298 MHz) is the main clock signal for the MOS 6507 microprocessor. That's why the signal is called CPU clock and why the Atari 2600 specifications say the clock rate of the console is 1.19 Mhz. This is valid only for the NTSC models.

Both signals are further divided by a constant of 114 (used by the video subsystem to draw one TV line). The signals enter the audio system too. The frequencies of the signals are 31399 Hz and 10466 Hz (31113 Hz and 10371 Hz for the PAL system). The original documentation only states that on input to the audio system, there is a signal of approximately 30 kHz. This information is inaccurate and can have negative impact on choosing constants for playing back musical notes.

From the programmers perspective, TIA provides two independently controlled programmable sound channels. Each channel is controlled by a triplet of control registers. The programmer can modify 6 control registers in total: AUDF0, AUDF1, AUDC0, AUDC1, AUDV0, AUDV1. As the capabilities of both channels are identical (all circuits are doubled), I will describe only the first channel controlled by one triplet of registers - AUDF0, AUDC0 and AUDV0.

The first control register (AUDF0), or more precisely 5 bits of the register determine a constant (1-32) used to divide the input frequency. Either PIXEL_CLOCK/114 or CPU_CLOCK/114 frequency is used. The division results in a rectangular waveform with frequency of approximately 1 kHz – 30 kHz (or 300 Hz – 10 kHz) that is channeled to a pair of configurable LFSRs. The first register is 5 bits wide, the other register is 4 bits wide. It is possible to merge the registers to a single register that is 9 bits wide. The two LFSRs are used to generate either a pure rectangular waveform or to generate noise of various characteristics. The configuration of both LFSRs is controlled by the lowest 4 bits of the AUDC0 register. The combinations of bits determine both the source of the signal (PIXEL_CLOCK/114 or CPU_CLOCK/114) and the way the feedback circuits of the LFSRs are connected together.

One of the combinations allows to generate a constant signal with value of 1. This is beneficial, as it allows to sample the sound easily just by rapid changes of the AUDV0 registers. Two other combinations switch the 5-bit LFSR to a mode that repeats the 01010101… sequence, i. e. the LFSR divides the input frequency by two (or six as CPU_CLOCK=PIXEL_CLOCK/3). This mode was used to play back pure tones (out-of-tune, however).

In another mode available, the LFSR is used to divide the input signal by 31. A sequence of 31 bits is repeated. 13 consequent bits are nonzero, the remaining bits are zero. The number of 0 and 1 is uneven, but the effect on the resulting signal is negligible. Once more, CPU_Clock has one third frequency, so the official documentation states the division is by 93. In fact, this "magic" constant is 3*31.

Other modes are using both LFSRs to generate noise. If only the 4-bit shift register is used, the period is only 15 bits long. Again, this can be used to generate tones with certain distortion. When 5-bit shift register is used, the results are similar with a period 31 bits long. If the two shift registers are connected serially, a noise with a period of 511 bits is generated. A similar effect can be created with the POKEY chip.

The most complex mode is a mode where the 5-bit LFSR controls the 4-bit LFSR. If the first LFSR outputs logical one, then the bit shift is performed in the other LFSR. Otherwise the other LFSR is ignored. The resulting signal a pseud-random signal with a period of 15*31=45 bits (another "magic" constant never mentioned in the original documentation, it was only explained by later interpretation of the chip schematic)

Note: The POKEY chip also has 4-bit, 5-bit and 9-bit LFSRs. This is not a coincidence (the LFSR theory dictates that for example 8-bit LFSR requires a feedback circuit that is much more complex than feedback circuit for 7-bit or 9-bit LFSRs. The best widths are 2-7 bits, 9-11 bits, 15 bits and 17 bits.

The resulting signal (either rectangular waveform or noise) is amplified 1 or 16 times, based on the value of the AUDV0 and AUDV1 register. The internals are rather simple. The four bits (or four logic levels) are connected to a simple resistor network with 3k7, 7k5, 15k and 30k resistors (so, in fact, the circuit doesn't perform amplification, but configurable attenuation of the signal). The resulting voltage on the resistors is connected to the output pins of the TIA chip. Therefore, the TIA chip must have two pins with analog audio output, one dedicated for each channel.

The sound generated by the TIA chip is easily distinguished from the sound of other gaming consoles and microcomputers. Why is that? A short counter is used to divide the input frequency, so almost all musical notes are slightly off. Despite its shortcomings, more or less serious music creations for the chip keep appearing. This includes successful attempts to create 4-bit sampled music (obviously, this requires "super cartridges" with large enough EPROMs as the internal 128-byte RAM is insufficient.

Pavel Tišnovský