Nascom 2
The Nascom 2 (Nascom Microcomputers, 1979) is a British Z80 kit home computer. This is a from-scratch JavaScript emulation: the CPU is Molly Howell's MIT Z80.js — the same core the 1942 build uses — and the rest of the machine (the memory map, the memory-mapped 48×16 character display, and the eight-row keyboard matrix scanned through port 0) is emulated here. It boots the authentic NAS-SYS 3 monitor ROM to its prompt, with 8 KB Nascom ROM BASIC at $E000. This build wires it into the shared debugger, so you can single-step the Z80, read and write its registers and the 64K memory, set breakpoints and write watchpoints, and type on an on-screen keyboard.
Runs on: Web browser
Nascom 2 Online Emulator
Play Nascom 2 using JavaScript directly in your browser.
Controls
Configurations
| Configuration | Emulator | Machine | OS | Legal | |
|---|---|---|---|---|---|
| NAS-SYS 3 | Nascom 2 | Nascom 2 | grey | Open ⛶ |
Machines emulated
Chips
Notes
Embedding
The Nascom 2 (Nascom Microcomputers, 1979) is a British Zilog Z80 kit home computer. This build is a from-scratch JavaScript emulation: the CPU is Molly Howell's MIT Z80.js (the same core the 1942 build uses), and everything around it — the memory map, the memory-mapped character display, and the keyboard matrix — is nascom.js. The machine runs from a host-owned loop, so the shared debugger can pause and single-step it.
Boot. Construct the machine on a canvas, fetch the two ROMs, and call boot(); it loads NAS-SYS 3 at $0000 and BASIC at $E000, resets the Z80, publishes window.EMU_BOOT and starts the loop:
var m = new Nascom({ canvas: canvas });
m.boot(nassysBytes, basicBytes); // load ROMs, reset the Z80, run to the prompt
// each animation frame runs one 50Hz field of the Z80, then repaints the screen
The machine object. Everything the host and debugger need is a field or method on the plain JavaScript machine — there is no wasm heap to reach into:
| Member | Kind | What it does |
|---|---|---|
m.cpu | field | The Z80 core. run_instruction() executes one instruction; get_pc() reads PC cheaply for breakpoints. |
m.getReg(name) / m.setReg(name,v) | method | Read / write A F, B C D E H L, the AF/BC/DE/HL pairs, IX IY SP PC, and I R. |
m.dbgRead(a) / m.dbgWrite(a,v) | method | Side-effect-free read of the 64K bus and the CPU write path — what the debugger's memory views read and poke. |
m.setKey(row, bit, down) | method | Set one cell of the eight-row key matrix that the NAS-SYS keyboard routine scans through port 0. |
EMU_BOOT.transport | field | The pause / resume / step / breakpoint / watchpoint surface the shared debugger drives. |
Video. The screen is 48×16 character cells, each 8×15 pixels, drawn from the Nascom character-generator font. Screen RAM is a 1 KB window at $0800-$0BFF; cell (x, y) lives at offset (((y-1)&15)<<6) | (x+10) inside it (the top display line follows the last memory line), so the whole visible page is repainted from that RAM every frame in green phosphor.
Debugger integration
Because the whole machine is ordinary JavaScript and the host owns the run loop, the debugger's controls need no changes to the CPU core: the loop can pause, single-step and check breakpoints between any two instructions. window.EMU_BOOT.transport maps the shared debugger onto the Z80:
- pause / resume / isPaused — stop or restart the
requestAnimationFrameloop. - stepInsn(n) — run exactly n Z80 instructions through the core's
run_instruction()entry, then repaint. - step(n) — advance n whole 50 Hz fields.
- breakpoints — a
Setof PC values checked before each instruction; a match pauses before the instruction runs. - watchpoints — the machine's memory-write path flags a hit when a watched address is written, and the loop pauses on it.
The stock Z80.js keeps its registers in a closure and exposes a whole-core getState()/setState(). The vendored core is given two extra hooks — get_pc() and set_pc() — so the loop can read PC before every instruction (for breakpoints) without allocating a state object, and the machine wraps getState/setState in focused getReg/setReg/getFlag/setFlag helpers the plug-in binds to. Memory reads use the machine's side-effect-free dbgRead. The Z80 disassembler is the shared decoder at /debugger/src/cpus/z80.js, reused unchanged since the Z80 is already a first-class debugger CPU.
Architecture
The Nascom 2 (Nascom Microcomputers, 1979) is a Z80 kit machine on a single board, built around a memory-mapped character display and a scanned keyboard:
- Z80 CPU at 4 MHz. The core interprets one instruction per
run_instruction(); the sharedz80decoder disassembles it. - Memory — NAS-SYS 3 monitor ROM at
$0000-$07FF, 1 KB screen RAM at$0800-$0BFF, monitor workspace and stack at$0C00-$0FFF, user RAM from000, and 8 KB Microsoft BASIC ROM at$E000-$FFFF. - Display — a 48×16 character screen scanned straight out of the screen-RAM window through the character-generator font; there is no bitmap mode in this build.
- Keyboard — an eight-row matrix read through Z80 I/O port 0: writing bit 0 clocks the row counter and bit 1 resets it, and a read returns the active-low columns of the selected row, exactly as the NAS-SYS keyboard routine expects.
- NAS-SYS 3 — the standard Nascom machine-code monitor; it prints the
-- NAS-SYS 3 --banner and prompt the machine boots to.