FX-870P Emulator

A browser-based emulator for the Casio FX-870P (also sold as the VX-4) pocket computer, written in TypeScript and Vue 3.

The FX-870P was a 1986 programmable calculator running a Hitachi HD61700 CPU at 921 kHz with a 96×64 pixel LCD,

83-key keyboard, serial port, and optional MD-120 floppy drive. This emulator is a full port of the

original Delphi reference implementation to the web platform.

screenshot.png

Credits

The original emulator is available on the PISI and credit

is given to the original author of the amazing suite of emulators available on this site. This implementation is

designed to purely make the code behind that emulator available to a wider audience on the internet.

PISI

This version of the emulator implemented by Mark Wickens, the source code is hosted

on GitHub here and it is

hosted if here you want to try it.

Mark Wickens

here

hosted if here you want to try it

Hardware Emulated

Features

Responsive calculator face — scales to fit any screen size with multiple resolution faceplate images

Full keyboard mapping — type directly on your PC keyboard with automatic CAPS and shifted-symbol handling

Program library — built-in curated collection of sample BASIC programs loadable directly from the toolbar

RS-232C serial — LOAD and SAVE BASIC programs via emulated COM0 with XON/XOFF flow control

Floppy disk — MD-120 disk emulation via Origin Private File System (OPFS)

Character set table — interactive 16x16 hex grid showing all 256 character bitmaps from the ROM font

DEFCHR$ pixel editor — click any character to open a drag-to-paint 5x8 pixel editor that generates the BASIC DEFCHR$ command with a one-click copy button

Turbo mode — run the CPU at ~50x speed for compute-heavy BASIC programs

Fullscreen mode — hide toolbar and panels to use the calculator full-screen (useful on mobile)

Firmware toggle — switch between FX-870P (Japanese) and VX-4 (English) ROM modes

CPU debugger — live registers, flags, and disassembly view

BASIC listing panel — live detokenized listing of all BASIC programs (P0–P9) stored in RAM, with tabbed navigation, syntax highlighting, and live/frozen toggle

BASIC editor — in-place editing of BASIC programs with syntax highlighting, direct RAM writes, add/delete/edit lines, whole-program import/export with rich-text clipboard support

Communications panel — UART register state, serial byte stream, and diagnostics

Running

Prerequisites

Node.js 22 LTS

ROM files placed in public/roms/ (not included)

Development server

Or use npm directly:

Production build

The app is served under the /fx870p-emulator/ base path in both dev and production.

Project Structure

Developer Tools

Beyond the browser emulator, this repo ships two Node.js tools for compiling and debugging HD61700 machine code:

BASIC Compiler — tools/compiler/

tools/compiler/

Compiles Casio JIS Standard BASIC to HD61700 machine code. Generates an annotated 132-column assembly listing, a raw binary, a symbol table, and a self-loading BASIC program for real hardware. Generated code calls into the existing ROM for PRINT, INPUT, FP math, and string operations (the CosmicV4 pattern) rather than reimplementing the runtime.

Headless Debugger — tools/emu-debugger/

tools/emu-debugger/

Library and CLI for driving the emulator programmatically. Breakpoints, memory watchpoints, instruction tracing, snapshot restore, single-stepping. Designed for debugging compiled binaries and automated regression testing.

Reference Documents

reference/fx870p-rom-annotations.md

reference/fx870p-roms.md

docs/CasioVX-4-Manual-Peter-Rost.pdf

docs/FX-870P emulator.pdf

docs/basic-detokenizer.md

docs/basic-editor.md

docs/plan.md

reference/fx870_es/

Testing

The emulator has a headless test suite powered by vitest that boots the emulator in Node.js,

injects keystrokes, runs the CPU, and verifies LCD output.

vitest

Run all tests

Run a single test file

Run tests matching a name pattern

Watch mode (re-runs on file changes)

Tests require ROM files in public/roms/ (same as the dev server).

Debug Logging

The dev server exposes a /fx870p-emulator/log endpoint that writes to emulator-debug.log. Enable logging from the browser console:

Tech Stack

Vue 3 + <script setup>

Vue 3

&lt;script setup&gt;

TypeScript

TypeScript

Vite 7

Vite 7

CodeMirror 6 — BASIC editor with custom syntax highlighting

CodeMirror 6