mbasic Reconstructed Source Code for Altair/Microsoft BASIC (4K, 8K, and MBASIC 5.21

48 views
Skip to first unread message

aaw...@gmail.com

unread,
Dec 1, 2025, 9:32:49 PMDec 1
to RC2014-Z80
 I'm pleased to share a project reconstructing the lost source code for the
  Microsoft BASIC interpreters:

  - 4K BASIC 4.0 - The original Altair BASIC (3,833 bytes)
  - 8K BASIC 4.0 - Extended Altair BASIC with more features
  - MBASIC 5.21 - The widely-used CP/M disk BASIC (24,320 bytes)

  Each reconstructed source assembles byte-for-byte identical to the commonly
  distributed binaries from the 1980s. These aren't approximations—run the build
  scripts and cmp will confirm an exact match.

  Where did the comments come from?

These reconstructions combine multiple
  approaches:

  - 4K BASIC: Comments from altairbasic.org's annotated 3.2 disassembly, plus analysis
  - 8K BASIC: Pattern-matched comments from 4K and 5.21, plus cpmemu execution tracing
  to distinguish code from data
  - MBASIC 5.21: Started with partial 5.2 sources found online, then diffed against the
   5.21 binary to fix differences (marked with ;5.21 comments)

  Currently 68% of the 8K source lines have comments. Work continues.

  Building

  The sources are in Microsoft M80 macro assembler format. Building with the original
  M80/L80 on CP/M has not been tested.

  For modern systems, use Python 3 and the um80 assembler:
  pip install um80
  ./build_4k.sh   # or build_8k.sh or build.sh for 5.21

  Links

  - Repository: https://github.com/avwohl/mbasic2025
  - um80 assembler: https://github.com/avwohl/um80_and_friends
  - cpmemu (with tracing): https://github.com/avwohl/cpmemu

  These sources are useful for understanding how early BASIC interpreters worked,
  studying 8080 assembly techniques, or just appreciating the code that Gates, Allen,
  and Davidoff wrote in 1975-76.

  Feedback and contributions welcome.
Reply all
Reply to author
Forward
0 new messages