Skip to content

leandrogaspar/chip8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Greenkeeper badge

Chip-8

A Chip-8 interpreter for the browser!

Chip8 Screenshot

Play with it!

The ever-growing non-exhaustive over-hyphenated to-do list

  • Fix scroll-bar on Firefox
  • Fix select rom style
  • Keypad should show the keyboward mapping
  • Test more ROM's
  • Make the emulator color configurable

Development

npm start

Runs the app in the development mode.
The interpreter will be available at http://localhost:3000.

The page will reload if you make edits.

npm test

Launches the test runner in the interactive watch mode.

Each test compares the Chip-8 state after an instruction against an expected state. This approach was chosen because we want to be sure that an instruction only alter the involved properties.
For instance, a instruction that perform a jump should only change the PC - any other change would be a bug.

A typical test looks like this:

...

chip8 = createChip8(); // Create a chip-8 instance
writeWord(chip8, 0x200, 0x1EEE); // Load an instruction
const snapshot = chip8Snapshot(chip8); // Create a copy of the current state

// Change the copy to reflect our expected state for the instruction
snapshot.PC = 0xEEE;

// Perform the instruction
chip8.cycle();

// Compares the state of the actual chip-8 after
// the instruction vs our expectation.
// If the instruction wrongly changed V[0], for example,
// the test would fail warning that the register doesn't match
const equals = isChip8Equal(chip8, snapshot);
expect(equals).toBe(true);

...

npm run build

Builds the app for production to the build folder.

References

Releases

No releases published

Packages

No packages published