A Chip8 emulator written in JavaScript.
This project was created as part of a presentation for the University of Central Florda Techrangers. It simulates the behavior of a Chip8. It does not match 1-to-1 the behavior and structure of a Chip8, but it follows it closely and the end result is the same.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
The latest version of node and npm is recommended. NVM is recommended for installing and managing node versions. The example given is for installing nvm and node in a Unix environment.
Download and install the latest nvm version.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v<latest nvm version>/install.sh | bash
Use the set environment variables.
source ~/.bashrc
Install the latest node 12.
nvm install 12
Use that version.
nvm use 12
Install the required packages.
npm install
Start the development server (updates on file changes).
npm run devstart
Tests the output of the JavaScript files. Primarily focuses on the emulator.
The coverage will be very low, especially for the chip8.js file. This is acceptable because the uncovered portions are covered by the ROM tests, explained below.
npm run test
My linting for a consistent environment. Mostly follows the default eslint configuration with some exceptions.
npm run lint
Within the roms folder is test1.ch8 and test2.ch8. You can run these tests on the live emulator to test the output.
Gives error code. Look at the author's explanation to know what it means.
Lists name of opcode and whether or not it passes.
This was intended to be used as a static web page. The default listening port for the node server is 3000.
This can be deployed on with a static site hoster like GitHub Pages or Netlify. I personally am using Netlify. Specifiy the public
folder as the build directory for it to be hosted correctly.
-
- https://github.com/chrisledet/chip8.js
- I referenced and used some portions of his code for the icky bitwise operations and conversions. I also used his implementation of canvas for the graphics.
-
- Reference with C++ code examples.
-
- Helpful reference for the opcodes.