SearchA-ZR › RCA Studio II

RCA Studio II

1977 Open source · Public domain Online

The RCA Studio II (January 1977) was one of the first programmable cartridge game consoles, and one of the first machines built entirely around the RCA CDP1802 (COSMAC). This in-browser emulator runs the authentic 2 KB system ROM on a hand-written RCA 1802 core, reusing the same 1802 CPU the emulators.org Cosmac ELF is built on. It reproduces the console's video the way the real hardware makes it: like a CDP1861 Pixie, the display interrupts the 1802 once per frame and steals DMA cycles that read the 0x0900 page out to a 64x32 black-and-white raster. It plugs into the shared debugger, so you can single-step the 1802, set breakpoints and watchpoints, and read every register (D, DF, P, X, T, Q, IE and the sixteen 16-bit R0-RF) and the whole 4 KB address space. The default boots the Pac-Man cartridge straight to its maze; the two ten-key keypads are on-screen and on the keyboard.

Runs on: Web browser

RCA Studio II Online Emulator

Play RCA Studio II using JavaScript directly in your browser.

Configurations

ConfigurationEmulatorMachineOSLegal
Pac-Man (cartridge)RCA Studio IIRCA Studio IIopenOpen ⛶
Hockey (cartridge)RCA Studio IIRCA Studio IIopenOpen ⛶
Kaboom (cartridge)RCA Studio IIRCA Studio IIopenOpen ⛶
Combat (cartridge)RCA Studio IIRCA Studio IIopenOpen ⛶
Built-in games (system ROM)RCA Studio IIRCA Studio IIgreyOpen ⛶

Machines emulated

Chips

Notes

Embedding

The Studio II core is a single hand-written file, studio2.js, exposing a global Studio2. It reuses the emulators.org RCA 1802 instruction core (written for the Cosmac ELF) and wraps it in the console's hardware: a per-frame video interrupt, the 64x32 display DMA, two keypads and the Q beeper. Vendor it, load the 2 KB system ROM (and optionally a cartridge), and drive it from a loop you own:

var s2 = Studio2.create(canvas);          // canvas is the 64x32 screen
s2.loadSystemRom(sysRomBytes);          // 2 KB BIOS + interpreter + built-in games
s2.loadCart(st2Bytes);               // optional .st2 cartridge (page table in its header)
s2.reset();
(function loop(){ s2.runFrame(); s2.render(); requestAnimationFrame(loop); })();

The machine is plain JavaScript. Everything the host (or the debugger) needs is a method or field on the object:

MemberKindWhat it does
s2.step()methodExecute exactly one 1802 instruction and advance the per-frame video state machine; returns 'ok' or 'idle'. The single-step primitive.
s2.runFrame()methodRun instructions until the next video frame begins (fires the frame interrupt on the way).
s2.R · s2.D · s2.DF · s2.P · s2.X · s2.T · s2.Q · s2.IEfieldsThe sixteen 16-bit scratchpad registers R0-RF, the accumulator, the carry, the PC/pointer selectors, T, the Q output and the interrupt enable — all read and pokeable live.
s2.peek(a) · s2.poke(a,v)methodsSide-effect-free read / write of the 4 KB space — used by the debugger's memory views.
s2.onWrite(a,v)hookCalled on every CPU memory write; the boot uses it for watchpoints.
s2.setKey(pad,d,down)methodPress/release digit d (0-9) on pad 'a' or 'b' — drives EF3 / EF4 through the OUT 2 key latch.

Debugger integration

The debugger plug-in (studio2-debug.js) reads the live core each refresh and calls EmuKit.defineMachine. Because the whole machine is ordinary JavaScript, the only core hook needed is the write callback:

  • CPU decoder. The 1802 is neither a 6502 nor a Z80, so the shared 1802 disassembler at /debugger/src/cpus/1802.js (added for the Cosmac ELF) is reused here — high nibble = operation, low nibble = register; unknown bytes decode as .byte.
  • Registers. D, DF, P, X, T, Q, IE and the sixteen 16-bit R0-RF are read live each refresh and written back through the set callbacks. “PC” is R[P] — the 1802 keeps the program counter in a scratchpad register chosen by P, so which register is the PC changes as the program runs SEP; during the video interrupt P is 1 (the handler at R1).
  • Memory. Two chips: the whole 4 KB address space (ROM + RAM + the display page, disassembled with 1802) and the 64x32 display page 0x0900-0x09FF on its own for the bits view — you can watch the screen bitmap change. Reads are side-effect-free (I/O is on ports, not memory).
  • Single step is one step(). Breakpoints compare R[P] against a set before each instruction; write watchpoints wrap the CPU memory-write path through onWrite and pause the loop the moment a watched cell is written. Both are host-side, so they cost nothing when the debugger is closed.
  • Input. Two on-screen ten-key keypads (players A and B) drive the same setKey the physical keyboard does, so input works in the shell fold-up, the debugger Controls window and from the host keyboard.

Architecture

The RCA Studio II (January 1977) was one of the first programmable cartridge consoles, and among the first to build the whole machine around the RCA 1802:

  • RCA CDP1802 (COSMAC) — a static CMOS 8-bit CPU with sixteen 16-bit scratchpad registers R0-RF, any of which can be the program counter or a data pointer, an 8-bit accumulator D, a 1-bit carry DF and the 4-bit selectors P (which R is the PC) and X (which R is the pointer).
  • 2 KB system ROM + 512 bytes RAM — the ROM holds a small byte-code interpreter, the interrupt/keypad/sound BIOS and five built-in games; RAM is 0x0800-0x09FF, the upper 256 bytes being the display.
  • Video — there is no video chip: exactly like a CDP1861 “Pixie”, the display hardware interrupts the 1802 once per frame, then steals a run of DMA-OUT cycles that read the 0x0900 page byte-by-byte to paint a 64x32 black-and-white raster (one byte = eight pixels, MSB left). The EF1 line marks the display window and the handler syncs to it with B1/BN1.
  • Two ten-key keypads — players A and B. The program latches a key number with OUT 2, then EF3 reads whether that key is held on pad A and EF4 on pad B.
  • Sound — a single tone gated by the 1802 Q flip-flop (SEQ/REQ).

Cartridges are byte-code images that overlay the ROM from 0x0400 (the .st2 format carries an explicit page table); the console then interprets them exactly as it does the built-in games.