Search This Blog

Monday, 10 February 2020

Reverse-Engineering An AdLib Clone [Part One]

Home Page

A long article, so part one is about creating the schematic, while part two is about fabricating, constructing, and testing the board.

Back in November of 2016 I was fortunate enough to acquire an AdLib clone via eBay. It had been sitting in someone's loft for goodness knows how long prior to being discovered and sold so it was in bad shape. I restored it fully, however, and it worked perfectly. For a short while.

My attempts to repair the card were rushed, clumsy and ultimately destroyed the board. For many this would be the end of the road, but instead I embarked on a project to recreate the card from scratch, such was its value and uniqueness. I thought I would share the process I employed to achieve this, now that I'm on the verge of ordering a replacement board.

The first step was to take a high resolution photo of the component side of the board in its original state. This was so I would know which chips went where, and what their orientation was. The only components on the rear were resistors and non-polarised capacitors, both SMD type.


Next, I desoldered the through-hole components.



You can see on the picture of the component side where I've scorched the PCB by leaving the soldering iron on it for too long. In removing other components I lifted some pads, too. To be honest this isn't much of an issue when you've already written off a board and intend to recreate it. I have since upgraded my equipment.

I then made a list of all the component labels, thanks to the handy silkscreen, on a piece of paper and desoldered the SMD components. I used tape to stick each of the components on the page next to each label with values where known, so I could store them safely and not get them mixed up with each other. While the resistors had standard markings on them for their value the capacitors did not, so I would have to measure those later.

The final step was to get very high resolution scans of the board so that I would be able to zoom in and follow each trace. I did this at 1200dpi, giving me five times more detail than photos would.



Removing the SMD components was a lot easier and you can see how cavalier I was with the rest of the board. Partly I blame 30 year old solder. Note how I have flipped the rear scan. This is so I can import the images to Photoshop and switch between layers, which makes it a lot easier to trace the vias. This board is well and truly toast by now.

Another layer I needed to introduce was pin numbers. When you're zoomed in close on a trace and following it to an IC, you don't want to be taking your eyes off the screen. Having the pin numbers visible makes it a lot easier to transfer the information to a schematic.



What's that you say? A schematic? Yes. I previously had very little experience of creating PCB schematics. As I using an Apple Mac most of the time, KiCad seemed like an obvious choice for the task. It's very capable, easy to learn, and is powerful enough to appeal to experts too. Much like with programming when I first started learning it, I thought I'd be crap at it. It turns out my sense for structure, organisation and clean layouts works in my favour for such things.

If you do want to get into reverse engineering, starting small is a good idea. My first project was to work out how the hell the control circuit in our cooker hood worked. It was misbehaving, it used a number of relays and other discrete components, and I figured creating a schematic would be the best way to study it - sometimes just looking at things makes my head hurt. Schematics create more of an organisational view of things, so that it can be a lot easier to see how power and data flow in a circuit.


Trust me, it didn't look this neat after the first attempt. Unless you've learned electrical engineering formally, making something like this is going to be an iterative process. First it will be a complete mess and won't make much sense. Over time, things like component placement will become clearer but it's hard to teach such a thing. I think having a feel for it helps.

I fully accept that I am naive about this stuff, so I'm probably not a great example to follow. I know nothing about best practice, procedures, standards, documentation or anything like that, but I've learned a lot from looking at other people's schematics. Examples I've looked at are Sergey's AdLib clone, a replica of the original, and even an s100 board with OPL3 and game port. The more complex the project, the more experience you're going to need.

Now the laborious bit - the reverse-engineering itself. It's a bit like trying to recreate a jigsaw puzzle that you've only got a photo of. I don't know if there's a particular method that is best, but here's what I did:

1. Place each of the ICs into the schematic. This is done with models of the component, which are drawings that include information on physical form, number of pins and their designation. While KiCad has a huge component library included and many more available for download online (if you can find them), when you're dealing with obsolete components they may not exist anymore. Not only does this mean that you might not be able to buy equivalent replacements, but you will probably have to make your own models. (More on this below).

2. Voltage and ground connections. Each IC has at least one pin for power and at least one pin for ground. Labelling this pins is the easiest way to start, much like finding the corners and edge pieces of the puzzle.

3. Connecting the other pins. This is like finding all the sky bits in the puzzle, or a particular building. In the case of a computer expansion card, this usually equates to bus connections. In this case it's the ISA bus, so having the bus connector on the schematic is a good start.

4 & 5. Laying out and adding smaller components. As you add more components and connections, the schematic is going to become increasingly complex. As a result you need to stay on top of how things are organised. Keeping discrete parts of the circuit together, but separate from other parts of the circuit, is helpful. For example, the Amstrad AdLib clone is made up of the following elements:

