altair8800
altair8800 is a MITS Altair 8800 that runs in the browser and boots straight to Microsoft 8K BASIC and its famous MEMORY SIZE? prompt. The Intel 8080 CPU is a compact pure-JavaScript core (Alexander Demin's i8080.js, the same core used by this site's cpm-z80 emulator); around it, an original JavaScript machine adds 64 KB of memory with the 8 KB BASIC EPROM write-protected at 0xE000, an 88-2SIO serial console on I/O ports 0x10/0x11, and a glass-TTY drawn to an 80×24 canvas text grid. There is no operating system: the genuine MITS/Microsoft BASIC runs as real 8080 code, so the whole interpreter can be single-stepped and inspected live.
Visit the i8080-js CPU core on GitHub ↗
Runs on: Web browser
altair8800 Online Emulator
Play altair8800 using JavaScript directly in your browser.
Controls
Configurations
| Configuration | Emulator | Machine | OS | Legal | |
|---|---|---|---|---|---|
| Altair 8K BASIC | altair8800 | grey | Open ⛶ |
Chips
Notes
Embedding
The emulator is two independent pieces: a vendored Intel 8080 CPU core (i8080.js) and an original JavaScript Altair 8800 machine (altair-machine.js). There is no operating system to emulate - the genuine MITS/Microsoft 8K BASIC ROM runs as real 8080 code from power-on. The 8 KB EPROM image is loaded at 0xE000 and that region is made read-only, exactly like the real ROM board; the image begins with a relocating stub that copies BASIC down into low RAM and jumps to it.
Boot. Load the ROM, write-protect its region, point the CPU at 0xE000, then run your own loop over cpu.instruction() (one 8080 instruction). BASIC drives the console entirely through the 88-2SIO serial ports, so nothing needs trapping:
var cpu = new I8080(memoryBus, ioBus); // vendored 8080 core
loadROM(0xE000); // MITS 8K BASIC EPROM image
cpu.pc = 0xE000; // the ROM stub relocates BASIC and runs it
(function frame(){
for (var i = 0; i < BUDGET; i++) {
if (breakpoints.has(cpu.pc)) break;
cpu.instruction(); // one 8080 instruction
}
requestAnimationFrame(frame);
})();
The 88-2SIO console lives on the I/O bus: IN 0x10 returns the status byte (bit 0 = a key is waiting, bit 1 = transmitter ready), IN 0x11 reads the next key, and OUT 0x11 prints a character to the Teletype. BASIC polls that status register to read and echo input.
The machine is plain objects. Everything the debugger needs is a field or method on the core. There is no wasm heap to reach into:
| Member | Kind | What it does |
|---|---|---|
cpu.instruction() | method | Execute exactly one 8080 instruction; returns its cycle count. The single-step primitive. |
cpu.pc / cpu.sp | field | Live program counter and stack pointer (plain, writable numbers). |
cpu.a()…cpu.l() / cpu.set_reg(r,v) | method | The 8080 register file (A B C D E H L); flags are cpu.sf .zf .hf .pf .cf. |
memoryBus.read(a) / .write(a,v) | method | The 64 KB address space the CPU sees; the 0xE000-0xFFFF EPROM region ignores writes. |
ioBus.input(p) / .output(p,v) | method | The 88-2SIO console on ports 0x10/0x11 - the only I/O BASIC uses. |
Because the CPU and memory are ordinary JavaScript, the debugger single-steps with cpu.instruction(), reads and writes registers straight off the core, and implements breakpoints and watchpoints as host-side checks around the loop. No changes to the emulator.
Debugger integration
The plug-in (altair8800-debug.js) describes the machine to the shared debugger and nothing more:
- Registers are read live from the 8080 core each refresh (A, B, C, D, E, H, L, SP, PC and the S Z AC P C flags) and written back through
set_reg. - Disassembly uses the shared
z80decoder: the Z80 is a superset of the 8080, so it renders BASIC's 8080 code correctly, mnemonics and all. - Memory is the full 64 KB, read side-effect-free straight from the RAM array - you can watch BASIC's interpreter code in low RAM, the program text and variables, and the untouched EPROM at once.
- Single step is one
cpu.instruction(); breakpoints and watchpoints are host-side checks in the run loop. At the prompt BASIC sits in a tight loop polling the serial status port, so stepping there walks that poll. Set a breakpoint inside a running program (or step after typingRUN) to watch real interpreter code execute.
Architecture
The MITS Altair 8800 (1975) is the machine that launched the personal-computer industry and Microsoft's first product, Altair BASIC. This build models the classic console configuration:
- Intel 8080 - the CPU, run as a compact pure-JavaScript core one instruction at a time.
- 64 KB memory - RAM below
0xE000; the top holds the 8 KB BASIC EPROM and is write-protected, so BASIC's "MEMORY SIZE?" auto-sizer correctly finds RAM up to0xDFFF. - 88-2SIO serial board - the MITS console interface at I/O ports
0x10/0x11, connected to a Teletype. The console is a glass-TTY drawn to an 80×24 canvas text grid, the way an ASR-33 printed characters.
The bundled software is MITS/Microsoft 8K BASIC rev 4.0 - grey system software, universally redistributed for the long-dead Altair. It boots to the famous "MEMORY SIZE?" prompt; answer the three start-up questions and it drops to OK, a full BASIC with strings, arrays and the transcendental functions.