1.0.0 • Published 3 years ago

typescript-chip8 v1.0.0

Weekly downloads
-
License
GPL-3.0
Repository
-
Last release
3 years ago

CHIP8 Typescript Implementation

Build Status Codacy Badge Coverage Status

Usage

import { createCpu } from "typescript-chip8";
  let cpu = createCpu();

  // Roms are buffers of big-endian 2-byte instructions. You can hard code these...
  const rom = Buffer.from([0x60, 0xaa, 0x61, 0xbb, 0x62, 0xcc]);
  /*
  // Or fetch from a remote source somewhere...
  const rom = await fetch(`http://example.com/roms/HelloWorld.ch8`)
    .then((r) => r.arrayBuffer())
    .then((data) => new Uint8Array(data));
  */
  cpu.load(rom);

  // perform 1 CPU cycle (you could put this in a loop/interval to "run" the cpu forever) 
  cpu.cycle();

Thank you

This would not have been possible if not for these excellent guides;