JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
build Update build Sep 22, 2017
roms Add Sgt. Helmet rom Sep 20, 2017
src Add MMC3Mapper Sep 21, 2017
.gitignore Modularize Sep 20, 2017
LICENSE Add LICENSE Sep 20, 2017 Update Oct 4, 2017
index.html Clean up index.html Sep 22, 2017
index.js Add Joypad import into index.js Sep 22, 2017
index2.html Clean up index2.html Sep 22, 2017
index3.html Add WebVR demo Sep 22, 2017
index4.html Update index4.html Oct 4, 2017
package.json Modularize Sep 20, 2017


This is JavaScript NES(Famicom) emulator which runs on browser.



Demo with Three.js (It has a performance issue!)

WebVR Demo with Three.js (It has a serious performance issue!)

AR Demo with Three.js and jsartoolkit5 (It has a performance issue!)


Screen shot

Screen shot with Three.js


  • iNES format rom image support
  • Renders with Canvas
  • Audio support with WebAudio
  • Runs on browser


How to use

  <script type="text/javascript" src=""></script>
  <script type="text/javascript" >
    function init() {
      var url = 'url to rom image';
      var request = new XMLHttpRequest();
      request.responseType = 'arraybuffer';

      request.onload = function() {
        var buffer = request.response;
        var nes = new NesJs.Nes();

        nes.setRom(new NesJs.Rom(buffer));
        nes.setDisplay(new NesJs.Display(document.getElementById('gameCanvas')));
        nes.setAudio(new NesJs.Audio());

        window.onkeydown = function(e) { nes.handleKeyDown(e); };
        window.onkeyup = function(e) { nes.handleKeyUp(e); };

      };'GET', url, true);

<body onload="init()">
    <canvas id="gameCanvas" width="256" height="240"></canvas>


How to install

$ npm install nes-js

How to build

$ npm install
$ npm run all

Default key configuration

This table shows the key - joypad configuration set by

  window.onkeydown = function(e) { nes.handleKeyDown(e); };
  window.onkeyup = function(e) { nes.handleKeyUp(e); };
key joypad
enter start
space select
cursor-left left
cursor-up up
cursor-right right
cursor-down down
x A
z B



  • NesJs
    • Nes
      • setRom()
      • setDisplay()
      • setAudio()
      • bootup()
      • run()
      • handleKeyDown()
      • handleKeyUp()
    • Rom
    • Display
    • Audio


  • Performance optimization
  • Support more many mappers
  • Support unofficial CPU instructions
  • Gamepad API support