Joined: 11/22/2004
Posts: 1468
Location: Rotterdam, The Netherlands
Yeah, some guy is actually doing this. And he's documenting every step of the way as a sort of learning tool for programmers: http://imrannazar.com/GameBoy-Emulation-in-JavaScript
This is very neat, and it seems that the latest step in development allows Tetris to run.
JavaScript is not one of the most efficient scripting languages in existence (even though some web browsers have optimized the execution speed quite a bit in the last years). Browser-based JavaScript also was never designed for drawing graphics at high speed. Seems to be a rather suboptimal platform for that purpose.
Well, I suppose it's a project akin to those raytracers written in PostScript (which are thus completely runnable in a PS-based printer).
He doesn't really seem to have picked it because he thought it was the most efficient language to do the job. Readers of his blog can learn about js and how to write emulators at the same time this way. I like it. ^^
Joined: 11/22/2004
Posts: 1468
Location: Rotterdam, The Netherlands
Yeah, this is really more of a proof-of-concept. Javascript is easy to understand and to program in, and it gives you results immediately, so it's a great language for giving a basic lesson in how things like the CPU work and how one can emulate them.
It's true that Actionscript/Flash is way more efficient for this (especially when using the AVM2 virtual machine) though. He'll most likely use that when he writes the chapter on emulating sound since if I'm not mistaken, it's still not possible to create sound in the browser without it.