Indexed by TopGit from live GitHub metadata: taniarascia/chip8 has 474 stars, written primarily in JavaScript. ๐ฎ โ A Chip-8 emulator written in JavaScript for web, CLI, and native UI.
Snapshot summary built from the project's own GitHub metadata โ there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then โ see the READ ME tab for the original README in full.
Chip8.js can be run on the web, in a terminal, or using native keybindings.
Web
Chip8.js emulator for the web
Development
Spin up a local server during development.
# watch for changes and rebuild
npm run watch:web
# spin up server on localhost:8080
cd web && http-server
Deployment
Build and bundle the code for the web.
npm run build:web
Deploy to GitHub.
# remove web/bundle.js from .gitignore
git add web && git commit -m "update web version"
# delete gh-pages branch from origin before push
git subtree push --prefix web origin gh-pages
Terminal
Run Chip8.js in the terminal by selecting a ROM.
npm run play:terminal roms/<ROM>
Native
Run Chip8.js natively with raylib (experimental).
npm run play:native roms/<ROM>
Motivation
Chip8.js is a project to write a Chip-8 emulator in JavaScript. The main motivation is to learn lower level programming concepts and to increase familiarity with the Node.js environment.
Here are some of the concepts I learned while writing this program:
The base system: specifically base 2 (binary), base 10 (decimal), base 16 (hexadecimal), how they interact with each other and the concept of abstract numbers in programming
Bits, nibbles, bytes, ASCII encoding, and big and little endian values
Bitwise operators - AND (&), OR (|), XOR (^), left shift (<<), right shift (>>) and how to use them for masking, setting, and testing values
Using the Node built-in file system (fs)
The concept of a raw data buffer and how to work with it, how to convert an 8-bit buffer to a 16-bit big endian array
Writing and understanding a 8-bit and 16-bit hex dump
How to disassemble and decode an opcode into instructions a CPU can use
How a CPU can utilize memory, stack, program counters, stack pointers, memory addresses, and registers
How a CPU implements fetch, decode, and execute
And here are some articles I wrote based on those concepts:
Understanding Bits, Bytes, Bases, and Writing a Hex Dump in JavaScript (Node)
Writing an Emulator in JavaScript (with Multiple UIs)
Testing
The unit tests for Chip8.js use the Jest testing framework. You can run all test suites with or without displaying coverage.
# Run test suites
npm run test
# Run test suites and view coverage
npm run test --coverage
Chip8.js has two suites of unit tests:
Opcode instruction masks and arguments
CPU implementation of instructions
Instruction tests
The instruction tests cover the INSTRUCTION_SET found in data/instructionSet.js. Each instruction has:
A key: for internal use
An id: for a unique name
A name: for the type of instruction)
A mask: to filter out arguments from instruction signifiers)
A pattern: to match the mask to the specific instruction pattern
Each unit test checks an opcode to an instruction and tests:
The unique id to ensure the correct instruction is running for the mask/pattern
The number of arguments
The value of the arguments
// tests/instructions.test.js
test('6: Expect disassembler to match opcode 3xnn to instruction SE_VX_NN', () => {
expect(Disassembler.disassemble(0x3abb).instruction).toHaveProperty('id', 'SE_VX_NN')
expect(Disassembler.disassemble(0x3abb).args).toHaveLength(2)
expect(Disassembler.disassemble(0x3abb).args[0]).toBe(0xa)
expect(Disassembler.disassemble(0x3abb).args[1]).toBe(0xbb)
})
There are 35 instruction tests for 35 opcodes (the first instruction, CLS, is no longer implemented).
CPU tests
The CPU decodes the opcode and returns the instruction object from data/instructionSet.js. Each instruction performs a specific, unique action in the case. The CPU tests test the state of the CPU after an executing an instruction.
In the below example, the instruction is skipping an instruction if Vx === nn, otherwise it's going to the next instruction as usual.
// classes/CPU.js
case 'SE_VX_NN':
// Skip next instruction if Vx = nn.
if (this.registers[args[0]] === args[1]) {
this._skipInstruction()
} else {
this._nextInstruction()
}
break
Each CPU test:
Loads a RomBuffer containing the data of a single opcode
Sets up the state to make the instruction testable (if necessary)
Executes the step method
Tests all possible outcomes of an instruction and state updates
In this example, the instruction can either be skipped or not skipped depending on the arguments, and both cases are tested.
// tests/cpu.test.js
test('6: SE_VX_NN (3xnn) - Program counter should increment by two bytes if register x is not equal to nn argument', () => {
cpu.load({ data: [0x3abb] })
cpu.step()
expect(cpu.PC).toBe(0x202)
})
test('6: SE_VX_NN (3xnn) - Program counter should increment by four bytes if register x is equal to nn argument', () => {
cpu.load({ data: [0x3abb] })
cpu.registers[0xa] = 0xbb
cpu.step()
expect(cpu.PC).toBe(0x204)
})
Acknowledgements
Inspiration, guidance, and mentorship from Vanya Sergeev.
Cowgod's Chip-8 Technical Reference, made by Thomas P. Greene.
CHIP-8 - Wikipedia.
Author
Tania Rascia
License
This project is open source and available under the MIT License.
The most recent commit recorded on taniarascia/chip8 was 4.3 years ago, based on the GitHub push timestamp. The repository has 44 forks โ one of the better signals of community interest.
How many stars does taniarascia/chip8 have?
taniarascia/chip8 has 474 GitHub stars โ refresh the page for the live number, or check github.com/taniarascia/chip8. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is taniarascia/chip8 open source?
Yes โ taniarascia/chip8 ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/taniarascia/chip8.
What else is in the Frontend space?
taniarascia/chip8 is tracked by TopGit under the Frontend category, alongside 5 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What topics is taniarascia/chip8 associated with?
GitHub's repository topics for taniarascia/chip8: "chip-8", "chip-8-emulator", "emulator", "javascript", "node". TopGit's editorial category is Frontend.
Where can I see taniarascia/chip8 in action?
The project maintains a homepage at https://taniarascia.github.io/chip8/. The README tab on this page also usually contains screenshots and a quickstart.
Where do I read more about taniarascia/chip8?
This TopGit page is a snapshot โ the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/taniarascia/chip8 is the definitive source.
Read full README in the tab above.
Is chip8 worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of chip8.