-
Introducing the World's First Joystick for Game Boy
08/31/2019 at 11:40 • 0 commentsI made it. The Joy Boy has seen the day of light. Now anyone can play their Game Boy using a joystick. Anytime, anywhere.
Finally, you're playing with power. Stick power!
-
My Work Environment, Tools, and Resources
08/30/2019 at 17:07 • 0 comments -
Inverter Simulation and Moving To Protoboard
08/30/2019 at 13:46 • 0 commentsAn inverter turned out to be an okay solution to the polarity problem. My parts bin lacked anything even remotely looking like a NOT gate, so I implement my own using an ATtiny85. Try to find a dedicated 74x1G04 chip if you are following along and building this yourself at home.
/* Performs the Boolean function Y = Ā, a quick and dirty simulation of an inverter gate. Please don't use this. Buy a 74x1G04 IC [0] instead. [0]: https://www.mouser.com/Semiconductors/Logic-ICs/Inverters/_/N-5820b?Keyword=74%3f1G04 */ const int IN_PIN = 2; const int OUT_PIN = 3; void setup() { pinMode(IN_PIN, INPUT); pinMode(OUT_PIN, OUTPUT); } void loop() { boolean pinInState = digitalRead(IN_PIN); digitalWrite(OUT_PIN, !pinInState); }
With that fixed, I have a fully working connection between any Game Boy and Zinger Joystick (or any NES or SNES controller really). Until now, I have experimented on a breadboard, but I grew tired of the messy state it was in, so for a more permanent installation I took the time to move everything over to a protoboard.
I call it the NES to Game Boy Adapter and you should be able to throw one together yourself by having a look at the schematic.
-
Polarity Sucks
08/15/2019 at 10:06 • 0 commentsDo 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.
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.
If you need to brush up your SPI skills, as I did, What Could Go Wrong: SPI by Elliot Williams is a great read.
-
SNES success
08/13/2019 at 22:38 • 0 commentsYes, 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.
-
Stuck and unstuck
08/12/2019 at 18:35 • 0 commentsGiven 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.
Maybe I'm not stuck, after all.
-
Bad news and good news
08/11/2019 at 09:14 • 0 commentsI've got some bad news and some good news to deliver. Let's start with the bad.
I missed the August 10 deadline for the "Useless Machine" contest.
The good news is that Macrofab decided to extend the deadline to 31st. Yay!
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.
-
Crafting breadboard friendly cables
08/10/2019 at 12:48 • 0 commentsI 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.
-
A colorful plug teardown
08/10/2019 at 08:55 • 0 commentsAfter 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
Name
Wire color GND Brown CLK Blue OUT White D0 Green +5V Black D3 Not present D4 Not present Black for +5V and brown for GND? Not the most obvious choices of color if you ask me.
-
A strange-looking robot pirate
08/10/2019 at 00:04 • 0 commentsThe 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.
If that's the case, I'm in luck because the standard controller is well documented and basically just a big parallel-in to serial-out shift register.
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.