Wednesday, August 18th, 2010
JavaScript Gameboy Emulator: Memory and GPU
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.
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.
Related Content:













No working demo?
checkout his repo,put it under a webserver and browser to index.html.
in the test name go to /tests/ttt.gb and refresh.
Absolutely fascinating proof of concept, and for once, this comment thread is free of comments like “this is stupid” and “useless.” :)
Here is a working javascript gameboy emulator http://codebase.es/jsgb/
With debugger. Have fun :)