I have been working on a ROM reader/writer for a while, originally as the basis for a universal programmer, but that can wait -- I have decided to implement it as a GameBoy (and possibly other platforms!!) cartridge reader/writer. So far all I have done is created a huge mess of wires on a breadboard, and tried reading a 512k UV EPROM.
So, here's the amazing pictures of this groundbreaking technology:
The above photo shows the microcontroller I'm using, which is actually in a handy little module [which, by the way, is a DIY module that I paid next to nothing for] and it shows the jumble of all the jumper wires I own, and the 512k UV EPROM, which may or may not have been damaged by the camera flash...
As you can also see somewhat on the right, there's a RCA connector for a TV. Since the microcontroller that I used (the Parallax Propeller, if you didn't recognize it) can do 1-pin video, I displayed all the ROM data on the TV.
Here's some more pictures:
On this one, you can even see my little 2.1mm power connector to breadboard adapter, which has come in handy for a BUNCH of projects. The huge mess of wires is also a bit more noticeable here too.
This is just the same thing, different angle. Can you spot the Kid Icarus Mask ROM chip?
Now, for a summary of the code...
First, since this is the Propeller, you need to define the clock speed at 80MHz (yeah -- that fast, not even overclocked) and define the Output Enable (OE on most flash/ROM chip pinouts) and Chip Select (sometimes called chip enable; labeled as CS or CE). I put them as IO pins 27 and 28, simply because it made everything much easier.
You also need to define the variable for the address you'll be incrementing. I called mine "addr" for simplicity. Also define another variable, which will be the actual data held in the addresses -- "data" seems to be a fitting name...
Since this is the Propeller, you also need to define what objects (if any) you will be using for your program. The demo program I have uses the 1-pin TV text object, which was a lifesaver, since I wouldn't have had enough jumper wires for normal 3 pin TV.
Now for the actual process of reading (I havent tried writing chips yet, since I only have one flash chip, which is currently in my cartridge). What you do is define "addr" as: %0_0_0_0_0_0_0.... Basically, you need to have as many zeros as there are address lines on the ROM chip. Once I configure it for GB carts, it will be 16 zeros. Then, you will need to set OE and CS to outputs, set the pins connected to the address lines of the ROM to outputs, and set the data lines to input. To read, you set OE and CS to low, write "addr" to the address pins, wait a few moments (moments are of course, microseconds) and then read the data pins. Wait a few more microseconds and then repeat as many times as there are addresses in the ROM chip.
That's pretty much all there is to it! As you can see, its
super simple...
I will be working on reconstructing this on my breadboard today and tomorrow. I'm hoping to get some more pictures and maybe even a video of it working.
Finally, I am planning on selling this project once it's completed, for about $20 to $25, fully assembled and ready-to-go, as long as I can find an alternative connector...
That's all for now... If any of you know of a source for an equivalent to the GameBoy cartridge connector, PLEASE leave a comment with a link!
--Vaati