Search This Blog

Thursday, 2 April 2020

Reverse-Engineering An AdLib Clone [Part Two]

Home Page

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

So this bit will lay the groundwork for physical assembly of the new card once it's done. The SMD components from the original card need to be identified, as I doubt all of them are still being produced. We don't need to look at either the YM3812 OPL2 chip or its accompanying DAC, the Y3014B, because there are no compatible replacements. These will have to be salvaged instead. I still don't know if I'm going to sell these boards but, given the economy of getting boards made, it makes perfect sense to. As I'm reproducing an existing board, I will have to stick to that layout for now. I would rather do a through-hole version but that would require significant re-engineering that's currently beyond my skill level.


Creating schematics from scratch is easy because they are abstracted - the component models need only include information about pin connections, not physical dimensions, so they need only be representative of the component in question. That's why some ICs will be represented by a triangular shape when, in real life, they're rectangular. The only precision required is pin assignment and a layout that makes sense.


Footprints are a pain in the arse, even if you don't need to make them from scratch. They require / contain information about pitch and dimensions. The easiest way to get a footprint is from the library of your PCB design software, as most components use a package that is common. To give an example, IC1 on this board uses an SOP-16 (Small Outline Plastic, 16 pin) package according to Mouser. If I search the KiCad footprint library for SOP-16 or SOIC-16 I get 12 results. Now I need to find out which of those (if any) correspond to my physical chip.

If dimensions are included in the datasheet, I can use this to cross-reference. If they're not in the datasheet there might be a separate 'mechanical data' document, or the datasheet might not be available. Time to get your micrometer out? Maybe not. If you can find another component with the same profile then the chances are it will possess similar or identical dimensions thanks to industry standards - a visual comparison should confirm this.

ICs 1, 2 and 3

Model: 74LS138D
Function: 3-to-8-Line Decoder/Demultiplexer
Datasheet Link
Mechanical Data

This is a 16 pin SMD IC and they are available on Mouser so I guess their function isn't yet obsolete. The purpose of these ICs on the card is ISA bus address selection. In this instance (as is usually the case with AdLib cards) this is hardwired to 0x388 for software compatibility.

I found a datasheet for an IC possessing the same model number as IC1 but I need to check that they are the same physically. The mechanical diagrams are to scale, so I can open the PDF in Photoshop and overlay the part of the PCB where IC1 sits.

A match

We have a match within tolerance. It's extremely likely that the datasheet matches the chip I have. Now, does KiCad have a footprint that matches the IC? Initially I was looking at SOP housings and the nearest one I could find was 10.4mm x 4.4mm. I realised that SOIC was correct, and found one measuring 3.9x9.9.

Not a match

It's unlikely, but if you find yourself in a situation where none of the footprints match (as above), modifications can be made. In the above example the pads are too small and can be easily adjusted. The offset relative to centre will be wrong once this change has been made so the pads would also have to be repositioned. The yellow information is for the fab only and is not printed, while the blue lines are silkscreen. Obviously these need to change too. An excellent, detailed tutorial for the process of making footprints is here.

A match should look like this.


Model: 74LS245D (Mouser: SN74LS245DW)
Function: Octal 3-State Non-Inverting Bus Transceiver
Datasheet Link / Mechanical Data

So, looks like octal bus transceivers are also in demand. This 20 pin IC sits between the data from the ISA bus and the OPL2 chip on the card. Pretty simple. The D suffix on the chip model number has been deprecated, but again we can overlay the dimensions from the datasheet onto the PCB. There are about 50 different packages available.

A match

That'll do. It's the SOIC package with max 2.65mm height, as opposed to the 2mm one, which is wider and flatter. The datasheet, helpfully, includes mechanical dimensions, example board layout, and example stencil design. There's an SOIC-20 footprint in KiCad with the dimensions 7.5x12.8, which appears to be the exact correct dimensions.

A match

IC5 doesn't exist.

IC6 is YM3812, the OPL2. As I won't be acquiring any of these, I'll just install a socket on the board for later installation, which is a 24 pin DIP.

IC7 is YM3014B, the DAC that accompanies the OPL2. This is an 8 pin DIP, which again will be socketed.


Model: LM324D
Function: Low Power Quad Op Amp

