Close

Hooking up a Logic Analyzer

A project log for Game Link Online

Play your good old multiplayer Gameboy games over the internet!

Arno MoonenArno Moonen 11/12/2016 at 16:020 Comments

As you have read before, I received the boards quite a while back. In the mean time I also received a cheap Chinese logic analyzer which I wanted to try out. Being a software guy, I never really had to work with a logic analyzer, but I must say this first experience was very pleasing.

In order to analyze the data, I soldered headers to two of the boards. I wanted to put them on a breadboard and connect a Game Link cable to each of these boards, both connected to a GameBoy Color console.

It is well known that these Game Link cables have several wires twisted (Data in and Data out, for instance). To make sure that I wasn't "undoing" the twist by using two cables, I did not hook up the boards one to one. Instead I connected a single cable between them first, to figure out which pins where connected together by the boards. Using a multimeter I could easily "beep" out the connections and make sure that I recreated the twist correctly. I noticed that not only the Data lines were twisted, but that VDD (pin 1) on one end is connected to SD (pin 4) on the other end. I reckon this is used as a very basic detection mechanism.

Two Gameboys and a logic analyzer, connected via a breadboard.

After that I hooked up some additional wires so I could connect it to the Logic Analyzer. Looking at the software that came with the Chinese device, as well as the sticker on it, it turned out to be a clone of a product by Saleae. As I mentioned before, the tool was very pleasant to work with and I'm actually considering being the device by the original vendor after using this clone.

After some fiddling around with the SPI analyzer settings in the software, I was able to see the communication between the two GameBoys. They were running Pokémon Yellow and Pokémon Red, both in the trading center. The protocol for this has already been described on several places on the internet (on vaguilar.js.org, for instance). The data I saw on my screen, matched the structure described in those descriptions.

Initial communication between Gameboys when entering the trading center.

Above you can see a small part of the data that was transferred. The first few bytes appear to be preamble bytes (0xFD). After that the names of the players are transferred (up to 11 bytes, but both players had a name of only 4 characters, terminated by 0x50). The names are followed by the number of Pokémons in their party (6 for both players). The next 6 bytes represent the species of the Pokémon, terminated by 0xFF, and so on...

The logic analyzer also showed me that the clock was running at 8192Hz,, which is the "Non-CGB Mode" internal clock speed. This implies a transfer speed of about 1 kilobyte per second. For today's standards this is pretty slow and that's good news actually. Most internet connections nowadays are much faster, so the overhead of another communication protocol on the transfer speed will probably not be significant. Only problem I see now is the delay in the connection (talking over the internet will never be as fast as a direct connection between two devices).

By the way, for those interested in the settings I used in the Saleae software, I've added a screenshot:

SPI Analyzer settings

Till next time!

-Arno

Discussions