Skip to content

Repository files navigation

Altair 8800 Simulator

Tests

The 1975 computer that started the personal computer revolution, in your browser. Toggle 8080 machine code in through a working front panel, watch it run on the LEDs, then install a memory board and boot Microsoft's original 4K BASIC on a simulated Teletype.

Try it online

  • A working front panel. The Altair 8800's address and data lamps and its switches - EXAMINE, DEPOSIT, SINGLE STEP, RUN, RESET and the sense switches - on an Intel 8080 clocked at the machine's own 2 MHz.
  • Microsoft Altair BASIC 3.2. The 4K edition Bill Gates, Paul Allen and Monte Davidoff wrote in 1975, running unmodified.
  • The hardware it needs. A Teletype ASR-33 on MITS 88-SIO and 88-2SIO serial boards, and 256 B, 4 KB or 8 KB of memory, installed the way you installed a board.
  • A debugger the Altair never had. Live CPU registers, a paged memory dump, and a map of what fills each page of memory.
  • Ten example programs, from a seven byte switch echo to a guessing game on the teletype, each a checked listing you load with one click.
  • Nine languages, no build step and no dependencies.

The Simulator tab: the Altair 8800 front panel, switched on, with the Switch Board Helper below it

Usage

Serve the directory over HTTP and open it. Anything will do; with no web server installed, Python has one built in:

python3 -m http.server 8000

then open http://localhost:8000/. To deploy, copy the whole directory to your web server's root — there is nothing to build.

Opening index.html straight off the disk mostly works: the front panel, the teletype and the debugger are all in the page itself. Two things are not — the example programs and the 4K BASIC tape, which the page reads from examples/ and roms/ when you ask for them. A browser treats every file:// page as a different site from the files beside it and blocks the read, so those two controls grey out and say so. Serving the directory is what fixes it.

The simulator has four tabs.

Simulator is the front panel. In a desktop browser you can click the switches on the panel directly. On a phone a single switch is hard to touch, so the Switch Board Helper buttons below the panel do the same job, and show which switches are up.

Teletype holds a simulated ASR-33: the paper, its keyboard, and a repeat of the address and data LEDs so a program that prints and lights lamps at once can be watched on one screen. The machine talks to it through an 88-SIO serial board on ports 00H and 01H (and an 88-2SIO on 10H and 11H), so a program has to be running and reading that board before anything appears — nothing echoes by itself.

The Teletype tab running 4K BASIC: MEMORY SIZE?, 727 BYTES FREE, then PRINT 3.14 * 9 answered with 28.26

Debugger shows the internal state of the simulated 8080 CPU and the contents of memory, and is where programs are loaded:

  • Load a Program has Load 4K BASIC and the Example Programs menu, which lists every program in examples/. Pick one and it is loaded at 0000H with RESET pressed, ready to RUN. The menu reads the listing files themselves, so there is no assembled copy of a program anywhere to fall out of step with its source.
  • Load Your Own takes a hex string (Load Data) or a binary file from disk (Load Binary File).
  • Installed Memory chooses 256 bytes, as the Altair 8800 shipped, or 4 KB / 8 KB as if you had plugged in one or two 88-4MCS memory boards. Memory boards are not something you add to a running machine, so changing the size switches the simulator off.
  • Memory Dump shows one 256-byte page at a time. Above 256 bytes a map strip sits over it — one cell per page, shaded by how much of that page is in use, and marked where the program counter and the stack pointer are. Click a cell to jump there, or use Follow PC to track the running program.

The Debugger tab: the loaders, the CPU registers, installed memory and the memory dump

Tutorial walks through toggling in a first program by hand and starting BASIC, with references for going further.

Teletype programs

tty-leds is the one to start with: eighteen bytes, and pressing A lights 01000001 on the data LEDs while printing the letter on the paper.

For something to actually play, guess-letter is a game in 218 bytes — it thinks of a letter and tells you whether yours is higher or lower, and counts your guesses. Twenty-six letters fall to five tries if you halve the alphabet each time.

GUESS MY LETTER A-Z. ANY KEY STARTS.

