Microsoft co-founder Bill Gates has shared the 1975 source code for Altair BASIC.
The code was the foundation on which Microsoft was built. Before Windows and before Office, there was a carefully crafted BASIC interpreter designed to fit within the limited resources available on the Altair 8800.
Why an interpreter? Compiling the code and running it all at once was an option, but Gates explained: "We figured the line-by-line approach of an interpreter would be helpful to novice programmers since it would give instant feedback on their code, allowing them to fix any mistakes as they crop up."
Gates and fellow Microsoft co-founder Paul Allen famously spotted the Altair on the cover of the January 1975 issue of Popular Mechanics. The duo reckoned – correctly as it turned out – that the PC revolution was imminent, "and we wanted to get in on the ground floor."
It took two months to create the software, which Gates and Allen had pitched to MITS founder Ed Roberts as already existing. This was complicated by the need to compress the code into four kilobytes to allow Altair owners to run programs without needing to purchase extra memory.
"Extra memory for the Altair could easily cost more than the computer itself," recalled Gates.
The pair also lacked the Intel 8080 chip, on which the Altair ran, so Allen put together a program to simulate the chip on a PDP-10 mainframe, allowing the software to be tested without the actual target computer. Another friend, Monte Davidoff, developed the math package.
By today's standards, this version, later known as 4K BASIC, was somewhat limited. There wasn't much in the way of string manipulation, for example, and a subsequent version, 8K BASIC, added functions familiar to users of later home computers.
It was, however, good enough for MITS to license the software. Gates said: "This was a pivotal moment for Paul and me. Altair BASIC became the first product of our new company, which we decided to call Micro-Soft."
The source code is provided as a 157-page PDF of scanned fan-fold paper rather than as source in a convenient repository.. An annotated disassembly of Altair BASIC 3.2 can be found on GitHub.
"I still get a kick out of seeing it, even all these years later," Gates said. "Computer programming has come a long way over the last fifty years, but I'm still super proud of how it turned out." ®