Wednesday, August 18th, 2010

JavaScript Gameboy Emulator: Memory and GPU

Category: Canvas, Tutorial

>a>

Jack Vaughn posted on Ajaxian recently about a new blog series on building a Gameboy emulator using JavaScript. Now Parts II and III have been posted in the series:

In the Memory section, Imran Nazar builds up a JavaScript MMU that can interpret the different parts of the Gamboy’s memory:

In the previous part of this series, the computer was introduced as a processing unit, which fetches its instructions from memory. In almost every case, a computer’s memory is not a simple contiguous region; the GameBoy is no exception in this regard. Since the GameBoy CPU can access 65,536 individual locations on its address bus, a “memory map” can be drawn of all the regions where the CPU has access.

[CC-A by Michael Ngilen]

In the third part Imran is now ready to actually draw things to the screen, using the Canvas tag:

Nintendo’s internal name for the GameBoy is “Dot Matrix Game”; its display is a pixel LCD of dimensions 160×144. If each pixel in the LCD is treated as a pixel in a HTML5 <canvas>, a direct mapping can be made to a canvas of width 160 and height 144. In order to directly address each pixel in the LCD, the contents of the canvas can be manipulated as a “framebuffer”: a single block of memory containing the entirety of the canvas, as a series of 4-byte RGBA values.

Next in the series will be a blog post on backgrounds and patterns.

Posted by Brad Neuberg at 6:00 am
4 Comments

+++--
3.6 rating from 5 votes

4 Comments »

Comments feed TrackBack URI

No working demo?

Comment by jerone — August 18, 2010

checkout his repo,put it under a webserver and browser to index.html.
in the test name go to /tests/ttt.gb and refresh.

Comment by Urielka — August 18, 2010

Absolutely fascinating proof of concept, and for once, this comment thread is free of comments like “this is stupid” and “useless.” :)

Comment by mdmadph — August 18, 2010

Here is a working javascript gameboy emulator http://codebase.es/jsgb/
With debugger. Have fun :)

Comment by sonic1980 — September 20, 2010

Leave a comment

You must be logged in to post a comment.