JSNES
A JavaScript NES emulator.
It's a library that works in both the browser and Node.js. The browser UI is available at https://github.com/bfirsh/jsnes-web.
Installation
For Node.js or Webpack:
$ npm install jsnes
(Or yarn add jsnes.)
In the browser, you can use unpkg:
<script type="text/javascript" src="https://unpkg.com/jsnes/dist/jsnes.min.js"></script>
Usage
var nes = new jsnes.NES({
onFrame: function(frameBuffer) {
},
onAudioSample: function(left, right) {
}
});
nes.loadROM(romData);
nes.frame();
nes.frame();
nes.buttonDown(jsnes.Controller.BUTTON_A);
nes.frame();
nes.buttonUp(jsnes.Controller.BUTTON_A);
nes.frame();
Build
To build a distribution:
$ yarn run build
This will create dist/jsnes.min.js.