Skip to content

Gameboy / Gameboy Color Emulator written for Web Assembly using AssemblyScript. Shell/Debugger in Preact

License

Notifications You must be signed in to change notification settings

meepiquitous/wasmBoy

 
 

Repository files navigation

wasmboy

Build Status Buy Me A Coffee

🎮👾🕹️ Gameboy Emulator Library written in Web Assembly using AssemblyScript, Debugger/Shell in Preact 🎮👾🕹️

Debugger / Demo with support for mobile controls

Pokemon Crystal Wasmboy Demo

Table of Contents

Features

  • Emulates the Gameboy / Gameboy Color 🎮👾🕹️
  • Outputs graphics to a scalable / responsive HTML5 canvas 🖼️, and audio through the Web Audio API 🔊
  • Support for In-game saves, and save states 💾
  • Configurable options to increase performance for low(er) end devices 🔥
  • WIP: Importable into other projects as a dependency ♻️
  • Built with Web Assembly 🕸️
  • Keyboard and gamepad input support using responsive gamepad ⌨️ 🎮
  • Debugger with a value table (I/O map), Tile Data visualizer, and Background Map with Scroll Indicators 🐛

Please see the Roadmap for upcoming features

Example Gifs & Screenshots

Gameboy Support

Is that a demo in your pocket Megaman 2 Pokemon Blue tetris tobu tobu girl

Gameboy Color Support

Links Awakening L s d j Megaman extreme 2 Pokemon Silver Pokemon Yellow back to color demo

Options & Save States

Wasm boy options and save states gif

Debugger

was boy pokemon silver debugger demo

Tests

Blarrg

cpu_instrs

Cpu Instructions all tests passing

Roadmap

The project doe quality and performance also depends on the AssemblyScript Roadmap.

The Wasmboy library is being recorded at Issue #3

Contributing

Feel free to fork and submit PRs! Any help is much appreciated, and would be a ton of fun!

Installation

Just your standard node app. Install Node with nvm, git clone the project, and npm install, and you should be good to go!

CLI Commands / Npm Scripts

The project contains three different elements.

  • The debugger is the container for the wasmboy library, which is simply a preact application, generated with preact-cli.
  • The core or wasm which is the web assembly module for wasmboy written in AssemblyScript.
  • The lib which is the importable library of wasmboy that can be used in other projects, that adds a top level API to the core.

Each of these uses a different build process. The debugger uses webpack, the wasm uses the AssemblyScript compiler CLI tool, and the lib uses Rollup.js.

Commands for each part of the project will be prepended with their element name and a colon, e.g debugger:[command here].

Commands not prepended with a colon are meant for easily building on all of the different parts as a whole.

# Command to serve the project, and watch the debugger, wasm, and lib for changes
# Uses concurrently: https://github.com/kimmobrunfeldt/concurrently
# Concurrently helps cleanup the output and organizes all three watchers/servers
npm start

# Same as npm start
npm run dev

# Same as npm start
npm run watch

# Build the wasm module and the lib to be ready to be pushed to npm or released
npm run build

# Run tests in `test/accuracy/test.js`
npm run test

# Run tests in `test/performance/test.js`
npm run test:performance

# Watch the debugger (preact) project for changes and livereload
npm run debugger:watch

# Build the debugger (preact) project and serve it
npm run debugger:serve

# Build the debugger (preact) project
npm run debugger:build

# Watch the wasm (AssemblyScript) *.ts files and build on changes
npm run core:watch

# Build the wasm (AssemblyScript) *.ts files, with the correct CLI flags
npm run core:build

# Watch the Wasmboy ES6 Module for changes, and build
npm run lib:watch

# Build the WasmBoy Es6 module
npm run lib:build

The debugger application/container for wasmboy utilizes the preact-cli. Additional workflow commands and tips can be found there.

Using the gh-pages for debugger/demo deployment onto gh-pages.

Notable Projects

  • wasmboy-rs - Wasmboy Compiled to Rust, for native executables and additional cool features!

Special Thanks

Random Tips for new Gameboy EmuDevs

  • It's better to code an emulator by abstracting assembly commands into functions, rather than by Opcode operation

  • Gameboy Opcodes are difficult till about 0x40

Resources

About

Gameboy / Gameboy Color Emulator written for Web Assembly using AssemblyScript. Shell/Debugger in Preact

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 96.3%
  • CSS 3.7%