There's a handful of cool peripherals for the Game Boy®. Like Pocket Sonar, the perfect companion on your next fishing trip, or PediSedate, designed to reduced stress when sedating your child.
But all kids longing to play Tetris, Mario or Zelda using a joystick are left disappointed. Until now! Introducing Joy Boy – just connect it to the EXT. port and play your favorite games* using a stick and large, comfortable buttons. How cool is that?!
* Not all games are compatible with the Joy Boy accessory. In fact, at the time of writing, none are. Hopefully, future games will have support after developers hear about Joy Boy.
"Hmm …", you might be thinking, "this Joy Boy seems like a pretty dumb and useless machine. Why hack together a joystick for a 30-year-old handheld video game console? Seems rather pointless." You are correct!
Nobody needs a joystick for the Game Boy®. It's useless because:
it's about 20–30 years late to the party
Joy Boy is hard to play on the go, like on a crowded train
there are no games compatible with the Joy Boy
This project is just for the lols and also my entry to the MacroFab Design Contest: Useless Machine Sponsored by Mouser Electronics.
Do you remember me telling you about both the Zinger (or any NES controller for that matter) and the Game Boy communicates using not quite SPI, but close enough. That's still true. However, I was naive thinking the two could have a conversation without an interpreter.
This entry hits the nitty-gritty details of SPI. If you need to brush up your knowledge I can't recommend What Could Go Wrong: SPI by Elliot Williams of Hackaday enough.
Still with me? Nice!
The problem resolves around clock polarity and the fact that the NES controller expects the clock signal to be idle low while the Game Boy thinks it should be idle high. Polarity 0 in one end, 1 in the other. That's no good.
There's no way for me to change the polarity from firmware, so additional hardware is probably needed. In the best-case scenario throwing an inverter (NOT gate) on the clock signal should suffice.
Yes, I found my old SNES controller and, yes, it uses the same communication protocol as the NES controller and, by extension, the Zinger. In other words: it is a decent substitute until a working joystick shows up.
First thing I did after unearthing the controller, was to figure out its pinout. I ended up learning the order of things from the Schematics, Ports, and Pinouts page at the SFC Development Wiki. There's no fancy drawing this time, just this photo:
SFC Development Wiki provides different signal names compared to the ones at wiki.nesdev.com; using data, latch, and clock instead of D0, OUT, and CLK. I like the former, more descriptive ones, better. Next, I hooked up the controller to the Arduino Uno and ran my test program.
Lo and behold, it worked. I made contact! What does that mean? That I'm able to show current controller state, which buttons are held down at any moment, in a serial monitor on my Mac.
Finally, I've made progress.
What you see in the screenshot above is the result of me pressing buttons frantically during a test session. The controller state fits in a single byte, each bit representing one of the buttons. Can you guess which buttons I pressed in each case with just the screenshot as your guide? There's a hint in the source code window.
On the subject of source code, my test program is pretty simple. On a high level, it implements the NES controller protocol using the Arduino's SPI hardware. At roughly 60 Hz the controller is asked nicely to latch the button state into its shift register and start delivering bits until a full byte is received.
That byte is sent out on the serial line for me to marvel at in the monitor.
I won't go into more details here. The source file is short (< 100 lines) and heavily documented, so I strongly suggest anyone interested to take a closer look and study it.
It's great to be on track again. Now, time to focus on the Game Boy.
Given how much time I've spent troubleshooting, I'm a little disheartened it didn't get me anywhere. I still haven't been able to communicate with the joystick from an Arduino.
Today I, once again, took a screwdriver to the Zinger and tore it down. This time around, I took a closer look at the circuit board and snapped a couple of photos.
Next, I grabbed my multimeter and made sure everything was hooked up the way I expected it to be. No shorts circuits or other nasty surprises. I took note of the single integrated circuit on the board and which of its pins each wire ended up at.
Markings on the IC yielded no result when searching the interwebz. Lacking a proper datasheet, I can never be 100 % sure I've made the right assumptions concerning the pinout. Maybe I got it wrong somehow, and that's why I can't get data off the joystick.
Anyhow, with the PCB exposed I connected the pins directly to my logic analyzer and Arduino Uno and started running my test program – I'll get into more details in a future log entry – and, just as before, the clock (CLK) and latch (OUT) signals from the Arduino to the joystick looked okay, but the data signal (D0) from the joystick was flat. No matter what.
That's it, I'm stuck. At least with this particular joystick. Maybe it tanked during my investigations or perhaps it was already broken when I bought it. (I never confirmed with an actual NES that the joystick actually worked.)
To move forward, I need another Zinger to experiment with. Or some other interim controller, utilizing the NES protocol, like an original NES or SNES controller. I lack the former, but the latter is actually in my possession. Somewhere.
Neither good nor bad is the fact that my initial efforts at communicating with the joystick, utilizing an Arduino board, were fruitless. The data line is silent, no matter what I do to the stick and buttons. Maybe I messed something up during my teardown?
I should team up with a multimeter and logic analyzer next.
I want to start interfacing the joystick already. However, I'm not quite there yet. I need an easy way to connect the joystick to an Arduino, maybe a logic analyzer, and, of course, an actual Game Boy. In my previous log entry, I described the decapitation of the joystick cable – the removal of its NES connector. After that treatment, it's hard to use the joystick even as intended, connected to a Nintendo Entertainment System.
In cases like this, I tend to strip the wires inside the cable and attach jumper wires to them. The result is the breadboard friendly cable shown in the header image.
That's it! Later on, I will need something similar at the Game Boy end: a breadboard friendly Game Link Cable. Luckily that's something I already made for myself a couple of years ago using the same method described above.
After a good nights sleep and breakfast, I reached for my wire cutter and cut off the NES connector from the joystick cable. There are five wires inside the cable, color-coded as black, white, blue, green and brown. I had no idea what color corresponded to wich signal. What I do know is the NES controller port pinout, thanks to the hard-working Nesdev community. With that information, I pried open the plug to figure out the relationships between wires and pins.
So, without further ado, I'll present to you my findings. Be careful though: I can't guarantee all Zinger joysticks are wired the same way or using the same colors as mine.
The Zinger plug pinout
Black for +5V and brown for GND? Not the most obvious choices of color if you ask me.
The Zinger is sold as a Nintendo Entertainment System (NES) accessory and connects to the controller socket. For the joystick to be compatible with every NES game, it should pretend to be an ordinary NES controller.
I don't want to destroy my Game Boy for this to work, so I have to interface the joystick unobtrusively. Fortunately, every Game Boy come equipped with an External Extension Connector – EXT for short. Have you ever used a Game Link Cable to trade Pokémons with other kids at school? That cable goes to the EXT connector.
The port consists of 6-pins and, according to my interpretation of the Game Boy Programming Manual, it works pretty much like an SPI (Serial Pheripial Interface) device without a slave select line.
"Hey! Isn't a shift register just that?", you might think, "A peripheral device, communicating over a serial line. Maybe … the Zinger and the Game Boy can understand each other. Really well."
Yeah, that's my thought as well. Great minds think alike and all that.
However, the plug at the end of the Zinger cable is too big to fit into the EXT connector. My plan right now (given that my assumptions above turn out to be correct) is to cut away the NES plug from the Zinger cable. Then slice a Game Link Cable in half, merging one of the halves with the Zinger cable. That should yield me a joystick with a cable and plug that fits right into the EXT connection on a Game Boy.
Reasoning about all this is part of what I did since the last log entry. I also cracked open the Zinger and peeked inside.
Opening the case was easy enough. Seven screws, and that's it. Two wires connecting the stick and PCB prevents a total disassembly, however, unless you're up for some desoldering.
There's not much going on here. I count to one integrated circuit, probably containing the shift register and some circuitry to handle the "Quick Fire" functionality.
When the joystick was all in parts, I seized the opportunity and gave most of the plastic pieces a bath. Probably the first one in a long time. The Zinger is a lot cleaner now and smells goodish.
There's more work to be done before this is a success:
Remove the plug from the joystick and replace it with pins for easy breadboarding.
Get a hold of a Game Link Cable with pins suitable for breadboarding (I have one laying around from earlier projects).
Try communicating with the joystick (using an Arduino) to confirm my shift register theory.
After that, I should be able to write a Game Boy homebrew that interfaces with the joystick.
I've known about MacroFab's design contest since the beginning of June and intended to participate. But the days turned to weeks that turned to months, and today I woke up with just a day left before the deadline and nothing more than a vague idea in my head.
I wanted my entry to be Game Boy related somehow – I'm a big fan of Nintendos old handheld. The theme of the contest is "Useless Machine," and contesters should "build an electronic project that is useless." So, in the end, I have to come up with some kind of useless electronic accessory – but what exactly?
Given the short amount of hours available, I gave myself the following constraints:
just breadboard the thing – no time for PCB design and manufacturing
solve as much as possible with firmware/software
Happy with limiting myself this way, I jumped on my bike and started pedaling to the local second-hand store. Why? To find something interesting that I could hack, hook up to my Game Boy, and do something useless with.
I browsed the store for a while, chitchatted with the owner and, suddenly, there it was. In a cupboard, on the shelf closest to the floor, it stood. In all its glory. The Zinger – a joystick for the Nintendo Entertainment System by Beeshu Inc.
"Jackpot! That's my entry to the competition.", I thought. Hacking the joystick to work with the Game Boy is the perfect useless accessory:
it's about 20–30 years late to the party
it makes it harder to play on the go, like on a crowded train
there are no games compatible with it
Can you imagine anything more useless? An accessory for a handheld video game console that is not compatible with any game.
It must work, though, so I have to figure out a way to connect the Zinger to the Game Boy, reverse engineer the joystick communication protocol and write some demo homebrew software to prove everything operates as intended. And I have to do it in less than 18 hours.