Making BASIC
Bill and Paul
It is a cold winter day in Boston. It's December of 1974 and Paul Allen was walking across Harvard Square to visit his friend Bill Gates when he noticed the new issue of Popular Electronics was out. He stopped at a kiosk (perhaps Out of Town News) and his heart started racing when he saw the cover. On the cover was the Altair 8800, described as the "World's First Minicomputer Kit to Rival Commercial Models". He fumbled through his pockets for 75 cents for the issue and raced to his friend's dorm, copy in hand.
Paul Allen knew computer technology continued to get cheaper and more accessible, and forsaw a time when computers would become cheap enough and small enough to buy and use in the home, and what he saw on the cover of the January 1975 issue of Popular Electronics magazine confirmed that.
The article, by MITS founder Ed Roberts, started out stating that "the era of the computer in every home -- a favorite topic among science-fiction writers -- has arrived!" This project was "the most powerful computer ever presented as a construction project in any electronics magazine." The article stated that some applications of this computer included being used as a scientific calculator, an IC tester, a digital clock, an autopilot, or even a time-share computer system.
But Ed Roberts knew his computer was powerful enough to run a higher-level programming language like BASIC, and as soon as the article appeared, he began receiving phone calls and letters from electronics and computer professionals and hobbyists offering to program a BASIC interpreter for the Altair. Paul Allen and Bill Gates also knew it would be possible for the Altair 8800 to run BASIC, and they called Ed Roberts as well, bluffing that they had already created a BASIC interpreter for the Intel 8080 CPU that formed the brain of the Altair.
Altair BASIC
So Bill Gates and Paul Allen set out to write a BASIC interpreter for the Altair. But they didn't program it on an Altair, as they couldn't get their hands on one. Even if they could, there was no OS, editor, or assembler available for them to code on. Instead, they wrote the 8080 machine language on one of MIT's PDP-10 mainframes, using a simulator of the 8080 and Altair 8800 that Paul Allen wrote.
It took about four weeks to have a functional BASIC interpreter, and then another four weeks to fix bugs, add features, and clean up the code so that it would fit on a 4,096 byte RAM board available for the Altair.
The BASIC programming language version that Bill Gates and Paul Allen wrote was styled after DEC BASIC-PLUS, which both were familiar with, having used it on the PDP-11 in high school and college.
Why BASIC?
FORTRAN and BASIC were the two most used and known higher level programming languages at the time, and BASIC had been used for a decade as a teaching language, so many computer-literate professionals and hobbyists were familiar with the language.
BASIC was created in 1963 by John Kemeny and Thomas Kurtz at Dartmouth College as a way to enable students in non-scientific fields to use computers. Before BASIC, people wanting to program computers had to understand machine language or a complex programming language like FORTRAN. Because of it's ease of use, BASIC began being used to teach computer programming courses. In more affluent high schools with teletypes connected to time-shared mainframes, kids were exposed to BASIC and starting writing software and sharing the source code.
Digital Equipment Corporation, who sold mainframe computers, had a version of BASIC for their systems. They marketed into the educational space, and to make it easy for educators and students, published software and books with programs written in DEC-BASIC, including 101 BASIC Games, compiled by David Ahl.
But there were other individuals and companies who also published books and newsletters with BASIC programs. One of the most famous was the Peoples Computer Company, which wasn't a company at all, but an informal group of computer enthusiasts and educators who wanted to bring the power of computers to individuals. They published books like "My Computer Likes Me" and "What To Do After You Hit Return..." which taught novices with no computer knowledge how to use a computer and program in BASIC.
This was all before the era of personal computers. Anyone buying one of these early BASIC books would have been typing in the programs on a teletype or "glass terminal" connected to a mainframe or minicomputer in a computer room. But when the first personal computers finally did arrive, BASIC was a natural choice as the programming language. It was small, simple, and had a ready source of programs and people who knew how to program in it.
The First Altair BASIC program
After Bill and Paul, with help from Monte Davidoff for the floating point routines, finished their BASIC interpreter, Paul flew to Albuquerque to load it on real Altair 8800 hardware for the first time. On the flight, Paul was thinking about how he was going to present their BASIC to Ed Roberts when he suddenly realized that they hadn't thought of how they were going to load the binary code on the punch tape in his briefcase onto the Altair. He knew that the Altair at MITS was connected to a teletype with a punch tape reader, but he didn't know how to get the Altair to read it. So he quickly wrote a small bootstrap program, whose job would just be to get the binary code on the punch tape into the Altair's memory. He wrote it just in time for the presentation with Ed Roberts.
Paul used the switches on the front of the Altair to key in the bootstrap program, and was relieved when the BASIC interpreter code on the punch tape successfully loaded into memory and he was greeted with "OK" on the teletype. Paul then typed the immediate command "PRINT 2+2" and Ed was beside himself that the teletype printed out "4". Finally Paul typed in the Lunar Lander program that was printed in one of those early BASIC computer books published and distributed by DEC, a compilation of games by David Ahl mentioned above called 101 BASIC Games. And so Lunar Lander was the first BASIC program typed in and run successfully on a personal computer.
Bill and Paul Weren't The Only Ones
While what became Microsoft BASIC is the first complete personal computer BASIC released, they weren't the only ones making BASIC. Because of the simplicity of the language, it wasn't especially difficult to write a BASIC interpreter. And so many other BASICs were made.
Steve Wozniak, having seen Microsoft BASIC run on the Altair at the Homebrew Computer Club, set out to be the first person to write a BASIC interpreter for the 6502 CPU. He was successful, and his BASIC became the standard BASIC shipped with the Apple I and Apple II computers. However, Steve's BASIC didn't have floating point support and so Steve Jobs made the decision to sign a contract with the struggling Microsoft to include Microsoft BASIC on the Apple II. This contract may have saved Microsoft.
Steve called his BASIC "GAME BASIC", and it was later called "Apple BASIC". However, once Microsoft started supplying Apple's BASIC, which was called "Applesoft BASIC", Steve's BASIC began to be referred to as "Integer BASIC", because of the lack of floating point support.
Tiny BASIC was a specification created by Dennis Allison after a call to action by Peoples Computer Company founder Bob Albrecht for an "free" and "open source" alternative to the proprietary Altair BASIC, and was sparked by a harsh letter from Bill Gates about people freely making copies of Altair BASIC's punch tapes. While programs and their sources had been freely shared before, this moment is often considered the beginnings of the open-source collaborative software development model and it's permissive licensing. Level I BASIC on the original TRS-80 was one of the more famous implementations of Tiny BASIC.
And so the "Holy Trinity" of personal computers from 1977 had three different BASICs: the PET had Microsoft BASIC, the Apple had Steve Wozniak's Apple BASIC, and the TRS-80 Model I had a version of Tiny BASIC. And in the few years following, as other computers came to market, there were other versions of BASIC. Some of the most notable are Atari BASIC, TI BASIC, Sinclair BASIC, and Acorn Systems BASIC, which became BBC BASIC.
I Was A BASIC Kid
I was in fourth grade when my Dad brought home our first personal computer. It was an Ohio Scientific Instruments Challenger IIP, with 8K and Microsoft BASIC. I learned programming by typing in programs first from "BASIC and the Personal Computer" written by Thomas Dwyer and Margot Critchfield and re-published by OSI, and later from magazines like Byte and Creative Computing. I moved on to a VIC-20, Commodore 64, and then to C and Pascal, but the ease of learning programming with BASIC is the reason I became a computer scientist and still love computers to this day. I'm still amazed that as a kid in high school, I wrote my own Bulletin Board System (BBS) software in BASIC on the Commodore 64. It just goes to show that BASIC was a real programming language, and it taught an entire generation how to program personal computers.
Making BASIC Today
BASIC is still relevant today. All the programs and source code for games and applications still exist, and it's still an easy way to learn programming. But for our case, it's a simple enough programming language that we can go through the same process Bill and Paul and so many others did in creating BASIC interpreters in the late 1970s and early 1980s and make our own BASIC interpreter. This time, it will be on the modern equivalent of the 8-bit CPUs of that day -- the ARM Cortex-M series. Stay tuned.