Dartmouth BASIC is the original version of the BASIC programming language. It was designed by two professors at Dartmouth College, John G. Kemény and Thomas E. Kurtz. With the underlying Dartmouth Time Sharing System (DTSS), it offered an interactive programming environment to all undergraduates as well as the larger university community.
|Designed by||John G. Kemény, Thomas E. Kurtz|
|OS||Dartmouth Time Sharing System|
|Cf. list of BASIC dialects|
Several versions were produced at Dartmouth, implemented by undergraduate students and operating as a compile and go system. The first version ran on 1 May 1964, and it was opened to general users in June. Upgrades followed, culminating in the seventh and final release in 1979. Dartmouth also introduced a dramatically updated version known as Structured BASIC (or SBASIC) in 1975, which added various structured programming concepts. SBASIC formed the basis of the ANSI-standard Standard BASIC efforts in the early 1980s.
Most dialects of BASIC trace their history to the Fourth Edition, and left out more esoteric additions like matrix math. In contrast to the Dartmouth compilers, most other BASICs were written as interpreters. This allowed them to run in the limited main memory of early microcomputers. Microsoft BASIC is one example, designed to run in 4 kB of memory. By the early 1980s, tens of millions of home computers were running some variant of the MS interpreter. It became the de facto standard for BASIC, which led to the abandonment of the ANSI SBASIC efforts. Kemény and Kurtz later left Dartmouth to develop and promote a version of SBASIC known as True BASIC.
Many of the early computer games of the mainframe computer era trace their history to Dartmouth BASIC and the DTSS system. A selection of these were collected, in HP Time-Shared BASIC versions, in the People's Computer Company book What to do after you hit Return. Many of the original source listings in BASIC Computer Games and related works also trace their history to Dartmouth BASIC.
John Kemény joined the mathematics department of Dartmouth College in 1953 and later became its department chairman. In 1956 he gained access to an IBM 704 via MIT's New England Regional Computer Center efforts. That year, he wrote the DARSIMCO language, which simplified the programming of mathematical operations. He was aided by Thomas E. Kurtz, who joined the department that year.
DARSIMCO was forgotten when the first FORTRAN compiler was installed on the machine in 1957. The arrival of FORTRAN instilled an important lesson. Kurtz, having been indoctrinated that FORTRAN was slow, spent several months writing a program in 704 assembler which had taken up about an hour of CPU time to debug and still wasn't running. Giving up, he rewrote it in FORTRAN and had it running in five minutes. The lesson was that high-level languages could save time, regardless of their measured performance.
In 1959, the school received its first computer, the drum-based LGP-30. One student wrote a FORTRAN-inspired language called DART for the machine. This led to an effort to produce an ALGOL 58 compiler, turning to ALGOL 60 when that definition was finalized. Writing the compiler was difficult due to the very small memory size, 4 kB in modern terms, and was extremely slow, based on the drum speed of 30 rpm. Nevertheless, they were able to produce a functional cut-down version known as ALGOL 30.
Further development produced SCALP, the "Self-Contained Algol Processor", a one-pass compiler that was ready to run the compiled program as soon as the punch tape finished reading in the source. This compile-n-go style operation would later be used by BASIC.
In 1962, Kemény and student Sidney Marshall began experimenting with a new language, DOPE, for Dartmouth Oversimplified Programming Experiment. This used numbered lines to represent instructions, for instance, to add two numbers, DOPE used:
5 + A B C
Which meant "on line 5, perform an addition of the values in variables A and B and put the result in C". Although somewhat cryptic in layout, the basis for the future BASIC language can be seen. In addition to basic mathematical operations, the language included SQR, EXP, LOG, SIN and a simple branching construct.
Computing in liberal arts
Kemény and Kurtz agreed on the need for programming literacy among students outside the traditional STEM fields; only 25% of the students at Dartmouth took STEM-related courses, but some level of mathematics was used in almost every field. Moreover, as computers became more important in society, they wondered "How can sensible decisions about computing and its use be made by persons essentially ignorant of it?"
Kemény later noted that "Our vision was that every student on campus should have access to a computer, and any faculty member should be able to use a computer in the classroom whenever appropriate. It was as simple as that." But doing so would be largely impossible given what they had to work with; the turnaround on a typical SCALP run was about 15 minutes, and the languages were far too difficult for non-STEM users to use for basic tasks.
It wasn't simply the complexity that was a problem, it was the entire concept of the batch process. Students would prepare their programs on punch cards or paper tape, submit them to the computer operators, and then at some future point receive their output, often to find there was an error and the entire process had to be repeated. As they later put it, "If it takes on the order of 1 day for one try, the student will either lose interest or forget what the problems were. At best, he will waste time standing around waiting for the day's results to appear."
In 1959, due largely to Kemény's reputation as an innovator in math teaching, the department won an Alfred P. Sloan Foundation award for $500,000 to build a new department building.
Developing the concept
During a 1961 visit to MIT, they were introduced to the PDP-1 and its recently completed experimental time-sharing operating system. John McCarthy asked Kurtz why they didn't use time sharing for their efforts to bring computing to the masses. Kurtz later told Kemény "we should do time sharing", to which Kemény replied "OK". The arrival of the Teletype Model 33 teleprinter using the newly introduced ASCII over telephone lines solved the problem of access; no longer would the programmers have to submit the programs on cards or paper tape. All that was needed was a new machine that was fast enough to host a time-sharing system, and a simple language for the programmers to use.
When the topic of a simple language began to be considered seriously, Kemény immediately suggested writing a new one. Kurtz was more interested in a cut-down version of FORTRAN or ALGOL. But these languages had so many idiosyncrasies that Kurtz quickly came to agree with Kemény. Over time, four key elements emerged; the system would use time-sharing, a new language would be needed, to get users onto the system new courses would introduce programming as an adjunct to other subjects, and finally, the terminals would be open to all users.
The project officially started in September 1963. The goal was to develop the language and operating system on an off-the-shelf computer. In early 1964, two grants from the National Science Foundation, one to develop the time-sharing system and another the language, along with educational discounts from General Electric led to the purchase of a GE-225 computer. This was paired with the much simpler Datanet-30 (DN-30) machine and a hard drive connected to both machines in order to share data.
The system would work by having the DN-30 run the terminals and save the work to the disk. When the user typed
RUN, the GE-225 would read that file, compile it, run it, and pass back the results to be printed on the terminal. This combination of machines was later known as the GE-265, adding their model numbers. GE built about fifty additional examples of the GE-265, many for their service bureau business. GE referred to these as their Mark I time-sharing systems.
In the summer of 1963, pending purchase of the computer, GE provided access to one of their GE-225s. Kemény began working on a prototype compiler. Students Michael Busch and John McGeachie began working on the operating system design that fall. Both the language and the OS were extensively modified during this period, although the basic goals remained the same and were published in a draft form that November.
The machine arrived in the last week of February 1964, was operational by mid-March, and officially handed over on 1 April. By that point, the operating system design was already well developed. Most of the student programmers working on the operating system did so for 50 hours a week, in addition to their normal course load. The language was developed in parallel on borrowed time on another 225 machine. The OS was completed in April, and the entire system running on three Model 33 terminals was ready by the end of the month. John Kemény and John McGeachie ran the first BASIC program on 1 May 1964 at 4 a.m. ET.
PRINT 2 + 2
Over the next month the system was tested by having a numerical analysis class test programs on the system. During this period, the machine remained running properly for an average of five minutes. However, the problems were rapidly addressed, and in June it was decided to increase the number of terminals to eleven. It was around this time that a faster GE-235 replaced the 225. By the fall, 20 terminals were in use.
One of the original goals of the program was to work programming into other coursework. This was a success, but it put considerable strain on the system and it became clear that it had no room for future growth.
In 1965, the team approached GE for support with ongoing development. In September, Vice President Louis Rader offered the new GE-635, which ran approximately 10 times as fast and included two CPUs. Additionally, a second DN-30 would be added to handle more lines, enough for 150 simultaneous users. To house it, a larger facility would be needed than the basement of College Hall where the 265 was running. Peter Kiewit, Class of '22, along with additional support from the NSF, led to the construction of the Kiewit Computation Center, which opened in December 1966.
While waiting for this machine to arrive, in the summer and fall of 1966 a GE-635 at the Rome Air Development Center was used to develop MOLDS, the "Multiple User On-Line Debugging System". The GE-635 was operational in early 1967, and using MOLDS the new operating system was fully functional in September, at which time the GE-265 was sold off.
GE provided the machine for free for three years as part of a wider agreement under which Dartmouth would develop new versions of BASIC while GE used it to develop a new release of their version of the operating system. This collaboration proved to be a success; GE began deploying these machines as their Mark II time-sharing systems, and by the end of the decade they were one of the largest time-sharing vendors in the world.
When this "Phase I" system became operational, the Dartmouth team began development of "Phase II", the ideal operating system. This was installed in March 1969, and changed its name to the Dartmouth Time Sharing System shortly thereafter. When the three-year period was up, GE gifted the machine to the university. Although the teams remained in contact, and several good-faith attempts were made to continue the relationship, little further collaboration occurred and the partnership officially ended on 20 September 1972.
Expanding user base
A review in 1968 noted that 80% of the students and 70% of the faculty was making some use of the system. By this time, hundreds of terminals were spread across the campus, from the hospital to the business school. 57% of the CPU time was used for coursework, 16% for research, and the remaining 27% for "recreational use". In contrast to most sites where games were banned, or at least during business hours, Dartmouth actively encouraged users to play games as a way to get hands-on use and overcome the awe of the machine.
Time-sharing was a major area of research in the 1960s, with many in the computer industry predicting that computing power would become inexpensive and widespread. This was most famously stated by John McCarthy, who said "computing may someday be organized as a public utility just as the telephone system is a public utility."
With BASIC, such services became far more accessible to end-users whose tasks would take too long to code for them to be suitable for solving on a computer. This led to a number of manufacturers who introduced computers specifically designed for this market of users who wanted to solve small or medium-scale tasks and were not as worried about outright performance. In particular, two machines aimed directly at this market became the "most widely used small time-sharing systems ever developed".
The HP 2000 ran HP Time-Shared BASIC, a combination of a BASIC and a time-share operating system almost identical to the DTSS setup. The system supported up to 32 simultaneous users, using a low-end HP 2100 CPU to run the terminals in the same fashion as the Datanet-30 of the original GE-265 setup, while the programs ran on a higher-end model of the same machine, typically differing in that it had more core memory. HP's BASIC used a semi-compiled "tokenized" format for storing programs, which improved loading times and meant "compiles" were zero-time.
Digital Equipment Corporation took a similar approach, offering their existing PDP-11 line with the new RSTS/E operating system and BASIC-PLUS. BASIC-PLUS more closely followed the Fifth Edition, including the
MAT commands, but was implemented as a pure interpreter as opposed to the Dartmouth compiler or HP's tokenized format. It also included a number of control structures following the JOSS model, like
PRINT I IF I > 10. Tymshare SUPER BASIC also supported JOSS-style structures and matrix math, but retained the original compile-and-go operation.
Practically every vendor of the era offered some solution to this same problem, although they may not have been so closely similar to the original. When Kurtz began considering the formation of an ANSI standard for BASIC in 1973, he found that the number of time-sharing service bureaus with BASIC available was greater than any other language. Unfortunately, this success was also a problem; by that point, there were so many variations that a standard seemed impossible.
Games in BASIC
Kemény actively encouraged games on the DTSS platform, and considered it to be one of the major reasons for the success of the DTSS system. More than that, he was almost certainly the author of one of the earliest games on the platform. Although he did not take credit for it, Kemény later referred to FTBALL by stating it "was written on Sunday after a certain Dartmouth-Princeton game in 1965 when Dartmouth won the Lambert trophy. It’s sort of a commemorative program." The game in question was a stunning upset, Princeton University was heavily favored.
As the system expanded, especially after the addition of string handling in BASIC, the DTSS system became a major platform for the development of many text-based games. In the early 1970s, the People's Computer Company began publishing these in their magazine, typically converted to the more widely available HP BASIC. Many of these listings were collected in their 1975 book, What to do after you hit return. Although these are published in HP BASIC form, the majority of them trace their history to either DTSS or the Lawrence Hall of Science in California where a similar machine was set up, known as DECISION.
A more famous collection is BASIC Computer Games of 1978, where about half of the programs in the book were either written at Dartmouth, including another by Kemény, Batnum, or more commonly, one of the many high schools that were connected to it after 1968. A particularly prolific high school was Lexington High School in Massachusetts but many other schools appear as well. A number of the programs do not list their original locations, but come from authors that were likely connected to the system through a school or public projects like Project SOLO.
The original version, retroactively known as version one, supported the commands
REM. It included basic math instructions, +, -, * and /, as well as the up-arrow for exponents "...since on a teletype typewriter it is impossible to print superscripts." In modern varieties, the up-arrow is normally replaced by the "hat" character, ^. Exponents took the absolute value of the number before calculation, so to calculate
-X^3, one had to use
X*X*X. There was a further problem in the exponent function that treated
(-X)^2 as opposed to the correct order of operations
-(X^2), which was not corrected until the third release. The INT function always truncated towards zero.
The language had a number of idiosyncrasies of its own. In contrast to later versions, the
LET command was required on all statements lacking another command, so
10 A=5*5 was not valid in this version. The
PRINT "output a value" A was valid. A somewhat hidden feature was that all variables were capable of representing arrays (vectors) of up to 10 elements without being declared that way using
Additionally, due to the GE-235's word size being 20-bits and using a six-bit character code, the language enshrined the use of three-letter function names because that allowed the storage of three six-bit characters in a 20-bit word (using 18 bits). This is why BASIC functions are three letters, like
VAL, something that remained in the many varieties of the language long after they left the GE-235.
Second Edition, CARDBASIC
The Second Edition of BASIC, although not referred to such at the time, only made minimal changes. Released in October 1964, it added the semicolon, ;, to the
The October version also included a separate definition for CARDBASIC, which was simply a version of BASIC for use on card-based workflows. CARDBASIC was almost identical to the interactive version, with the exception being that it did not include the zero-based arrays. More important to the language's future, CARDBASIC added the
MAT commands that worked with numerical matrixes. CARDBASIC was not developed further, as the entire idea of BASIC had been to be interactive.
The Third Edition, released in 1966 and the first to use the "edition" naming, was the first designed specifically with the intent of running on the new GE-635 computer which was due to arrive shortly. This version includes the
MAT functions from CARDBASIC, although they now allow for a subscript of 0.
SGN function returned whether the enclosed variable was positive or negative, while
RESTORE was added to "rewind" the position of
READ/DATA. The exponentiation problem was fixed, so
-X^2 would be interpreted as
-(X^2). Additionally, the
INT function was changed to be a true floor, as opposed to trim-toward-zero, which allowed rounding to be implemented with
The major change in this version was the new
INPUT statement, which allowed the user to type in numeric values, making the language truly interactive during execution for the first time; previously the only control one had during execution was to type
STOP in the monitor. Additionally, the system now allowed, and encouraged, loops to be indented, a feature that was not seen on most other versions of BASIC.
The Third Edition remained in use through the GE-235's lifetime into the fall of 1967. However, as plans were made to receive the GE-635, an experimental version was created on the 635 in the spring of 1967. This version was a partnership between GE and Dartmouth, with GE contributing a new operating system as well as a number of features of BASIC from their own Mark 1 BASIC efforts.
This version, initially published as a supplement to the Third Edition, added the
RANDOMIZE command to "seed" the
RND function, and the
ON...GOTO "computed goto" that closely matched the similar feature in FORTRAN. This version also allowed
ON...THEN, arguing that
IF...THEN did not require the
GOTO so the same format should be allowed here. The new
TAB function allowed the printing to be moved to a given column, from 0 to 74.
Two major additions were made during the development. The first addition was string variables, along with changes to the
READ/DATA statements to allow strings to be stored in them and the
INPUT statement to read them in interactively. One feature of the string system was that trailing spaces were deliberately ignored in comparisons, so that "YES" and "YES " were considered equal. This was later realized to be a grave error. The other major change was to once again change the
MAT to be 1-based; one could use the 0th index, but it would normally be ignored by the various commands.
The official Fourth Edition did not appear until 1968. This included the ability to define multi-line functions with the
DEF command, and the powerful
CHANGE statement that treated strings as arrays of characters to allow per-character operations without having to loop over the string.
The major change was the introduction of file handling. Previously any pre-defined data that had to be used in the program had to be placed in the
DATA lines and then read in one-at-a-time using the
READ command. This extension allowed files to be accessed and read in a similar fashion. The
INPUT command could now be used to read a single item from a file, while
READ could now be positioned anywhere in the file with the
RESET command, while
WRITE would write at that location. The current location was returned by the
LOC function, and the file length by
LOF. One could also test if you were at the end of the file during sequential reads using the
IF END THEN....
Another major change was the ability for one BASIC program to call another using the
CHAIN command, and pass variables to it using the
COMMON list. It was later realized that this basic concept had a number of problems, but it was nevertheless used to write some large programs.
Numerous more minor changes were also added. Among these were two-dimensional string arrays, as opposed to one-dimensional in the previous version, as well as the ability to use the
DEF to define string-based functions rather than just mathematical. New system-oriented functions included CLK$, DAT$ to work with times and dates, TIM which returned the elapsed time, and USR$ which returned the user number, what would today be the username. New string functions included LEN, STR$, VAL, ASC, which are common in modern BASIC dialects. The ' as a short form for
REM also appeared in this version.
Work on the Sixth Edition began in the fall of 1969, before the Fifth Edition was finalized. In contrast to the previous versions, where the specification documents were based on whatever changes had been made to the compiler, for the new version a complete specification was written beforehand. This version was worked on by Kemény and Kurtz, as well as several former students who returned as faculty; Stephen Garland, John McGeachie, and Robert Hargraves. It was allowed considerable time to mature, with a beta version running for three months during the summer of 1971, before it was finally released on 21 September 1971. As a result of giving the design time to mature, it was, as Kurtz described, "probably the best-designed and most stable software system Dartmouth has ever written."
One of the more major changes was the replacement of the earlier
CHAIN concept with the much better defined
CALL, which operated in a fashion similar to
GOSUB but referring to a function name rather than a line number. The functions were defined using
SUB...SUBEND, and allowed arbitrary parameters to be passed in as a part of the call, rather than using the
COMMON system. Another major change was to use file handles (numbers) created with the
FILE command, which is similar to the
OPEN found in most modern BASICs. New string functions included the
SEG$ to return substrings in a fashion similar to the
MID$ found in MS-derived BASICs, the
POS that returns the location of one string inside another, and the & for concatenation.
PRINT USING provided formatted output in a fashion somewhat similar to FORTRAN.
The Seventh Edition, released in 1978, was the first update to the standard in many years, and in many ways is the most radical. Most of the changes were further elaborations to the system for calling external programs and "overlays" that allowed a program to be broken up into parts. In this version,
SUBs sharing a single file shared data between them, providing a modicum of data hiding within the group of routines, or what would today be known as a module.
In addition, this edition added structured error handling and allowed arbitrary matrix math in
LET statements, so one could
LET A = M*4 where M was a matrix variable and output another matrix into A with all the elements in M multiplied. Finally, another major update was the subroutines now use an activation record system which allowed recursion.
ANSI BASIC, Eighth Edition
By the early 1970s, the number of BASIC implementations had grown to dozens, all of which had their own changes to the basic concept introduced in the original version. Most of these were based on the Fifth Edition, although they often lacked the MAT instructions and the ability to indent code. GE was one of these companies; they released their Mark II systems with the 5th edition rather than waiting for the 6th to arrive a few months later. BASIC-PLUS on the DEC platform was perhaps the closest implementation, including the MAT commands for instance, but then added a number of changes that were not backward-compatible.
After the release of the 6th edition, Kurtz became involved in an effort to define a standard BASIC. An American National Standards Institute (ANSI) working group, X3J2, formed in January 1974, and a corresponding European Computer Manufacturers Association (ECMA) group, TC21, that September. The goal at that time was to produce two related standards. Minimal BASIC would be similar to the Second Edition, but adding strings, a standard to which practically every BASIC would already be able to conform. Standard BASIC would add more functionality to produce something more in keeping with the real BASIC varieties seen in the market.
The process was slow, and the first draft of Minimal BASIC was not published until January 1976, leading to it being officially adopted in December 1977 by ECMA, and 1979 by ANSI as X3.60-1978. Minimal BASIC was similar to the 3rd edition, including string variables, while lacking MAT and other advanced features. In contrast, Standard BASIC had many new features that did not exist in other BASICs, and many of these were poorly considered and the subject of some criticism. For instance, the standard included a line-continuation character, but chose the ampersand, &, which was also used for string concatenation. Using these in a single line could lead to very confusing code.
By this time, the release of the first microcomputer systems in 1975 had quickly led to the introduction of Altair BASIC, the first version of what would soon be known as Microsoft BASIC. MS BASIC was patterned on BASIC-PLUS, and thus ultimately the Fifth Edition, but lacked indenting, MAT, and other features. It also added the
RIGHT$ functions, breaking the three-letter convention. As the number of microcomputers grew, and turned into the home computer market in the late 1970s, MS BASIC became the de facto standard.
With this rapid change in the market, the Standard BASIC effort slowed further and was not formally ratified until 1987 as X3.113-1987. By this time, there was no real purpose to the standards; not only was MS BASIC everywhere, but by the mid-1980s the use of BASIC was declining as shrinkwrap software took over from type-in programs. Both standards were eventually withdrawn.
In 1976, Stephen J. Garland added structured programming features to create Dartmouth SBASIC, a precompiler that produced version 6 output and which formed the basis of ANSI BASIC. In 1979 Kemény and Kurtz released an ANSI BASIC compiler as the seventh and final version of BASIC at Dartmouth before leaving the college to concentrate on the further development of ANSI BASIC in the form of True BASIC.
The early versions of BASIC were used and tested by other Dartmouth students working in the College Psychology laboratories in early 1964. The departments shared several IBM card punch machines that were used to run batch statistical analysis programs.
Students working on NSF grants in both departments lived in the same rural New Hampshire farmhouse during the summer of 1964. They often met to share ideas. A notable contribution of these late night sessions was the GOTO statement. The earliest printed versions of the users' manual were reproduced with the typical purple print of spirit duplicators of the era and had a pink cover.
DTSS implemented an early integrated development environment (IDE): an interactive command line interface. This provided a number of user and job control commands. For instance, an idle terminal could be connected to a user account by typing
HELLO, and logged out again with
Any line typed in by the user, and beginning with a line number, was added to the program, replacing any previously stored line with the same number; anything else was assumed to be a DTSS command and immediately executed. Lines which consisted solely of a line number weren't stored but did remove any previously stored line with the same number. This method of editing was necessary due to the use of teleprinters as the terminal units.
Each user account could have any number of BASIC programs stored offline, while administrator accounts could also leave programs in permanent storage. Any one of these was active at a given time for a given user account, and if no program had been loaded, a new program was assumed. Stored programs were accessed using commands that are today better known as parts of the BASIC language itself; for instance, the
LIST command instructed DTSS to print out the currently active program.
List of commands
- log into DTSS
- log off from DTSS
- start BASIC mode
- name and begin writing a program
- retrieve a previously named program from permanent storage
- display the current program
- save the current program in permanent storage
- clear the current program from permanent storage
- display the names of programs in permanent storage
- erase the current program without clearing its name
- change the name of the current program without erasing it
- execute the current programs
- interrupt the currently running program
- Friden mode for teletypes with mechanical linefeeds
- exit Friden mode
- explain (help) EXP EXP for list of commands that can be explained by the system
- save the current program using a name already in use for another file
The commands were often believed to be part of the BASIC language by users, but, in fact, were part of the time sharing system and were also used when preparing ALGOL or FORTRAN programs via the DTSS terminals.
The first release implemented the following statement types, taking some of its operators and keywords from FORTRAN II and some from ALGOL 60. Overall, the language more closely follows the FORTRAN model, in that it generally has one statement per line of code, lacks ALGOL's "blocks" to group code (these structured programming constructs were a primary reason for ALGOLs development) and the use of GOTO to control program flow.
From ALGOL it took the
FOR...TO...STEP style loops that replaced FORTRAN's unwieldy
DO...CONTINUE statements. BASIC also simplified the
IF...THEN construct to allow simple comparisons like
IF X>5 THEN GOTO 20, as opposed to FORTRAN's
IF (X-5) 20,20,30. FORTRAN's style "computed IF" was reintroduced with the
ON...GOTO command in later versions.
Variable names were limited to A to Z, A0 to A9, B0 to B9, ..., Z0 to Z9, giving a maximum of 286 possible distinct variables. FORTRAN's odd system for setting up the variables I through N as integers and the rest as floating point was removed, and all variables were assumed to be floating point and dimensioned with up to 10 elements. The
DIM command was only required if the array held more than ten elements. Array names were restricted to A to Z only.
List of BASIC statements
- define single line functions
- (short for dimension) define the size of arrays
- define the end of the program
- stop a program before the textual end
FOR / TO / STEP
- define loops
- mark the end of loops
- transfer control to simple subroutines
- return control from simple subroutines
- transfer control to another statement
IF / THEN
- decision making
LET / =
- assign formula results to a variable
- output results
- store static data within the program
- input data stored in DATA statements
- comment ("REMark")
It also implemented floating-point numeric variables and arithmetic.
List of operators
|Arithmetic operators||Relational/logical operators|
||Negation (unary op.)||
||Not Equal To|
||Subtraction (binary op.)||
||Less Than or Equal To|
||Greater Than or Equal To|
List of functions
Early versions of BASIC did not have the ability to read and write external files. To represent lists of data that would normally be read from a file, BASIC included the
DATA keyword, which could be followed by an arbitrarily long list of elements, ending only at the limit of the line length. The
DATA was non-executable and was skipped if encountered.
READ commands would consume the data one by one, keeping track of its location within the complete collection of
DATA elements in an internal pointer. In version 3, a
RESTORE command was added to reset the pointer to the first
DATA command in a program.
15 READ X, Y, Z 20 READ N 24 FOR I=0 TO 10 25 READ B(I) 26 NEXT I 40 DATA 4.2, 7.5, 25.1, -1, .1, .01, .001, .0001 45 DATA .2, .02, .002, .0002, .015, .025, .3, .03, .003
Unlike most subsequent BASICs, Dartmouth BASIC, from the Third Edition onwards, had a matrix keyword,
MAT, which could prefix a number of other commands to operate on entire arrays of data with a single command. In this example, from the 1968 manual,
MAT INPUT V is used to input a series of variables. When the user enters nothing on a line, this process ends and the total number of elements is accessed in the
NUM pseudovariable. The code then adds up all of the individual elements in the matrix and calculates the average. The Third Edition also added indentation, which is used here to clarify the loop structure.
5 LET S = 0 10 MAT INPUT V 20 LET N = NUM 30 IF N = 0 THEN 99 40 FOR I = 1 TO N 45 LET S = S + V(I) 50 NEXT I 60 PRINT S/N 70 GO TO 5 99 END
- Note the use of the term "his", which in this case was the only possibility as Dartmouth did not admit women until some time later.
- David Ahl stated Kenemy had written it when describing the game in BASIC Computer Games.
- This feature was found on most BASICs based on Dartmouth, but was rare on those that were created independently.
- There was no need to log out, if users did not respond, they were logged out after a short delay.
NUMwas not implemented as a function, like
LEN(), is a mystery.
- What to do after you hit Return. People's Computer Company. 1975.
- Kurtz 1981, p. 516.
- Kurtz 1981, pp. 516-516.
- Kurtz 1981, p. 517.
- Kurtz 1981, p. 518.
- Time 2014.
- Kenemy & Kurtz 1968, p. 3.
- "High Math at Hanover". Time. 23 February 1959.
- Kurtz 1981, p. 519.
- Kurtz 1981, pp. 519-520.
- Kiewit 1971, p. 9.
- Kurtz 1981, p. 520.
- Dartmouth Time Sharing System (DTSS). March 1995. Retrieved 27 May 2016
- Kurtz 1981, pp. 532,534.
- Kenemy & Kurtz 1968, p. 224.
- Kiewit 1971, p. 10.
- Kenemy & Kurtz 1968, p. 225.
- "The 1960s". Dartmouth ITS.
- Kenemy & Kurtz 1968, p. 226.
- Kiewit 1971, p. 11.
- Kurtz 1981, p. 533.
- Kurtz 1981, p. 534.
- Kiewit 1971, p. 17.
- Kiewit 1971, p. 18.
- Garfinkel, Simson (1999). Abelson, Hal (ed.). Architects of the Information Society, Thirty-Five Years of the Laboratory for Computer Science at MIT. Cambridge: MIT Press. p. 1. ISBN 978-0-262-07196-3.
- A Guide to Time Shared BASIC (PDF). Hewlett Packard. August 1969.
- BASIC-PLUS Manual (PDF). DEC. 1972.
- Kemény, John (1972). Man and the computer. Scribner. p. 35.
- "John Kemény and Tecmo's BASIC FTBALL Granddaddy". 17 October 2017.
- Ahl 1978, p. 64.
- What to do after you hit return. People's Computer Company. 1975.
- Ahl 1978.
- Kurtz 1981, p. 523.
- Kurtz 1981, p. 524.
- Kurtz 1981, p. 525.
- Kurtz 1981, p. 526.
- Kurtz 1981, p. 527.
- Kurtz 1981, p. 528.
- Kurtz 1981, p. 529.
- Kurtz 1981, p. 530.
- Kurtz 1981, p. 531.
- Kurtz 1981, p. 532.
- Elliott 1988, p. 134.
- Elliott 1988, p. 135.
- Minimal BASIC (PDF). ECMA. January 1978.
- Guntheroth, Kurt (July 1983). "The New ANSI BASIC Standard". ACM SIGPLAN Notices. 18 (7): 50–59. doi:10.1145/988216.988221.
- BASIC Language Reference Mandual. Interdata. January 1975. pp. 3–24.
- BASIC, 4th Edition, 1968, page 53
- Kenemy, John; Kurtz, Thomas (11 October 1968). "Dartmouth Time-Sharing". Science. 162 (3850): 223–228. doi:10.1126/science.162.3850.223.
- Kurtz, Thomas E. (1981). "BASIC". In Wexelblat, Richard (ed.). History of programming languages. History of Programming Languages I. New York: ACM. pp. 515–537. doi:10.1145/800025.1198404. ISBN 0127450408.
- The Kiewit Computation Center and the Dartmouth Time-Sharing System. Dartmouth University. 1971.
- BASIC version 2 manual. Dartmouth College Computation center, 1964. (PDF)
- BASIC version 4 manual. Dartmouth College Computation center, 1968. (PDF)
- "Fifty Years of BASIC, the Programming Language That Made Computers Personal". Time. 29 April 2014.
- Ahl, David (1978). BASIC Computer Games. Creative Computing.
- Marconi, Andrea. "History of the BASIC Programming Language" (PDF). Q7basic.
- Elliott, Brig (1988). "BASIC". In Kent, Allen; Williams, James (eds.). Encyclopedia of Microcomputers: Volume 2. CRC Press. pp. 133–153. ISBN 9780824727017.
- Kemény, John G. & Kurtz, Thomas E. (1985). Back to BASIC: The History, Corruption and Future of the Language. Addison-Wesley Publishing Company, Inc. ISBN 0-201-13433-0.