This amp is technically part of the DAC as a 'buffer op amp'. Again, we have a match on Mouser. Thanks, Texas Instruments. This one is 14 pin and there are two packages called 'plastic small outline': NS and D. Obviously the latter is the one we're after and there is a match in the footprint library.


Model: TDA7233
Function: 1W Audio Amp With Mute

This is an 8 pin DIP by ST Microelectronics and is obsolete. So we need to find a replacement. First we search Mouser for amplifiers that are through-hole and 8 pin. We get 7 results. Now we need to work out which of these, if any, are pin compatible with our chip. One thing to consider is that the mute function is not used on the sound card so pin 2 can be ignored (if it being connected to ground isn't an issue). In fact the only pins that need to match are 3 (power), 8 (input) and 5 (output).

None of the results are pin compatible because all of them are dual-amps. Poop. Let's try RS Online instead. TI's LM386 comes up and fits the spec. But is not pin compatible. I made an assumption that any ICs in the same series wouldn't be worth checking because they're likely to be similar but the LM380 has quite a different pinout... from both chips. The documentation of this IC is quite poor, including only a test circuit.

There is the salvage option but that's not sustainable for a number of reasons. Obviously I'm gonna have to change the layout of the PCB but that's fine as I haven't laid it out yet. Sure, why not, let's do it. I mean it's got to be cheaper than paying £5 a pop from eBay. I think I'll focus a separate article on identifying a suitable candidate and, for now, I'll stick a socket on the board.


Model: NE558D
Function: Quad Timer

Another obsolete chip, this time it's a 16 pin SOP SMD. I'm pretty sure we can find a quad timer, but then I would have thought a mono amp also would have been easier to find. Pinout:

So each timer has 3 pins (trigger, timing, output), plus we have common control voltage, Vcc, reset and ground. Maybe SOL in this case will also mean shit outta luck. Research tells me that no such product is currently being manufactured, which I find a little odd. This thread on suggests they're widely available. Well, maybe they were 9 years ago. Referring to Sergey's AdLib clone, RC4136 is used, but there is no SMD variant of this. For now, redesigning the board for an alternative IC isn't feasible (or desirable) so I might need to rely on private sellers on eBay, selling whatever discrete chips they have. Nuts.


Model: PC74HCT02T (Mouser: SN74HC02D)
Function: Quad 2-Input NOR Gate

The PC prefix designates Philips as the manufacturer so can be omitted during searches. SO-14 package, seems to be widely available and variant D in the datasheet matches the footprint.


Model: 74LS74AD (Mouser: SN74LS74AD)
Function: Dual Pos-Edge-Trig D-Type Flip-Flop

I don't know why the ISA clock needs a flip flop between it and the OPL2 chip, but I would just say it's to latch the oscillator and make it sound like I know what I'm talking about. I'm guessing it's for the same reason that IC4 is needed for the data bus. I intend to fully write up HOW this card works at some point because, although AdLib clone projects can be found far and wide, a run-down of how the card works is not. Mostly I think it's because the use of 74-series logic ICs suggests generic function and that the card does nothing special on its own. I mean the OPL2 practically sits right there on the ISA bus. Either way, these components are readily available and package D of the SO-14 variant matches.


Model: 74LS244D (Mouser: SN74LS244DW)
Function: Octal Buffers and Line Drivers With 3-State Outputs

This buffers data from the game port to the ISA bus. And it exists, so that's easy. Another 20 pin SOIC.

And that's it. The remaining passive components (which I'm yet to document fully) are mostly surface-mount, aside from the filter caps and the following:


This is the 3.5mm audio jack, which is obviously mono and that seems to make it harder to find. This part appears to be a near match, aside from the fact it has 4 pins instead of the 3 that the existing board has. That's fine, as it will require only minor cosmetic adjustments to the PCB design. As you can see from the overlay, the dimensions are a good match.


This is the volume potentiometer. Without being able to test the original pot, I'm can identify it from sight, and I can guess it's rated for 10K. This one from Mouser seems to be a match and the mechanical specifications match the existing markings.


This is the game port, a fairly standard DA-15 female connector. There are a number of variables to be aware of here, mostly that the socket is female, is right-angled, and has an offset of about 8mm from the PCB edge to the pins. KiCad has a footprint that matches this, and the mechanical specification of this socket match, so I think we're good.

And here's the final board with the various overlays.