oric1js
oric1js is a small, pure-JavaScript Oric-1 emulator by Emmanuel Caradec. It emulates just enough of the machine, the MOS 6502 CPU, the 6522 VIA, an 8912 sound-chip stub and the text-mode display, to boot Oric Extended BASIC and let you type commands, entirely in the browser.
Runs on: Web browser
oric1js Online Emulator
Play oric1js using JavaScript directly in your browser.
Controls
Configurations
| Configuration | Emulator | Machine | OS | Legal | |
|---|---|---|---|---|---|
| Oric-1 BASIC | oric1js | Oric 1 | grey | Open ⛶ |
Machines emulated
Chips
Notes
Embedding
oric1js is a small set of CommonJS modules (a 6502, a 6522 VIA, an 8912 PSG stub, a text-mode screen and a keyboard matrix). Vendor src/**, bundle it with esbuild into one IIFE, and drive the machine yourself rather than letting oric1.js start its built-in setTimeout loop; that loop cannot be paused or single-stepped, which the debugger needs.
Boot. The bundle grabs the <canvas id="screen"> at load, resets the 6502 from the ROM vector, then hands you the live machine as window.ORIC1. Run your own loop on ORIC1.step() - one 6502 instruction plus the VIA / PSG / raster / IRQ servicing for that instruction:
var M = window.ORIC1; // { step, cpu, addr_space, memory, keyboard, rom }
(function frame(){
var budget = 20000; // ~1 MHz / 50 Hz = 20000 cycles per frame
while (budget > 0) {
M.step(); // exactly one instruction
budget -= (M.cpu.icycles || 2);
}
requestAnimationFrame(frame);
})();
The machine is plain objects. The patched build exposes everything the debugger needs as live handles. No wasm heap to reach into:
| Member | Kind | What it does |
|---|---|---|
ORIC1.step() | method | Execute one 6502 instruction and clock the peripherals for it. The single-step primitive; cpu.icycles holds its cycle count. |
ORIC1.cpu | field | The 6502 with live register accessors .pc .a .x .y .s .p and a .flags object (N V B D I Z C), all readable and writable (they are otherwise closure-private module vars, exposed by a small patch). |
ORIC1.cpu.reset() | method | Reset the CPU (reloads PC from the $FFFC vector). |
ORIC1.addr_space.read(a) / .write(a,v) | method | The 6502 bus: RAM, the VIA at $0300, and the BASIC ROM at $C000. Poke it live for cheats or a debugger. |
ORIC1.memory | field | The raw 64 KB RAM array under the I/O and ROM windows. |
ORIC1.keyboard.setCell(row,col,down) | method | Drive the Oric key matrix directly (row 0-7, column bitmask), what the on-screen keyboard calls. |
ORIC1.rom | field | The BASIC 1.1 ROM byte array (16 KB at $C000). |
Because the CPU, bus and RAM are ordinary JavaScript, the debugger single-steps with ORIC1.step(), reads and writes registers straight off cpu, and implements breakpoints and watchpoints as host-side checks around those calls, no changes to the emulator core.
Architecture
oric1js is a compact, interpreted Oric-1, just enough hardware to reach the BASIC prompt and type commands. Each chip is its own module:
p6502- the MOS 6502 CPU interpreter (a flat opcode table plus NMOS illegal opcodes).step()runs one instruction and returns its cycle count.addr_space- the memory map: RAM below$C000, the 6522 VIA mapped at$0300-$030F, and the 16 KB BASIC ROM at$C000-$FFFF.p6522- the 6522 VIA: its two ports scan the keyboard matrix and gate the PSG, and it raises the 50/100 Hz IRQ that BASIC's keyboard scan relies on.p8912- a stub of the GI 8912 (AY) programmable sound generator; register$0Eselects the keyboard column.screen- the Oric text mode: 40×28 characters rendered from screen RAM at$BB80using the character set the ROM copies to$B400, into a 240×200 canvas.keyboard- the 8×8 key matrix, read by the VIA one column at a time.basic11ROM- the Oric-1 BASIC 1.1 ROM, embedded as a byte array (system ROM, redistributed as freeware, see the licence note).
The emulator is deliberately minimal, but its CPU and memory are faithful and fully exposed, which is exactly what makes it a good debugging target.