A Game Boy emulator written in TypeScript. Runs in the browser, on servers, and in serverless functions. View source on GitHub.
npm install gboy-ts
import { Emulator, Button } from "gboy-ts";
const rom = new Uint8Array(await fetch("rom.gb").then(r => r.arrayBuffer()));
const emu = new Emulator(rom);
emu.runFrames(60);
emu.pressButton(Button.A);
emu.runFrames(10);
const framebuffer = emu.getFramebuffer(); // 160x144 RGBA Uint8Array
const saveState = emu.serialize(); // ~110KB, excludes ROM