All Projects → bfirsh → Jsnes

bfirsh / Jsnes

Licence: apache-2.0
A JavaScript NES emulator.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to Jsnes

Nes
A Javascript NES Emulator
Stars: ✭ 168 (-96.86%)
Mutual labels:  nes, 6502, emulator, emulation
Punes
Nintendo Entertaiment System emulator and NSF/NSFe Music Player (Linux, FreeBSD, OpenBSD and Windows)
Stars: ✭ 217 (-95.95%)
Mutual labels:  nes, 6502, emulator, emulation
js-nes-emulator
NES emulator in javascript.
Stars: ✭ 12 (-99.78%)
Mutual labels:  emulator, emulation, nes, 6502
Anese
Another NES Emulator - written for fun & learning - first implementation of wideNES
Stars: ✭ 323 (-93.97%)
Mutual labels:  nes, 6502, emulator, emulation
Gearnes
NES / Famicom emulator for iOS, Mac, Raspberry Pi, Windows, Linux and RetroArch.
Stars: ✭ 23 (-99.57%)
Mutual labels:  emulator, nes, 6502
Embeddednes
A portable NES simulator for embedded processors
Stars: ✭ 26 (-99.51%)
Mutual labels:  nes, 6502, emulator
Nsfplay
Nintendo NES sound file NSF music player
Stars: ✭ 155 (-97.1%)
Mutual labels:  nes, emulator, emulation
Provenance
iOS & tvOS multi-emulator frontend, supporting various Atari, Bandai, NEC, Nintendo, Sega, SNK and Sony console systems… Get Started: https://wiki.provenance-emu.com |
Stars: ✭ 4,732 (-11.62%)
Mutual labels:  nes, emulator, emulation
Jsnes Web
A browser UI for JSNES, a JavaScript NES emulator
Stars: ✭ 398 (-92.57%)
Mutual labels:  nes, emulator, emulation
Thistle
6502 based architecture for OpenComputers
Stars: ✭ 26 (-99.51%)
Mutual labels:  emulator, emulation, 6502
retro-computing
🤓🕹💾 This hobby project contains software implementations of old microprocessors and complete computer systems. I'm very interested in retrocomputing and this is how I learn about the inner workings of these old, classic and amazing computers and game consoles.
Stars: ✭ 15 (-99.72%)
Mutual labels:  emulator, emulation, 6502
Hnes
🎮 NES Emulator written in Haskell
Stars: ✭ 340 (-93.65%)
Mutual labels:  nes, emulator
Xenia
Xbox 360 Emulator Research Project
Stars: ✭ 5,404 (+0.93%)
Mutual labels:  emulator, emulation
Pcjs.v1
PCjs Machines 1.0 (archived)
Stars: ✭ 468 (-91.26%)
Mutual labels:  6502, emulator
Xqemu
Open-source emulator to play original Xbox games on Windows, macOS, and Linux
Stars: ✭ 518 (-90.32%)
Mutual labels:  emulator, emulation
Core
Common Open Research Emulator
Stars: ✭ 330 (-93.84%)
Mutual labels:  emulator, emulation
Avocado
🥑 PlayStation 1 emulator
Stars: ✭ 356 (-93.35%)
Mutual labels:  emulator, emulation
Higan
higan is a multi-system emulator focused on accuracy, preservation, and configurability.
Stars: ✭ 457 (-91.46%)
Mutual labels:  emulator, emulation
Higan
higan is a multi-system emulator focused on accuracy, preservation, and configurability.
Stars: ✭ 388 (-92.75%)
Mutual labels:  emulator, emulation
Eka2l1
An experimental Symbian OS emulator
Stars: ✭ 462 (-91.37%)
Mutual labels:  emulator, emulation

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

// Initialize and set up outputs
var nes = new jsnes.NES({
  onFrame: function(frameBuffer) {
    // ... write frameBuffer to screen
  },
  onAudioSample: function(left, right) {
    // ... play audio sample
  }
});

// Read ROM data from disk (using Node.js APIs, for the sake of this example)
const fs = require('fs');
var romData = fs.readFileSync('path/to/rom.nes', {encoding: 'binary'});

// Load ROM data as a string or byte array
nes.loadROM(romData);

// Run frames at 60 fps, or as fast as you can.
// You are responsible for reliable timing as best you can on your platform.
nes.frame();
nes.frame();
// ...

// Hook up whatever input device you have to the controller.
nes.buttonDown(1, jsnes.Controller.BUTTON_A);
nes.frame();
nes.buttonUp(1, jsnes.Controller.BUTTON_A);
nes.frame();
// ...

Build

To build a distribution:

$ yarn run build

This will create dist/jsnes.min.js.

Running tests

$ yarn test

Embedding JSNES in a web page

You can use JSNES to embed a playable version of a ROM in a web page. This is handy if you are a homebrew ROM developer and want to put a playable version of your ROM on its web page.

The best implementation is jsnes-web but unfortunately it is not trivial to reuse the code. You'll have to copy and paste the code from that repository, the use the <Emulator> React component. Here is a usage example..

A project for potential contributors (hello!): jsnes-web should be reusable and on NPM! It just needs compiling and bundling.

A more basic example is in the example/ directory of this repository. Unfortunately this is known to be flawed, and doesn't do timing and sound as well as jsnes-web.

Formatting code

All code must conform to Prettier formatting. The test suite won't pass unless it does.

To automatically format all your code, run:

$ yarn run format

Maintainers

JSNES is based on James Sanders' vNES, and owes an awful lot to it. It also wouldn't have happened without Matt Wescott's JSSpeccy, which sparked the original idea. (Ben, circa 2008: "Hmm, I wonder what else could run in a browser?!")

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].