- Sound generator
- Amplifier
- Bus logic
- Game port
- Power supply
- Timer / buffer circuits

Some are connected to each other, some aren't. Often a naturally-fitting layout will become apparent. I wish I had kept a record of the iterations that were involved in refining my schematic as an example but, much like writing an essay or an article, incremental changes overwrite the old document. Version control only really comes into it when you have a complete, initial version.

6. Fine tuning and double-checking. More than once I checked each trace from each pin on the ISA bus edge connector and each trace from each IC pin. Looking at schematics of other, similar projects can help to build a familiarity with how the circuit should work, so you can look at it and think "hmm... that ain't right" and then focus on a particular section until it makes sense.

I've never published a schematic before and I'm 99.999% sure that I've not made any mistakes but, until I build and test the board, I won't truly know.

Here's what I've produced so far, and here's a link to the PDF version.



There is a workflow that is managed by KiCad that goes in this order (summarised from this page):

1. Eeschema - schematic design and component model creation. This includes the electrical rules check, which ensures that the circuit works in theory. Errors highlighted in this check require returning to the schematic and fine tuning it.
2. Cvpcb - step one establishes how each component is connected in the circuit. Step two relates a physical footprint for each component to the eventual format of the PCB. The first two stages produce a netlist, which is the basis of step three.
3. Pcbnew - footprints are placed on a blank canvas and physical copper connections are laid out. There is a certain amount of automation available here, but it's mostly a manual process from what I understand. (I haven't done this bit yet...) This can then be checked with design rules, which ensure tracks aren't too close together, etc.
4. Gerber - this is a set of files that are used by a fabricator to make the actual boards. The closer the relationship between the PCB designer and the fabricator, the quicker errors or changes to the design can be realised. This is why it pays to spend more time getting things right if you're one person who is sending your stuff off to a fab in China. A mistake could cost weeks of progress.

Luckily I'm not in a hurry. At the moment I'm just making a replacement board for myself but I fully intend to publish the final schematic and related files when it's complete so anyone can if they want. One major obstacle to this additional step is that I need to find equivalent replacements for the SMD ICs this particular card uses and, if I can't, I might even redesign the board to use through-hole components instead. I guess we'll see.

Sunday, 9 February 2020

Creative Labs vs Ad Lib: The Sound Blaster Fairytale

The original Creative Music System. Source: Cloudschatze (aspect corrected)


I read with interest The Sound Blaster Story on the Custom PC website a few days ago. Except replace the word 'interest' with 'disdain' and 'The Sound Blaster Story' with 'a highly questionable piece of journalism'.

The article, written by CPC's editor Ben Hardwidge, is actually an interview with Creative Labs founder Sim Wong Hoo, so don't take it too seriously. It's only a story in the sense that Jack and the Beanstalk is a story. Like a tall one. One that should be taken with a massive pinch of salt and firmly located in the fiction aisle.
 
I don't think anyone expects an article like that to cite sources but it's preferable if you'd like to avoid plagiarism, which it isn't far off doing. The preamble to the interview is startlingly similar to excerpts from the 1998 book Asia's Computer Challenge. Aside from being written some ten years after the events it summarises (poorly), this book claims the "Sound Blaster hit the market just as Intel's 386 card [was] arriving..."[1] This is no way to establish technical credentials considering the 386 was released in 1985 and Creative Labs was a *checks notes* computer repair shop in Chinatown, Singapore. It gets better worse. The question that seems to have got everyone pretty animated (me included) from the original version (since corrected), was this:
"The first Sound Blaster used a Yamaha OPL2 FM synthesiser, making it AdLib compatible. If AdLib hadn’t done this first, do you think the first Sound Blaster cards have had [sic] different MIDI synthesis?"
Oops. MIDI synthesis is not a thing, but I'm not even going to get into that. It was Sim's answer that I found to be far more interesting and far more problematic:
"The first Sound Blaster did have a different music synthesis system – that was already in our Cubic CT PC in 1986. In fact, the first generation of Sound Blaster supported both the Yamaha OPL2 FM synthesiser and our own 12-voice synthesiser, so by default, it automatically supported a wider range of software from the two standards, giving users the best of both worlds."
My proof-reading wife, someone who knows very little about sound cards, chuckled at this almost as much as I did. This is because Creative's "different music synthesis system" was actually a bit shit[2][3][4] and I think Sim knows it. He also quite clearly bristles at the use of AdLib and first in the same sentence like it never happened or was inconsequential. This really couldn't be further from the truth and that is what I'd like to explain in this article.

