Skip to content

Repository files navigation

Lazarus AP

The Space Shuttle's computing world, brought back to life.

An emulator of the IBM AP-101S — the flight computer that flew every Shuttle mission — built page by cited page from IBM's own Principles of Operation, together with the recovered flight toolchain that fed it. Real Shuttle software runs here: thirty routines of the genuine flight runtime library, HAL/S programs compiled by the actual Space Shuttle compiler, and five emulated computers voting against each other the way the orbiter's did.

Read it here (source) — narrated execution, source stepped against the machine code it compiled to, the five-computer vote, the crew keyboard and CRT, the flight math, the history, and a defect report. One self-contained page; serves from GitHub Pages (Settings → Pages → main / docs).

lazap running roms/hello/hello.fcm: a
HAL/S program printing THE BEGINNING, HELLO WORLD and a loop

That is a HAL/S program compiled by the genuine Space Shuttle compiler, executing on an emulated AP-101S. Every image in this repository runs.

(Every terminal card below is generated by tools/mkshots.py from the real output of the real binary — CI fails if one drifts. None of them is a mockup.)


What runs

The machine AP-101S CPU (138 instructions), hexadecimal floating point, interrupts, storage protection, the IOP with its Master Sequence Controller and 24 Bus Control Elements, and per-instruction execution times from the flight compiler's own table
The redundant set Five GPCs on shared serial buses: listen mode, sync discretes, timeout voting, force-voted actuators, fault injection, a BFS-style shadow listener
The crew station DEU keyboard and CRT over the display buses — type at it in your terminal
Flight software Four HAL/S programs at byte-for-byte parity with the reference emulator; WRITE, READ, floats, and ON ERROR recovery
The toolchain The genuine HAL/S-FC compiler (release 32V0, all seven passes) and ASM101S assembler, both rebuilt and running; our own linker replaces the one piece history didn't preserve
NASA flight code 202 of 205 recovered runtime routines assemble; 40 runnable images, all 40 verified — 39 against modern mathematics every CI run, plus the attitude pipeline in an integration test
Provenance Every traced address is attributed to the routine that owns it, from the linker's own table; where the evidence to attribute it did not survive, the page says so instead of guessing

Five GPCs voting; GPC 2 reports 13
where the others report 42 and is bypassed by the force-voting actuator

Five computers on shared serial buses. One has been given a corrupted sensor and reports 13 where the others report 42; the healthy majority outvotes it and the force-voting actuator ignores its command. The mechanism is emulated from documentation — NASA's own redundancy- management software has never been released.

labcheck.py output: the Shuttle's
own SQRT, sine/cosine, dot product, unit vector, matrix inverse and
double-precision product, each against the modern value, 39/39 verified

The Shuttle's own mathematics, re-run and re-checked against modern values on every build. Note the fourth column: SQRT(2) comes back as 1.4142132 where a modern machine says 1.4142136. That gap is the hexadecimal floating point this machine actually used.

lazap-time: hello.fcm takes 6,613
instructions and 10,970 time units, 44 percent of a 40 Hz frame

And what it cost. The guidance loop ran at 40 Hz — a new answer every 25 milliseconds, no option to run late. Printing eight short lines burns close to half a frame, because almost all of it is character formatting. Inverting a 3×3 matrix costs under 2%. That ratio is why flight software does not print things. (The time unit itself is unconfirmed — see src/timing.rs.)

Run it

cargo run --bin lazap-dps                 # crew station: type at the DPS keyboard
cargo run --bin lazap-set                 # five computers vote out a faulty one
cargo run --bin lazap-set -- --kill 1     # kill one, watch the survivors outvote its silence

cargo run --bin lazap -- roms/hello/hello.fcm       # a real HAL/S program
cargo run --bin lazap -- roms/lazarus/LAZARUS.fcm   # written here, compiled by the Shuttle's compiler
echo "42, 3.14" | cargo run --bin lazap -- roms/read_write/read_write.fcm

tools/resurrect.py SQRT:2.0 EXP:1.0 EPROD:2,3,4     # bring NASA routines back, checked
cargo run --bin lazap-trace -- roms/lazarus/LAZARUS.fcm   # the trace behind the web page
cargo run --bin lazap -- examples/sum.asm           # assemble and trace your own program
cargo test                                          # 189 tests
python3 tools/check_symtabs.py                      # symbol tables match their object decks
python3 tools/labcheck.py                           # all 39 routines vs modern mathematics
cargo run --bin lazap-time -- roms/hello/hello.fcm --assume-microseconds

Requires a stable Rust toolchain. The historical toolchain (ASM101S, HAL/S-FC) is Python and lives in the Virtual AGC tree — see docs/ROADMAP.md for the fetch-and-build recipe.

The flight math, running again

Thirty-nine genuine routines, each assembled by the real flight assembler and re-checked against modern mathematics on every CI run — full table in roms/nasa/lab.md, generated by tools/labcheck.py from the manifest in roms/nasa/lab.json. The fortieth, the attitude pipeline, needs sensor data polled over the IOP and so is verified by an integration test instead:

