For novel ideas about building embedded systems (both hardware and firmware), join the 30,000+ engineers who subscribe to The Embedded Muse, a free biweekly newsletter. The Muse has no hype and no vendor PR. Click here to subscribe.
BASIC at 50
Summary: BASIC was a gateway to great developers, not a development dead-end.
If any language ever got a bad rap it's BASIC. Edgar Dijkstra and others have famously claimed that a person reared on BASIC was forever damned by the experience. By that reasoning, a baby who dribbles food can never learn table manners, and the old-timer who was adept with analog oscilloscopes will be eternally baffled by the new world of the DSO. BASIC got a lot of people into software development. Some shouldn't have, of course; for others it seduced them into a career in professional software engineering.
My first programming experiences were not with BASIC. In high school I learned FORTRAN, and then moved on to Univac 1108 assembly language before picking up APL, LITHP, many other languages, and eventually BASIC. FORTRAN and assembler suffer from the same lack of structure that the original Dartmouth BASIC had so one would think they'd also be accused as injurious to a developer's development. And what could be a bigger blot on the software world than APL?
My first exposure to BASIC was around 1975 when we bought a couple of Altair 8800s. These arguably jump-started the personal computer revolution, though came into being long before the word "PC" existed. Thousands of serious developers and hobbyists bought the machines, often with a paper tape of Bill Gates' BASIC interpreter. It was very liberating to use an interpreter rather than go through the incredibly-painful process of compiling or assembling code. Even today every little change requires a tedious recompilation. In the 70s there were no hard disks on micros; even floppies were expensive and rare. Recompiling to paper tape or cassette decks ate enormous blocks of time. With BASIC one could type in a line of code, then "RUN". The edit/test cycle took seconds.
BASIC was the lingua franca of the 8 bit computer world. All of the machines sold in the late 70s and early 80s supported it, and in many cases it was built into the ROM chips. Often there was no OS; the machine booted to a BASIC interpreter. Even the vaunted IBM PC originally had the language in ROM.
Embedded development in the early days was almost always in assembly language, and I suspect there wasn't a manager on the planet who was happy about the low productivity it entailed and the completely cryptic end-product that only a pony-tailed engineer who never came in before noon could understand. A lot of people were looking for alternatives. A few C compilers (e.g., MANX C) were available in the early 80s, but it was not a popular language among 8 bit developers.
Everyone knew BASIC, so in 1983 I wrote a BASIC compiler - not interpreter - targeted at embedded applications. It was interactive and felt exactly like an interpreter; one entered code with line numbers. "RUN" compiled and started executing the code in less than a second. The compiler generated very tight code and even had built-in multitasking support. It ran under CP/M on 8080 and Z80 systems and comprised about 30,000 lines of assembly language. Multitasking meant all generated code and libraries had to be reentrant, so I hired a college kid to write a reentrant and position-independent floating point package, which was, given the 8080's architecture, quite an accomplishment.
Surprisingly it took off. Orders showed up, then steam-rolled in. It was startling to find checks from people I didn't know in the daily mail. I was working out of a bedroom in the house but couldn't handle the order fulfillment, so my wife quit her job to help. Eventually we moved into the basement as the upper two floors were filled with manuals, boxes, floppy disks and eventually employees. Later we rented space in an R&D park and set up more professional offices.
IBM stunned the market when they introduced their PC. I bought one outfitted with everything: two floppy disks, 128 KB of RAM, etc., which cost $7000. Customers were asking for a PC version of the compiler so I purchased a Z80 to 8088 assembly translator, which created awful, nasty code as the instruction sets were so dissimilar, and of course all of the code generation was incompatible. In a hectic couple of months I recoded it in 8088 assembly. If you had anything for a PC then it sold, and our BASIC profited from that frenzy. It didn't hurt that Jerry Pournelle was an early advocate who featured it in Byte Magazine.
Code generated by the compiler eventually was used at both Poles for research instruments, aboard the space shuttle and even in the nuclear submarine fleet. But embedded C started to gain adherents and the BASIC's demise was evident. The last updates were in 1988, but to this day I still get requests for new versions.
I read an awful lot of code our customers wrote in BASIC; some was pretty terrible but a lot was as carefully crafted as anything written in C today, within the constraints of the language, giving lie to the belief that BASIC makes for crummy developers. I'll bet a lot of readers got their start in computers with BASIC but today build world-class code.
What was your experience with BASIC? Do you feel it poisoned your abilities?
Published May 1, 2014