Welcome to Robot Dialogs. This is a place where I will record my progress, mistakes, errors, failures, lessons learned and hopefully occasional success in my designs and implementations of robots and other technical endeavors. I will try to make it as educational, informative and entertaining as I can...

Saturday, February 26, 2011

GameBoy (Classic) Work In Progress Part 4

I finally dug the GameBoy back out of the project box and started making some more progress on it. I'm still working with an ATMega32, but now I've cranked it up to the full 16Mhz it can handle...


I also took some new data from the GameBoy LCD control signals with the Logic Sniffer. This time I wasn't clocking the GameBoy with my micro-controller. Instead I used the GBs original crystal, so the data is from the actual signals with actual timing that the GameBoy uses.

I was able to break down the timings of the signals and essentially emulate them with the ATMega32. The logic I use to determine what pixel data to push out was simply if(x = y) then the pixel was turned on. I figure a diagonal line is a good test that doesn't look like the crazy vertical and horizontal screen artifacts you sometimes get with the GB.


This picture is very deceiving, the contrast is a lot better in the picture than on the actual screen. The ATMega32 can't quite output data as fast as the GBs CPU, and even though I can emulate the signals I still don't fully understand them. I feel it's going to take a lot more effort to actually understand the non-obvious signals.

When I finally understand them I hope to be able to slow the frame rate down, leaving an old image on the screen while I compute the next. Unfortunately my attempts to leave the image on screen while doing other stuff just lets the screen clear... I hope this is fixable, otherwise I'll have to either devise some sort of video ram setup that takes new data but always keeps the screen refreshing while leaving another chip to create the data and send it to the ram or I will have to upgrade to some much higher frequency micro-controller that can do both. From what I can tell the Z80 in the classic GB does both, but to pull it off it has dedicated hardware to pull data from shared memory and drive the LCD, while the main Z80 just handles the game logic and graphics computations and just stores into the shared memory...probably over simplified that explanation... you can go read the GB's patent if you want the real story/architecture.

Oh, my current source code is inexcusable. Give me some time to figure out the purpose of the LCD signals and then I'll put up some code. Also, you'll need the OpenBench_LogicSniffer_JAVA_CLIENT_2.1 to view that data.

No comments:

Post a Comment