Browser Emulators for ZENBASIC Console Integration

Last updated 28 Dec 2025, 20:41

This document catalogs available browser-based emulators for potential integration with the ZENPOWER Console's machine profiles.

Overview

The ZENBASIC Console currently has 20 machine profiles defined in VMSettings.ts. These profiles define CPU, memory, display, audio, and BASIC dialect specifications. To enable full system emulation (boot ROMs, OS loading, disk access), we can integrate existing browser emulators.

Integration Strategy Options

Option 1: EmulatorJS (Unified Solution)

Recommendation: Best for consistency and maintenance

EmulatorJS is a web-based frontend for RetroArch compiled to WebAssembly. It supports 30+ systems with a unified interface.

Supported relevant systems:

  • Commodore 64, VIC-20 (vice_x64, vice_xvic cores)
  • Atari 2600, 5200, 7800, Lynx, Jaguar
  • MSX, MSX2
  • Amstrad CPC
  • Sega systems (SMS, Genesis/MD, Game Gear, Saturn, 32X)
  • Nintendo systems (NES, SNES, N64, GB, GBA, NDS)

Pros:

  • Single codebase, consistent API
  • Active maintenance (updated Dec 2025)
  • Self-hostable
  • Unified save state/control mapping

Cons:

  • Large download size (~5-50MB per core)
  • Some systems have better standalone emulators

Option 2: Best-of-Breed (Per-System)

Recommendation: Best for accuracy and features

Use specialized emulators for each platform:


Commodore Systems

C64/C128: vc64web

  • URL: https://vc64web.github.io/
  • Source: Based on VirtualC64 (GPLv3)
  • Features: Cycle-accurate, SID emulation, disk/tape support
  • ROM Required: Yes (Kernal, BASIC, Character ROMs)
  • Integration: iframe or WebAssembly module

C64/C128: VICE.js

  • URL: https://rjanicek.github.io/vice.js/
  • Source: VICE emulator compiled with Emscripten
  • Features: Full VICE functionality, multiple machines (C64, C128, VIC-20, PET, Plus/4)
  • ROM Required: Yes (included in some builds)

VIC-20: JS VIC-20


Amiga Systems

SAE - Scripted Amiga Emulator

  • URL: https://scriptedamigaemulator.net/
  • Source: Pure JavaScript
  • Features: A500, A1200 emulation, ADF disk support
  • ROM Required: Yes (Kickstart ROMs)
  • Status: Most mature browser Amiga emulator

vAmigaWeb

  • URL: https://vamigaweb.github.io/
  • Source: vAmiga compiled to WebAssembly
  • Features: Cycle-exact emulation, modern codebase
  • ROM Required: Yes (Kickstart 1.3/3.1)

Atari Systems

Atari 800/XL: jsA8E

  • URL: https://eahumada.github.io/AtariOnline/
  • Source: A8E ported via Emscripten
  • Features: Full Atari 800 XL emulation, joystick support
  • ROM Required: Yes (OS ROMs)
  • Controls: F1=HELP, F2=OPTION, F3=SELECT, F4=START, F5=RESET

Atari ST: pce.js / EstyJS


British Systems

BBC Micro/Acorn: jsbeeb

ZX Spectrum: JSSpeccy 3

  • URL: https://jsspeccy.zxdemo.org/
  • Source: WebAssembly core
  • Features: 48K, 128K, Pentagon, fast loading
  • ROM Required: Yes (Spectrum ROM)
  • Quality: Excellent - modern WASM implementation

Amstrad CPC: CPCBox


Other Systems

MSX/MSX2: WebMSX

  • URL: https://webmsx.org/
  • Source: Pure JavaScript
  • Features: MSX, MSX2, MSX2+ with NetPlay, extensive peripheral support
  • ROM Required: Uses open-source CBIOS by default
  • Quality: Best-in-class MSX emulator for browser

Apple II: apple2js

TRS-80: trs80-emulator


ROM Legality Note

Most emulators require original ROM files to function. Options:

  1. User-provided ROMs - User uploads their own legally obtained ROMs
  2. Open-source alternatives - CBIOS for MSX, OpenROM for some systems
  3. Licensed distribution - Amstrad has given blanket permission for CPC ROMs
  4. Abandonware - Some ROMs are effectively abandoned (legal gray area)

Recommended approach: Provide emulator shell, let users supply ROMs via drag-and-drop.


Integration Architecture

┌─────────────────────────────────────────────────────────────┐
│                    ZENBASIC Console                         │
│  ┌──────────────────────────────────────────────────────┐  │
│  │                  Machine Selector                     │  │
│  │   MACHINE C64 | MACHINE AMIGA500 | MACHINE SPECTRUM  │  │
│  └──────────────────────────────────────────────────────┘  │
│                           │                                 │
│           ┌───────────────┼───────────────┐                │
│           ▼               ▼               ▼                │
│   ┌───────────┐   ┌───────────┐   ┌───────────┐           │
│   │ ZENBASIC  │   │ Full Emu  │   │  Hybrid   │           │
│   │  Mode     │   │   Mode    │   │   Mode    │           │
│   │(current)  │   │(external) │   │ (bridge)  │           │
│   └───────────┘   └───────────┘   └───────────┘           │
│        │               │               │                   │
│        ▼               ▼               ▼                   │
│   ZenCPU.ts      iframe/WASM      PEEK/POKE              │
│   (6502-like)    (real 6502)      Interceptor             │
└─────────────────────────────────────────────────────────────┘

Mode 1: ZENBASIC Mode (Current)

  • Uses ZenCPU.ts (6502-compatible emulator)
  • Runs BASIC programs with ZEN extensions
  • Fast startup, integrated with Zenpower API

Mode 2: Full Emulation Mode (New)

  • Loads external emulator (EmulatorJS or standalone)
  • Boots actual ROM, runs real software
  • User provides ROM files
  • Command: BOOT C64 or EMU AMIGA500

Mode 3: Hybrid Mode (Future)

  • ZENBASIC interpreter with pass-through to real hardware emulation
  • PEEK/POKE operations route to actual emulated memory
  • Best of both worlds

Implementation Plan

Phase 1: EmulatorJS Integration

  1. Add EmulatorJS as optional dependency
  2. Create EmulatorBridge.ts wrapper class
  3. Add BOOT <machine> command to launch full emulation
  4. Store user-provided ROMs in IndexedDB

Phase 2: Premium Standalone Emulators

  1. Integrate jsbeeb for BBC Micro (excellent quality, included ROMs)
  2. Integrate WebMSX for MSX (open CBIOS, best features)
  3. Integrate JSSpeccy for Spectrum (WASM performance)

Phase 3: Hybrid Mode

  1. Create memory bridge between ZENBASIC and emulator
  2. Allow ZENBASIC programs to interact with emulated hardware
  3. Enable "turbo" mode for BASIC programs

File Size Estimates

Emulator Core Size With ROMs
EmulatorJS (per core) 2-10 MB +0.5-2 MB
jsbeeb ~500 KB Included
WebMSX ~800 KB CBIOS included
JSSpeccy ~300 KB +16 KB ROM
SAE ~2 MB +512 KB ROM

References