Advert For The Creative Music System. Source: PC Resource's PC Games, Autumn '88

Technical Limitations


It's widely recorded that the Sound Blaster's predecessor, the Creative Music System (C/MS, later rebranded Game Blaster for retail in the U.S.) was released in 1987.[11][12][13][14][15][16]  but it's important to note that this was the original Singapore-exclusive release (which made hardly any impact on the global sound card market). It was not until 1988[2][4][5][6][7][8][9][10] that it became available elsewhere, so Creative weren't really there at 'the beginning', much as Sim likes to pretend. There were actually a number of PC sound products already established, the most notable being the AdLib, using Yamaha's YM3812 FM synthesis chip aka OPL2, and Roland's MT-32 using higher quality LA synthesis. (The latter actually isn't a sound card, but deserves a mention because it was almost as well supported in games as the AdLib - most supported one, or the other, or both). At this time, sound add-ons for the PC were originally intended for musicians rather than gamers - they were priced as professional, rather than consumer, products. Poor initial sales suggest that consumers literally didn't buy the idea of using a PC to make music, however. It was only when companies like Sierra started composing soundtracks for their games that prices began to drop.

Part of the issue with Creative's early products in particular was their use of square wave synthesis using the Philips SA1099 chip. This method attempts a trade-off between the qualities of a sine wave and a sawtooth wave, but ultimately achieves neither.[17] While they produce fair instrumental sounds,[18] square waves are pretty crap at replicating percussion, thereby limiting their versatility. FM synthesis, on the other hand, is vastly superior in comparison.[19] The C/MS did output stereo, however, and this appears to have been how Creative tried to stand out from the competition and appeal to those elusive musicians. The limitations of the C/MS did not appeal to developers, however, plus the fact that the technical documentation did it no favours.[20] A much more interesting question to Mr Sim would have been why Creative chose Philips' product in first place, but no one seems to have asked that question.

The AdLib, on the other hand, was technically superior, attracted more developers, and was released over a year before the industry heard of the C/MS or Game Blaster, debuting in June 1987 at CES.[27] The way Sim tells it you would think that OPL2 was the standard for FM sound in games but it was very much Ad Lib's implementation of it that made it popular. No other manufacturers were making OPL2 sound cards -they were making AdLib clones and AdLib was the option that was available in the setup programs of all the games (with some exceptions). Observe: their own advert boasts AdLib compatibility and even uses an image of Ad Lib Inc's product! Did you know that Creative Labs tried to sue every company that tried to market a 'Sound Blaster compatible' product for using the name of their product?

AdLib Compatible: An Advert for the Sound Blaster. Source: Compute! Apr '90

Creative With The Truth?


To be fair to Sim he's actually an interesting guy and something of a philosopher, based on other interviews[21][22], but the true Sound Blaster Story is that Sim is a bit of a lunatic. Wait, that's not always a bad thing, right? Many successful technological dynasties have succeeded through the drive and passion of lunatics (Apple, Microsoft, Oracle, Amazon, Tesla...) and they wouldn't exist otherwise. The point I'm trying to make is that their portrayal of historical events should never be taken as Gospel. Of course Sim cannot be expected to give Ad Lib Inc. any credit for their contribution to the development of audio hardware on the PC, but these efforts were indisputably critical to Creative's eventual success.

One of Sim's most famous quotes is about a fateful day at Comdex '89 when they were selling the first Sound Blaster like hot cakes. From the Custom PC interview:
"At Comdex, people lined up in 20-person queues in front of three cashiers in our tiny 300 square foot booth – we sold one Sound Blaster every four minutes."
We can expand this nugget by looking at Sim's 2003 book, Chaotic Thoughts From The Old Millennium[23]:
"...over the five days of the trade show, sold 600 units of the sound card – one order every four minutes."
Source: InfoWorld, Dec 1990
Amusingly there's another source where the number is one every three minutes,[24] so I don't know where that came from because it's strange. Either way, Creative's head honcho likes to make it sound like a few sales at Comdex '89 launched the Sound Blaster. He was actually "giving them out like candy" at some point before December 1990[29] (see right), much like AdLib did with their early cards,[25] so we can safely assume they weren't killing it just yet. Ultimately they did, of course, and they well and truly buried Ad Lib's asses in the desert. even if it did involve some seriously dirty tricks like manipulating the QA process so that the AdLib Gold was massively delayed.[25] It was dog eat dog and, sadly, Creative Labs was the pitbull to Ad Lib's poodle.

History Is Written By The Victors


I don't like that Sim has persisted with the narrative that Creative Labs built the PC sound card market from nothing. I mean we shouldn't expect anything else really, but it's complete bollocks and I feel it's important that Sim's claims should be regarded as anecdotal at best. His version of events is repeatedly being told like the origin story of some sound card superhero but the Sound Blaster succeeded for two reasons alone: AdLib compatibility and a built-in game port,[25] a particular technical efficiency that wasn't relevant after about 1994. It certainly did not sell for its "best of both worlds" synthesis for the reasons mentioned previously. No one asked for Game Blaster compatibility and no other device supported it. It was included on the original Sound Blaster purely for backwards compatibility but was quickly engineered out and not just to save money - there are probably more people with Game Blaster chips in their Sound Blasters today than there were back then (me being one of them). The Sound Blaster also did not succeed because it offered digitised sound. Not initially, anyway, as this was still a gimmick in PC land. Most games were still being distributed on 5.25" floppy disks, which did not have the space to accommodate sample-based audio. It also wasn't because it supported a "wider range of software" because only one game that we know of (Airball[26]) supported C/MS and not the AdLib.


Sound Standards: the state of play in 1990.
The bottom line is that the first two standards in PC game audio were AdLib and Roland. PC speaker aside, almost every PC game supported these two products by the time the Sound Blaster came along. As a direct result, every subsequent product had to support at least one of them natively or be doomed to obscurity (looks at the Gravis UltraSound).

I guess because Creative eventually won out Sim feels he has the right to misrepresent the events that built up to it - there certainly aren't any of his competitors around still giving interviews. But if we want to hold an accurate historical record of creativity in our industry then we should all be taking the words of megalomaniacs with a pinch of salt. I mean, it took me three days to write and research this article so that I could reliably prove what actually happened and the more people we have digging up the facts, the more accurate - and the more interesting - our hobby will be.

Thanks for reading!

Footnote: Sim Hong Woo died yesterday, 5th November 2023, at the age of 67. That seems almost young to me but, damn, he lived an eventful life. Singapore's youngest billionaire at 45 - the dude was 2 years older than I am today, so I have to take my hat off to his pretty epic achievements right now. Yes, there's always a deeper story to what we see on the surface, but the other truth is that I was one of millions of teenagers in the early '90s who craved a Sound Blaster in their PC so I could play games like X-Wing in all their glory. In 1994 I achieved that dream by acquiring my first multimedia upgrade kit, which included an AWE32. I loved that thing. And, today, I still love my AWE64 and Creative Voodoo2 cards. No hard feelings from me, Sim Hong Woo. Rest in peace.

Sources


1. Dedrick, Jason, et al. (1998) Asia’s Computer Challenge: Threat Or Opportunity for the United States and the World? Oxford University Press, USA.
2. Game Blaster & LAPC-I (crossfire-designs.de)
3. The History of Sound Cards And Computer Game Music (Computed Blg)
4. C/MS Review (PC Mag, 29 Nov '88)
5. When Sound Came On A Card (PC Mag, Feb '16)
6. Wave Of The Future (Wired, Mar '94)
7. Sound Board Duet (Compute! Oct '89)
8. IBM PC Ramblings (oldskool.org)
9. C/MS Advert (PC Resource's PC Games, Fall '98)
10. The Gamer's Guide To Sound Boards (CGW, Sep '89)
11. Corporate Milestones: 1986 - 1990 (Creative Labs)
12. Game Blaster (Pixelated Arcade)
13. Sound Blaster Reference (Wikipedia)
14. Purcaru, B, I,. (2014) Games vs. Hardware. The History of PC video games: The 80's. [online]
15. Creative Labs Soundcard Overview (The Guru of 3D, Mar '06)
17. A Young Person's Guide to the Principles of Music Synthesis (Beau Sivers, Nov '06)
18. Guide To Subtractive Synthesis (Roland)
19. Dune Soundtrack (Adlib) (YouTube)
20. All You Ever Wanted To Know About C/MS (Nerdly Pleasures)
21. Sim Hong Woo Is Back (SGSME, Jan '19)
22. 'Don't Get Married' (Yahoo Finance, Apr '19)
23. Sim, W. H, (2003) Chaotic Thoughts from the Old Millennium. National Library Board, Singapore.
24. Creative Technology (Singapore Infopedia, 2016)
25. Rick Heimlich (Topstar) Interview (YouTube)
26. Airball Tech Specs (Moby Games)
28. Post by ZanQuance (Vogons)

History


6/1/23 - Clarification of initial release date of the C/MS (thanks to Cloudschatze) and the AdLib, formatting changes, inclusion of title image and some rewording for accuracy, addition of footnote.
9/2/20 - Initial version.