The venerable BASIC programming language is 53 this week.
(If you reverse the decimal number 53, you get its hexadecimal equivalent 35 – and there aren’t many two digit numbers [*] with that property!)
Strictly speaking, BASIC already existed by the start of 1964, but it was on 01 May 1964 that Dartmouth College in New Hampshire, USA, made it available interactively via its timesharing terminals.
By “interactively”, we mean that you could sit down at a terminal, GOTO the BASIC environment and start programming as you went along, trying out commands one at a time, adding them into your program, running it, fixing bugs, running it again, tweaking it, saving it…
…and then coming back later on and picking up where you left off.
If you’re looking for quasi-religious moments in computer programming, this was a bit like rending the veil of the temple in twain.
Dartmouth BASIC, as it became known, was a huge step in breaking down the barrier between those who used computers and the white-coated clerics and acolytes who operated them behind glass screens and double-door airlocks.
The new language was called BASIC because it was meant to be easy to learn, easy to use, and effective.
Indeed, BASIC was even stretched out into a backronym to convey the message that this was computer programming for everyone, not just for a high priesthood: Beginners’ All-purpose Symbolic Instruction Code.
You no longer needed to learn an unforgivingly esoteric language like FORTRAN, or a verbosely Joyceian beast like COBOL, or a robotically blocky dialect of ALGOL.
You didn’t need to punch your program onto 80-column cards or paper tape and hand it in through a grille at the abbey gate, or to write it out by hand in pencil on coding sheets and put it in a pigeon hole where someone else would type it in for you.
You didn’t even have to come back later to find out whether your program had run properly, or run at all, or even compiled successfully in the first place.
This ritualistic batched mode of operation explains why early COBOL compilers would do crazily unsafe things like blindly ignoring catastrophic errors and ploughing on anyway – leaving you with a worrying cascade of build-time warnings like INCOMPLETE STATEMENT, PERIOD ASSUMED
, or SYNTAX ERROR, STATEMENT OMITTED
, or THIS WON'T WORK, BUT WHY STOP NOW?
The hub of the programming wheel turned so slowly that it was worth seeing what your code would do anyway, even after you knew it was glaringly incorrect. As the compiler said, WHY STOP NOW?
Dartmouth BASIC let you program as you went along, and though early BASIC applications must be considered to be miles away from today’s so-called literate programming, they were much more readable than most other programming languages of the day.
For an applied mathematician, a statistician or any other scientist with data to make sense of, BASIC made it easy to get useful results without climbing a learning curve that was as steep as any cliff.
Here’s an example, adapted from a fiftieth-anniversary article about the Dartmouth BASIC phenomenon:
1000 PRINT "0.0 0.1 0.2 0.3 0.4" 1010 PRINT "-+---------+---------+---------+---------+-" 1020 FOR X = -2.25 TO 2.25 STEP 0.25 1030 LET Y = EXP(-(X*X/2)) / SQR(2*3.142) 1040 LET Y = INT(100*Y) 1050 PRINT " "; 1060 FOR Z = 1 TO Y 1070 PRINT " "; 1080 NEXT Z 1090 PRINT "*" 1100 NEXT X
Try to figure out what it does and how it works – the formula and the way we’d visualise it today are shown below.
In fact, you can see for yourself what it does by copying-and-pasting it into a suitable online BASIC emulator, such as the one we used at a website called Quite BASIC.
In case you are wondering, the first LET Y
statement does the main normal distribution calculation for the various values of X
, which peaks at just under 0.4 when X = 0.
The second LET
therefore scales the Y
value up to a maximum of 40 (100 x 0.4), and 40 spaces just happen to fit nicely across the width of the output window in the Quite BASIC emulator.
(40 columns was the usual screen width of early home computers, with lower-case letters a luxury offered only by the more expensive models.)
The nested FOR Z
loop prints Y
spaces (the trailing semicolon tells the PRINT
inside the loop to stay on the same line) and the final PRINT
statement positions a *
as a graphical dot.
This may seem tame, or even feeble, by today’s standards, but stop to think how unbelievable this sort of simplicity and flexibility must have seemed more than half a century ago.
The idea that you could print a graph in moments to visualise an equation was amazing; the fact that you could interactively tweak parameters like the range of X
on line 1020
or the scale of Y
in 1040
and then try running the program again right away was all but revolutionary.
BASIC today
Sadly, BASIC was a product of its age, and was quickly usurped and trampled by all the upstart languages that came later – by the Modulas, the Oberons, the Erlangs, Haskells, Pascals, Perls, Pythons, Bashes, Rusts, Swifts and Clojures; by the Valas, the Scalas and the Befunges; by B, C, C++, D, F#, J, m4, R, S, T and, last but not least, Z (which is a notation, if the truth be told, but it’s a nice one to end on).
By the year 2000, BASIC was dead and buried, cast away into the dustbin of the last millennium along with shag-pile carpets, shoulder pads, mullets and Imperial weights and measures.
Hang on…
…that’s not right!
BASIC isn’t dead – not by a long shot: it’s alive and well, as a look at any Office document with macros in it will show you.
Word and Excel macros are written to this day in VBA, short for Visual Basic for Applications.
Although VBA looks very grown up compared to the stripped down syntax of 1960s-style Dartmouth BASIC, there’s no mistaking that it’s BASIC at heart.
Sadly, what’s good for the goose is good for the gander, and cybercrooks still love BASIC, too.
The first-ever ransomware, back in 1989, was the AIDS Information Trojan, written in Microsoft’s GWBASIC dialect; fast forward nearly 30 years, and we’re still seeing VBA used as a distribution vector for ransomware and other malware attacks today.
Plus ça change, plus c’est la même chose.
[*] If you use Quite BASIC, this should do the trick, old-school style:
10 FOR X = 10 TO 99 20 LET H = INT(X/10) 30 LET L = X - H*10 40 LET N = L*16 + H 50 IF X <> N THEN 90 60 LET R = L*10 + H 70 PRINT X + " IN DEC IS " + R + " IN HEX" 80 LET T = T + 1 90 NEXT X 100 PRINT "FOUND " + T + " OF THEM"
Mahhn
In high school 1982, our only computer class was programming in basic on a Tandy. Class projects were to easy, so we made a couple simple games. The prior year’s typing class actually came in handy. I think apple came out with the first color display that year too. Lots and lots of If, Goto, Then, Print…
Vog Bedrog
Ah, the old school computer lab days! We had C64s with awful amber monitors. Didn’t do a lot of BASIC programming (I did more of that at home), but did a fair bit with LOGO – now *there’s* a dead language!
Paul Ducklin
Turtle graphics. Very Zen/Star Wars: “Be the turtle.” (For those who don’t know, the turtle was a metaphor for the graphics cursor. Instead of computing X,Y co-ordinates and plotting dots at the right point, you had control over the direction and movement of the turtle, which could lay down a trail of colour as it went, or not. So you drew images by “walking” the turtle over the screen, imagining the path you would take if you were the turtle.)
What I always wondered was, “Why a turtle?” A turtle goes in water, so feels more like a 3D cursor, given that it can vary its depth at will. Why not a tortoise? Or, indeed, any ambulatory land animal, e.g. ant, stoat, zebra, triceratops, mongoose, echidna. Why a *turtle*?
rtobie
Why a turtle? Because an English roboticist and cybernetician by the name of W. Gray Walter in a book written back in the 50s described a small self guiding robot he called a turtle. It looked rather like a turtle. It could turn left or right and move forward (and maybe backwards) and it could remember it’s path and so retrace its steps back to its home base plate where it could recharge its battery when the current got low. Seymour Papert in his Logo language took this “metaphor” of the turtle and used it for a graphical on screen and/or on floor device which you could program by telling it to turn left or right and move forward. Those were the basic commands. Thus Turtle Graphics was born. So, why a turtle? Because the basic gizmo on which this concept was based looked rather like a turtle.
Paul Ducklin
I’ll buy that! It’s rather like why a mouse is called a mouse. (That reads back like a rather peculiarly pointless thing to say, but I trust you know what I mean.)
Jim
In the fourth paragraph, it says “… sit down at a terminal, go into the BASIC environment and …”. Shouldn’t that be “…sit down at a terminal, GOTO the BASIC environment and …”?
:)
Wonderful trip down memory lane. Thanks!
Paul Ducklin
Edited it as suggested, thanks :-)
Jim
Sorry, my post was a joke. I must be too old to write my own humor.
Paul Ducklin
I put it into the article because it was a joke, not because it wasn’t :-)
Jim
Whew! That’s a relief. Thanks!
Frank Virginia
Back in the late sixties I used to run a Basic course for scientists and engineers at various customer locations. They loved it and I had waiting lists for new sessions. My enemy was always the person in charge of the leased IBM computers that had to be used before Basic began. After 2 or 3 sessions the engineers would develop there own programs in Basic and the Main Frame IBM was used just for the final run. They saved time and money and companies paid monthly charges to time-sharing services.
Wilbur
I remember the nights spent in the basement of the old engineering building trying to get a Fortran IV program to plot the first few seconds of electrical transients during startup of a very large electric motor. Punch the cards, turn in the deck to the cranky old guy in the basement office, wait for him to use his golf cart to take the cards to the computing center, then wait some more for him to pick up my printouts when he took the next batch of cards over… and then getting a small stack of fanfold paper with meaningless errors noted… but no plots. Graduation finally came but the plots never did…
I graduated in 1967 and the next year the new engineering building opened and a friend told me the punch card machines in the basement were gone… they had installed interactive terminals and programs were run on submission. No more waiting for the cranky old guy to make the run on his golf cart, results were available immediately. I cried.
Some years later I had a shiny new PC clone running MS-DOS 3.1 (MS-DOS 3.1, not Windows 3.1) and a copy of BASIC at home. It dawned on me that I could finally finish that program, if I had only kept the original problem statement, but I hadn’t, since I didn’t expect to have access to a computer again. I cried again.
People have no idea…
R. Dale Barrow
A modern terminal in 1964 was the Teletype ASR 33. It thundered along at 10 characters per second. All in a monospace font. Digital Equipment Corporation PDP 8s were the rage. The iconic IBM System/360 mainframe had yet to be shipped. Touch-Tone telephones were current tech. BASIC came at just the right time.
I remember them all!
Andrew Ludgate
Wow… I didn’t get on a DTMF network until around 1989… 1964 was still back when most local loops would open up to the 2600Hz whistle.
Paul Ducklin
In the Anglo world, the 2600 thing didn’t work. But in the pulse-coded era, you could – or so I am told – tap-dial. One tap for 1, two for 2, up to ten for 0. Some office phones even had a “flash on hook” button, which could be used to “dial” without the hit-and-miss business of tapping at the receiver rest. (Phones that were for incoming calls only were often “secured” against making outbound calls simply by installing an instrument with no dial, only a receiver.) You could – or so I am told – practise your technique using the speaking clock, which in many countries has a handily short number, e.g. UK = 123, AU = 1194, ZA = 1026, and is always there to answer.
Apparently, in the days of overhead wiring on telegraph poles, natural causes such as heavy winds, branches bashing the cable and so on, could easily introduce spurious pulses, and the digit 1 was the most likely to be “tap-dialled” by mistake. And, apparently, that’s why the emergency number in most countries is not 111, which is the easiest and quickest three-digit number to rotary-dial when you are in a panic. The next most logical sequence is 000, given that the “0” hole is easy to locate, and if you keep your finger in the hole you can reliably dial it repeatedly. Indeed, in Oz, the emergency number is triple-zero for this reason.
In the UK, “0” was already used for operator connections, so 999 was chosen instead. The US ended up with 911, presumably so that the “9” would be hard to dial by mistake, while the “11” simplified and speeded up dialling the rest of the number, given that the rotor moves a much shorter distance to dial “1” than “9”. Of course, 911 introduces the risk that in the dark you would have to find the “9” hole, dial it, and then and then move your finger in a panic to the “1” hole to finish the dialling. But 911 seemed to work out just fine in North America.
Nomphra
Tap-dialling! Didn’t realise that was a “thing”, but I remember figuring this out as a young boy. Curious as to why, if you tapped the telephone “hook” really quick, the dial tone would disappear. Then, putting together the clicks you would hear as you rotary dialled, I figured out “tap-dialling”. I know for a long time in the UK you could “pulse dial” as well as “tone dial”. Wonder if they finally did away with the old legacy method. Confess I haven’t tried it in years! :P
Paul Ducklin
I am not sure if the UK local loops still support pulse dialling. I suspect not…
…if you have an old rotary dial phone (if “rotary dial” is not a tautology) you could give it a try.
I know there are kits (I have heard of an Arduino project for this purpose) that convert old phones to DTMF so you can not only use them with PBXes and so on for a hip retro vibe, but also use the dial to “type in” voicemail prompts or do credit card payments :-)
Not sure how you dial * or # but perhaps there are hidden buttons for those, or maybe you can tap them out!
Nomphra
Tried it last night on my house phone (just an ordinary tone-dial only). Hit the hook once, dial 1. Hit it twice, dials 2, etc. It still works!! I successfully called the speaking clock (123). Confess, I was surprised it was still supported!
Nomphra
Suspect # and * would be tone-dial only keys, as they were only introduced (AFAIK) when digital technology started to take hold.
Paul Ducklin
Yes, along with the ABCD row in the DMTF set.
Thing is, if you want to use a rotary-dial phone in real life today, you’d might want some sort of way to trigger your special pulse-to-tone converter gizmo to generate # and * nevertheless, because so many services require you to be able to produce the right tones…
Jim
Be very careful about tap-dialing on modern phones. If the phone line is digital, there’s enough current to seriously injure someone. Wearing a glove or using insulated wire should be enough to keep from getting shocked.
Also, I THINK that you dialed two pulses for 1, three for 2, etc. It’s hard to remember that far back. Makes me wonder if they really did it in Wargames, or if it was all just movie effects.
zengator
1978. Sixth grade. They wheeled in a 20″ tv (HUGE!) and showed us how you could make a computer count to 100 by 10s–just like the lines in the program were numbered.
I was hooked that day and have never lost the joy of seeing my code (which is still pretty basic, but hey, it works, so why stop now?) complete successfully.
Steve
Thanks, you made my day with reminiscence.
Laurence Marks
Duck wrote “The venerable BASIC programming language is 53 this week.”
And coincidentally, ERROR 53 in every version of Microsoft BASIC from BASIC.COM and BASICA.COM shipped with DOS 1.0 through the latest VBA in Office 2016 means “File not found.” Sort of a metaphorical HTTP 404.
jgh
That’s not an online BASIC emulator, it’s an online BASIC interpreter. You can’t emulate software, as soon as you attempt to emulate software, you are automatically EXECUTING it. Is a C compiler on Windows a C emulator? Is MSWord on MacOS an MSWord emulator?
Paul Ducklin
Hmmmm. Maybe. I am happy with calling it an emulator because it’s a website pretending to be a computer that can run BASIC directly, rather like early home microcomputers did. If you want to call it a BASIC interpreter, you can do that too. How about we call it a browser-based emulator that runs a BASIC interpreter?