NES Controller / GameBoy Button Translation

Yep!

Nice! :+1: :joystick:

1 Like

I’ve spent the good part of a day measuring the DMG pcb and designing in Fusion360.

This is the design I’ve come up with so far. Pretty similar to a gameboy casing. :wink:

I’ll work on the lid after checking this next test print.

2 Likes

All done! I call it the Gamebox. I even made a mini NES controller that uses DMG buttons to match!

More info on Element14

3 Likes

I hope TTC LLC isn’t watching.

Probably if you do something like that, they will see the smoke signals. :thinking:

…not sure there is anything here they would object to? Playing a physical copy of “that which must not be named” on a physical GameBoy, and taking a photo of it - where’s the problem? :face_with_raised_eyebrow:

If the issue is hypothetically around using a ROM on a GameBoy flash cart, then a couple of dollars on eBay will buy you the right to play Tetris in your own home:

https://www.ebay.com/b/Tetris-Nintendo-Game-Boy-Video-Games/139973/bn_7205562?rt=nc&_sop=15

EDIT: Also - https://www.nintendo.co.jp/networkservice_guideline/en/

1 Like

I’m a simple man. I see trip world and I press like.

2 Likes

Oh right, I didn’t realise it was a physical copy.

Disregard my earlier comment.

Hello

Super Project !

can someone help me to change the adruino code to read the DMG button presses ?

thank you

Sure - what are you trying to do though? Read the buttons while the GameBoy is running? or use the front board independently of the main board?

Reading the GameBoy buttons is just a matter of taking an input from P10, P11, P12, P13 in the diagram above. Which four buttons are being represented on these pins depends on the state of P14 & P15.

1 Like

Thx for the info, i would like to read the start & select button when de Gameboy is running.

with as less wires as possible running to the arduino (the arduino is running off de DMG GND & 5V)

To read start and select you would need three gpio wires (P12, P13 and P15). Your software would wait till the gameboy polls P15 and then you would read the states of P12 and P13 to know if either start or select was pressed.

…and here is how those pins in the above diagram correspond to the pins on the GameBoy’s ribbon cable connector:

P11 = 4
P14 = 5
P13 = 6
P12 = 7
P10 = 8
P15 = 9

…and a couple of images from @nobble that may help you identify those pin numbers on the ribbon connector:


1 Like

What would change in the code when running this on an Arduino Uno? PORTF is not available (I don’t even see that in the arduino documentation actually, the site says the chips used in arduino only use ports B,C, and D.)

From what I gather that would depend on what you have wired up to what.

If it actually says that then the information is probably wrong.
The Arduino Leonardo board (which uses the same chip as the Arduboy - an ATmega32u4) has PORTF defined.

The Arduino Uno board (which uses an ATmega328P) does not have PORTF defined.

When porting code that references gpio from one target to another that doesn’t have the same pins just swap the instantiations and references to whatever pins you want to use on the new chip. So long as the original software isn’t using specific peripherals that the new chip doesn’t have it’ll be fine (and obviously you may have to rewrite some of the initialization code/transfer anything device specific register-wise).

Thanks for the response. As far as I understand it, Port manipulation allows for faster switching. So would it be feasible just to use a different port on the Uno that is defined, and then change the instantiations from this script to correspond to the pins used in the port I decide to use on the Uno?

I don’t have any experience with port manipulation so that’s what’s throwing me for a loop.

Of course you can use a different port or even a different pin number within any given port. As with all things the datasheet will have all the details you’ll ever need. For direct port manipulation you’ll need to do what is colloquially known as bit-twiddling ("and"ing with a zero to clear a bit (the rest of the port pins are anded with 1 to prevent changing them), "or"ing with a one to set a bit (the rest of the port pins are ored with 0 to prevent changing them)). There are tons of examples of this online. Alternatively you can create bit-masks/defines to make the code more human-readable.

The issue is that I chose PORTF because the code isn’t actually doing comparisons and separate bitwise operations to set some pins up and others down - it just sets the whole port to the current button values, which is fine for the 32u4…

A0 - A3 on the Uno are on PORTC though, and unfortunately so is the RESET pin :confounded:

Thought I found a solution using PORTB, but the crystal pins are on PORTB :grimacing:

Don’t have time to write this for you right now… sorry :frowning_face:

1 Like