JSNES JavaScript NES emulator

Ben Firshman wrote a rather impressive NES emulator. There are already quite a few NES emulators out there already this one impressive is because it’s written in pure JavaScript.

Yet another application of “Atwood’s Law“:

Any application that can be written in JavaScript, will eventually be written in JavaScript.

I should note that I mentioned back in January how someone ported Super Mario brothers to JavaScript. JSNES is different as it is actually emulating and reading ROM’s (looks like they are hex’d), rather than just replicating the game.

Currently it runs in all modern browsers, but only Chrome’s <canvas/> performs well enough at this point to really be playable. With WebGL coming to Firefox and WebKit we’ll hopefully see a lot more of this kind of stuff in the future.

9 thoughts on “JSNES JavaScript NES emulator

  1. The limiting factor here is not canvas (which is the same in chrome and Safari, by the way) but the javascript engine doing the emulation. I seriously doubt webgl will change anything here.

  2. 64-bit Linux user here; hopefully Firefox 3.6 with its x86_64 JIT support for JavaScript will speed this up from 6fps. 🙂

    (As an aside: why oh why didn’t Firefox just use one of the many solutions for generically generating native machine code in an architecture independent way? LLVM, for instance.)

  3. Yeah, I mailed the author. The tweak he mentions was actually due to a change in how the script interfaces with Chrome’s canvas; not sure yet whether it was working around a bug in said canvas (or rather imageData) or in V8….

    Just to be clear, in my m-c build I se us spending 3% of the time in canvas painting. This is while getting somewhere in the 8-15fps range (depending on ROM).

  4. @Boris: I wonder if JSNES is perhaps the next SunSpider? At a minimum it’s more entertaining than any other JS benchmark that I know of 😉 .

  5. The #1 problem I have with this product currently, is the lack of binary data support in Javascript.

    Because a) the roms have to be kept server side b) once Nintendo sees this project, they’ll likely push for a cease-and-desist regarding the storage of roms for everyone to play online.

    Plus binary data support is just ideal for the future of this project.

    But who knows, maybe he’ll add Google Gears support in the future (and hopefully support to go along with it).

Leave a Reply

Your email address will not be published. Required fields are marked *