ctrl-alt-Development

Your hotkey to alternative software development

Essential Reading

There are many nice books out there, but a few of them contain such wisdom that I just must mention them here:

Dec '20
19

DIY VIC-20 Game Cartridge

I made a small batch of VIC-20 Game Cartridges for Overthrown. With parts readily available you could do this yourself as it makes a nice retro hobby project. This tutorial shows you the steps and links to information you need for testing and such.

Parts

Parts and where to get them

Additional Tools

  • XGecu TL866IIplus Programmer Ebay
  • EPROM UV Eraser Ebay

I'm assuming you have an appropriate selection of soldering equipment and a multi-meter:)

Soldering components

The thing with through the hole soldering is that you should always start with the lowest components and then increase height until all components are in place. For this PCB there are 3 kinds of components:

  • The wire bridges
  • IC Socket
  • Capacitor

Wire bridges

So we'll start with the wire bridges. These determine the cartridge configuration; in this case it will be an 8K cartridge. So according to this table the A15, A14 and A13 bridges should be connected to 5V.

Not in the table but still required is the 8K/16K mode selection in the middle of the PCB which must be set to 8K and finally to which memory block the EPROM should be mapped. For games this is always $A000 or Block 5, which is set using the 'upper/8K' bridges by connecting the left and center. The 'lower' section remains unconnected.

See the picture below for an (unsoldered) example.

bridges front

Now flip the PCB over (without the jump wires falling out :) and solder and clip them. Make sure you let the solder flows through the hole so that both sides and the inner copper make contact.

bridges soldered bridges soldered and clipped bridges soldered front side

IC Socket

Next up is the IC Socket. Make sure you orient it correctly, the notch on the component should match the one on the PCB.

Socket unsoldered

Flip the PCB over (again without losing the socket :). Now soldering this is slightly tricky as the PCB is now somewhat unstable. So put something underneath the empty edge or use a soldering aid. Start out with soldering one pin in one of the corners while fixating the PCB there so there is no room. Then check if the socket sits straight on the PCB. If not you have only on pin to heat and fix it :) If you're satisfied the socket sits appropriatly you can solder the other pins.

Socket unsoldered backside Socket soldered backside Socket soldered frontside

Capacitor

The final part is soldering the capacitor; which allows the EPROM to briefly draw additional current while switching. Depending on the type of capacitor its wires may fit or not fit through the holes. In that case use a plier to slightly adjust the wire so that it fits.

Check before soldering the capacitor that it sits close to the PCB (this is the highest component and the casing is limited in height) other than that it should be easy. Ceramic capacitors don't have polarity so you can't put it in the wrong way.

Capacitor unsoldered front and back

Check your work

With all components in place it is time to check your work. This prevents expensive 'magic smoke' later on.

Visual Inspection

First a visual inspection. Make sure there is no excess solder on the PCB or that two pins have bridged by solder, shortcircuiting them. Use the two images below as a reference.

PCB complete front PCB complete back

Continuity Check

Next up is the continuity check. This ensures that all soldering joints work and that there are no hidden short-circuits.

Most multi-meters have a dedicated setting for continuity, the mode that does 'beep' on low resistance, but you can also just measure resistance.

Starting at the top of the PCB, the easiest is to hold one of the multi-meter terminals on a pad of the IC Socket and the other one on the connector edge of the PCB and then check. The beep should sound indicating continuity. Also perform a negative test by measuring the adjacent pads; these should not beep. If they do, you have made a soldering mistake (or the terminal went awry :)

I've color coded the various pins you can check in the image below.

Continuity Check Top

If all is well, flip the PCB over and continue with the other side of the board.

Continuity Check Bottom

The PCB is ready, well done! Now we're going to program the EPROM

Programming the EPROM

For programming EPROMs you need a programmer and an eraser (in case you made a mistake). If you don't have them or not want to buy them there are shops that provide a programming service if you buy the EPROM from them. In the Netherlands I can recommend flipperwinkel.nl

Which ROM to Program?

Of course I'll recommend Overthrown , whose .bin file is ready to program. There are many other images available on the Internet. Those on zimmers.net are in PRG file format which means the first two bytes indicate the loading address. These must be removed (using an hex-editor) first because the bridges on the PCB determine the memory location ($A000 in our case). The resulting file must be exactly 8192 bytes in length.

Programming

So make sure you have your TL866IIplus connected to an USB port and the programming software running. It takes a few steps to program the EPROM:

  • Select the Manufacturer and IC from the database
  • Load the data to program
  • Set programming options
  • Program!
Select the IC

In the main user interface top left there is a big button 'Select IC'. When you press it the following dialog pops up. You can use this dialog to select the chip from the database. Every type of chip has different programming parameters so this database base is very convenient. Have a close look at your EPROM. On it is the type code. Enter this into the search field. Select the correct manufacturer (use the logo on the chip to identify it) and the device using the type code and packaging of the IC you have. DIP means 'Dual Inline Packaging' which refers to the two rows of pins on the package.

