With the numerous emulators and documentation on classic gaming consoles available today, it is easier than ever to create a “homebrew” video game for one of these classic game consoles (see http://en.wikipedia.org/wiki/Homebrew_(video_games) for more information about homebrew video games). Even though it is easier than it used to be, it can still be quite a challenge. It often helps to see how existing games work before creating a new one from scratch.
This article explains how to create a ColecoVision cartridge reader using an Arduino UNO (or similar product) and a PC.
What You Need
- Arduino UNO (or similar board) - http://arduino.cc/en/Main/ArduinoBoardUno
- Two 8-bit Shift Registers (74HC595 or similar chips) [this could also be implemented with a single 16-bit Shift Register (STP16C596), but I have not tested this implementation]
- Standard Card Edge Connector 15 Position (CONN SEC II 15 POS 100C/L) - http://www.mouser.com/ProductDetail/TE-Connectivity-AMP/5530841-2/?qs=sGAEpiMZZMvlX3nhDDO4AIGhITdGxFYIj%252be5B1rBFtQ%3d
- Prototyping PC Board – to mount the 15 position standard card edge connector
- ColecoVision Cartridge to read
Note: If using an Arduino board with 29 or more digital I/O pins (e.g. the Arduino Due, Arduino MEGA ADK, Arduino Mega 2560, etc.), this can be built without using the two 8-bit shift registers (i.e. the 74HC595 or STP16C596).
ColecoVision Cartridge Overview
ColecoVision cartridges typically come in sizes of 8K, 16K, 24K, or 32K. I have also encountered a few 12K cartridges. They generally have one to four 8K rom chips, although I have seen a few exceptions. For example, the Pitfall cartridge I own has a single 16K rom chip.
Image of the inside of the 24k Donkey Kong cartridge.
ColecoVision Cartridge Pin Outs
ColecoVision cartridges have 15 address pins, 8 data pins, 4 low-enabled chip select pins, 2 ground pins, and a Vcc pin. The layout of the 30 ColecoVision pins is shown below:
Not Enough Pins
The Arduino UNO only has 20 pins that can be used for digital I/O. Two of these are used for the serial communication to the host PC, and I avoid using pin 13, since it is wired to the LED on the Arduino board. That leaves only 17 pins on the Arduino to connect to the 27 pins (15 address, 8 data, and 4 chip select) on the ColecoVision cartridge.
Shift Register Circuit
In order to reduce the number of Arduino pins required, a shift register circuit can be used that allows the Arduino to set the cartridge’s 15 address pins using only three Arduino pins. This circuit is described in detail on the Arduino website at http://arduino.cc/en/tutorial/ShiftOut. The LEDs and resistors shown in the example are not required for the cartridge reader, but I included them so I could see what the cartridge reader was doing.
|Cartridge Connector (A01)||9||74HC595 #1||1|
|Cartridge Connector (A02)||11||74HC595 #1||2|
|Cartridge Connector (A03)||15||74HC595 #1||3|
|Cartridge Connector (A04)||17||74HC595 #1||4|
|Cartridge Connector (A05)||21||74HC595 #1||5|
|Cartridge Connector (A06)||23||74HC595 #1||6|
|Cartridge Connector (A07)||25||74HC595 #1||7|
|Cartridge Connector (A00)||7||74HC595 #1||15|
|Cartridge Connector (A09)||26||74HC595 #2||1|
|Cartridge Connector (A10)||16||74HC595 #2||2|
|Cartridge Connector (A11)||14||74HC595 #2||3|
|Cartridge Connector (A12)||24||74HC595 #2||4|
|Cartridge Connector (A13)||19||74HC595 #2||5|
|Cartridge Connector (A14)||20||74HC595 #2||6|
|74HC595 #1||9||74HC595 #2||14|
|Cartridge Connector (A08)||28||74HC595 #2||15|
Chip Select Pins
The four chip select pins on the cartridge correspond to the four ROM chips that may be present in the cartridge. The first chip select pin (Chip Select 0x8000) should be toggled (high to low) when reading any addresses between 0x8000 and 0x9FFF. Likewise, Chip Select 0xA000 should be toggled for addresses between 0xA000 and 0xBFFF, Chip Select 0xC000 for 0xC000 through 0xDFFF, and Chip Select 0xE000 for 0xE000 through 0xFFFF.
|Arduino||A0||Cartridge Connector (Chip Select 0x8000)||18|
|Arduino||A1||Cartridge Connector (Chip Select 0xA000)||22|
|Arduino||A2||Cartridge Connector (Chip Select 0xC000)||2|
|Arduino||A3||Cartridge Connector (Chip Select 0xE000)||27|
Data, Vcc, and Ground Pins
Once the address pins and chip select pins have been wired up, the data, Vcc, and ground pins of the cartridge can be connected to the Arduino.
|Arduino||Vcc||Cartridge Connector (Vcc)||30|
|Arduino||GND||Cartridge Connector (GND)||13, 29|
|Arduino||2||Cartridge Connector (Data 0)||5|
|Arduino||3||Cartridge Connector (Data 1)||3|
|Arduino||4||Cartridge Connector (Data 2)||1|
|Arduino||5||Cartridge Connector (Data 3)||4|
|Arduino||6||Cartridge Connector (Data 4)||6|
|Arduino||7||Cartridge Connector (Data 5)||8|
|Arduino||8||Cartridge Connector (Data 6)||10|
|Arduino||9||Cartridge Connector (Data 7)||12|
Arduino Sketch File
The following Arduino Sketch file causes the Arduino to wait for a line from the host computer. If the line read in is “READ ALL”, the Arduino will do the following:
- Send a “START:” line to the host computer.
- Read all of the data from the cartridge and send it to the host computer in HEX, one byte per line.
- Send a “:END” line to the host computer.
One the cartridge data has been sent to the host computer, the Arduino is ready for its next command from the host computer.
If you are fortunate enough to be using an Arduino board with 29 or more digital I/O pins (e.g. the Arduino Due, Arduino MEGA ADK, Arduino Mega 2560, etc.) and you are not using the shift register circuit, the SetAddress function in the sketch file above will need to be re-written.
The Windows executable and associated sketch file can be downloaded at ColecoVisionCartridgeReader.zip. The source code for the application and associated sketch file can be downloaded at ColecoVisionCartridgeReaderSource.zip.
After the program reads the contents of the cartridge from the Arduino, it truncates any 8K sections from the end of the cartridge that are blank (i.e. all bytes are set to FF).
Reading a Cartridge
Once all of the circuits have been built and connected to the Arduino, the sketch file has been loaded onto the Arduino, and the ColecoVisionCartridgeReader.exe is installed on the host PC, a ColecoVision cartridge can be read.
Recommended steps to follow:
- Insert the cartridge into the connector.
- Plug the Arduino into the PC.
- Start the ColecoVisionCartridgeReader.exe application.
- Select File -> Read From Arduino from the main menu.
- Verify the settings are correct and click the Read button.
The progress dialog should appear and within 30 seconds the contents of the cartridge should appear on the screen.
The first two bytes of all ColecoVision cartridges are 55 and AA. If the AA comes first, the cartridge displays the standard ColecoVision title screen (e.g. standard ColecoVision cartridges like Donkey Kong, Mouse Trap, Zaxxon, etc.). If the 55 comes first, the cartridge skips the standard title screen (e.g. third-party cartridges like Q*Bert, Frogger, Pitfall, etc.).
Interesting Cartridges to Read
Almost everyone who owns a ColecoVision has a Donkey Kong cartridge, since it came with the game console. There are at least two different versions of this cartridge in circulation. The first edition of this cartridge was 24K, but the second edition was only 16K. Using the Arduino ColecoVision Cartridge reader, you can determine which edition you have. Another way to tell is to look at Pauline’s umbrella on the second and third levels of the game. In the 24K version of the cartridge, the umbrella has a glitch shown in the following screenshot, but the updated 16K version of the cartridge does not.
Another interesting cartridge to look at is Fortune Builder. It is one of the few 32K cartridges. It also has a large number of text strings, which can be interesting to read through.
Possible Future Enhancements
- Detect 12K cartridges and truncate the duplicate 4K at the end of the cartridge image.
- Have the Arduino check the first two bytes of the cartridge to verify they are correct before reading the entire cartridge.
- Speed up the transfer of the cartridge data by sending multiple bytes on the same line.