{"id":13426774,"url":"https://github.com/bfirsh/jsnes","last_synced_at":"2026-03-01T19:06:53.016Z","repository":{"id":603606,"uuid":"239966","full_name":"bfirsh/jsnes","owner":"bfirsh","description":"A JavaScript NES emulator.","archived":false,"fork":false,"pushed_at":"2024-05-04T21:19:09.000Z","size":1029,"stargazers_count":6203,"open_issues_count":69,"forks_count":835,"subscribers_count":138,"default_branch":"master","last_synced_at":"2025-04-28T10:56:14.535Z","etag":null,"topics":["6502","emulation","emulator","javascript","nes"],"latest_commit_sha":null,"homepage":"https://jsnes.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"kellegous/datauri","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bfirsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2009-06-30T18:24:29.000Z","updated_at":"2025-04-27T10:38:11.000Z","dependencies_parsed_at":"2024-06-18T13:48:28.492Z","dependency_job_id":"650da389-325f-4e03-9708-b87dc7655ffe","html_url":"https://github.com/bfirsh/jsnes","commit_stats":{"total_commits":288,"total_committers":29,"mean_commits":9.931034482758621,"dds":"0.42013888888888884","last_synced_commit":"d8021d0336cb5c1cf924cd660ecf816bec15c11a"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfirsh%2Fjsnes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfirsh%2Fjsnes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfirsh%2Fjsnes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfirsh%2Fjsnes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bfirsh","download_url":"https://codeload.github.com/bfirsh/jsnes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020611,"owners_count":22000754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["6502","emulation","emulator","javascript","nes"],"created_at":"2024-07-31T00:01:44.245Z","updated_at":"2026-03-01T19:06:52.959Z","avatar_url":"https://github.com/bfirsh.png","language":"JavaScript","readme":"# JSNES\n\nA JavaScript NES emulator.\n\nIt's a library that works in both the browser and Node.js. The browser UI is available at [https://github.com/bfirsh/jsnes-web](https://github.com/bfirsh/jsnes-web).\n\n## Installation\n\nFor Node.js or Webpack:\n\n    $ npm install jsnes\n\n(Or `yarn add jsnes`.)\n\nIn the browser, you can use [unpkg](https://unpkg.com):\n\n```html\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/jsnes/dist/jsnes.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n```javascript\n// Initialize and set up outputs\nvar nes = new jsnes.NES({\n  onFrame: function(frameBuffer) {\n    // ... write frameBuffer to screen\n  },\n  onAudioSample: function(left, right) {\n    // ... play audio sample\n  }\n});\n\n// Read ROM data from disk (using Node.js APIs, for the sake of this example)\nconst fs = require('fs');\nvar romData = fs.readFileSync('path/to/rom.nes', {encoding: 'binary'});\n\n// Load ROM data as a string or byte array\nnes.loadROM(romData);\n\n// Run frames at 60 fps, or as fast as you can.\n// You are responsible for reliable timing as best you can on your platform.\nnes.frame();\nnes.frame();\n// ...\n\n// Hook up whatever input device you have to the controller.\nnes.buttonDown(1, jsnes.Controller.BUTTON_A);\nnes.frame();\nnes.buttonUp(1, jsnes.Controller.BUTTON_A);\nnes.frame();\n// ...\n```\n\n## Build\n\nTo build a distribution:\n\n    $ yarn run build\n\nThis will create `dist/jsnes.min.js`.\n\n## Running tests\n\n    $ yarn test\n\n## Embedding JSNES in a web page\n\nYou 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.\n\nThe best implementation is [jsnes-web](https://github.com/bfirsh/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 [`\u003cEmulator\u003e`](https://github.com/bfirsh/jsnes-web/blob/master/src/Emulator.js) React component. [Here is a usage example.](https://github.com/bfirsh/jsnes-web/blob/d3c35eec11986412626cbd08668dbac700e08751/src/RunPage.js#L119-L125).\n\nA project for potential contributors (hello!): jsnes-web should be reusable and on NPM! It just needs compiling and bundling.\n\nA 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.\n\n## Formatting code\n\nAll code must conform to [Prettier](https://prettier.io/) formatting. The test suite won't pass unless it does.\n\nTo automatically format all your code, run:\n\n    $ yarn run format\n\n## Maintainers\n\n- [Ben Firshman](http://github.com/bfirsh)\n- [Ben Jones](https://github.com/BenShelton)\n- [Stephen Hicks](https://github.com/shicks)\n- [Alison Saia](https://github.com/allie)\n\nJSNES is based on [James Sanders' vNES](https://github.com/bfirsh/vNES), and owes an awful lot to it. It also wouldn't have happened without [Matt Wescott's JSSpeccy](http://jsspeccy.zxdemo.org/), which sparked the original idea. (Ben, circa 2008: \"Hmm, I wonder what else could run in a browser?!\")\n","funding_links":[],"categories":["JavaScript","🔧 Utilities \u0026 Miscellaneous","Emulators \u0026 Virtual Machines"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfirsh%2Fjsnes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbfirsh%2Fjsnes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfirsh%2Fjsnes/lists"}