How to patch your DMG to use an inverted palette
November 23rd, 2009
(Please excuse the shabby look, but that is my guinea pig Gameboy that I use for experimentation.)
I’ve already explained how you can invert the monochrome palette in LSDj which is useful if you have a DMG backlight with an inverted polarizer film on your DMG. But what if you want to use a normal palette for other software or games?
Modding the ROM of the game or program you want to invert the palette for is an option, but it may not be practical. Fear not however, the protocol that the DMG is using to transfer data from its all-in-one chip to the LCD is strikingly simple, and can easily be inverted with a 74hc logic circuit of your choice.
First let’s have a look at how the protocol works.

For the sake of this tutorial there are three important pins to keep track of. Data bit 0, data bit 1 and clock. At every rising edge clock edge (when the clock line changes from 0V to +5V) the current state of the data lines is recorded, and the corresponding pixel value is drawn to the currently active pixel on the LCD. This keeps goes until the whole screen is filled with an image. And then again and again. (Ok, there are more aspects to it, like so called “blanking” but that’s not relevant for this discussion)
So what you need to do is change the values of the data lines in such a way that black becomes white, light gray becomes dark gray and so on. The way to do this is by simply inverting the two data bits. There are (at least) two possible ways to do this.

One way is to use a simple inverter like 74hc04, where you connect the data bits to the appropriate input and outputs. Also note two things abut the schematic:
1) I have connected all unused input to ground. (Unused outputs should remain unconnected)
2) I’ve added a bypass capacitor between Gnd and +5V
Neither one of these things are strictly necessary but they are good practice, and may help reduce interference to the signal if that would be a problem.
And obviously you can use any pair of inputs and outputs on the chip.

The other way of doing it, which is what I did for my prototype, is to use xor gates. (74hc86) The advantage of that method is that you can switch between the modes easily with a switch. If you xor a bit value with 0, you get back the same bit value. If you instead xor the bit value with 1, you get back the inverted value. So in this configuration, I’ve connected a weak pullup resistor, which sets one of the inputs to 1 by default, meaning the image is inverted by default. However, if those inputs are shorted to ground, the xor operation returns the original data and the picture is again unaffected.

So, how does one actually connect the inverter? You need to cut the copper trace where the data and solder the input and outputs on each side of the cut.
This is what my prototype circuit looks like. I’ve connected the inputs of the inverter to the appropriate holes that are already available in the motherboard, but filled with solder.
A sidenote on these holes: They were most probably placed there to enable connection to the WideBoy unit, which was an official Nintendo development kit that allowed the screen image of a Gameboy to be displayed on a TV with the help of a NES.

At any rate they come in handy now. The above diagram show you where to tap the input signals, where to cut the traces, and where to solder the output wires. When cutting the traces make sure you cut them properly, or you’ll have a conflict. Do not cut the Clk trace.
All three holes shown to the right in the diagram are connected to Gnd.
Last but not least, a video of the thing in action:
So… Tell me what you think. Is this information useful? Anything unclear? Is my English to quirky and corny? Anyone nterested in buying kits for this thing?



November 23rd, 2009 at 11:03 am
you are a wizard.
November 23rd, 2009 at 2:14 pm
So useful. I’ll put this into action soon. Where should I buy a 74hc86?
November 23rd, 2009 at 7:52 pm
Just tried it with the schmitt gates and it works perfectly, but i want it on a switch so i am going to keep trying.
amazing work keep it up
November 23rd, 2009 at 11:53 pm
Sweet! I’d order a kit. It’ll be nice to have a DMG inverted twice without messing with each ROM.
November 24th, 2009 at 12:25 am
Bibin: I don’t know… There’s a student lab at my university where companies have donated circuits through out the years. We have a drawer full of just different 74hc circuits. I suggest you settle for the 74hc04 version, since 74hc04 is way easier to find than 74hc86. As NeX said btw, a schmitt triggered gate will work too, 74hc14. They are the same pinout, and equivalent when used like this. In fact, if I do a kit, I’ll probably go for 74hc04, since I couldn’t find any surface mount 74hc86’s.
If you really want a switch, you could use a 74hc04 + a DPDT switch to choose between the two.
November 24th, 2009 at 1:04 am
[...] inverted Palette Mod: http://blog.gg8.se/wordpress/2009/11/23/how-to-patch-your-dmg-to-use-an-inverted-palette/ [...]
November 26th, 2009 at 9:14 pm
Amazing work. I love it!
November 30th, 2009 at 2:59 pm
Just tried it with the 74hc86 chip and again works perfectly! i ordered a minimum order of 4 chips, so i think a lot of other gameboys are going to get this mod.
December 6th, 2009 at 9:20 am
[...] How to patch your DMG to use an inverted palette [...]
December 6th, 2009 at 4:50 pm
[...] below: The left picture is a Nonfinite backlight with an inverted polarizer. (And of course a 74hc04 screen inverter to uninvert the image) It has white LEDs which is atcually a bad idea for use with a monochrome [...]