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.

Tags: , , , , ,

9 Responses to “JSNES JavaScript NES emulator”

  1. Boris says:

    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.

    • Robert says:

      @Boris: Interesting note. I was basing my comment on the authors note about Chrome having a better optimized canvas.

  2. Anonymous says:

    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. Boris says:

    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. Robert says:

    @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).

  6. Anonymous says:

    @Hugh: Clearly the project should just add a file upload mechanism, to use local ROMs.

  7. David Smith says:

    The performance issues in WebKit turned out to be due to dictionary-vs-object property caching heuristics making a wrong guess. As of http://trac.webkit.org/changeset/48573 it’s running at full speed.

  8. Robert says:

    @David Smith: Most excellent. That explains why Chrome was recommended and Safari got no mention.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.