Close

Game Boy Printer vs. Arduino

davedarkodavedarko wrote 09/23/2014 at 21:41 • 2 min read • Like

I won the fubarino a while ago on hackaday.com because I worked a little easter egg into a Game Boy Printer library for the arduino. The printing from code was a work around since I never got the serial running. I ran into problems though, trying to print more than 2 arrays of 640bytes and thought that while my code reached a compiled size of 8kb+ that my cheap chinese arduinos where just faking the 32kb and the code would not fit. Like any other project it went into a box until sunday some one contacted me on github and I got motivated to get into it again. 

I tried 2 arduinos and again bricked them and had to install the bootloader over ISP, to get them working. At one time I started noticing jitters on the serial line. So I googled for maximum array sizes on a arduino and I finally found the problem and the solution. The atmega328 has 2kb of SRAM and this is where the values are stored, so having 3 x 640 (1920) bytes is definitely overkill. 

http://playground.arduino.cc/Main/CorruptArrayVariablesAndMemory#Array_example_and_comparison

Storing the picture in flash finally let me print up to ten rows of a picture, which was the maximum the printer could take before printing. But I wanted to be able to print endless pictures and after printing there was always a boarder of 3 rows and 1 row starting the next part. That was finally fixed when I found that the printing command contained the margin before and after the prints. With that fixed I was able to send multiple lines, but they were all just fired on the printer and only one row got out. Then I noticed, that Miles Burtons code wasn't waiting for the print to finish, so I copied the code from furrteks attiny code and bam, it worked with 17 lines of 640 bytes so far. 

I also updated the code for generating the arduino lines on my webpage to give out progmem values and created a canvas based html5 page on http://davedarko.com/canvas/ - be warned that the pictures will also show on http://davedarko.com/gameboy.php

What an adventure! I'm not sure how I will proceed from here, I like the web based approach and don't want to make a processing app, working the algorithm again. So, internet of things stuff for a 16 year old printer anyone? Arduino and ENC26J80 maybe? 

Like

Discussions