DailyJS

JSNES and Emulation

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

emulators games

JSNES and Emulation

Posted by Alex R. Young on .
Featured

emulators games

JSNES and Emulation

Posted by Alex R. Young on .

If you haven't seen JSNES or
JSSpeccy they're worth trying out, if only as a way of proving what JavaScript and canvas can
do. The most interesting thing about these emulators, though is the
source. JSNES is on GitHub so you can
casually browse files like
cpu.js to see how the emulator works.

In fact, if you've never written an emulator but wondered how they work,
JSNES is worth checking out. Emulators aren't really as scary as they
sound: they're essentially decoders that can understand code for
particular hardware and run it in a different environment. They're giant
case statements and simple algorithms.

In JSNES, you can see how the CPU registers and interrupts are handled.
Since the original hardware has been reverse engineered there's nothing
fundamentally complicated or difficult to understand, there's just a
sizable amount of code.

Now all we need to do is find the source for an x86 emulator to create a
JavaScript PC emulator. Browser
VMware could be the most computationally extravagant use of JavaScript
yet.