Skip to content
StreetblockPublic

About

Browser-based Game Boy emulator UI with a custom JavaScript emulator core

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS-Boy

Lies mich auf Deutsch: README_de.md

JS-Boy is a browser-based Game Boy emulator UI with a custom JavaScript emulator core.

The main branch is the stable branch and is intended to back the GitHub Pages deployment of the project.

An experimental Game Boy Color branch is available at feat/cgb-core. That branch contains ongoing CGB work and may be more unstable than main.

The project started as a single HTML file and was later split into a cleaner GitHub-friendly structure:

  • index.html for markup
  • style.css for the Game Boy UI styling
  • app.js for UI wiring, i18n, ROM loading, and save import/export
  • lib/emulator.js for the emulator core

Features

  • Game Boy-style browser UI
  • ROM loading from the browser
  • Save RAM import/export (.sav)
  • Local save persistence via localStorage
  • Basic multi-language UI support
    • German
    • English
  • Custom emulator core with:
    • CPU
    • MMU
    • Timer
    • PPU
    • APU
    • Joypad
    • MBC1 / MBC3 / MBC5 support

Project Structure

.
|-- index.html
|-- style.css
|-- app.js
`-- lib/
    `-- emulator.js

Running Locally

Because the app uses ES modules, you should serve it through a local web server instead of opening index.html directly as a file.

Example with Python:

python -m http.server 8000

Then open:

http://localhost:8000

Controls

  • D-pad: Arrow keys or WASD
  • A: Z, Y, or J
  • B: X or K
  • START: Enter
  • SELECT: Right Shift

Current Emulator Status

This is still a work-in-progress emulator, but several important gaps have already been closed.

Recent improvements include:

  • ADD SP, r8 (0xE8) implemented
  • delayed EI / IME enable behavior
  • HALT bug handling for pending interrupts
  • serial transfers shift one bit per clock and request an interrupt after eight bits
  • with the link port disconnected, internal-clock transfers receive $FF and external-clock transfers wait
  • basic MBC3 RTC register support
  • MBC3 RTC persistence across reloads
  • timer register synchronization
  • deferred TIMA reload after overflow
  • LY reset behavior on FF44 writes
  • OAM blocking during DMA
  • VRAM / OAM access restrictions based on PPU mode

Known Limitations

JS-Boy is not a cycle-accurate emulator yet.

Known gaps and risks include:

  • compatibility is still incomplete across commercial ROMs
  • PPU and DMA timing are improved, but still simplified
  • MBC3 RTC support is basic, not fully hardware-accurate
  • Color Game Boy support is still missing
  • some cartridge types are still unsupported
  • audio emulation is functional but not hardware-accurate

UI Language Support

The UI can be switched between German and English from the language selector in the right-side panel.

Currently translated:

  • splash text
  • storage / controls panel labels
  • ROM loading label
  • CPU status heading
  • save / load status messages

Saving

JS-Boy identifies each ROM by the SHA-256 digest of its contents and stores its save RAM in localStorage. Renaming the ROM keeps the same save.

When older ROM variants shared a save key, the first matching ROM loaded with no current save inherits the old data. The original entry is kept as a backup. Subsequent saves use the individual ROM's SHA-256 key.

For MBC3 cartridges, RTC state is also stored separately in localStorage.

Development Notes

The emulator core currently lives in:

The UI entry points are:

Tests

Run the regression tests with Node.js 24. Set JSBOY_TEST_ROMS to a local checkout of Blargg's test ROMs to run instruction and memory timing tests and all 12 DMG sound ROMs.

node --test tests/*.test.mjs

git clone https://github.com/retrio/gb-test-roms.git /tmp/gb-test-roms
git -C /tmp/gb-test-roms checkout c240dd7d700e5c0b00a7bbba52b53e4ee67b5f15
JSBOY_TEST_ROMS=/tmp/gb-test-roms node --test tests/*.test.mjs

For OAM DMA, LCD, STAT, DMG boot timing and I/O registers, extract Mooneye 31510e1 and point JSBOY_MOONEYE_ROMS at the directory containing acceptance/.

JSBOY_MOONEYE_ROMS=/tmp/mts-20260714-0944-31510e1 node --test tests/mooneye-timing.test.mjs

License

No license has been added yet.

About

Browser-based Game Boy emulator UI with a custom JavaScript emulator core

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages