# 3.7.0 Release: BASIC¶

## History¶

Dartmouth professors John G. Kemeny and Thomas E. Kurtz had the idea that every student should have access to a computer. But in those days, batch processing was the law of the land. Programmers would fill out a coding sheet, then a keypunch operator would create a deck of punch cards. The cards were fed into machines, and hours later you might receive results from your program – or if you were unlucky, an error report.

Kurtz had heard about time-sharing systems from John McCarthy at MIT. Such a system would allow students to use the computer interactively via their own terminals. Kemeny managed to acquire GE-225 and DATANET-30 computers, and together with a small army of undergrads, they developed the Dartmouth Time Sharing System (DTSS).

Kurtz convinced the trustees that computing should be as widely available as the open stack library at Dartmouth, and so the system was made free for students to use. The system was released in the spring of 1964, and by 1968, there were about sixty Teletype terminals connected via phone lines, each hammering out up to 10 characters per second on fan-fold paper.

Its centerpiece was the BASIC programming language, designed as a friendlier alternative to ALGOL and FORTRAN. To reduce complexity, it had a small set of commands, one command per line. Line numbers were required, used for GOTO statements and for interactive editing. FORTRAN’s loops and conditionals were simplified into FOR and IF statements. BASIC was compiled directly into machine code, a process that often took less than a second.

There was some resistance among the faculty to the new machines, but the students dove in with gusto. Two hour-long lectures introduced students to BASIC programming. During their programming session at the terminal, they could automatically check their assignments with yet another BASIC program written by the faculty.

Students found creative uses for the computer, one writing a program to algorithmically check their music composition assignment. There were also the inevitable hacks and pranks and randomly-generated gibberish, often directed at fellow students or at the computer vendor, General Electric.

Thanks to the new INPUT keyword, which paused the program to ask the user for input, games began to appear on the network. Football and basketball simulations were popular, as well as “hot-seat” multiplayer games, later modified to play remotely over the regional Kiewit Network. These games would soon find their way to the new BASIC-compatible time-sharing platforms from DEC and HP, and then into various periodicals and books.

This era saw the beginning of several game genres: the cave explorer (Hunt the Wumpus), the procedural RPG (Super Star Trek) the space trading game (Star Trader) and the historical simulation (The Oregon Trail). Even the DTSS’s EXPLAIN feature might remind of you of the EXAMINE command in text adventures, given some of its snarky responses.

The next phase of BASIC began when Bill Gates and Paul Allen read about the Altair 8800 microcomputer in the January 1975 issue of Popular Electronics. They contacted the company and agreed to demonstrate a BASIC interpreter in a few weeks, having never seen an actual Altair unit in person.

Allen had written an Intel CPU simulator for a previous project, and he used this experience to develop an Altair simulator on a PDP-10. Using the simulator to test their code, the pair finished the 4KB BASIC interpreter on time, and flew the paper tape to demo in Albuquerque. BASIC booted up, and Microsoft was thus born.

Meanwhile, Microsoft licensed several variants of BASIC to Altair in exchange for royalties, and went on to do the same for the TRS-80, Commodore PET, Apple ][, MSX, and many other microcomputers.

Their dominance of BASIC lasted well into the PC/Windows era, with products like GW-BASIC, QuickBasic, QBasic, and Visual Basic. VB.NET, which is more-or-less a syntax alternative to C#, is still widely used in back-office applications. The Dartmouth BASIC bloodline survives in TrueBASIC, a commercial product.

These days, there are many modern hobbyist incarnations of BASIC, sharing the original core concepts of simplicity and fun. We’ve already integrated the Atari 2600 language batariBASIC into the 8bitworkshop IDE. New in this release is FastBasic, a BASIC interpreter for Atari 8-bit computers.

If you want to program like it’s the 1960s (or 1970s) you can read on and try our new vintage BASIC interpreter.

## Programming¶

OPTION DIALECT DARTMOUTH
10 PRINT "HELLO! LET'S PROGRAM IN BASIC."
20 INPUT "WOULD YOU MIND TYPING IN YOUR NAME";A$30 PRINT "THANKS, ";A$;"! THIS WILL BE FUN!"
40 INPUT "NOW TELL ME YOUR FAVORITE NUMBER";N
50 LET B=N^2
60 PRINT "THAT'S A GOOD ONE! I LIKE";B;"MYSELF."
70 PRINT "NICE MEETING YOU, ";A\$;"."
999 END


The original Dartmouth system required that a user press the ORIG button on the teleprinter, enter their user number, enter “NEW” or “OLD” problem, enter a problem name, then begin typing their program line-by-line. Afterwards, RUN would compile and execute the program, or give a list of errors to be corrected.

The 8bitworkshop IDE works a little differently. You can edit your BASIC program in the browser, and any errors are highlighted immediately when typing. When you make an edit and the program compiles successfully, your program is reloaded. If the program is already running, the IDE can often hot-load the program without restarting from scratch.

You can click on “Debug Tree” to inspect the program state, or highlight a variable name in the editor to see its value. There is also a new “Restart at Line” button that lets you re-RUN your program starting at a specific line. (Watch out for uninitialized variables, loops, and such.)

Note the OPTION DIALECT line at the beginning of the file. This is a non-standard BASIC construct that tells the compiler to recognize a specific variant of BASIC. This affects syntax, allowable keywords and functions, and print formatting. Older dialects will limit the editor to uppercase characters.

There is no CRT, so no graphics. Instead, we offer a teleprinter interface with the speedy performance of the IBM 1403 line printer. (It’s nearly silent, although you can ring its bell by outputting ASCII code 7.)