? M HIGHER
? T HIGHER
? W LOWER
? U HIGHER
? V GOT IT IN 5 TRIES.

Microsoft BASIC

The simulator runs the Altair's first piece of software, and Microsoft's: Altair BASIC 3.2, written in 1975 by Bill Gates, Paul Allen and Monte Davidoff. Choose 4 KB or 8 KB under Installed Memory in the Debugger tab, click Load 4K BASIC, then RUN from the front panel and type at the Teletype tab.

MEMORY SIZE?
TERMINAL WIDTH?
WANT SIN? Y

727 BYTES FREE

BASIC VERSION 3.2
[4K VERSION]

OK

On a 4 KB machine that leaves 727 bytes for your program, which is exactly what the name means — load it and look at the memory map before pressing RUN, and you can see BASIC filling fifteen of the machine's sixteen pages. The Tutorial tab walks through it, including what Load 4K BASIC quietly skips: toggling in a 28 byte boot loader by hand and then waiting seven minutes for the paper tape.

The ROM is in roms/, and roms/NOTICE explains what it is and why it is not under this repository's licence. It is optional; Load Binary File will load an image of your own instead.

A Quick Tutorial

How to input and run the following program to calculate 1 + 2 = 3, by hand, on the front panel. The same steps are in the simulator's Tutorial tab.

        LDA 0080H  ; 00 111 010
                   ; 10 000 000
                   ; 00 000 000
        MOV B,A    ; 01 000 111
        LDA 0081H  ; 00 111 010
                   ; 10 000 001
                   ; 00 000 000
        ADD B      ; 10 000 000
        STA 0082H  ; 00 110 010
                   ; 10 000 010
                   ; 00 000 000
        JMP 0000H  ; 11 000 011
                   ; 00 000 000
                   ; 00 000 000
  1. Turn on Altair 8800 by clicking OFF/ON switch.
  2. Set switches A7-A0 to 00 111 010 (up for 1, down for 0).
  3. Click "DEPOSIT".
  4. Set switches A7-A0 to 10 000 000.
  5. Click "DEPOSIT NEXT".
  6. Repeat step 4-5 to input the following bytes one by one: 00 000 000, 01 000 111, 00 111 010, 10 000 001, 00 000 000, 10 000 000, 00 110 010, 10 000 010, 00 000 000, 11 000 011, 00 000 000, 00 000 000.
  7. Set switches A7-A0 to 10 000 000.
  8. Click "EXAMINE".
  9. Set switches A7-A0 to 00 000 001 (the first number to be added, or 1 in decimal).
  10. Click "DEPOSIT".
  11. Set switches A7-A0 to 00 000 010 (the second number to be added, or 2 in decimal).
  12. Click "DEPOSIT NEXT".
  13. Click "RESET".
  14. Click "RUN" and wait for a few seconds.
  15. Click "STOP".
  16. Set switches A7-A0 to 10 000 010 (the address that holds the sum).
  17. Click "EXAMINE".
  18. The LEDs D7-D0 show the result 00 000 011 (3 in decimal).
  19. Turn off Altair 8800.

Example programs

Ten small 8080 programs to try on the simulator — five on the front panel, from a pattern walking across the LEDs to the 1975 game Kill the Bit, and five on the teletype, from HELLO, WORLD! to a guessing game — are in examples/, each with a listing and instructions for loading it. They double as the golden set the tests run against.

Tests

npm test

Node.js 24, no dependencies to install. The suite covers the 8080 CPU, the front panel, the serial boards and the teletype, the page's own logic and translations, every program in examples/, and 4K BASIC booting and running end to end. It runs on each push and pull request.

References

Acknowledgements

The Intel 8080 CPU core is maly/8080js.

The Quick Tutorial in the simulator UI uses an example program from the original Altair 8800 Operator's Manual.

The interaction design took another Altair 8800 simulator as a reference.

About

Altair 8800 emulator in your browser: a working front panel, an Intel 8080, an ASR-33 Teletype and Microsoft's original 4K BASIC

Topics

Resources

Stars

112 stars

Watchers

2 watching

Forks

Releases

Contributors

Languages