Tim Hentenaar's Blog

Nov 10, 2014 18:00

Expanding the Gameboy's I/O Capabilities

As a follow-up to my last post, I starting thinking about simple ways to interface with the Gameboy dev cart I now own. Of course, I could just use my arduino and a couple of 74595's, but nowadays that's a bit cliche. Not to mention, plenty of people have already done it. :P

I figured it would be much more interesting to build a Gameboy cart which can interface with other Gameboy cartridges (or any other hardware that you can drive at TTL or CMOS line levels.) Since a Gameboy cart has 29 I/O pins (if you count the bus control lines,) this new cart would have to add that many lines.

That made me think back to the days of the 8085, and the more widespread availability of I/O expansion chips for microprocessors. The first such chip to come to mind was, of course, the Intel 8255. In more "modern" computer systems, the functionality of the 8255 is likely provided by the southbridge chip on the motherboard. However, the 8255 is still in production, and still just as useful in 8-bit systems.

The 8255 provides three 8-bit I/O ports (A, B, and C -- although, port C is actually comprised of two independent 4-bit ports) on one IC. To oversimplify a bit, you just read from / write to the ports on the 8255, and it relays your wishes to the outside world, or vice versa.

Here's the datasheet for the 8255 I'ved used in the design below.

The downside to this approach is that reads and writes to another cartridge, for example, will be about 4x slower than if the Gameboy did it directly, as it requires 4x as many writes, and each write cycle probably takes around 450 ns or so.

Anyhow, I set about to design such an interface, and came up with this. Ain't it a beauty? The two 8255's map to the Gameboy's address space at $7FF8 - $7FFF as shown.