I just got introduced to Arduino, the microcontroller that's easy to use, has a great community and the support material found on internet is very vast.

This little beauty, and the knowledge that I've acquired while learning to use it, allowed me to create a device that I always wanted to create since I was 19 years old: a videogame cartridge reader!

The main reason I choose Sega Genesis cartridges it's because I got very familiar with it by reading the documentation of an old cartridge dumper called "Game Medic". Game Medic originally used the PC parallel port and, because of its limitations, more ICs were necessary to build the whole circuit. Arduino turns any external world interfacing with your PC a breeze, so that's why I've used it for this project: ArDUMPino!

The Sega Genesis cartridge ROM

Description below was adapted from the Game Medic documentation:

The average Sega Genesis/Megadrive cartridge consists of a ROM chip and sometimes a battery backed up static ram chip. The signals to and from the cartridge are all CMOS level (rail to rail voltage swings) and therefore all chips which interface to a cartridge or the Genesis/Megadrive should be CMOS compatible parts. The Sega Genesis uses a CMOS variant of the Motorola 68000. Therefore, there are 16 data lines and 23 address lines at the cartridge slot.

Sega cartridges almost exclusively use a single mask programmed 16 bit wide ROM chip in their cartridges, but third party manufacturers sometimes use multiple (sometimes 8 bit wide) ROM chips. Therefore, reading a Genesis cartridge consists of asserting the address and chip select lines low, setting the address lines to the address you want to read and reading the data of the data lines.

The pinouts for the cartridge port is as follows:

When standing in front of the Genesis, b is frontward, a is rearward,
1 is to the left and 32 is to the right.

Given all the information about the Sega Genesis ROM cartridge above, all we need to do in order to read the contents of a ROM chip, in a nutshell, is the following (and this theory is pretty much the same and applicacable for reading any ROM chip):

:. Assert the Address (*AS) and Chip Select (*CS) low (active)

:. Set the Address Lines (A1 to A23) to the address we want to read

:. Read data from the Data Lines (D0 to D15)

Please note that the data bus has a 16-bit width, so every address will give you back 16 bits of data. Therefore, in order to read a 8 megabits (1 megabyte) cartridge (Sonic 2, for instance), the address line should range from 0 to 524287 and you should read 2 bytes (16 bits) of data at every iteration.

This is exactly what ArDUMPino does! It basically reads data from the cartridge and outputs them to the Serial interface. All the "intelligence" is inside the Arduino itself, which is running the Schetch (this is how we call Arduino programs) that contains all the ROM reading logics and a Serial interface, making it "controllable" via serial interface.

The ArDUMPino client PC program is simply a "dumb terminal" which simply sends ArDUMPino commands and retrieve the output from it, saving all the data in a binary file (ROM file).

The shift registers are used as "expanders" for Arduino, adding 16 input pins acting as the data bus (2x CD4021B) and 23 output pins acting as the address bus (3x 74HC595N ).

You can get more information about Arduino and ShiftIn and ShiftOut procedures here and here respectively.

Here's a picture of a rather ugly (but functional) implementation of the schematics using protoboards! :)

The Software

ArDUMPino's software part is made of two main components:

:. ArDUMPino Sketch

:. ArDUMPino Client

The ArDUMPino sketch is the C program that runs inside the Arduino board. For a quick intro about Arduino and how to program it, please refer to the Arduino's Official Website.

It is responsible for receiving commands from the serial interface (sent by the ArDUMPino client application) and output ROM data to serial (which is captured by the client application).

Currently, the two most important functions implemented by the ArDUMPino sketch and that are often used by the client application are:

:. GET_GENESIS_ROMSIZE - It returns a string which is the integer representation of the cartridge ROM size, in bytes. This information is read from addresses 0xD2 and 0xD3. These four bytes are the final addresses used by the ROM.

:. READ_GENESIS_ROM - Makes the Arduino read all ROM bytes and output then to the serial interface

The sketch code was created in a matter that will be very easy to implement support for other cartridges. Super NES support is really easy to implement by using pretty much the same circuit. The reason I didn't do this yet it's because I could not find a SNES slot connector and a cartridge. Game Medic documentation even has an explanation about how to achieve this.

The ArDUMPino Client part, as mentioned, is a much simpler program that simply send commands to the Arduino and saves the received bytes. It was created using Lazarus, an opensource and multi platform FreePascal IDE/Compiler. The library used for getting serial port support was SynaSer.

Here's a screenshot of the ArDUMPino Client program reading the Sonic 2 cartridge from my protoboard prototype:

This is my first Arduino related project. I'm a newbie in electronics, including microcontrollers and Arduino itself. Suggestions are welcome! I still wonder if it's possible to speed up the read process: Dumping a 16 megabits cartridge takes about 6 minutes. Not sure whether this is considered normal or too slow.