Close

Let's make some sounds

A project log for LM80C Color Computer

A Z80 homebrew computer with 32KB SRAM & 32KB ROM, TMS9918A VDP (video) and AY-3-8910 PSG (audio)

Leonardo MilianiLeonardo Miliani 07/14/2019 at 17:530 Comments

After a short period of absence I got my hands back on LM80C. I wired up the Yamaha YM2149F (but this is valid for the GI AY-3-8910, too: they are almost identical. I got the first one with a kit of ICs where the seller on eBay said he was selling an AY while sent me the YM) programmable sound generator (PSG) that I bought some time ago, and then I connected the audio output to the RCA mono input of my TV set, getting the first whimpers of my home-brew computer.

In the video you can hear that there is a complex audio: in fact,in this first test I activated all the 3 analog channels: channel A is reproducing a fixed tone; channel B is reproducing a fixed note mixed with some white noise; channel C is reproducing a tone using an envelope mode (saw tooth). To get the sound, I simply connected the 3 output channels to the mono audio input of the RCA port of my TV set.

To obtain this result I had to add another address decoder to my circuit, since the original AY-3-8910 from General Instrument (and the YM2149F clone from Yamaha, of course) was made to work in conjunction with the old CP1600 microprocessor from GI, that used 3 lines to set the operating modes of the PSG. Since the PSG settings are redundant (there are several settings that get the same effect), it was the same manufacturer that suggested to pull up one of the setting lines and use the other two. Thanks to this, we can use the just 3 signals: one for the chip selection, one to choose between register and data modes, and the last one to choose to read from/write to the PSG.

The PSG is a register-based sound processor: this means that the CPU has just to send the data to the PSG, that stores these infos inside its registers and then use them to generate the sounds, so that the CPU doesn't have to take part in the process anymore once the PSG starts its work. But I discovered an issue concerning the way we choose the register: in the datasheet registers go from 0 to 7 and then from 10 to 17 but in reality they go from 0 to 15. I didn't investigate why but to choose the register 10 I had to send the value "8", and so on. In the video you can see the list of the program I used to get the sounds you hear in the video: as you can see, there a lot of OUTs: outputting a value to port 64 selects the write mode to the register pointed by the passed value, followed by an output to port 65 to send the value to be written into such register.

Once I was able to get some sounds from the PSG, I added a couple of statements to the NASCOM BASIC to write to/read from the registers of the PSG. Firmware release R2.0 now contains the SREG command and the SSTAT function. The first one is used to write a byte into a specific register while SSTAT is used to read from any of the registers.

The new firmware with the updated schematic is available at my Github repository.

Discussions