Gameboy VGA adapter

From Hackerspace ACKspace
Revision as of 02:02, 25 May 2011 by Prodigity (talk | contribs)
Jump to: navigation, search
Project: Gameboy VGA adapter
Featured:
State Active
Members Prodigity
GitHub No GitHub project defined. Add your project here.
Description Adding VGA output to a gameboy classic
Picture
No project picture! Fill in form Picture or Upload a jpeg here


Temporary VGAmeboy logo

Introduction

The gameboy classic is a handheld video game device which invokes a feeling of nostalgia into the hearts of many gamers (and non-gamers!).

In total nearly 120 million of these devices have been sold around the world and have delivered uncountable hours of fun (and frustration.. "DAMN YOU MARIO!" heh anyone? :P).

Nowadays the gameboy has been replaced by far more advanced (read: battery-slurping) handheld devices and as such, many people have one lying around collecting dust.

As some of you might remember, the biggest problem with the gameboy classic was the unlit screen which caused any form of sunlight to render the screen into a useless plastic mirror.

REJOICE! For I have decided to add VGA output to the gameboy so you can play on 21" screens! (TAKE THAT SUN!) No more visibility problems! (Yes you can add LEDs to the back of the screen, stop being so boring :P).

Before we get down and dirty, you'll need to be sure that you understand the terms used on this page; VGA terminology.


The gameboy

Gameboy specs:

  • Resolution: 160 x 144
  • Refresh rate: 59.7Hz
  • Horizontal Sync: 9.2KHz
  • Bits per pixel: 2 (Black, Dark grey, Light grey or White)
  • Pixel Clock: 4MHz


As you can see we are presented with a refresh rate of 59.7Hz which nearly matches the standard VGA refresh rate. (Most likely close enough, only testing will tell)

The resolution of 160x144 however poses a problem, no such VGA resolution exists and as such we will be forced to pick a different resolution and do some pixel juggling.

The solution? We will use double buffering and a different resolution.


Double buffer

To determine the size of our buffers we simply take the resolution of the gameboy screen and multiply the amount of horizontal pixels with the vertical pixels (160x144 = 23040).

The 23040 bits translate roughly to 3 kilobyte.

Since we are dealing with 2 bits per pixel, we need 2 buffers per frame, which adds up to 4 buffers in total.


Resolution

Multiplying horizontal pixels by a float is only a matter of altering the pixel clock.

Multiplying vertical pixels by a float however is difficult as this has to be done with a digital solution.

As such we prefer to use a resolution whose vertical pixels are a multiple of 144. (Any integer)

There so happens to be a resolution which adheres to this: 768x576


VESA signal 768x576

General timing
Screen refresh rate 60 Hz
Vertical refresh 35.819672131148 kHz
Pixel freq. 34.96 MHz
Horizontal timing (line)
Polarity of horizontal sync pulse is negative.

Scanline part Pixels Time [µs]
Visible area 768 21.967963386728
Front porch 24 0.68649885583524
Sync pulse 80 2.2883295194508
Back porch 104 2.974828375286
Whole line 976 27.9176201373
Vertical timing (frame)
Polarity of vertical sync pulse is positive.

Frame part Lines Time [ms]
Visible area 576 16.080549199085
Front porch 1 0.0279176201373
Sync pulse 3 0.083752860411899
Back porch 17 0.4745995423341
Whole frame 597 16.666819221968