These issues only presented themselves at runtime with the WASM virtual machine throwing up.
Gameboy emulator code#
CPU, GPU, memory management unit etc) there were some bits of the code base that made a lot of assumptions about its environment. The first real issue was, while my previous self had endeavored to make the code very modular, with individual packages for each hardware component (e.g. Learn something about porting Gameboy Color emulators to WASM at least.īy the way, as a side note, if you want to know what programming your own Gameboy emulator is like, paints a pretty accurate portrait, I’m impressed he managed to do it in less than two months. But this time I’ll indulge myself a little and document a few challenges I found along the way. No one ever talks about the journey, just the destination. I’ve not tried Edge.Īdmit it, you're just here for the screenshots Firefox and Safari seem to perform reasonably well though. Oh boy there’s trouble there, we’ll get onto that.
There are some caveats and performance issues of this WASM implementation that I will explain below if you’re still interested in my long ramblings, but it mostly works.Įxcept in Google Chrome, that is. In fact someone is doing a WASM Gameboy emulator in AssemblyScript, so I’m definitely not the first. Running emulators in the browser isn’t new and I’d imagine some people have had some fun porting other emulators using emscripten. The preinstalled ROM is a test suite used to test the CPU: The end result being gomeboycolor WASM edition (warning: ~5mb or so download), go on, try it out, load some ROMs on it that you’ve illegally downloaded 1.Īlternatively try out the demo below, click “start” to run the emulator and “stop” to stop it.
Gameboy emulator torrent#
It was exciting enough for me to blast out furious torrent of commits. This absolutely blew my mind, here was some old code, written for a non browser environment in a language not supported by browsers, running in the browser. Obviously, not rendering anything to the page, but there was stuff printing to the developer tools console at least to indicate the emulator was running.
Much to my surprise though, compiling the project using the new WASM target actually worked.Īs in, within 5 minutes of commenting out code related to GLFW/GL calls, there was something running in the browser. Going back to old code is like looking at old photos of yourself. If only I had a decently sized project written in Go that wasn’t some trivial TODO list manager ? Hello, old friend There’s nothing one likes more than experimental APIs so this got me thinking, what could I do to test out this new WASM target? You see, a few weeks ago Go 1.11 came out, and with it came the promise of experimental support for compiling Go code to WebAssembly. However, as the passage of time progressed, it landed on the pile of mostly-done-but-not-finished projects and left largely abandoned.
It was a very frustrating, but rewarding experience that I’ve been dining out on in job interviews ever since. I ported my Gameboy Color emulator to WebAssemblyĪround five years ago I wrote a Gameboy Color emulator in Go.