Code Monkey home page Code Monkey logo

nes-js's Introduction

nes-js

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

Demo

Demo

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!)

Screenshot

Screen shot

Screen shot with Three.js

Features

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

Browser

How to use

<head>
  <script type="text/javascript" src="https://cdn.rawgit.com/takahirox/nes-js/v0.0.1/build/nes.min.js"></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); };

        nes.bootup();
        nes.run();
      };

      request.open('GET', url, true);
      request.send(null);
    }
  </script>
</head>

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

NPM

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

APIs

T.B.D.

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

TODO

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

Links

nes-js's People

Contributors

takahirox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nes-js's Issues

i find a unsupport No7 Mapper

debug:
Uncaught Error: unsupport No.7 Mapper
at MapperFactory.getMapperParam (nes.min.js:5966)
at MapperFactory.create (nes.min.js:5949)
at new Rom (nes.min.js:5517)
at XMLHttpRequest.ReflashGame.request.onload (sss:120)

MAPPERS: {
0: {'name': 'NROM', class: NROMMapper},
1: {'name': 'MMC1', class: MMC1Mapper},
2: {'name': 'UNROM', class: UNROMMapper},
3: {'name': 'CNROM', class: CNROMMapper},
4: {'name': 'MMC3', class: MMC3Mapper},
76: {'name': 'Mapper76', class: Mapper76}
},

Game:『バトルトード』 (Battle Toads)

Cannot click

He can't run on mobile devices. Computer browser switch F12 to mobile phone mode is also invalid。Your demo website also has this problem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.