TL866IIplus Select the IC
Load the Data

Select File->Open and the .bin file of the cartridge. Then complete the dialog (the defaults suffice). Your data is now loaded into the programming buffer.

Set the programming options

In the bottom right of the main user interface there is a panel 'Options'. These need some modification.

  • Pin Detect: must be checked; this make sure the IC has a good connection with the programmer.
  • Erase Before: is disabled (as EPROMS cannot be electrically erased; they need UV light for that)
  • Verify After: must be checked; this checks the data has been programmed correctly.
  • Skip Blank: can be unchecked; This option skips programming bytes that are empty ('0xFF') which is the default so no programming needed :)
  • Blank Check: must be checked; the checks if the EPROM is really empty before programming.
  • Check ID: must be unchecked; these chips don't have an ID (the check fails when programming).
  • Auto SN: must be unchecked; this allows serial number generation; which we don't need.
TL866IIplus Programming Options
Program!

The final step. First of all, cut a small piece of paper the size of the window on the EPROM. Then use this to cover the window and use a bit of tape to fixate it. This prevents UV rays undoing the programming.

Put the EPROM into the programmer by moving the lever in the up position, insert the EPROM, notch towards the lever and as close as possible to it. Gently lower the lever to connect the EPROM.

In the menu select 'Device' -> 'Program'. A new dialog pops up. Verify the EPROM is positioned in the programmer as shown in the dialog. And then, press 'Program'.

The software will verify connectivity and the blankness of the EPROM. If the black check fails, you need to erase the EPROM first (see below). Then the EPROM wil be programmed and verified. If the verification fails, you may have a bad EPROM or the settings may be incorrect. In that case find the datasheet of this particular EPROM and manufacturer and check the programmer settings.

When programming is successful you can close the dialog and remove the EPROM from the programming socket.

Assemble the cartridge

Everything is now ready to be put together. Put the EPROM into the socket, make sure you align the EPROM notch with the one on the socket (should be towards the center of the PCB). If the EPROMs legs are a little too wide for the socket carefully bend one side of the legs on a paper block or something non static and try again. Gently does it. When the ERPOM is in the socket, check if all the legs are in.

Put the EPROM in the socket

Then take the cartridge casing, put the PCB inside it and use the screw to join the 3 parts.

Assemble the Cartridge

Test the cartridge

This is the magic moment. Make sure your VIC is turned off, insert the cartridge and then turn it on. The game should start within a few seconds. If it doesn't or the display looks garbled something is wrong and you should turn off the computer immediately and remove the cartridge. See the troubleshooting section below.

If it works: Congratulations, well done!

If you chose the Overthrown image for your cartridge send me an email and I'll send you an official 'Overthrown' sticker to put the cartridge housing (while stocks last)

Erasing an EPROM

EPROMS can be erased using UV light. This light is harmful for your eyes and skin. Do not look into the light or expose your skin to it. Most EPROM erasers have some form of enclosure, so remove anything covering the window on the EPROM, stick it into some ESD safe foam and put it in the enclosure. Close the lid and turn on the UV light. And wait, a minute of 3 should suffice. Then turn the light off. The EPROM should now be empty and ready for programming again.

Troubleshooting

If the cartridge doesn't work it can be two things:

  • You've programmed the EPROM with something that isn't a cartridge.
  • There is something wrong with the hardware.

Symptom: the VIC starts normally with '**** CBM BASIC V2 ****' but no game.
Possible cause: cartridge image doesn't have the autostart magic bytes. See below.
Possible cause: EPROM is not located at block 5 ($A000); check the wire bridges.
Possible cause: EPROM Pin not in socket, check if all the pins in the socket.
Possible cause: Bad connection, remove the EPROM and check continuity.

Symptom: the screen stays black.
Possible cause: cartridge image crashes the computer at initialization.
Possible cause: EPROM Pin not in socket, check if all the pins in the socket.
Possible cause: short circuit on address or data lines. Remove the EPROM and check (dis-)continuity.

Symptom: the game crashes into 'READY'.
Possible cause: cartridge image crashes the computer after initialization.
Possible cause: EPROM Pin not in socket, check if all the pins in the socket.

Checking cartridge images

Cartridge images should be 8192 bytes (exactly!) in length.

Open your cartridge image in an hex-editor. The first two bytes are the starting address of the cartridge And the next two the warm start address. The next five bytes are the 'magic bytes' that are checked by the kernal and if found, the cartridge is started. If not found, the computer starts in basic.

0x0000 ?? ?? ?? ?? 41 30 C3 C2 CD
                      

So, check if the magic bytes are present at the position indicated. If they're not, something is wrong with the image.

If the image starts with 00 A0 and the magic bytes are 2 bytes off, you're probably dealing with a PRG file (8194 bytes!), remove the first two bytes and try again.