This article was made at the same time than French Touch‘s intro « Digidream 2 ».
We wanted to share the issues we ran into when developing this demo, and what we discovered about the General Instruments AY-3-8913 sound chip that is used on most Apple II sound cards.
Click here for a free & open hardware patch by French Touch, available on GitHub.
Edit 2024/10/15: added link to French Touch’s hardware patch
Edit 2024/05/22: added links to this page talking about fake AY-3-8910
Edit 2024/05/20: added feedbacks from Deater and tomcw (« Other tests »)
The Apple II sound cards
The AY family
This family of PSG (programmable sound generator) is well known.
- AY-3-8910 is the original PSG by General Instruments. It features 3 channels + a noise generator, enveloppe, and a few IO ports.
- AY-3-8912 is a smaller version of the AY-3-8910.
- AY-3-8913 is an even smaller version of the AY-3-8910 but the IO ports have been removed.
In addition, we must add some more chips:
- YM2149 is the AY-3-8910 build by Yamaha under licence. It’s pin compatible with the AY-3-8910, sounds very slightly differently (you really need to know what to look for the hear the difference), with slightly more defined envelopes.
- YM2203 and YM2608 are later chips adding FM channels & ADPCM but retaining compability with the YM2149: it still has the three original PSG channels.
- Many more variants and compatible chips were also released.
The AY-3-8910 was primarily used in arcade games, the AY-3-8912 being used in 8-bits computers like the ZX Spectrum+ or Amstrad CPC. The YM2149 was mostly used in the Atari ST. FM variants were used in the famous Japanese PC-88 and PC-98 lines of computers by Fujitsu.
Compatibility
The YM2149 can be used as a dropout replacement for the AY-3-8910 because the pinout is identical. Software-wise, there’s a slight difference that allows the programmer to detect if the chip is an AY or a YM but this test sometimes fail (we don’t know why). The trick of halving the clock by activating a specific pin only on YM works, though.
All others AY models are documented as being 100% compatible with the AY-3-8910 audio-wise, the only difference is the missing IO ports on the AY-3-8913, making it unsuitable for some computers (for example the Atari ST uses the IO ports of the YM2149 to select the floppy disk’s head).
To replace one AY by another except the YM2149, an adapter is needed because the pinout is different.
Software-wise, they’re all compatible, minus a slight timing difference on the AY-3-8913.
The AY-3-8913
This is the 24 pins version of the AY-3-8910, documented as being 100% compatible except for the IO part, that have been removed.
There’s a few documented hardware differences: a /CHIP SELECT signal that must be activated but is actually internally defaulted to Vss (so, active), and to write a register, the CPU must present the data 1800ns instead of 500ns on the bus. The computers at that time were slow so it makes no difference.
The only uses we could find of the AY-3-8913 were on some early pinball machines, and of course, the Mockingboard and other audio cards.
This is maybe why the issues we found went largely undetected until now, because the computers that make extensive use of chiptunes were not based on AY-3-8913.
The Mockingboard and Friends
This article and this article list a good part of all Mockingboards and compatible cards that were built during years, but here’s a quick list of the ones we had access to:
The original Mockingboards
The Mockingboard is a series of cards produced from 1983 by Sweet Micro Systems for the Apple II.
It looks like there was at least 10 different models, but the interesting things is that at least the two or three first models were based on the AY-3-8910. All following models were based on the AY-3-8913, making the Mockingboard maybe the biggest use case for this chip.
Nearly all models are compatible, except for the first one, having only one PSG, and the Mockingboard D for Apple IIc, which plugs to the serial port.
They all have amplifiers for speakers with stereo volume control, and the last one (Mockingboard M) added a jack AUX output.
Compatible cards
The Phasor is one of the later audio cards for the Apple II that are compatible with the Mockingboard. There were other released cards, some made by hobbyist in small batches.
Most of those cards are based on AY-3-8913 chips.
There’s also modern FPGA compatible cards, of course.
We can also mention Plamen’s (A2Heaven) MegaAudio card, but this one doesn’t work for our demo because of a timer incompatibility . We already found out earlier that the Timer 1 is late, compared to a real Mockingboard, which creates issues. Unfortunately no update is available, but we can say that it doesn’t seem affected by the AY-3-8913 bugs.
Mockingboard modern clones
Many PSG-based modern clones were made but the ones still available are mostly those two:
Mockingboard 2 by ReactiveMicro
It’s a 100% compatible card but it’s inferior to the latest Mockingboards because it doesn’t have volume control nor AUX output. The jack output is actually an amplified output to be used for simple internal speakers.
It’s based on two AY-3-8913 chips.
Mockingboard 4C and 4C+ by Ian Kim
The only models of Mockingboard for Apple IIc and IIc+ that are natively compatible with the original Mockingboards.
It’s based on two YM2149F chips.
They plug on the CPU socket and have volume control, two speaker outputs and on AUX output like the Mockingboard M.
However there’s a software incompatibility because there’s only one 6522 VIA controller instead of two, so the programmer has only access to two timers instead of 4. It usually doesn’t matter but that can create issues because it’s not documented. Optimized ways of programming both PSG chips at the same time are also not possible.
The issue
Doubt
The first Apple II I got back a few years ago was the Apple IIc, and I very quickly bought a Mockingboard 4C by Ian Kim for it to check some demos by French Touch and compatible games. It worked like a charm and the sound is perfect.
Then a friend gave me an Apple IIe, and around that time I entered French Touch. We were developing new effects and I needed a Mockingboard for my IIe, so I bought a version 2.2 from ReactiveMicro.
But the sound quality was very bad – saturated and muffled. Something was very wrong, but I compared the board with my Mockingbard 4C and I saw that there was no volume controls. I thought that was the issue, but actually, that’s because the jack output is not made to be used as an AUX output. You need simple speakers to plug on it, like the one available in the IIe (that you can plug directly on the original Mockingboards, for instance). That was actually confirmed by ReactiveMicro to me in 2021.
Since I use my computers with modern speakers or directly with a capture card, the audio output of the Mockingboard 2.2 was of useless to me so I just let it unplugged for years, only using the card for its VIA timers compatibility.
That’s mostly why my captures on real hardware were always done on my IIc, with the YM2149-based Mockingboard 4C.
Need
In 2024, Grouik of French Touch started to adapt the so-called « SID » technique from the Atari ST to the Apple II for his intro Digidream 2.
However, we needed to check it on all possible configurations, and while it sounded okay on my Mockingboard 4C,it still didn’t on my Mockingboard 2.2. So I started to think of a way to ‘fix’ my Mockingboard 2.2 to get a real line output and check Grouik’s work on it.
So I looked for schematics of the ZX Spectrum+, Atari ST and Amstrad CPC to know how to implement a line output and it happens that the AY-3-891x outputs are already within the correct level range. So you almost only need to plug your jack output on it and voila. You can add a few resistors to make the level lower, but that’s really basic.
Trouble
So I started tinkering with my Mockingboard 2.2 and recorded the output of one AY-3-8913 directly.
I quickly realized multiple things:
- The audio output of AY PSGs are indeed already almost line level
- The various capacitors added to the output of the AY on the Mockingboard act as a high-pass filter, making all low frequencies sound muffled.
- There was a real issue about basses envelopes and it looked to be a PSG issue.
The last one was most annoying. The SID effect worked fine, but there was a regular bass line with a standard AY envelope applied (no special effect here). Note that this envelope was not common in chiptunes made in 1980. Here it is, recorded from my Mockingboard 4C (YM2149):
And the same bass line, recorded from my Mockingboard 2.2, directly from the AY-3-8913 output pins (scale is not exactly the same):
The general shape vary, here’s another example:
Clearly, there was a big issue somewhere.
This bass « bug » can actually be heard clearly, and we also did the same test on another Mockingboard 2.2 and on a ReactiveMicro’s Phasor (both based on AY-3-8913), with the same bogus result.
Since at French Touch we always indicate that we are « Mockingboard compatible », that was a problem, because we wanted to know if we did something wrong with our code.
So we needed to make more tests to find out what was the general issue and if all Mockingboards and compatible sound cards were doomed.
Research
We did a lot of research on the net, and we found out that other people have run into issues with AY-3-8913 chips.
We found that someone trying to use it as a replacement to AY-3-8912 on ZX Spectrum ended up with no fakes of chips with no active noise generator (always used for drums effects). That some guy trying to fix a pinball machine ended up getting fakes AY-3-8913.
Some people succeeded in playing music correctly on AY-3-8913 but they don’t use advanced envelope effects. Same here when replacing an 8912 for an 8913. Here, someone complains about the sound of his Mockingboard: « the music is quite good but the sound quality is still not great on my MB ».
We are still wondering if the fact that old songs work is because they only use a very limited set of envelopes.
We were also aware of the fakes. For example, the AY-3-8910s you can find now might be rebranded YM2149s, and sometimes AY PSGs are just no AY chips at all. Same for the 6522 VIAs, there’s a lot of fakes around, and so we always needed to double check.
Grouik bought a second hand Mockingboard 2.1 from ReactiveMicro with busted 6522. He tried to replace them, and got some fake/defective 6522 VIAs on the net. In the end, he could get working 6522s, some legit AY-3-8910s, and I bought an original Mockingboard M to rule out fake AY-3-8913 batches. We started to do a lot more tests from there. We also bought breadboards and an Arduino to make more tests.
Note that I did not make Arduino tests or PSG swaps with the AY-3-8913 from the original Mockingboard M because I didn’t wand to remove them from that vintage board.
Tests
Those are the results of the tests we conducted.
We couldn’t check all configurations because Grouik and I (Fenarinarsa) made our tests each on our side, only talking about our researches and results online.
Unmodified boards
We checked and recorded music on original unmodified boards.
- SMS Mockingboard M, AY-3-8913: Muffled sound, buggy bass ❌
- RM Mockingboard 2.2 and 2.1, AY-3-8913: Muffled sound, buggy bass ❌
- RM Phasor 1.0, AY-3-8913: Buggy bass (recorded from speakers) ❌
- IK Mockingboard 4C, YM2149: OK ✅
Modified boards
I removed components on my ReactiveMicro board in order to completely disconnect the audio amplifier so that it didn’t mess up with my tests, and recorded the PSG output directly.
- RM Mockingboard 2.2 (AY-3-8913): Buggy bass ❌
PSG swap
We removed one PSG from a Mockingboard and put it on a breadboard connected to the audio card. Then we could easily swap it for another PSG.
- RM Mockingboard 2.2, AY-3-8913, direct output: Buggy bass ❌
- RM Mockingboard 2.1, AY-3-8910, MB output: Muffled sound ✅
- RM Mockingboard 2.2, YM2149, direct output: OK ✅
- IK Mockingboard 4C, AY-3-8913: Buggy bass ❌
Arduino replay
To eliminate the « Apple II factor », we used an Arduino and this player to replay YM files on a PSG.
So the music replayed is exactly the same than on Apple II or an Atari ST.
Note that I found two bugs in the player that I had to fix (register 13 setup & setup time on the PSG bus).
- Arduino, AY-3-8913: Buggy bass and other bugs ❌
- Arduino, YM2149: Sound ok ✅
This last test made me discover multiple strange behaviors.
First, of course, the envelope generation for bass was still buggy. But also, I initially didn’t have any noise generator (same bug described here). I eventually found out that this was induced by the /RESET pin being connected to +5V. By disconnecting /RESET, the noise generator starts to work again, but at startup, sound may not be correctly generated. So I need to connect briefly /RESET to mute the chip, and start playing.
This behavior was not the same than with the YM2149, which worked perfectly with the standard connection where /RESET connected all the time. It’s worth noting that in the Amstrad CPC and on the Mockingboard, /RESET is connected through a diode, but I don’t know to what extent this is mandatory. In any case, the way it’s connected in this project does not seem correct for the AY-3-8913 and maybe all PSGs of the same family.
Another strange behavior is that when register 7 is set to 0xFF, all channels should be muted. But that’s not the case: the bass effect with the envelope can be heard (without bug!!) and all notes can be heard very briefly when they start playing.
Also it’s worth noting we used a 2Mhz clock generated by the Arduino to avoid converting the YM files, while on Apple II, the PSG runs at 1Mhz. But the envelope bug was still the same.
Other tests
tomcw found out that there’s less bugs when the AY-3-8913 runs at 2Mhz than when it runs at 1Mhz.
Deater also had the same bugs and eventually got a pair of AY-3-8913 that sound slightly better.
Conclusions
Unfortunately we don’t have that much time on our hands, nor enough electronic skills or tools to make more advanced tests. We already took many weeks to do all those tests, and we think we have enough information.
Our own conclusion: the AY-3-8913 is definitively buggy, and must be avoided. To make a Mockingboard-compatible card, use any other PSG from the AY or YM family. We think the YM2149F is a good fit for that (or even a later model, to get FM channels without breaking compatibility).
You can check the records I did from a Mockinboard 4C below. I replaced one of the two YM2149F by a AY-3-8913 and played the same song on both at the same time. So same conditions, same registers values, same everything. And it’s completely broken on the AY-3-8913.
Top channel : YM2149F
Bottom channel : AY-3-8913
Content: bass + drums only
As for our « Mockingboard compatible »-somehow label, we consider it to be true since the original Mockingboards were based on AY-3-8910. The fact that later Mockingboards use chips that seems not to be 100% compatible with the AY-3-8910 is not really a software matter so we still consider that we are 100% Mockingboard-compatible. To us the fact AY-3-8913-based cards don’t play sounds correctly is a hardware-related issue that can be solved only by a hardware fix.
If you have more information or made some tests on your side, please let us know. We can be reached on our Discord, on Mastodon (@fenarinarsa@shelter.moe) or on Bluesky (@fenarinarsa.com). I’ll be happy to update this article with new info.
We also may release a test program soon.
What now?
The next question is: which Mockingboard to consider if you want to buy one?
Well, if you want a Mockingboard only to play old games with PSG support, you can still buy a Mockinboard because music and sound FX in thos games don’t use envelope effects or play basses that trigger the defect we found in the AY-3-8913.
PSG-based clones
For II/II+/IIe
Based on our own tests, it seems there’s currently no available clone for II/II+/IIe that would output a correct sound in all cases.
You could try to ask the vendors if the AY-3-8913s are okay and don’t have this nasty bug, but honestly, we would be surprised if there’s any working AY-3-8913 out there (again, we’re open to feedback).
Older cards that should work correctly are all based on other versions of the PSG, like the Mockingboard T by A2Heaven, the Mockingboard Dual etc.
For Apple IIc/IIc+
The Mockingboard 4C+ by lan Kim is a very good product and is based on YM2149F so we definitively recommend getting one.
FPGA clones
Of course, there’s also the FPGA clones, that would get your back for many things, but it’s a lot more expensive, especially if like use you’re located outside the USA with customs taxes (from our experience, shipping fees + customs can add up to 50% to the cards’ price).
Also we don’t recommend getting an FPGA that’s not 100% open source since they will surely go unsupported earlier than you wished. That’s for example the case of the MegaAudio, which has NO audio bug, but the timers emulation is not 100% compatible with the 6522-based Mockingboards, making our demos unstable or not working on this card, and no update is available nor possible. But on the other hand, if you don’t mind, go for it 🙂
Fixing existing Mockingboards
If you already have a recent AY-3-8913 based Mockingboard clone, you can use this free & open adapter by French Touch.
Creating a new Mockingboard clone
In our opinion, another way of getting a working Mockingboard would be to make a new PCB that takes the design of the Mockingboard M with its volume control and AUX line output, removing the SSI chip slot (which is very expensive anyway), and replacing the AY-3-8913 by YM2149 chips. Or you could drop the amplifier completely if you don’t need internai speakers, because you can take the YM2149 as is and just plug a jack on it to get a line output. Again, that’s what the Mockingboard M does, as well as the ZX Spectrum+, Amstrad CPC, Atari ST…
Another problem is to find legit working 6522 VIAs, and as a matter of fact, lan Kim used a recent version on the Mockingboard 4C instead (the WDC 65C225). The W66C22N is also pin-compatible with the original 6522A. We don’t recommend using only one VIA like the Mockingboard 4C, as it can limit compatibility because you’ll get less timers (and we like using timers).
Actually, I might try to make exactly that and reuse parts from my Mockingboard 2.2, since making a new Mockingbard is not really rocket science.
Thanks
We’d like to thank everyone that helped us, mostly on our Discord, and especially xtof, who made a test on his Phasor.
We also thank everyone involving in the retro computing communities that make researches and share their results, and people working on making schematics and open clones of cards, which helped us a lot since I had to dig up schematics from other computers 🙂
Ping : AY-3-8913有问题。 - 偏执的码农