Gameboy Flashcart using Teensy 3.5? - Page 1
Forum section: electronics / projects

author: timothyaag
author_rank: Contributor
timestamp: January 04, 2017, 06:06:40 pm
content: In my path toward total Gameboy obsession I've been exploring the idea of using a teensy 3.5 to emulate a gameboy cartridge. I've written a mostly complete gameboy emulator, and wrote a bunch of gb code, so I'm familiar with how the gameboy operates logically. I am, however, at the beginner level of electronics design. I hope you all can help.My software design would include a fixed bootloader of sorts in the flash(or a separate rom if the teensy is slow to boot) that gets past the gameboys bootstrap and communicates with the Teensy to load a rom into its ram and then pass off control to that code. Behind the scenes the Teensy will need to route requests from the Gameboy to return the correct data. Along the lines of databus = data or data[(address + ($4000 *(bank - 1))] with banking. The teensy operates at 120MHz while the cart bus operates at 1MHz, so I think I have enough overhead for emulating not just rom only carts but also those with memory banking.My concerns are:1. How to make the cartridge end that plugs into the gameboy. I have a Toy Story cart I could butcher. I was thinking of cutting away everything down to the pins and then soldering wires directly onto the pins that will connect directly to the teensy. Then the pinboard can slide nicely into the cartridge slot. I don't see any supporting components for the lines like pull ups or downs or caps, but I don't exactly have the eye for it. Can I do this?2. Logic levels. The gameboy cart is at 5V but the teensy is 3.3V and "5V tolerant". As far as I can see from the docs online low is low enough and high is high enough for the Teensy to differentiate. Not sure about the other way around. This guy's done it with a similar micro:http://dhole.github.io/post/gameboy_cartridge_emu_2/3. Power. My PSU shows the gameboy only pulls about 80mA active (running Links Awakening with sound), and some forum posts show the teensy pulling 100mA+ depending on what it's doing. I think I can put it in low power state while the clock from the gameboy is inactive but I'm at least doubling the gameboys consumption. This also raises concern that even if the Gameboy can handle it, can I pull that much from the 5V line on the cart slot. If it comes down to powering it separately then I will probably have more questions.Has anyone here done this or something similar? I would appreciate any advice or thoughts.Thanks.

author: nano
author_rank: Contributor
timestamp: January 04, 2017, 08:17:28 pm
content: Very interesting project!Had had a similar idea but unfortunately not enough time to try anything yet.Regarding the first question: A 0.8mm think PCB should fit well in the gameboy. You can order them cheaply at elecrow.Please keep this thread updated with your progress

author: timothyaag
author_rank: Contributor
timestamp: January 05, 2017, 03:30:41 pm
content: I went the quicker route since I was impatient. Consider Toy Story BUTCHERED.There's a bit of a wire mess where I connect the wires to the teensy but coming off the Gameboy cart the cords are neat and color coded.. I'll have to get some pictures up here soon.So far, I have an interrupt on clock pulse, which then waits a few NOPs for Read to go low, at which point I read the address, then throw data on the data lines.Pins:Write: Not checked yet, don't need until implementing bank switching or in-cart RAM. Still connected.CS SRAM: Not connected.Reset: Working.Audio-In: Not connected.Clock: Working. Clean signal to Teensy and interrupts fire consistently.Read: *Stuck low. Should be active low, so somethings amiss here.*Address Lines: Don't know since I can't really time it without a low Read signal. If I willy-nilly read off the current address on a clock pulse, I don't get good addresses. The GB should be looking at $104-$143 early on to do the checksum. So far, no good.Data Lines: Presumably working. Since I don't have a working clock->read all I can do is force the lines high or low in specific ways to make sure everything is working. The Nintendo Logo scroll will display whatever you have at $104-$143 so it's a good indicator it's at least reading what I'm putting out, and it is.So I've hit a roadblock with the Read signal. The docs I've read say it's supposed to be idle high, active low, but it's not really doing anything. I can probe it without a cart and it's not high either, but if I put a real game in, it works fine. Either the docs are weird, or I'm not connecting something right. Could it be the AudioIn and CS SRAM being disconnected? I'll try connecting those tonight.