SQRT(2)             = 1.4142135        EXP(1) = 2.7182817
dot [1,2,3]·[4,5,6] = 32               cross  x × y = [0,0,1]
UNIT [3,4,0]        = [0.6, 0.8, 0]    det diag(2,3,4) = 24
3x3 multiply, 3x3 inverse, sinh/cosh/tanh, asinh/acosh/atanh,
atan2, fmod, powers, sums, products, maxima, minima - single and double precision

Dot products for angles, cross products for perpendiculars, normalization for headings, matrix multiply to compose rotations, inverse to undo them: the operations the orbiter used to know which way it was pointing.

Honesty

The AP-101's instruction set is not fully documented in public sources, so this project treats reconstruction as a research deliverable:

  • Every implemented instruction cites its page in IBM 85-C67-001.
  • Anything unverified is marked UNVERIFIED and left unimplemented rather than guessed — see docs/ISA_STATUS.md.
  • Deliberate deviations (documented hardware anomalies we chose not to replicate, emulator conventions where the record is silent) are listed with reasons.
  • Bugs found — in the hardware's own documentation, in the recovered tools, and in this emulator — are filed in roms/nasa/DEFECTS.md.
  • Claims about what ran where are made only where a surviving artifact supports them. 176-P's object deck is lost, so the walkthrough declines to say which routines were its own.
  • The historical toolchain is no longer on the build machine; what can and cannot be regenerated is tabulated in docs/ROADMAP.md.

If you find a behavior this emulator gets wrong against period documentation or hardware evidence, that's a bug — please report it with the source.

Documentation

File What's in it
docs/ISA_STATUS.md Every instruction: encoding, status, citation
docs/IOP_STATUS.md MSC and BCE instruction sets, bus model
docs/DEU_STATUS.md Crew interface: what's sourced, what's convention
docs/ARCHITECTURE.md Design and language rationale
docs/SOURCES.md Primary sources and what each confirmed
docs/PRIOR_ART.md How this relates to Virtual AGC and nsts-sim-gpc
docs/ROADMAP.md Phases, including the toolchain build recipe
roms/nasa/CENSUS.md The resurrection scoreboard
roms/nasa/DEFECTS.md Defect report, filed as you would today

Thanks

None of this is a solo achievement, and most of the people who made it possible have no idea this project exists.

Ron Burkey, and the Virtual AGC project. Everything here rests on his work. The HAL/S-FC compiler, the ASM101S assembler, the 205 routines of the flight runtime library, the fixture programs, the yaGPC2 cross-check emulator, the scanned AP-101S manuals — he found, restored, transcribed and published all of it, over decades, for free. This project builds on top of that and checks itself against it: the fixture programs were verified against his yaGPC2 instruction by instruction, and matched exactly.

Don Schmidt, whose nsts-sim-gpc AP-101S emulation work is the lineage yaGPC2 descends from.

The IBM Federal Systems Division engineers who designed the AP-101S and then wrote 85-C67-001, the Principles of Operation. They documented their machine so carefully that it can be rebuilt from paper, forty years on, by people they never met. Almost no hardware of that era is so well described. Every instruction in src/ cites their pages.

The IBM Space Shuttle onboard software team in Houston, who wrote the flight software and whose defect rate remains a benchmark the industry still quotes and rarely reaches. Their runtime library is the code that runs in this repository. It still computes correctly, first time, on an emulator built from their documentation — which is its own kind of tribute.

The HAL/S language team at Intermetrics, who built a language for people writing software that could not fail, complete with a compiler that printed how long each statement would take. That timing table is now src/timing.rs.

NASA and Rockwell International, and everyone who kept the Shuttle software honest for thirty years and 135 flights.

ibiblio.org at the University of North Carolina, for hosting the Apollo and Shuttle archives without which none of this material would be reachable at all.

The crews. Every line of the software emulated here was, at some point, something that seven people trusted with their lives.

And Keith Adler, who on 2 August 2026 at 12:09 PDT ran the Shuttle's own square-root routine for the first time since Atlantis came home.

A note on how this was built: the emulator, tools and documentation in this repository were written by Claude (Anthropic) working under human direction — the same disclosure Virtual AGC's own yaGPC2 makes. The research standard in CONTRIBUTING.md exists precisely because a machine writing code about a machine nobody can test any more needs a strict rule against plausible invention.

License

GPL v2-or-later (see LICENSE).

Parts of this project derive from Virtual AGC, which is GPL v2-or-later — src/timing.rs is a port of yaGPC2's timing tables — so the whole is licensed to match rather than sit in conflict with it.

The recovered NASA/IBM flight sources vendored under roms/nasa/ are public domain and are not covered by that licence. NOTICE sets out exactly what came from where.

About

An emulator of the IBM AP-101S, the Space Shuttle's flight computer — built from IBM's own manuals and running real NASA flight software.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages