
A BASIC interpreter is an
interpreter
Interpreting is translation from a spoken or signed language into another language, usually in real time to facilitate live communication. It is distinguished from the translation of a written text, which can be more deliberative and make use o ...
that enables users to enter and run programs in the
BASIC
Basic or BASIC may refer to:
Science and technology
* BASIC, a computer programming language
* Basic (chemistry), having the properties of a base
* Basic access authentication, in HTTP
Entertainment
* Basic (film), ''Basic'' (film), a 2003 film
...
language
Language is a structured system of communication that consists of grammar and vocabulary. It is the primary means by which humans convey meaning, both in spoken and signed language, signed forms, and may also be conveyed through writing syste ...
and was, for the first part of the
microcomputer
A microcomputer is a small, relatively inexpensive computer having a central processing unit (CPU) made out of a microprocessor. The computer also includes memory and input/output (I/O) circuitry together mounted on a printed circuit board (P ...
era, the default
application that computers would launch. Users were expected to use the BASIC interpreter to
type in programs or to load programs from storage (initially
cassette tape
The Compact Cassette, also commonly called a cassette tape, audio cassette, or simply tape or cassette, is an analog audio, analog magnetic tape recording format for Sound recording and reproduction, audio recording and playback. Invented by L ...
s then
floppy disk
A floppy disk or floppy diskette (casually referred to as a floppy, a diskette, or a disk) is a type of disk storage composed of a thin and flexible disk of a magnetic storage medium in a square or nearly square plastic enclosure lined with a ...
s).
BASIC interpreters are of historical importance.
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
's first product for sale was a BASIC interpreter (
Altair BASIC
Altair BASIC is a discontinued interpreter for the BASIC programming language that ran on the MITS Altair 8800 and subsequent S-100 bus computers. It was Microsoft's first product (as Micro-Soft), distributed by MITS under a contract. Altair B ...
), which paved the way for the company's success. Before Altair BASIC, microcomputers were sold as kits that needed to be programmed in
machine code
In computer programming, machine code is computer code consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). For conventional binary computers, machine code is the binaryOn nonb ...
(for instance, the
Apple I
The Apple Computer 1 (Apple-1), later known predominantly as the Apple I, is an 8-bit personal computer designed by Steve Wozniak and released by the Apple Computer Company (now Apple Inc.) in 1976. The company was initially formed to ...
). During the Altair period, BASIC interpreters were sold separately, becoming the first software sold to individuals rather than to organizations; Apple BASIC was Apple's first software product. After the
MITS Altair 8800, microcomputers were expected to ship bundled with BASIC interpreters of their own (e.g., the
Apple II
Apple II ("apple Roman numerals, two", stylized as Apple ][) is a series of microcomputers manufactured by Apple Computer, Inc. from 1977 to 1993. The Apple II (original), original Apple II model, which gave the series its name, was designed ...
, which had multiple implementations of BASIC). A backlash against the price of Microsoft's Altair BASIC also led to early collaborative software development, for
Tiny BASIC
Tiny BASIC is a family of dialects of the BASIC programming language that can fit into 4 or fewer KBs of memory. Tiny BASIC was designed by Dennis Allison and the People's Computer Company (PCC) in response to the open letter published by Bi ...
implementations in general and Palo Alto Tiny BASIC specifically.
BASIC interpreters fell from use as computers grew in power and their associated programs grew too long for typing them in to be a reasonable distribution format. Software increasingly came pre-compiled and transmitted on
floppy disk
A floppy disk or floppy diskette (casually referred to as a floppy, a diskette, or a disk) is a type of disk storage composed of a thin and flexible disk of a magnetic storage medium in a square or nearly square plastic enclosure lined with a ...
or via
bulletin board system
A bulletin board system (BBS), also called a computer bulletin board service (CBBS), is a computer server running list of BBS software, software that allows users to connect to the system using a terminal program. Once logged in, the user perfor ...
s, making the need for source listings less important. Additionally, increasingly sophisticated
command shell
An operating system shell is a computer program that provides relatively broad and direct access to the system on which it runs. The term ''shell'' refers to how it is a relatively thin layer around an operating system.
A shell is generally a ...
s like
MS-DOS
MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few op ...
and the
Mac
Mac or MAC may refer to:
Common meanings
* Mac (computer), a line of personal computers made by Apple Inc.
* Mackintosh, a raincoat made of rubberized cloth
* Mac, a prefix to surnames derived from Gaelic languages
* McIntosh (apple), a Canadi ...
GUI became the primary
user interface
In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine fro ...
, and the need for BASIC to act as the shell disappeared. The use of BASIC interpreters as the primary language and interface to systems had largely disappeared by the mid-1980s.
History
BASIC helped jumpstart the time-sharing era, became mainstream in the microcomputer era, then faded to become just another application in the DOS and GUI era, and today survives in a few niches related to game development, retrocomputing, and teaching.
Time-sharing era
First implemented as a
compile-and-go system rather than an interpreter, BASIC emerged as part of a wider movement towards
time-sharing
In computing, time-sharing is the Concurrency (computer science), concurrent sharing of a computing resource among many tasks or users by giving each Process (computing), task or User (computing), user a small slice of CPU time, processing time. ...
systems.
General Electric
General Electric Company (GE) was an American Multinational corporation, multinational Conglomerate (company), conglomerate founded in 1892, incorporated in the New York (state), state of New York and headquartered in Boston.
Over the year ...
, having worked on the
Dartmouth Time-Sharing System
The Dartmouth Time-Sharing System (DTSS) is a discontinued operating system first developed at Dartmouth College between 1963 and 1964. It was the first successful large-scale time-sharing system to be implemented, and was also the system for wh ...
and its associated
Dartmouth BASIC
Dartmouth BASIC is the original version of the BASIC programming language. It was designed by two professors at Dartmouth College, John G. Kemeny and Thomas E. Kurtz. With the underlying Dartmouth Time-Sharing System (DTSS), it offered an interac ...
, wrote their own underlying
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
and launched an online time-sharing system known as Mark I featuring a BASIC compiler (not an interpreter) as one of its primary selling points. Other companies in the emerging field quickly followed suit. By the early 1970s, BASIC was largely universal on general-purpose mainframe computers.

BASIC, as a streamlined language designed with integrated line editing in mind, was naturally suited to porting to the
minicomputer
A minicomputer, or colloquially mini, is a type of general-purpose computer mostly developed from the mid-1960s, built significantly smaller and sold at a much lower price than mainframe computers . By 21st century-standards however, a mini is ...
market, which was emerging at the same time as the time-sharing services. These machines had very small
main memory
Computer data storage or digital data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processin ...
, perhaps as little as 4 KB in modern terminology, and lacked the high-performance storage like
hard drive
A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating hard disk drive platter, pla ...
s that make compilers practical. In contrast, an
interpreter
Interpreting is translation from a spoken or signed language into another language, usually in real time to facilitate live communication. It is distinguished from the translation of a written text, which can be more deliberative and make use o ...
would take fewer computing resources, at the expense of performance. In 1968,
Hewlett Packard
The Hewlett-Packard Company, commonly shortened to Hewlett-Packard ( ) or HP, was an American multinational information technology company. It was founded by Bill Hewlett and David Packard in 1939 in a one-car garage in Palo Alto, Californi ...
introduced the
HP 2000
The HP 2100 is a series of 16-bit minicomputers that were produced by Hewlett-Packard (HP) from the mid-1960s to early 1990s. Tens of thousands of machines in the series were sold over its 25-year lifetime, making HP the fourth-largest minicomput ...
, a system that was based around its
HP Time-Shared BASIC
HP Time-Shared BASIC (HP TSB) is a BASIC, BASIC programming language Interpreter (computing), interpreter for Hewlett-Packard's HP 2100#HP 2000, HP 2000 line of minicomputer-based time-sharing computer systems. TSB is historically notable as th ...
interpreter. In 1969,
Dan Paymar and Ira Baxter wrote another early BASIC interpreter for the
Data General Nova
The Nova is a series of 16-bit computing, 16-bit minicomputers released by the American company Data General. The Nova family was very popular in the 1970s and ultimately sold tens of thousands of units.
The first model, known simply as "Nov ...
.
One holdout was
Digital Equipment Corporation
Digital Equipment Corporation (DEC ), using the trademark Digital, was a major American company in the computer industry from the 1960s to the 1990s. The company was co-founded by Ken Olsen and Harlan Anderson in 1957. Olsen was president until ...
(DEC), the leading minicomputer vendor. They had released a new language known as
FOCAL, based on the earlier
JOSS
JOSS (acronym for JOHNNIAC Open Shop System) was one of the first interactive, time-sharing programming languages. It pioneered many features that would become common in languages from the 1960s into the 1980s, including use of line numbers as bo ...
developed on a DEC machine at the
Stanford Research Institute
SRI International (SRI) is a nonprofit organization, nonprofit scientific research, scientific research institute and organization headquartered in Menlo Park, California, United States. It was established in 1946 by trustees of Stanford Univer ...
in the early 1960s. JOSS was similar to BASIC in many respects, and FOCAL was a version designed to run in very small memory systems, notably the
PDP-8
The PDP-8 is a family of 12-bit minicomputers that was produced by Digital Equipment Corporation (DEC). It was the first commercially successful minicomputer, with over 50,000 units sold during the model's lifetime. Its basic design follows the pi ...
, which often shipped with 4 KB of
main memory
Computer data storage or digital data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processin ...
. By the late 1960s, DEC salesmen, especially in the educational sales department, found that their potential customers were not interested in FOCAL and were looking elsewhere for their systems. This prompted
David H. Ahl to hire a programmer to produce a BASIC for the PDP-8 and other DEC machines. Within the year, all interest in alternatives like JOSS and FOCAL had disappeared.
Microcomputer era
The introduction of the first
microcomputer
A microcomputer is a small, relatively inexpensive computer having a central processing unit (CPU) made out of a microprocessor. The computer also includes memory and input/output (I/O) circuitry together mounted on a printed circuit board (P ...
s in the mid-1970s continued the explosive growth of BASIC, which had the advantage that it was fairly well known to the young designers and computer hobbyists who took an interest in microcomputers, many of whom had seen BASIC on minis or mainframes. BASIC was one of the few languages that was both
high-level enough to be usable by those without training and small enough to fit into the microcomputers of the day. In 1972, HP introduced the
HP 9830A programmable desktop calculator with a
BASIC Plus interpreter in
read-only memory
Read-only memory (ROM) is a type of non-volatile memory used in computers and other electronic devices. Data stored in ROM cannot be electronically modified after the manufacture of the memory device. Read-only memory is useful for storing sof ...
(ROM).
In June 1974, Alfred Weaver, Michael Tindall, and Ronald Danielson of the
University of Illinois at Urbana-Champaign
The University of Illinois Urbana-Champaign (UIUC, U of I, Illinois, or University of Illinois) is a public land-grant research university in the Champaign–Urbana metropolitan area, Illinois, United States. Established in 1867, it is the f ...
proved it was possible to produce "A BASIC Language Interpreter for the Intel 8008 Microprocessor," in their paper of the same name, though their application was deployed to an 8008 simulator for the
IBM 360/75 and required 16 KB.

In January 1975, the
Altair 8800
The Altair 8800 is a microcomputer introduced in 1974 by Micro Instrumentation and Telemetry Systems (MITS) based on the Intel 8080 CPU. It was the first commercially successful personal computer. Interest in the Altair 8800 grew quickly after i ...
was announced and sparked the
microcomputer
A microcomputer is a small, relatively inexpensive computer having a central processing unit (CPU) made out of a microprocessor. The computer also includes memory and input/output (I/O) circuitry together mounted on a printed circuit board (P ...
revolution. One of the first microcomputer versions of BASIC was co-written by Gates, Allen, and
Monte Davidoff
Monte Davidoff (; born 1956) is an American computer programmer.
Davidoff is from Glendale, Wisconsin. He graduated from Nicolet High School in 1974, and went on to Harvard College, where he majored in applied mathematics, the department at Harv ...
for their newly formed company, Micro-Soft. This was released by MITS in
punch tape
file:PaperTapes-5and8Hole.jpg, Five- and eight-hole wide punched paper tape
file:Harwell-dekatron-witch-10.jpg, Paper tape reader on the Harwell computer with a small piece of five-hole tape connected in a circle – creating a physical program ...
format for the
Altair 8800
The Altair 8800 is a microcomputer introduced in 1974 by Micro Instrumentation and Telemetry Systems (MITS) based on the Intel 8080 CPU. It was the first commercially successful personal computer. Interest in the Altair 8800 grew quickly after i ...
shortly after the machine itself, showcasing BASIC as the primary language for early microcomputers.
In March 1975,
Steve Wozniak
Stephen Gary Wozniak (; born August 11, 1950), also known by his nickname Woz, is an American technology entrepreneur, electrical engineer, computer programmer, philanthropist, and inventor. In 1976, he co-founded Apple Inc., Apple Computer with ...
attended the first meeting of the
Homebrew Computer Club
The Homebrew Computer Club was an early computer hobbyist group in Menlo Park, California, which met from March 1975 to December 1986. The club had an influential role in the development of the microcomputer revolution and the rise of that aspec ...
and began formulating the design of his own computer. Club members were excited by Altair BASIC. Wozniak concluded that his machine would have to have a BASIC of its own. At the time he was working at
Hewlett Packard
The Hewlett-Packard Company, commonly shortened to Hewlett-Packard ( ) or HP, was an American multinational information technology company. It was founded by Bill Hewlett and David Packard in 1939 in a one-car garage in Palo Alto, Californi ...
and used their TS-BASIC minicomputer dialect as the basis for his own version.
Integer BASIC
Integer BASIC is a BASIC interpreter written by Steve Wozniak for the Apple I and Apple II computers. Originally available on Cassette tape, cassette for the Apple I in 1976, then included in Read-only memory, ROM on the Apple II from its release ...
was released on cassette for the
Apple I
The Apple Computer 1 (Apple-1), later known predominantly as the Apple I, is an 8-bit personal computer designed by Steve Wozniak and released by the Apple Computer Company (now Apple Inc.) in 1976. The company was initially formed to ...
, and was supplied in
ROM
Rom, or ROM may refer to:
Biomechanics and medicine
* Risk of mortality, a medical classification to estimate the likelihood of death for a patient
* Rupture of membranes, a term used during pregnancy to describe a rupture of the amniotic sac
* ...
when the
Apple II
Apple II ("apple Roman numerals, two", stylized as Apple ][) is a series of microcomputers manufactured by Apple Computer, Inc. from 1977 to 1993. The Apple II (original), original Apple II model, which gave the series its name, was designed ...
shipped in the summer of 1977.
Other members of the Homebrew Computer Club began circulating copies of Altair BASIC on paper tape, causing Gates to write his
Open Letter to Hobbyists
"An Open Letter to Hobbyists" is a 1976 open letter written by Bill Gates, the co-founder of Microsoft, to early personal computer hobbyists, in which Gates expresses dismay at the widespread duplication of software taking place in the hobbyist co ...
, complaining about this early example of software piracy. Partially in response to Gate's letter, and partially to make an even smaller BASIC that would run usefully on 4 KB machines, Bob Albrecht urged
Dennis Allison
Dennis Allison is a lecturer at Stanford University, a position he has held since 1976.
Allison was a founding member of the People's Computer Company.
Allison in 1975 wrote a specification for a microcomputer interpreter for the BASIC progr ...
to write their own variation of the language. How to design and implement a stripped-down version of an
interpreter
Interpreting is translation from a spoken or signed language into another language, usually in real time to facilitate live communication. It is distinguished from the translation of a written text, which can be more deliberative and make use o ...
for the BASIC language was covered in articles by Allison in the first three quarterly issues of the ''
People's Computer Company
People's Computer Company (PCC) was an organization, a newsletter (the ''People's Computer Company Newsletter'') and, later, a quasiperiodical called the ''Dragonsmoke''. PCC was founded and produced by Dennis Allison, Bob Albrecht and George Fi ...
'' newsletter published in 1975 and implementations with source code published in ''
Dr. Dobb's Journal of Tiny BASIC Calisthenics & Orthodontia: Running Light Without Overbyte''. This led to a wide variety of Tiny BASICs with added features or other improvements, with well-known versions from
Tom Pittman and
Li-Chen Wang, both members of the Homebrew Computer Club. Tiny BASIC was published openly and Wang coined the term "copyleft" to encourage others to copy his source code. Hobbyists and professionals created their own implementations, making Tiny BASIC an example of a
free software
Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
project that existed before the
free software movement
The free software movement is a social movement with the goal of obtaining and guaranteeing certain freedoms for user (computing), software users, namely the freedoms to run, study, modify, and share copies of software. Software which meets thes ...
.
Many firms developed BASIC interpreters. In 1976,
SCELBI
SCELBI was an early model of microcomputer based on the Intel 8008 processor. The company SCELBI (derived from SCientific-ELectronics-BIology) Computer Consulting in 1973, by Nat Wadsworth. The SCELBI 8H was marketed in 1974 and was delivered eith ...
introduced
SCELBAL for the
8008 and the
University of Idaho
The University of Idaho (U of I, or UIdaho) is a public land-grant research university in Moscow, Idaho, United States. Established in 1889 and opened three years later, it was the state's sole university for 71 years, until 1963.
The un ...
and
Lawrence Livermore Laboratory announced that they would be publishing to the public domain LLL BASIC, which included floating-point support. In 1977, the Apple II and
TRS-80 Model I
The TRS-80 Micro Computer System (TRS-80, later renamed the Model I to distinguish it from successors) is a desktop microcomputer developed by American company Tandy Corporation and sold through their Radio Shack stores. Launched in 1977, it is ...
each had two versions of BASIC, a smaller version introduced with the initial releases of the machines and a licensed Microsoft version introduced later as interest in the platforms increased.

Microsoft ported its interpreter to the
MOS 6502
The MOS Technology 6502 (typically pronounced "sixty-five-oh-two" or "six-five-oh-two") William Mensch and the moderator both pronounce the 6502 microprocessor as ''"sixty-five-oh-two"''. is an 8-bit microprocessor that was designed by a small ...
, which quickly became one of the most popular microprocessors of the 8-bit era. When new microcomputers began to appear, such as the
Commodore PET
The Commodore PET is a line of personal computers produced starting in 1977 by Commodore International. A single all-in-one case combines a MOS Technology 6502 microprocessor, Commodore BASIC in read-only memory, keyboard, monochrome monitor ...
, their manufacturers licensed a Microsoft BASIC, customized to the hardware capabilities. By 1978, MS BASIC was a ''de facto'' standard and practically every
home computer
Home computers were a class of microcomputers that entered the market in 1977 and became common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a s ...
of the 1980s included it in
ROM
Rom, or ROM may refer to:
Biomechanics and medicine
* Risk of mortality, a medical classification to estimate the likelihood of death for a patient
* Rupture of membranes, a term used during pregnancy to describe a rupture of the amniotic sac
* ...
. In 1980, as part of a larger licensing deal that included other languages and
PC DOS
PC or pc may refer to:
Arts and entertainment
* Player character or playable character, a fictional character controlled by a human player, usually in role-playing games or computer games
* '' Port Charles'', an American daytime TV soap opera
* ...
, IBM rejected an overture from Atari and instead licensed MS-BASIC over its own implementation, eventually releasing four versions of
IBM BASIC
The IBM Personal Computer BASIC, commonly shortened to IBM BASIC, is a programming language first released by IBM with the IBM Personal Computer, Model 5150 (IBM PC) in 1981. IBM released four different versions of the Microsoft BASIC interprete ...
, each much larger than prior interpreters (for instance, Cartridge BASIC took 40 KB).
Don Estridge, leader of the
IBM PC
The IBM Personal Computer (model 5150, commonly known as the IBM PC) is the first microcomputer released in the List of IBM Personal Computer models, IBM PC model line and the basis for the IBM PC compatible ''de facto'' standard. Released on ...
team, said, "IBM has an excellent BASIC--it's well received, runs fast on mainframe computers, and it's a lot more functional than micro-computer BASICs... But
tsnumber of users were infinitesimal compared to the number of Microsoft BASIC users. Microsoft BASIC had hundreds of thousands of users around the world. How are you going to argue with that?" ''(See
Microsoft BASIC
Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first v ...
for the subsequent history of these different implementations.)''
Many vendors did "argue with that" and used other firms or wrote their own interpreters. In September 1978,
Shepardson Microsystems
Shepardson Microsystems, Inc. (SMI) was a small company producing operating systems and programming languages for CP/M, the Atari 8-bit computers and Apple II. SMI is most noted for the original Apple II disk operating system, Atari BASIC, and At ...
was finishing Cromemco 16K Structured BASIC for the
Z80
The Zilog Z80 is an 8-bit microprocessor designed by Zilog that played an important role in the evolution of early personal computing. Launched in 1976, it was designed to be software-compatible with the Intel 8080, offering a compelling altern ...
-based
Cromemco
Cromemco, Inc. was a Mountain View, California microcomputer company known for its high-end Z80-based S-100 bus computers and peripherals in the early days of the personal computer revolution.
The company began as a partnership in 1974 between ...
S-100 bus
The S-100 bus or Altair bus, later standardized as IEEE 696-1983 ''(inactive-withdrawn)'', is an early computer bus designed in 1974 as a part of the Altair 8800. The bus was the first industry standard expansion bus for the microcomputer in ...
machines. Paul Laughton and Kathleen O'Brien then created
Atari BASIC
Atari BASIC is an interpreter for the BASIC programming language that shipped with Atari 8-bit computers. Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC and differs in significant way ...
as essentially a pared-down version of Cromemco BASIC ported to the 6502. In 1979,
Warren Robinett
Joseph Warren Robinett Jr. (born December 25, 1951) In the A. Merrill interview, Robinett says he was 26 in November 1977. is an American video game designer. He is most notable as the developer of the Atari 2600's ''Adventure'' and as a founder ...
developed the
BASIC Programming cartridge for
Atari, Inc., even though it only supported programs with 9 lines of code (64 characters in total). Also in 1979,
Texas Instruments
Texas Instruments Incorporated (TI) is an American multinational semiconductor company headquartered in Dallas, Texas. It is one of the top 10 semiconductor companies worldwide based on sales volume. The company's focus is on developing analog ...
released
TI BASIC with its
TI-99/4, which would sell nearly 3 million systems when revamped as the TI-99/4A.
Sinclair BASIC
Sinclair BASIC is a dialect of the programming language BASIC used in the 8-bit home computers from Sinclair Research, Timex Sinclair and Amstrad. The Sinclair BASIC interpreter was written by Nine Tiles Networks Ltd.
Designed to run in on ...
was developed for the
ZX-80 by John Grant and
Steve Vickers of Nine Tiles. In 1980,
Sophie Wilson
Sophie Mary Wilson (born Roger Wilson; June 1957) is an English computer scientist, a co-designer of the instruction set for the ARM architecture.
Wilson first designed a microcomputer during a break from studies at Selwyn College, Cambridge. ...
of
Acorn Computers
Acorn Computers Ltd. was a British computer company established in Cambridge, England in 1978 by Hermann Hauser, Christopher Curry (businessman), Chris Curry and Andy Hopper. The company produced a number of computers during the 1980s with asso ...
developed
Atom BASIC, which she later evolved into
BBC BASIC
BBC BASIC is an interpreted version of the BASIC programming language. It was developed by Acorn Computers Ltd when they were selected by the BBC to supply the computer for their BBC Literacy Project in 1981.
It was originally supplied on ...
, one of the first interpreters to offer structured BASIC programming, with named
DEF PROC
/
DEF FN
procedures and functions,
REPEAT UNTIL
loops, and
IF THEN ELSE
structures inspired by
COMAL.
Jan Jones developed
SuperBASIC
SuperBASIC is an advanced variant of the BASIC programming language with many structured programming additions. It was developed at Sinclair Research by Jan Jones during the early 1980s.
Originally SuperBASIC was intended as the BASIC interpre ...
, another British BASIC supporting structured programming, for the
Sinclair QL
The Sinclair QL (for ''Quantum Leap'') is a personal computer launched by Sinclair Research in 1984, as an upper-end counterpart to the ZX Spectrum.
The QL was the last desktop microcomputer from Sinclair Research aimed at the serious home use ...
. In 1983,
Randall Hyde developed SmartBASIC for the
Coleco Adam
The Coleco Adam is a home computer and expansion device for the ColecoVision by American toy and video game manufacturer Coleco. The Adam was an attempt to follow on the success of the company's ColecoVision video game console. It was available as ...
. Richard Clayton, Chris Hall, and Paul Overell developed
Mallard BASIC for the
BBC Micro
The BBC Microcomputer System, or BBC Micro, is a family of microcomputers developed and manufactured by Acorn Computers in the early 1980s as part of the BBC's Computer Literacy Project. Launched in December 1981, it was showcased across severa ...
and
Locomotive BASIC for the
Amstrad CPC
The Amstrad CPC (short for "Colour Personal Computer") is a series of 8-bit home computers produced by Amstrad between 1984 and 1990. It was designed to compete in the mid-1980s home computer market dominated by the Commodore 64 and the ZX Spec ...
, both supporting commands for an
ISAM
Indexed Sequential Access Method (ISAM) is a method for creating, maintaining, and manipulating computer files of data so that records can be retrieved sequentially or randomly by one or more keys. Indexes of key fields are maintained to achieve ...
indexed file system. In 1985,
MetaComCo
MetaComCo (MCC) was a computer systems software company started in 1981 and based in Bristol, England by Peter Mackeonis and Derek Budge. A division of Tenchstar, Ltd.
MetaComCo's first product was an MBASIC compatible interpreter for IBM PCs, ...
released ABasiC for the
Amiga
Amiga is a family of personal computers produced by Commodore International, Commodore from 1985 until the company's bankruptcy in 1994, with production by others afterward. The original model is one of a number of mid-1980s computers with 16-b ...
and
ST BASIC for the
Atari ST
Atari ST is a line of personal computers from Atari Corporation and the successor to the company's Atari 8-bit computers, 8-bit computers. The initial model, the Atari 520ST, had limited release in April–June 1985, and was widely available i ...
.
In 1978, David Lien published the first edition of ''The BASIC Handbook: An Encyclopedia of the BASIC Computer Language'', documenting keywords across over 78 different computers. By 1981, the second edition documented keywords from over 250 different computers, showcasing the explosive growth of the microcomputer era.
Interpreters as applications
With the rise of
disk operating system
A disk operating system (DOS) is a computer operating system that requires a disk or other direct-access storage device as secondary storage. A DOS provides a file system and a means for loading and running computer program, programs stored on th ...
s and later
graphical user interface
A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
s, BASIC interpreters became just one application among many, rather than providing the first prompt a user might see when turning on a computer.
In 1983, the
TRS-80 Model 100
The TRS-80 Model 100 is a Notebook form factor, notebook-sized portable computer introduced in April 1983. It was the first commercially successful notebook computer, as well as one of the first notebook computers ever released. It features a k ...
portable computer
A portable computer is a computer designed to be easily moved from one place to another, as opposed to those designed to remain stationary at a single location such as desktops and workstations. These computers usually include a display a ...
debuted, with its Microsoft BASIC implementation noteworthy for two reasons. First, programs were edited using the simple text editor, TEXT, rather than typed in line by line (but line numbers were still required). Second, this was the last
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
product that
Bill Gates
William Henry Gates III (born October 28, 1955) is an American businessman and philanthropist. A pioneer of the microcomputer revolution of the 1970s and 1980s, he co-founded the software company Microsoft in 1975 with his childhood friend ...
developed personally.
Also in 1983, Microsoft began bundling
GW-BASIC
GW-BASIC is a dialect of the BASIC programming language developed by Microsoft from IBM BASICA. Functionally identical to BASICA, its BASIC interpreter is a fully self-contained executable and does not need the Cassette BASIC ROM found in the ori ...
with DOS. Functionally identical to
IBM BASICA
The IBM Personal Computer BASIC, commonly shortened to IBM BASIC, is a programming language first released by IBM with the IBM Personal Computer, IBM Personal Computer, Model 5150 (IBM PC) in 1981. IBM released four different versions of the Micr ...
, its BASIC interpreter was a fully self-contained executable and did not need the
Cassette BASIC
The IBM Personal Computer BASIC, commonly shortened to IBM BASIC, is a programming language first released by IBM with the IBM Personal Computer, Model 5150 (IBM PC) in 1981. IBM released four different versions of the Microsoft BASIC interpre ...
ROM found in the original
IBM PC
The IBM Personal Computer (model 5150, commonly known as the IBM PC) is the first microcomputer released in the List of IBM Personal Computer models, IBM PC model line and the basis for the IBM PC compatible ''de facto'' standard. Released on ...
. According to Mark Jones Lorenzo, given the scope of the language, "GW-BASIC is arguably the ''ne plus ultra'' of Microsoft's family of line-numbered BASICs stretching back to the Altair--and perhaps even of line-numbered BASIC in general." With the release of MS-DOS 5.0, GW-BASIC's place was taken by
QBasic
QBasic is an integrated development environment (IDE) and BASIC interpreter, interpreter for a variety of dialects of BASIC which are based on QuickBASIC. Code entered into the IDE is compiled into an intermediate representation (IR), and this ...
.
MacBASIC
MacBASIC was a programming language and interactive environment designed by Apple Computer for the Macintosh 128K, original Macintosh computer. It was developed by original Macintosh team member Donn Denman, with help from fellow Apple programme ...
featured a fully interactive development environment for the
original Macintosh computer and was developed by Donn Denman,
Marianne Hsiung, Larry Kenyon, and Bryan Stearns.
MacBASIC was released as
beta software
The software release life cycle is the process of developing, testing, and distributing a software product (e.g., an operating system). It typically consists of several stages, such as pre-alpha, alpha, beta, and release candidate, before the fi ...
in 1985 and was adopted for use in places such as the
Dartmouth College
Dartmouth College ( ) is a Private university, private Ivy League research university in Hanover, New Hampshire, United States. Established in 1769 by Eleazar Wheelock, Dartmouth is one of the nine colonial colleges chartered before the America ...
computer science department, for use in an introductory programming course. It was doomed to be the second Apple-developed BASIC killed in favor of a Microsoft BASIC. In November 1985, Apple abruptly ended the project as part of a deal with Microsoft to extend the license for BASIC on the
Apple II
Apple II ("apple Roman numerals, two", stylized as Apple ][) is a series of microcomputers manufactured by Apple Computer, Inc. from 1977 to 1993. The Apple II (original), original Apple II model, which gave the series its name, was designed ...
.

BASIC interpreters were not just an American/British development. In 1984, Hudson Soft released Family BASIC in the Japanese market for Nintendo's Nintendo Entertainment System, Family Computer video game console, an integer-only implementation designed for game programming, based on Hudson Soft BASIC for the Sharp MZ80 (with English keywords).
Turbo-Basic XL is a compatible superset of Atari BASIC, developed by
Frank Ostrowski and published in the December 1985 issue of
German
German(s) may refer to:
* Germany, the country of the Germans and German things
**Germania (Roman era)
* Germans, citizens of Germany, people of German ancestry, or native speakers of the German language
** For citizenship in Germany, see also Ge ...
computer magazine
Computer magazines are about computers and related subjects, such as networking and the Internet. Most computer magazines offer (or offered) advice, some offer programming tutorials, reviews of the latest technologies, and advertisements.
...
''Happy Computer'', making it one of the last interpreters published as a
type-in program
A type-in program or type-in listing was computer source code printed in a home computer magazine or book. It was meant to be entered via the keyboard by the reader and then saved to cassette tape or floppy disk. The result was a usable game, ut ...
. The language included a compiler in addition to the interpreter and featured structured programming commands. Several modified versions working with different DOS systems were released by other authors. In France,
François Lionet and
Constantin Sotiropoulos developed two BASIC interpreters with a focus on multimedia:
STOS BASIC
STOS BASIC is a dialect of the BASIC programming language for the Atari ST personal computer. It was designed for creating games, but the set of high-level graphics and sound commands it offers is suitable for developing multimedia software withou ...
for the
Atari ST
Atari ST is a line of personal computers from Atari Corporation and the successor to the company's Atari 8-bit computers, 8-bit computers. The initial model, the Atari 520ST, had limited release in April–June 1985, and was widely available i ...
, in 1988, and
AMOS BASIC
AMOS BASIC is a dialect of the BASIC programming language for the Amiga computer. Following on from the successful STOS BASIC for the Atari ST, AMOS BASIC was written for the Amiga by François Lionet with Constantin Sotiropoulos and published by ...
for the
Amiga
Amiga is a family of personal computers produced by Commodore International, Commodore from 1985 until the company's bankruptcy in 1994, with production by others afterward. The original model is one of a number of mid-1980s computers with 16-b ...
, in 1990.
In May 1991, Microsoft released
Visual Basic Visual Basic is a name for a family of programming languages from Microsoft. It may refer to:
* Visual Basic (.NET), the current version of Visual Basic launched in 2002 which runs on .NET
* Visual Basic (classic), the original Visual Basic suppo ...
, a
third-generation event-driven programming language known for its
Component Object Model
Component Object Model (COM) is a binary-interface technology for software components from Microsoft that enables using objects in a language-neutral way between different programming languages, programming contexts, processes and machines ...
(COM) programming model. Visual Basic supported the
rapid application development (RAD) of
graphical user interface (GUI) applications, access to
database
In computing, a database is an organized collection of data or a type of data store based on the use of a database management system (DBMS), the software that interacts with end users, applications, and the database itself to capture and a ...
s using
Data Access Object
In software, a data access object (DAO) is a pattern that provides an abstract interface to some type of database or other persistence mechanism. By mapping application calls to the persistence layer, the DAO provides data operations without ex ...
s,
Remote Data Objects, or
ActiveX Data Objects, and creation of
ActiveX
ActiveX is a deprecated software framework created by Microsoft that adapts its earlier Component Object Model (COM) and Object Linking and Embedding (OLE) technologies for content downloaded from a network, particularly from the World Wide W ...
controls and objects. Visual Basic was used to develop proprietary in-house applications as well as published applications.
Niche BASICs
In 1993, Microsoft released
Visual Basic for Applications
Visual Basic for Applications (VBA) is an implementation of Microsoft's event-driven programming language Visual Basic 6, Visual Basic 6.0 built into most desktop Microsoft Office applications. Although based on pre-.NET Visual Basic, which is no ...
, a scripting language for
Microsoft Office
Microsoft Office, MS Office, or simply Office, is an office suite and family of client software, server software, and services developed by Microsoft. The first version of the Office suite, announced by Bill Gates on August 1, 1988, at CO ...
applications, which supersedes and expands on the abilities of earlier application-specific
macro programming languages such as
Word's WordBASIC
WordBASIC was a subset of Microsoft QuickBASIC customized for word-processing in Microsoft Word. It was replaced by Visual Basic for Applications (VBA) when Word 97 was released. Contrarily to VBA, WordBasic was not object-oriented
Object-o ...
(which had been introduced in 1989).
In 1996, Microsoft released
VBScript
VBScript (Microsoft Visual Basic Scripting Edition) is a deprecated programming language for scripting on Microsoft Windows using Component Object Model (COM), based on classic Visual Basic and Active Scripting. It was popular with system admi ...
as an alternative to
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
for adding interactive
client-side functionality to
web pages
A web page (or webpage) is a World Wide Web, Web document that is accessed in a web browser. A website typically consists of many web pages hyperlink, linked together under a common domain name. The term "web page" is therefore a metaphor of pap ...
viewed with
Internet Explorer
Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, commonly abbreviated as IE or MSIE) is a deprecation, retired series of graphical user interface, graphical web browsers developed by Microsoft that were u ...
.
In 1999,
Benoît Minisini released
Gambas as an alternative for Visual Basic developers who had decided to migrate to
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
.
In 2000, Lee Bamber and Richard Vanner released
DarkBASIC, a game creation system for
Microsoft Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
, with accompanying
IDE and development tools.
In 2001,
SmallBASIC was released for the
Palm PDA. Another BASIC interpreter for Palm was HotPaw BASIC, an offshoot of
Chipmunk Basic.
In 2002, Emmanuel Chailloux, Pascal Manoury and Bruno Pagano published a Tiny BASIC as an example of developing applications with
Objective Caml.
In 2011, Microsoft released
Small Basic (distinct from SmallBASIC), together with a teaching curriculum
and an introductory guide.,
designed to help students who have learnt
visual programming language
In computing, a visual programming language (visual programming system, VPL, or, VPS), also known as diagrammatic programming, graphical programming or block coding, is a programming language that lets users create computer program, programs by ...
s such as
Scratch learn text-based programming. The associated
IDE provides a simplified programming environment with functionality such as
syntax highlighting
Syntax highlighting is a feature of text editors that is used for programming language, programming, scripting language, scripting, or markup language, markup languages, such as HTML. The feature displays text, especially source code, in differe ...
,
intelligent code completion
Code completion is an autocompletion feature in many integrated development environments (IDEs) that speeds up the process of coding applications by fixing common mistakes and suggesting lines of code. This usually happens through popups while typ ...
, and in-editor documentation access. The language has only 14 keywords. In 2019, Microsoft announced Small Basic Online (SBO), allowing students to run programs from a
web browser
A web browser, often shortened to browser, is an application for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's scr ...
.
In 2014, Robin H. Edwards released Arduino BASIC for the
Arduino
Arduino () is an Italian open-source hardware and open-source software, software company, project, and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devices. Its hardwar ...
, and now a widely forked implementation. Another implementation using the same name was adapted from Palo Alto Tiny BASIC in 1984 by Gordon Brandly for his 68000 Tiny BASIC, later ported to C by Mike Field.

Many BASIC interpreters are now available for
smartphone
A smartphone is a mobile phone with advanced computing capabilities. It typically has a touchscreen interface, allowing users to access a wide range of applications and services, such as web browsing, email, and social media, as well as multi ...
s and tablets via the Apple
App Store
An app store, also called an app marketplace or app catalog, is a type of digital distribution platform for computer software called applications, often in a mobile context. Apps provide a specific set of functions which, by definition, do not i ...
, or
Google Play
Google Play, also known as the Google Play Store, Play Store, or sometimes the Android Store (and was formerly Android Market), is a digital distribution service operated and developed by Google. It serves as the official app store for certifie ...
store for Android.
Today, coding BASIC interpreters has become part of the
retrocomputing
Retrocomputing is the current use of Vintage computer, older computer hardware and software. Retrocomputing is usually classed as a hobby and recreation rather than a practical application of technology; enthusiasts often collect rare and valuabl ...
hobby. Higher level programming languages on systems with extensive RAM have simplified implementing BASIC interpreters. For instance, line management is simple if your implementation language supports
sparse matrix
In numerical analysis and scientific computing, a sparse matrix or sparse array is a matrix in which most of the elements are zero. There is no strict definition regarding the proportion of zero-value elements for a matrix to qualify as sparse ...
es, variable management is simple with
associative arrays
In computer science, an associative array, key-value store, map, symbol table, or dictionary is an abstract data type that stores a collection of (key, value) pairs, such that each possible key appears at most once in the collection. In math ...
, and program execution is easy with
eval
In some programming languages, eval , short for evaluate, is a function which evaluates a string as though it were an expression in the language, and returns a result; in others, it executes multiple lines of code as though they had been incl ...
functions. As examples, see the
open-source project Vintage BASIC, written in
Haskell
Haskell () is a general-purpose, statically typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research, and industrial applications, Haskell pioneered several programming language ...
or th
OCaml Tiny BASIC
Sales and distribution
Initially, interpreters were either bundled with computer hardware or developed as a custom service, before an industry producing independently packaged software for organizations came about in the late 1960s.
BASIC interpreters were first sold separately from microcomputers, then built-in, before becoming sold as applications again in the DOS era.
As the market shifted to ROMs, ROM size came to dominate decisions about how large a BASIC interpreter could be. Because RAM were sold as 4 KB chips, Altair BASIC was initially packaged in separate editions for 4K, 8K, and 12K; this carried over to ROM chips, as manufacturers would decide how many ROM chips they could fit in their design, given price goals and other constraints.
Compilers vs. interpreters
The first implementation of BASIC,
Dartmouth BASIC
Dartmouth BASIC is the original version of the BASIC programming language. It was designed by two professors at Dartmouth College, John G. Kemeny and Thomas E. Kurtz. With the underlying Dartmouth Time-Sharing System (DTSS), it offered an interac ...
, was a compiler. Generally, compilers examine the entire program in a multi-step process and produce a second file that is directly executable in the host computer's underlying
machine language
In computer programming, machine code is computer code consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). For conventional binary computers, machine code is the binaryOn nonb ...
without reference to the source code. This code is often made up of calls to pre-written routines in the language's
runtime system
In computer programming, a runtime system or runtime environment is a sub-system that exists in the computer where a program is created, as well as in the computers where the program is intended to be run. The name comes from the compile time ...
. The executable will normally be smaller than the source code that created it.
The main disadvantage of compilers, at least in the historical context, is that they require large amounts of temporary memory. As the compiler works, it is producing an ever-growing output file that is being held in memory along with the original source code. Additional memory for temporary lookups, notably line numbers in the case of BASIC, adds to the memory requirement. Computers of the era had very small amounts of memory; in modern terms a typical
mainframe
A mainframe computer, informally called a mainframe or big iron, is a computer used primarily by large organizations for critical applications like bulk data processing for tasks such as censuses, industry and consumer statistics, enterpris ...
might have on the order of 64 KB. On a timesharing system, the case for most 1960s BASICs, that memory was shared among many users.
In order to make a compiler work, the systems had to have some form of high-performance
secondary storage
Computer data storage or digital data storage is a technology consisting of computer components and Data storage, recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The cent ...
, typically a
hard drive
A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating hard disk drive platter, pla ...
. Program editing took place in a dedicated environment that wrote the user's source code to a temporary file. When the user ran the program, the editor exited and ran the compiler, which read that file and produced the executable code, and then finally the compiler would exit and run the resulting program. Splitting the task up in this fashion reduced the amount of memory needed by any one of the parts of the overall BASIC system; at any given time, only the editor, compiler, or runtime had to be loaded, the rest was on storage.
While mainframes had small amounts of memory, minicomputers had even smaller amounts: 4 and 8 KB systems were typical in the 1960s. But far more importantly, minicomputers tended to lack any form of high-performance storage; most early designs used
punch tape
file:PaperTapes-5and8Hole.jpg, Five- and eight-hole wide punched paper tape
file:Harwell-dekatron-witch-10.jpg, Paper tape reader on the Harwell computer with a small piece of five-hole tape connected in a circle – creating a physical program ...
as a primary storage system, and
magnetic tape
Magnetic tape is a medium for magnetic storage made of a thin, magnetizable coating on a long, narrow strip of plastic film. It was developed in Germany in 1928, based on the earlier magnetic wire recording from Denmark. Devices that use magnetic ...
systems were for the high end of the market. In this environment, a system that wrote out the source, compiled it, and then ran the result would have taken minutes. Because of these constraints, interpreters proliferated.
Interpreters ultimately perform the same basic tasks as compilers, reading the source code and converting that into executable instructions calling runtime functions. The primary difference is ''when'' they perform the various tasks. In the case of a compiler, the entire source code is converted during what appears to the user as a single operation, whereas an interpreter converts and runs the source one statement at a time. The resulting machine code is executed, rather than output, and then that code is then discarded and the process repeats with the next statement. This dispenses with the need for some form of secondary storage while an executable is being built. The primary disadvantage is that you can no longer split the different parts of the overall process apart - the code needed to convert the source into machine operations has to be loaded into memory along with the runtime needed to perform it, and in most cases, the source code editor as well.
Producing a language with all of these components that can fit into a small amount of memory and still has room for user's source code is a major challenge, but it eliminates the need for secondary storage and was the only practical solution for early minicomputers and most of the history of the
home computer
Home computers were a class of microcomputers that entered the market in 1977 and became common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a s ...
revolution.
Development
Language design
Language design for the first interpreters often simply involved referencing other implementations. For instance, Wozniak's references for BASIC were an HP BASIC manual and a copy of ''
101 BASIC Computer Games''. Based on these sources, Wozniak began sketching out a
syntax
In linguistics, syntax ( ) is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituenc ...
chart for the language. He did not know that
HP's BASIC was very different from the
DEC BASIC variety used in ''101 Games''. The two languages differed principally in terms of string handling and control structures.
Data General Business Basic
Data General Business Basic was a BASIC interpreter (based on a version from MAI Basic Four) marketed by Data General for their Nova minicomputer in the 1970s, and later ported to the Data General Eclipse MV and AViiON computers. Most bus ...
, an integer-only implementation, was the inspiration for Atari BASIC.
In contrast,
Dennis Allison
Dennis Allison is a lecturer at Stanford University, a position he has held since 1976.
Allison was a founding member of the People's Computer Company.
Allison in 1975 wrote a specification for a microcomputer interpreter for the BASIC progr ...
, a member of the Computer Science faculty at
Stanford University
Leland Stanford Junior University, commonly referred to as Stanford University, is a Private university, private research university in Stanford, California, United States. It was founded in 1885 by railroad magnate Leland Stanford (the eighth ...
, wrote a specification for a simple version of the language.
[ The ACM Special Interest Group on Programming Languages (SIGPLAN) reprinted the Tiny Basic design notes from the January 1976 Tiny BASIC Journal.] Allison was urged to create the standard by
Bob Albrecht
Bob Albrecht is a key figure in the early history of microcomputers. He was one of the founders of the People's Computer Company and its associated newsletters which turned into ''Dr. Dobb's Journal.'' He also brought the first Altair 8800 to the ...
of the
Homebrew Computer Club
The Homebrew Computer Club was an early computer hobbyist group in Menlo Park, California, which met from March 1975 to December 1986. The club had an influential role in the development of the microcomputer revolution and the rise of that aspec ...
, who had seen BASIC on
minicomputer
A minicomputer, or colloquially mini, is a type of general-purpose computer mostly developed from the mid-1960s, built significantly smaller and sold at a much lower price than mainframe computers . By 21st century-standards however, a mini is ...
s and felt it would be the perfect match for new machines like the Altair. Allison's proposed design only used integer arithmetic and did not support arrays or string manipulation. The goal was for the program to fit in 2 to 3 kilobytes of memory. The overall design for Tiny BASIC was published in the September 1975 issue of the
People's Computer Company
People's Computer Company (PCC) was an organization, a newsletter (the ''People's Computer Company Newsletter'') and, later, a quasiperiodical called the ''Dragonsmoke''. PCC was founded and produced by Dennis Allison, Bob Albrecht and George Fi ...
(PCC) newsletter.
The grammar is listed below in
Backus–Naur form
In computer science, Backus–Naur form (BNF, pronounced ), also known as Backus normal form, is a notation system for defining the Syntax (programming languages), syntax of Programming language, programming languages and other Formal language, for ...
. In the listing, an asterisk ("
*
") denotes zero or more of the object to its left — except for the first asterisk in the definition of "
term
", which is the multiplication operator; parentheses group objects; and an epsilon ("
ε
") signifies the empty set. As is common in computer language grammar notation, the vertical bar ("
,
") distinguishes alternatives, as does being listed on separate lines. The symbol "
CR
" denotes a
carriage return
A carriage return, sometimes known as a cartridge return and often shortened to CR, or return, is a control character or mechanism used to reset a device's position to the beginning of a line of text. It is closely associated with the line feed ...
.
line ::= number statement CR , statement CR
statement ::= PRINT expr-list
IF expression relop expression THEN statement
GOTO expression
INPUT var-list
LET var = expression
GOSUB expression
RETURN
CLEAR
LIST
RUN
END
expr-list ::= (string, expression) (, (string, expression) )*
var-list ::= var (, var)*
expression ::= (+, -, ε) term ((+, -) term)*
term ::= factor ((*, /) factor)*
factor ::= var , number , (expression)
var ::= A , B , C ... , Y , Z
number ::= digit digit*
digit ::= 0 , 1 , 2 , 3 , ... , 8 , 9
relop ::= < (>, =, ε) , > (<, =, ε) , =
This syntax, as simple as it was, added one innovation: and could take an expression rather than a line number, providing an
assigned GOTO rather than the
switch statement
In computer programming languages, a switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via search and map.
Switch statements function ...
of the structure more typical of BASIC.
Sinclair BASIC
Sinclair BASIC is a dialect of the programming language BASIC used in the 8-bit home computers from Sinclair Research, Timex Sinclair and Amstrad. The Sinclair BASIC interpreter was written by Nine Tiles Networks Ltd.
Designed to run in on ...
used as its language definition the 1978
American National Standards Institute
The American National Standards Institute (ANSI ) is a private nonprofit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organiz ...
(ANSI) Minimal BASIC standard, but was itself an incomplete implementation with integer arithmetic only. The ANSI standard was published after the design of the first generation of interpreters for microcomputers.
Architecture
Common components of a BASIC interpreter:
* I/O and interrupt handling
** Keyboard and screen
** File input/output (if any)
* Editing routines
** Command line
** Program editing and storage
* Execution routines
** Parsing and interpretation
** Arithmetic package
** Memory management
*** Symbol table (if any)
*** Garbage collection (if any)
Coding
Early microcomputers lacked development tools, and programmers either developed their code on minicomputers or by hand. For instance, Dick Whipple and John Arnold wrote Tiny BASIC Extended directly in machine code, using
octal
Octal (base 8) is a numeral system with eight as the base.
In the decimal system, each place is a power of ten. For example:
: \mathbf_ = \mathbf \times 10^1 + \mathbf \times 10^0
In the octal system, each place is a power of eight. For ex ...
. Robert Uiterwyk handwrote MICRO BASIC for the
SWTPC (a
6800 system) on a legal pad. Steve Wozniak wrote the code to
Integer BASIC
Integer BASIC is a BASIC interpreter written by Steve Wozniak for the Apple I and Apple II computers. Originally available on Cassette tape, cassette for the Apple I in 1976, then included in Read-only memory, ROM on the Apple II from its release ...
by hand, translating the
assembler code instructions into their
machine code
In computer programming, machine code is computer code consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). For conventional binary computers, machine code is the binaryOn nonb ...
equivalents and then uploading the result to his computer. (Because of this, the program was very hard to change, and Wozniak was not able to modify it quickly enough for
Steve Jobs
Steven Paul Jobs (February 24, 1955 – October 5, 2011) was an American businessman, inventor, and investor best known for co-founding the technology company Apple Inc. Jobs was also the founder of NeXT and chairman and majority shareholder o ...
, who subsequently licensed BASIC from Microsoft.)
Gates and Allen did not have an Altair system on which to develop and test their interpreter. However, Allen had written an
Intel 8008
The Intel 8008 ("''eight-thousand-eight''" or "''eighty-oh-eight''") is an early 8-bit microprocessor capable of addressing 16 KB of memory, introduced in April 1972. The 8008 architecture was designed by Computer Terminal Corporation (CTC) and ...
emulator
In computing, an emulator is Computer hardware, hardware or software that enables one computer system (called the ''host'') to behave like another computer system (called the ''guest''). An emulator typically enables the host system to run sof ...
for their previous venture,
Traf-O-Data
Traf-O-Data was a business partnership between Bill Gates, Paul Allen and Paul Gilbert that existed in the 1970s. The objective was to read the raw data from roadway traffic counters and create reports for traffic engineers. The company had only ...
, that ran on a
PDP-10
Digital Equipment Corporation (DEC)'s PDP-10, later marketed as the DECsystem-10, is a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. 1970s models and beyond were marketed under the DECsystem-10 name, especi ...
time-sharing
In computing, time-sharing is the Concurrency (computer science), concurrent sharing of a computing resource among many tasks or users by giving each Process (computing), task or User (computing), user a small slice of CPU time, processing time. ...
computer. Allen adapted this emulator based on the Altair programmer guide, and they developed and tested the interpreter on Harvard's PDP-10.
When Harvard stopped their use of this system, Gates and Allen bought computer time from a timesharing service in Boston to complete their BASIC program debugging. Gates claimed, in his
Open Letter to Hobbyists
"An Open Letter to Hobbyists" is a 1976 open letter written by Bill Gates, the co-founder of Microsoft, to early personal computer hobbyists, in which Gates expresses dismay at the widespread duplication of software taking place in the hobbyist co ...
in 1976, the value of the computer time for the first year of software development was $40,000.
Not that Allen couldn't handcode in machine language. While on final approach into the Albuquerque airport on a trip to demonstrate the interpreter, Allen realized he had forgotten to write a
bootstrap program to read the tape into memory. Writing in 8080 machine language, Allen finished the program before the plane landed. Only when he loaded the program onto an Altair and saw a prompt asking for the system's memory size did he know that the interpreter worked on the Altair hardware.
One of the most popular of the many versions of Tiny BASIC was Palo Alto Tiny BASIC, or PATB for short. PATB first appeared in the May 1976 edition of ''Dr. Dobbs'', written in a custom
assembler language
In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
with non-standard mnemonics.
Li-Chen Wang had coded his interpreter on a time-share system with a generic assembler.
One exception to the use of assembly was the use of
ALGOL 60
ALGOL 60 (short for ''Algorithmic Language 1960'') is a member of the ALGOL family of computer programming languages. It followed on from ALGOL 58 which had introduced code blocks and the begin and end pairs for delimiting them, representing a ...
for the Paisley XBASIC interpreter for
Burroughs large systems
The Burroughs Large Systems Group produced a family of large 48-bit computing, 48-bit mainframe computer, mainframes using stack machine instruction sets with dense Syllable (computing), syllables.E.g., 12-bit syllables for B5000, 8-bit syllables f ...
. Another exception, and
type-in program
A type-in program or type-in listing was computer source code printed in a home computer magazine or book. It was meant to be entered via the keyboard by the reader and then saved to cassette tape or floppy disk. The result was a usable game, ut ...
, was Classic BASIC, written by Lennart Benschop in
Forth and published in the Dutch Forth magazine ''Vijgeblad'' (issue #42, 1993).
The source code of interpreters was often
open source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
(as with Tiny BASIC) or published later by the authors. The complete annotated
source code
In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer.
Since a computer, at base, only ...
and design specifications of Atari BASIC were published as ''The Atari BASIC Source Book'' in 1983.
Virtual machines
Some BASIC interpreters were coded in the
intermediate representation
An intermediate representation (IR) is the data structure or code used internally by a compiler or virtual machine to represent source code. An IR is designed to be conducive to further processing, such as optimization and translation. A "good" ...
of a
virtual machine
In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
to add a layer of abstraction and conciseness above native
machine language
In computer programming, machine code is computer code consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). For conventional binary computers, machine code is the binaryOn nonb ...
.
While virtual machines had been used in
compile and go systems such as
BASIC-PLUS
BASIC-PLUS is an extended dialect of the BASIC programming language that was developed by Digital Equipment Corporation (DEC) for use on its RSTS/E time-sharing operating system for the PDP-11 series of 16-bit minicomputers in the early 1970s thro ...
, these were only for executing BASIC code, not parsing it. Tiny BASIC, in contrast, was designed to be implemented as a virtual machine that parsed and executed (interpreted) BASIC statements; in such an implementation, the Tiny BASIC
interpreter
Interpreting is translation from a spoken or signed language into another language, usually in real time to facilitate live communication. It is distinguished from the translation of a written text, which can be more deliberative and make use o ...
is itself run on a virtual machine interpreter. The length of the whole interpreter program was only 120 virtual machine operations, consisting of 32 commands. Thus the choice of a virtual machine approach economized on memory space and implementation effort, although the BASIC programs run thereon were executed somewhat slowly. ''(See
Tiny BASIC: Implementation in a virtual machine for an excerpt and sample commands.)'' While the design intent was for Tiny BASIC to use a virtual machine, not every implementation did so; those that did included Tiny BASIC Extended, 6800 Tiny BASIC, and NIBL.
For its
TI-99/4 and TI-99/4A computers, Texas Instruments designed a virtual machine with a language called GPL, for "Graphic Programming Language". (Although widely blamed for the slow performance of
TI-BASIC, part of the problem was that the virtual machine was stored in graphics ROM, which had a slow 8-bit interface.)
A misunderstanding of the Apple II ROMs led some to believe that Integer BASIC used a virtual machine, a custom
assembler language
In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
contained in the Apple ROMs and known as
SWEET16. SWEET16 is based on
bytecode
Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
s that run within a simple 16-bit virtual machine, so memory could be addressed via indirect 16-bit pointers and 16-bit math functions calculated without the need to translate those to the underlying multi-instruction 8-bit 6502 code. However, SWEET16 was not used by the core BASIC code, although it was later used to implement several utilities, such as a line renumbering routine.
Program editing and storage
Program editing
Most BASIC implementations of the era acted as both the language interpreter as well as the
line editor
In computing, a line editor is a text editor in which each editing command applies to one or more complete lines of text designated by the user. Line editors predate screen-based text editors and originated in an era when a computer operator typic ...
. When BASIC was running, a
command prompt
A command-line interface (CLI) is a means of interacting with software via commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user-friendly alternativ ...
was displayed where the user could enter statements. This was known as "
direct mode
In computing, direct or immediate mode in an interactive programming system is the immediate execution of commands, statements, or expressions. In many interactive systems, most of these can both be included in programs or executed directly in ...
". Upon boot, a BASIC interpreter defaulted to direct mode.
Statements that were entered with leading numbers are entered into the program storage for "deferred execution", either as new lines or replacing any that might have had the same number previously. Statements that were entered without a
line number
In computing, a line number is a method used to specify a particular sequence of characters in a text file. The most common method of assigning numbers to lines is to assign every line a unique number, starting at 1 for the first line, and increm ...
were referred to as commands, and ran immediately. Line numbers without statements (i.e., followed by a
carriage return
A carriage return, sometimes known as a cartridge return and often shortened to CR, or return, is a control character or mechanism used to reset a device's position to the beginning of a line of text. It is closely associated with the line feed ...
) deleted a previously stored line.
When a program was present in memory and the user types in the command, the system enters "indirect mode". In this mode, a pointer is set to point to the first line of the program, for instance, line 10. The original text for that line is then retrieved from the store and run as if the user had just typed it in direct mode. The pointer then advances to the next line and the process continues.
Different implementations offered other program-editing capabilities. Altair BASIC 8K had an command to shift into an editing mode for one line. Integer BASIC, also included the command to automatically enter line numbers at a given starting number like , adding 10 to the last number with every new line. would begin numbering at line 300 by fives; 300, 305, etc. Automatic numbering was turned off by entering . Some interpreters offered line-renumbering commands or utilities.
Tokenizing and encoding lines
To save RAM, and speed execution, all BASIC interpreters would encode some
ASCII
ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
characters of lines into other representations. For instance, line numbers were converted into integers stored as
byte
The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable un ...
s or
word
A word is a basic element of language that carries semantics, meaning, can be used on its own, and is uninterruptible. Despite the fact that language speakers often have an intuitive grasp of what a word is, there is no consensus among linguist ...
s, and keywords might be assigned single-byte
tokens (for instance, storing as the byte value 145, in MS-BASIC). These representations would then be converted back to readable text when ing the program.
Abbreviations
As an alternative to tokenization, to save RAM, early Tiny BASIC implementations like Extended Tiny BASIC, Denver Tiny BASIC and MINOL
truncated keywords: for , for , for . The full, traditional keywords were not accepted.
In contrast, Palo Alto Tiny BASIC accepted traditional keywords but allowed any keyword to be abbreviated to its minimal unique string, with a trailing period. For instance, could be typed , although and other variations also worked. This system was retained in
Level I BASIC
Level I BASIC is a dialect of the BASIC programming language that shipped with the first TRS-80, the TRS-80 Model I.
Background
Tandy employee Steve Leininger had written the first draft of the NIBL (National Industrial Basic Language) BASIC int ...
for the
TRS-80
The TRS-80 Micro Computer System (TRS-80, later renamed the Model I to distinguish it from successors) is a desktop microcomputer developed by American company Tandy Corporation and sold through their Radio Shack stores. Launched in 1977, it is ...
, which used PATB, and was also found in
Atari BASIC
Atari BASIC is an interpreter for the BASIC programming language that shipped with Atari 8-bit computers. Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC and differs in significant way ...
and the BASIC of various
Sharp Pocket Computers
Sharp or SHARP may refer to:
Acronyms
* SHARP (helmet ratings) (Safety Helmet Assessment and Rating Programme), a British motorcycle helmet safety rating scheme
* Self Help Addiction Recovery Program, a charitable organisation founded in 199 ...
.
To expand an abbreviation, the Atari BASIC tokenizer searches through its list of reserved words to find the first that matches the portion supplied. More commonly used commands occur first in the list of reserved words, with
REM
at the beginning (it can be typed as
.
). When the program is later
LIST
ed it will typically write out the full words. MS BASICs also allowed
?
as a short-form for
PRINT
, but did expand it when listing, treating it as an abbreviation, not a synonym.
Tokenization
Most BASIC interpreters perform at least some conversion from the original text form into various platform-specific formats. Tiny BASIC was on the simple end: it only converted the line number from its decimal format into binary. For instance, the line number "100" became a single byte value, $64, making it smaller to store in memory as well as easier to look up in
machine code
In computer programming, machine code is computer code consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). For conventional binary computers, machine code is the binaryOn nonb ...
(a few designs of Tiny BASIC permitted line numbers from only 1 to 254 or 255, although most used double byte values and line numbers of at least 1 to 999). The rest of the line was left in its original text format. In fact, Dennis Allison argued that, given memory constraints, tokenization would take more code to implement than it would save.
MS-BASICs went slightly further, converting the line number into a two-byte value and also converting keywords, like or , into a single-byte value, the "token". The token value had the high bit set to allow them to be easily distinguished at runtime. Everything else on a line was left in its original format, so for instance, the line:
10 FOR I=1 TO 10
would be tokenized as:
$64$81 I$B211$A410
Note that the space between and remains in the tokenized line, and the variable names and constants are not tokenized. The code that performed this tokenization, known as "the chunker", simply copied anything it did not recognize as a token back into the output, preserving spaces as-is. This meant that was stored in two bytes, while was stored in three bytes, and removing spaces was a common way to improve memory use.
Sinclair BASIC
Sinclair BASIC is a dialect of the programming language BASIC used in the 8-bit home computers from Sinclair Research, Timex Sinclair and Amstrad. The Sinclair BASIC interpreter was written by Nine Tiles Networks Ltd.
Designed to run in on ...
modified this slightly, removing spaces from the stored code and inserting them in code during a , such that would appear as yet not take up the extra byte in memory.
In contrast, Integer BASIC would convert the line entirely into tokens that could be immediately read and performed. In MS-BASIC, the line would produce , and at runtime the "100" would have to be converted to 16-bit format every time it was encountered. In contrast, Integer BASIC also tokenized numeric variables, avoiding this conversion and speeding up execution. The resulting two byte value was inserted into the tokenized code along with a prefix byte indicating a number followed. The prefix was a value between and , the last nibble of the value being the first decimal digit in the original value. String literals, like "HELLO WORLD" were instead encoded by setting the high bit of each character so that was stored as . Variable names were converted in the same fashion, with the letters encoded to have their high-bit turned on, and any digits in the name represented by the corresponding through , so that the variable would be encoded as (not reduced to a token). There were numerous other optimizations; where Microsoft BASIC had one token for the keyword , Integer BASIC had three tokens: one if the keyword was followed by no arguments, one if followed by an arithmetic expression, and one if followed by a string literal.
Carrying this even further, Atari BASIC's tokenizer parses the entire line when it is entered or modified. Numeric constants are parsed into their 48-bit internal form and then placed in the line in that format, while strings are left in their original format, but prefixed with a byte describing their length. Variables have storage set aside as they are encountered, instead of at runtime, and their name is replaced with a pointer to their storage location in memory. Shepardson referred to this early-tokenizing concept as a "pre-compiling interpreter"; statements with syntax errors could not actually be stored, and the user was immediately prompted to correct them.
Tokenization at the keyboard

Some interpreters, such as the Sinclair systems, basically had the user do the tokenization by providing special keystrokes to enter reserved words. The most common commands need one keystroke only; for example, pressing only at the start of a line on a Spectrum produces the full command
PRINT
. Less frequent commands require more complex key sequences. As every line starts with a keyword, is not optional, after a keyword is typed the system drops back to accepting text character-by-character. One upside to this approach is that the tokenizer cannot confuse strings with keywords. For instance, it allows a variable to be named
PRINT
and output its value with
PRINT PRINT
.
Many "
pocket computers" similarly use one keystroke (sometimes preceded by various kinds of shift keys) to produce one byte (the keyword token) that represented an entire BASIC keyword, such as , or , such as
Sharp pocket computer character sets and
TI-BASIC. The BASIC expansion for the
Bally Astrocade
The Bally Astrocade (also known as Bally Arcade and initially as Bally ABA-1000) is a second-generation home video game console
A home video game console is a video game console that is designed to be connected to a display device, such as ...
use this as well.
Line management
Valid line numbers varied from implementation to implementation, but were typically from 1 to 32767.
Most of the memory used by BASIC interpreters was to store the program listing itself. Numbered statements were stored in sequential order in a
sparse array
In numerical analysis and scientific computing, a sparse matrix or sparse array is a matrix in which most of the elements are zero. There is no strict definition regarding the proportion of zero-value elements for a matrix to qualify as sparse ...
implemented as a
linear collection (technically not a
list
A list is a Set (mathematics), set of discrete items of information collected and set forth in some format for utility, entertainment, or other purposes. A list may be memorialized in any number of ways, including existing only in the mind of t ...
as no line number could occur more than once).
Many Tiny BASIC implementations stored lines as follows:
* Binary equivalent of line number (one or two bytes, depending on range of valid line numbers supported)
* ASCII source statement (variable length)
* Carriage return (one byte, set to 13)
Microsoft BASIC, starting with Altair BASIC, stored lines as follows:
* Pointer to the next line (two bytes)
* Binary equivalent of line number (two bytes, unsigned)
* Tokenized source statement (variable length)
*
Null
Null may refer to:
Science, technology, and mathematics Astronomy
*Nuller, an optical tool using interferometry to block certain sources of light Computing
*Null (SQL) (or NULL), a special marker and keyword in SQL indicating that a data value do ...
(one byte, set to 0)
LLL BASIC:
* Binary equivalent of line number (two bytes)
* Forward pointer to next sequential line (two bytes)
* Length of ASCII source statement (one byte)
* ASCII source statement (variable length)
The maximum length of a line varied: 64 characters in Palo Alto Tiny BASIC, including the decimal representation of the line number; 120 characters in Atari BASIC; 128 characters in Integer BASIC; and 255 characters in MS-BASIC (not including the line number).
Interpreters would search the program a line at a time, looking at each line number. If it were lower than the new line number, the later lines would be moved in memory to make room for the space required for the new line. If it were the same line number, and not the exact same length, subsequent lines would need to be moved forward or backward. (Because sequential order was always maintained in memory, these were not
linked list
In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes whi ...
s.)
In Tiny BASIC, these searches required checking every byte in a line: the pointer would be incremented again and again until a carriage return was encountered, to find the byte before the next line. In Altair BASIC and LLL BASIC, on the other hand, the pointer would instead be set to the start of the next sequential line; this was much faster, but required two bytes per line. Given that Tiny BASIC programs were presumed to be 4 KB or less in size, this was in keeping with Tiny BASIC's general design philosophy of trading off performance in favor of minimizing memory usage.
When the user typed into the command line, the system would loop over the array of lines, using one of these methods, convert the line number back to decimal format, and then print out the rest of the text in the line, decoding any tokens or other encoded representations.
As developers added
structured programming Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making specific disciplined use of the structured control flow constructs of selection ( if/then/else) and repet ...
constructs to BASIC, they often removed the need for line numbers altogether and added
text editors
A text editor is a type of computer program that edits plain text. An example of such program is "notepad" software (e.g. Windows Notepad). Text editors are provided with operating systems and software development packages, and can be used to ...
and, later,
integrated development environment
An integrated development environment (IDE) is a Application software, software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, an ...
s.
Variables and data types
Variable names
Dartmouth BASIC
Dartmouth BASIC is the original version of the BASIC programming language. It was designed by two professors at Dartmouth College, John G. Kemeny and Thomas E. Kurtz. With the underlying Dartmouth Time-Sharing System (DTSS), it offered an interac ...
and HP-BASIC limited variable names to at most two characters (either a single letter or a letter followed by one digit; e.g., A to Z9). MS-BASIC allowed variable names of a letter followed by an optional letter or digit (e.g., A to ZZ) but ignored subsequent characters: thus it was possible to inadvertently write a program with variables "LOSS" and "LOAN", which would be treated as being the same; assigning a value to "LOAN" would silently overwrite the value intended as "LOSS".
Integer BASIC was unusual in supporting any length variable name (e.g., SUM, GAMEPOINTS, PLAYER2), provided it did not contain a reserved word. Keywords could not be used in variables in many early BASICs; "SCORE" would be interpreted as "SC" OR "E", where OR was a keyword.
String
String or strings may refer to:
*String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects
Arts, entertainment, and media Films
* ''Strings'' (1991 film), a Canadian anim ...
variables are usually distinguished in many microcomputer dialects of BASIC by having $ suffixed to their name, and values are often identified as strings by being delimited by "double quotation marks". Later implementations would use other punctuation to specify the type of a variable: A% for integer, A! for
single precision
Single-precision floating-point format (sometimes called FP32 or float32) is a computer number format, usually occupying 32 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point.
A floa ...
, and A# for
double precision
Double-precision floating-point format (sometimes called FP64 or float64) is a floating-point arithmetic, floating-point computer number format, number format, usually occupying 64 Bit, bits in computer memory; it represents a wide range of numeri ...
.
With the exception of arrays and (in some implementations) strings, and unlike
Pascal and other more structured programming languages, BASIC does not require a variable to be declared before it is referenced. Values will typically default to 0 (of the appropriate precision) or the null string.
Symbol table
Because Tiny BASIC only used 26 single-letter variables, variables could be stored as an array without storing their corresponding names, using a formula based on the ASCII value of the letter as the index. Palo Alto Tiny BASIC took this a step further: variables 'two-byte values were located in RAM within the program, from bytes 130 (ASCII 65, 'A', times two) to 181 (ASCII 90, 'Z', times two, plus one for the second byte).
[
Most BASICs provided for the ability to have far more than 26 variables and so needed symbol tables, which would set aside storage capacity for only those variables used.
In LLL BASIC, each entry in the symbol table was stored as follows:
* Variable name (byte 1: ASCII letter; byte 2: 0-9 ASCII or binary 0)
* Forward pointer (2 bytes)
* Value (4 bytes per element, 1 element if a scalar variable, otherwise as many elements as DIMensioned for an array)
Unlike most BASIC interpreters, UIUC BASIC had a ]hash
Hash, hashes, hash mark, or hashing may refer to:
Substances
* Hash (food), a coarse mixture of ingredients, often based on minced meat
* Hash (stew), a pork and onion-based gravy found in South Carolina
* Hash, a nickname for hashish, a canna ...
function, hashing by the letter of the variable/function/array name, then conducting a linear search from there. In UIUC BASIC, a symbol table entry was:
* Flag (bit 0: entry in use; bit 6: user-defined function; bit 7: array}
* Variable name (byte 1: ASCII letter; byte: 0-9 ASCII, " ", or "(") or function name (byte 1: ASCII letter or token 154 for ; ASCII letter)
* Value (5 bytes):
** Floating-point value for a scalar
** Array definition (last 3 bytes: upper dimension of first, second, third dimension, all assumed to start at 0)
** User function (first 2 bytes with the address of the function; byte 3 is symbol table displacement to the dummy variable parameter in function definition).
In Atari BASIC, a set of pointers (addresses) indicated various data: variable names were stored in the ''variable name table'' (VNTP – 82, 8316) and their values were stored in the ''variable value table'' (pointed to at VVTP – 86, 8716). By indirecting the variable names in this way, a reference to a variable needed only one byte to address its entry into the appropriate table. String variables had their own area.
One BBC BASIC performance optimization included using multiple linked list
In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes whi ...
s for variable lookup rather than a single long list, as in Microsoft BASIC
Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first v ...
.
Memory management
Because of the small RAM capacity of most systems originally used to run BASIC interpreters, clever memory management techniques had to be employed. Altair BASIC let users reclaim the space for trigonometry functions if those weren't being used during a session. PATB placed the start of the most common subroutines at the front of the program for use by the 1-byte 8080 opcode instead of the 3-byte opcode. In LLL BASIC, some variables occupied the same memory locations, in cases where the different variables were used only in command mode or only at runtime.
Video was often memory addressable, and certain esoteric functions were available by manipulating values at specific memory values. For instance, addresses 32 to 35 contained the dimensions of the text window (as opposed to the graphics window) in Applesoft BASIC. The command and the function (adapted from machine code monitor
A machine code monitor ( machine language monitor) is software that allows a user to enter commands to view and change memory address, memory locations on a computer, with options to load and save memory contents from/to secondary storage. Some f ...
s such as the DECsystem-10
Digital Equipment Corporation (DEC)'s PDP-10, later marketed as the DECsystem-10, is a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. 1970s models and beyond were marketed under the DECsystem-10 name, especi ...
monitor) provided direct memory access, for a variety of purposes, especially for modifying special memory-mapped hardware register
In digital electronics, especially computing, hardware registers are circuits typically composed of flip-flops, often with many characteristics similar to memory, such as:
* Using an memory or port address to select a particular register in a ma ...
s to control particular functions of the computer such as the input/output peripherals. "Memory maps" (in the archaic sense of lists of memory addresses and their functions) were popular for use with PEEK and POKE, with one of the best known memory maps being the book '' Mapping the Atari'', written by Ian Chadwick.
Some implementations of the Microsoft interpreter, for example those running on the TRS-80
The TRS-80 Micro Computer System (TRS-80, later renamed the Model I to distinguish it from successors) is a desktop microcomputer developed by American company Tandy Corporation and sold through their Radio Shack stores. Launched in 1977, it is ...
Models I/III, required the user to specify the amount of memory to be used by the interpreter. This was to permit a region of memory to be reserved for the installation of machine language subroutines that could be called by the interpreted program, for greater speed of execution. When the Models I/III are powered up, the user is greeted with the prompt "Memory size?" for this purpose.
Mathematics
Integer BASIC, as its name implies, uses integer
An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
s as the basis for its math package. These were stored internally as a 16-bit number, little-endian (as is the 6502). This allowed a maximum value for any calculation between −32767 and 32767. Calculations that resulted in values outside that range produced an error.
Most Tiny BASIC interpreters (as well as Sinclair BASIC 4K) supported mathematics using integers only, lacking floating-point
In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a ''significand'' (a Sign (mathematics), signed sequence of a fixed number of digits in some Radix, base) multiplied by an integer power of that ba ...
support. Using integers allowed numbers to be stored in a much more compact 16-bit format that could be more rapidly read and processed than the 32- or 40-bit floating-point formats found in most BASICs of the era. However, this limited its applicability as a general-purpose language.
Business BASIC implementations, such as Data General Business Basic
Data General Business Basic was a BASIC interpreter (based on a version from MAI Basic Four) marketed by Data General for their Nova minicomputer in the 1970s, and later ported to the Data General Eclipse MV and AViiON computers. Most bus ...
, were also integer-only, but typically at a higher precision: "double precision", i.e. 32-bit
In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in a maximum of 32- bit units. Compared to smaller bit widths, 32-bit computers can perform la ...
(plus or minus 2,147,483,648) and "triple precision" (plus or minus 1.4x10^14).
Other computer number format
A computer number format is the internal representation of numeric values in digital device hardware and software, such as in programmable computers and calculators. Numerical values are stored as groupings of bits, such as bytes and words. The ...
s were sometimes used. For instance, the MINOL Tiny BASIC supported only unsigned byte
The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable un ...
s, and the MICRO-BASIC Tiny BASIC used Binary Coded Decimal. But floating point would come to predominate.
Floating point
One story encapsulates why floating point was considered so important. The original prototype of the TRS-80 Model I ran Li-Chen Wang's public domain version of Tiny BASIC
Tiny BASIC is a family of dialects of the BASIC programming language that can fit into 4 or fewer KBs of memory. Tiny BASIC was designed by Dennis Allison and the People's Computer Company (PCC) in response to the open letter published by Bi ...
. This required only 2 KB of memory for the interpreter
Interpreting is translation from a spoken or signed language into another language, usually in real time to facilitate live communication. It is distinguished from the translation of a written text, which can be more deliberative and make use o ...
, leaving an average of another 2 KB free for user programs in common 4 KB memory layouts of early machines. During a demonstration to executives, Tandy Corporation
Tandy Corporation was an American family-owned Retail, retailer based in Fort Worth, Texas that made leather goods, operated the RadioShack chain, and later built personal computers.
Tandy Leather was founded in 1919 as a leather supply store ...
's then-President Charles Tandy tried to enter his salary but was unable to do so. This was because Tiny BASIC used 2-byte signed integers with a maximum value of 32,767. The result was a request for floating-point
In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a ''significand'' (a Sign (mathematics), signed sequence of a fixed number of digits in some Radix, base) multiplied by an integer power of that ba ...
math for the production version. This led to the replacement of the existing 16-bit integer code with a version using 32-bit single-precision
Single-precision floating-point format (sometimes called FP32 or float32) is a computer number format, usually occupying 32 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point.
A floati ...
floating-point numbers by Tandy-employee Steve Leininger.
SCELBAL used floating point
In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a ''significand'' (a signed sequence of a fixed number of digits in some base) multiplied by an integer power of that base.
Numbers of this form ...
routines published by Wadsworth in 1975 in
Machine Language Programming for the 8008
' based on a 32-bit (four byte) format for numeric calculations, with a 23-bit mantissa, 1-bit sign for the mantissa, a 7-bit exponent, and 1-bit sign for the exponent. These were organized in reverse order, with the least significant byte of the mantissa in the first byte, followed by the middle and then most significant byte with the sign in the high bit. The exponent came last, again with the sign in the high bit. The manual provides well-documented assembly code
In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
for the entire math package, including entry points and usage notes.
Consultants were typically brought into handle floating-point arithmetic
In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a ''significand'' (a Sign (mathematics), signed sequence of a fixed number of digits in some Radix, base) multiplied by an integer power of that ba ...
, a specialist domain well studied and developed for the scientific and commercial applications that had characterized mainframes. When Allen and Gates were developing Altair BASIC, fellow Harvard student Monte Davidoff
Monte Davidoff (; born 1956) is an American computer programmer.
Davidoff is from Glendale, Wisconsin. He graduated from Nicolet High School in 1974, and went on to Harvard College, where he majored in applied mathematics, the department at Harv ...
convinced them to switch from integer arithmetic. They hired Davidoff to write a floating-point package that could still fit within the 4KB memory limits. Steve Wozniak turned to Roy Rankin of Stanford University
Leland Stanford Junior University, commonly referred to as Stanford University, is a Private university, private research university in Stanford, California, United States. It was founded in 1885 by railroad magnate Leland Stanford (the eighth ...
for implementing the transcendental functions
In mathematics, a transcendental function is an analytic function that does not satisfy a polynomial equation whose coefficients are functions of the independent variable that can be written using only the basic operations of addition, subtraction ...
LOG, LOG10, and EXP; however, Wozniak never finished adding floating-point support to Integer BASIC. LLL BASIC, developed at the University of Idaho
The University of Idaho (U of I, or UIdaho) is a public land-grant research university in Moscow, Idaho, United States. Established in 1889 and opened three years later, it was the state's sole university for 71 years, until 1963.
The un ...
by John Dickenson, Jerry Barber, and John Teeter, turned to David Mead, Hal Brand, and Frank Olken for their floating-point support. For UIUC BASIC, a Datapoint 2200
The Datapoint 2200 was a mass-produced programmable terminal usable as a computer, designed by Computer Terminal Corporation (CTC) founders Phil Ray and Gus Roche and announced by CTC in June 1970 (with units shipping in 1971). It was initially ...
floating-point package was licensed.
In contrast, time-shared systems had often relied on hardware. For instance, the GE-235 was chosen for implementing the first version of Dartmouth BASIC specifically because it featured an " Auxiliary Arithmetic Unit" for floating point and double-precision calculations.
Early interpreters used 32-bit formats, similar to the IEEE 754 single-precision binary floating-point format, which specifies:
* Sign bit
In computer science, the sign bit is a bit in a signed number representation that indicates the sign of a number. Although only signed numeric data types have a sign bit, it is invariably located in the most significant bit position, so the term ...
: 1 bit
* Exponent
In mathematics, exponentiation, denoted , is an operation involving two numbers: the ''base'', , and the ''exponent'' or ''power'', . When is a positive integer, exponentiation corresponds to repeated multiplication of the base: that is, i ...
width: 8 bits
* Significand precision (arithmetic), precision: 24 bits (23 explicitly stored)
Here is the value 0.15625 as stored in this format:
While 32-bit formats were common in this era, later versions of BASIC, starting with Microsoft BASIC
Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first v ...
for the MOS 6502
The MOS Technology 6502 (typically pronounced "sixty-five-oh-two" or "six-five-oh-two") William Mensch and the moderator both pronounce the 6502 microprocessor as ''"sixty-five-oh-two"''. is an 8-bit microprocessor that was designed by a small ...
, generally adopted a 40-bit (five byte) format for added precision.
Operators and functions
Infix operators typically included (addition), (subtraction), (multiplication), (division), and exponent using the character. Relative operations included the standard set of , , , , , and for "not equal" either or the HP Time-Shared BASIC, HP-TSB-inspired . Binary operators, such as , and , weren't in every implementation, and some did Boolean algebra and some did not.
Dartmouth BASIC's initial edition included the following functions: (absolute value), (arctangent), (cosine), (''E (mathematical constant), e'' raised to the power), (truncate any fractional value, returning an integer), (logarithm), (pseudorandom number generator), (sine), (square root), and (tangent). It also included the statement to declare one-line functions, which would then be referred to as , , etc.
The function was the most widespread function to be supported in early BASICs, though implementations varied:
* Dartmouth's ignored the parameter and always returned a new pseudorandom number between 0 and 1.
* Altair BASIC and later Microsoft BASICs used the sign of the parameter: For RND(X), "X<0 starts a new sequence of random numbers using X. Calling RND with the same X starts the same random number sequence. X=0 gives the last random number generated."
* Being unable to return a decimal, integer-only BASICs instead used the value of the parameter, typically to specify an upper bound for the randomization; for example, in Integer BASIC itself, would simulate a die roll, returning values from 1 to 6.
* In contrast, in some TRS-80 BASICs, the parameter was the upper bound that could be returned; for instance, would return a value from 1 to 6, and would always return 1.
Arrays
The second version of Dartmouth BASIC
Dartmouth BASIC is the original version of the BASIC programming language. It was designed by two professors at Dartmouth College, John G. Kemeny and Thomas E. Kurtz. With the underlying Dartmouth Time-Sharing System (DTSS), it offered an interac ...
supported matrix (mathematics), matrices and matrix operations, useful for the solution of sets of simultaneous linear algebraic equations; matrix operations such as assignment, addition, multiplication (of compatible matrix types) and evaluation of a determinant were supported.
In contrast, Tiny BASIC as initially designed didn't even have any arrays, due to the limited main memory
Computer data storage or digital data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processin ...
available on early microcomputer
A microcomputer is a small, relatively inexpensive computer having a central processing unit (CPU) made out of a microprocessor. The computer also includes memory and input/output (I/O) circuitry together mounted on a printed circuit board (P ...
s, often 4 KB, which had to include both the interpreter and the BASIC program. Palo Alto Tiny BASIC added a single variable-length array of integers, the size of which did not have to be dimensioned but used RAM not used by the interpreter or the program listing, .
SCELBAL supported multiple arrays, but taken together these arrays could have no more than 64 items. Integer BASIC supported arrays of a single dimension, limited in size only by the available memory. Tiny BASIC Extended supported two-dimensional arrays of up to 255 by 255. Altair BASIC 4K supported only arrays (one dimension) while the 8K version supported matrices of up to 34 dimensions.
Many implementations supported the Dartmouth BASIC practice of not requiring an array to be dimensioned, in which case it was assumed to have 11 elements (0 to 10); e.g., would create the 11-element array as a side effect.
The dope vector of arrays varied from implementation to implementation. For instance, the dope vector of an Altair BASIC 4K array:[
* Variable name (2 bytes)
* Size of the array elements in bytes (2 bytes, so 4 times the number of elements, which was the upper bound plus one)
Then the array values themselves:
* Element 0 value (4 bytes)
* Element 1 value (4 bytes)
* ...
* Element N value (4 bytes)
Implementations that supported matrices had to record the number of dimensions and the upper bound of each dimension. Further, as some interpreters had only one data type (either floating point or integer), the dope vector merely needed to record the number of dimensions and the upper bound of each dimension. Interpreters with multiple data types had to record the data type of the array.
Even though Microsoft and other BASICs did support matrices, matrix operations were not built in but had to be programmed explicitly on array elements.
]
Strings
The original Dartmouth BASIC, some of its immediate descendants, and Tiny BASIC implementations lacked string handling. Two competing schools of string-handling evolved, pioneered by HP and DEC, although other approaches came later. These required different strategies for implementation.
The simplest string handling copied HP Time-Shared BASIC
HP Time-Shared BASIC (HP TSB) is a BASIC, BASIC programming language Interpreter (computing), interpreter for Hewlett-Packard's HP 2100#HP 2000, HP 2000 line of minicomputer-based time-sharing computer systems. TSB is historically notable as th ...
and defined string variables as arrays of characters that had to be ensioned prior to use. Strings in HP TSB are treated as an array of characters, up to 72 in total, rather than a single multi-character object. By default, they are allocated one character in memory, and if a string of longer length is needed, they have to be declared. For instance, DIM A$[10] will set up a string that can hold a maximum of 10 characters.[, Part No. 22687-90001]
Substrings within strings are accessed using a "Array slicing, slicing" notation: A$(L,R) or A$[L,R], where the substring begins with the leftmost character specified by the index L and continues to the rightmost character specified by the index R, or the A$[L] form where the substring starts at the leftmost character specified by the index L and continues to the end of the string. TSB accepts () or [] interchangeably. Array and substring indices start with 1.
This is in sharp contrast to BASICs following the DEC pattern that use functions such as LEFT$()
, MID$()
, and RIGHT$()
to access substrings. Later adopted by ANSI BASIC, HP's notation can also be used on the destination side of a or statement to modify part of an existing string value, for example 100 A$[3,5]="XYZ" or 120 B$[3]="CHANGE ALL BUT FIRST TWO CHARS", which cannot be done with early implementations of .
Dartmouth BASIC#Fourth Edition, Later versions of Dartmouth BASIC did include string variables. However, they did not use the LEFT$/MID$/RIGHT$
functions for manipulating strings, but instead used the CHANGE
command which converted the string to and from equivalent ASCII values. (Later adopted as is by DEC and adapted by HP, which changed the keyword to CONVERT
.[) Additionally, one could use the single-quote to convert a numeric constant to an ASCII character, allowing one to build up a string in parts; ]A$='23 '64 '49 "DEF"
produced the string "ABCDEF", without the need for the CHR$()
function.[ Dartmouth BASIC Sixth Edition supported (for ) and (for ).
Integer BASIC, North Star BASIC and ]Atari BASIC
Atari BASIC is an interpreter for the BASIC programming language that shipped with Atari 8-bit computers. Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC and differs in significant way ...
mimicked HP's approach, which again contrasted with the style found in BASICs derived from Digital Equipment Corporation, DEC, including Microsoft BASIC
Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first v ...
, where strings are an intrinsic variable-length type.
Some of the Tiny BASIC
Tiny BASIC is a family of dialects of the BASIC programming language that can fit into 4 or fewer KBs of memory. Tiny BASIC was designed by Dennis Allison and the People's Computer Company (PCC) in response to the open letter published by Bi ...
implementations supported one or more predefined integer arrays, which could be used to store character codes, provided the language had functionality to input and output character codes (e.g., Astro BASIC had KP
and TV
for this purpose).
Garbage collection
Having strings use a fixed amount of memory regardless of the number of characters used within them, up to a maximum of 255 characters, may have wasted memory but had the advantage of avoiding the need for implementing Garbage collection (computer science), garbage collection of the Heap (data structure), heap, a form of automatic memory management used to reclaim memory occupied by strings that are no longer in use. Short strings that were released might be stored in the middle of other strings, preventing that memory from being used when a longer string was needed.
On early microcomputers, with their limited memory and slow processors, BASIC garbage collection could often cause apparently random, inexplicable pauses in the midst of program operation. Some BASIC interpreters, such as Applesoft BASIC on the Apple II
Apple II ("apple Roman numerals, two", stylized as Apple ][) is a series of microcomputers manufactured by Apple Computer, Inc. from 1977 to 1993. The Apple II (original), original Apple II model, which gave the series its name, was designed ...
family, repeatedly scanned the string descriptors for the string having the highest address in order to compact it toward high memory, resulting in Big O notation, O(n2) performance, which could introduce minutes-long pauses in the execution of string-intensive programs. Garbage collection was notoriously slow or even broken in other versions of Microsoft BASIC. Some operating systems that supported interrupt-driven background tasks, such as TRSDOS, TRSDOS/LS-DOS 6.x on the TRS-80 Model 4, exploited periods of user inactivity (such as the milliseconds-long periods between keystrokes and periods following video screen refresh) to process garbage collection during BASIC program runs.
Other functionality
Graphics and sound
Most BASIC interpreters differed widely in graphics and sound, which varied dramatically from microcomputer to microcomputer. Altair BASIC lacked any graphics or sound commands, as did the Tiny BASIC implementations, while Integer BASIC provided a rich set.
Level I BASIC
Level I BASIC is a dialect of the BASIC programming language that shipped with the first TRS-80, the TRS-80 Model I.
Background
Tandy employee Steve Leininger had written the first draft of the NIBL (National Industrial Basic Language) BASIC int ...
for the TRS-80 had as minimal a set as possible: , for CLear Screen; , which lit a location on the display; , which turned it off; and , which returned 1 if a location was lit, 0 if it was not. The coordinates could be any expression and ranged from 0 to 127 for the X-axis and 0 to 47 for the Y-axis. Only black-and-white display was supported.
In contrast, Integer BASIC supported color graphics, simple sound, and game controllers. Graphics mode was turned on with the statement and off with . Drawing was modal and normally started by issuing a command to change the color, which was accomplished by setting a pseudo-variable; would set the drawing color to 12, light green. One could then to produce a single spot of that color, to draw a horizontal line at row 20 that spanned the screen, or to draw a shorter vertical line down column 7. returned the color of the screen at X,Y.
Hardware manufacturers often included proprietary support for semigraphics, simple shapes and icons treated as special Character (computing), characters. Examples included the block graphics of the ZX-81, and the Suit (cards), card symbols of ♠, ♣, ♥ and ♦ in the Commodore International PETSCII character set. BASIC could generate these symbols using .
Microsoft added many graphics commands to IBM BASIC
The IBM Personal Computer BASIC, commonly shortened to IBM BASIC, is a programming language first released by IBM with the IBM Personal Computer, Model 5150 (IBM PC) in 1981. IBM released four different versions of the Microsoft BASIC interprete ...
: , (Pixel SET), (Pixel RESET), (stores a rectangle of the screen to an array), (displays a stored rectangular segment), (to move the text cursor), and , which sketches shapes using a Logo (programming language), LOGO-like syntax. Bill Gates
William Henry Gates III (born October 28, 1955) is an American businessman and philanthropist. A pioneer of the microcomputer revolution of the 1970s and 1980s, he co-founded the software company Microsoft in 1975 with his childhood friend ...
and Neil Konzen wrote DONKEY.BAS, a bundled game, to demonstrate the interpreter's color computer graphics, graphics and sound.
Input/output
Another area where implementations diverged was in keywords for dealing with media (cassettes and floppy disks), keyboard input, and game controllers (if any).
Since ROM-based BASIC interpreters often functioned as Shell (computing), shells for loading in other applications, implementations added commands related to cassette tapes (e.g., and ), binary disk files (e.g., , , and ), and BASIC programs on disk (e.g., , , and ). Business BASIC implementations added commands for random-access files. (Even ROM-based BASIC interpreters were not designed or intended to be used as operating systems, and smaller microcomputers simply lacked any OS at all.)
Dartmouth BASIC
Dartmouth BASIC is the original version of the BASIC programming language. It was designed by two professors at Dartmouth College, John G. Kemeny and Thomas E. Kurtz. With the underlying Dartmouth Time-Sharing System (DTSS), it offered an interac ...
lacked a command for getting input from the keyboard without pausing the program. To support videogames, BASICs added proprietary commands for doing so: was a function in Microsoft BASIC
Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first v ...
that would return an empty string if no key was pressed or otherwise a single character; (for ''KeyPress'') returned the ASCII value of the input in Astro BASIC.
Palo Alto Tiny BASIC lacked strings but would allow users to enter mathematical expressions as the answer to statements; by setting variables, such as Y=1; N=0
, the user could answer “Y” or “1” or even "3*2-5" at a yes/no prompt.
Some systems supported game controllers. Astro BASIC supported JX()
(specified joystick's horizontal position), JY()
(joystick vertical position), KN()
(knob status), and TR()
(trigger status). Integer BASIC
Integer BASIC is a BASIC interpreter written by Steve Wozniak for the Apple I and Apple II computers. Originally available on Cassette tape, cassette for the Apple I in 1976, then included in Read-only memory, ROM on the Apple II from its release ...
supported a game controller, a paddle controller, which had two controllers on a single connector. The position of the controller could be read using the function, passing in the controller number, 0 or 1, like , returning a value between 0 and 255.
Integer BASIC lacked any custom input/output commands, and also lacked the statement and the associated . To get data into and out of a program, the input/output functionality was redirected to a selected Expansion card, card slot with the and , which redirected output or input (respectively) to the numbered slot. From then on, data could be sent to the card using conventional commands and read from it using . Producing sounds was accomplished by ing the memory-mapped location of a simple "beeper", −16336.
Structured programming
While structured programming Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making specific disciplined use of the structured control flow constructs of selection ( if/then/else) and repet ...
, through the examples of ALGOL 58 and ALGOL 60
ALGOL 60 (short for ''Algorithmic Language 1960'') is a member of the ALGOL family of computer programming languages. It followed on from ALGOL 58 which had introduced code blocks and the begin and end pairs for delimiting them, representing a ...
, were known to Kemeny and Kurtz when they designed BASIC, they adapted only the for-loop, ignoring the else-statement, while-loop, repeat loop, named procedures, parameter passing, and local variables. As a result, subsequent dialects often differed dramatically in the wording used for structured techniques. For instance, (in Microsoft BASIC
Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first v ...
), (in Turbo-Basic XL), and even clauses (both in BASIC-PLUS).
Of the Tiny BASIC implementations, only National Industrial Basic Language (NIBL) offered a loop command of any sort, . This was despite the inventor of Tiny BASIC, Dennis Allison, publicly lamenting the state of BASIC.
BBC BASIC
BBC BASIC is an interpreted version of the BASIC programming language. It was developed by Acorn Computers Ltd when they were selected by the BBC to supply the computer for their BBC Literacy Project in 1981.
It was originally supplied on ...
was one of the first microcomputer interpreters to offer structured BASIC programming, with named DEF PROC
/DEF FN
procedures and functions, REPEAT UNTIL
loops, and IF THEN ELSE
structures inspired by COMAL. Second-generation BASICs—for example, Dartmouth BASIC#SBASIC, SBASIC (1976), BBC BASIC
BBC BASIC is an interpreted version of the BASIC programming language. It was developed by Acorn Computers Ltd when they were selected by the BBC to supply the computer for their BBC Literacy Project in 1981.
It was originally supplied on ...
(1981), True BASIC (1983), Beta BASIC (1983), QuickBASIC (1985), and AmigaBASIC (1986) -- introduced a number of features into the language, primarily related to structured and procedure-oriented programming. Usually, line number
In computing, a line number is a method used to specify a particular sequence of characters in a text file. The most common method of assigning numbers to lines is to assign every line a unique number, starting at 1 for the first line, and increm ...
ing is omitted from the language and replaced with label (computer science), labels (for GOTO) and subroutine, procedures to encourage easier and more flexible design. In addition keywords and structures to support repetition, selection and procedures with local variables were introduced.
The following example is in Microsoft QBASIC, Microsoft's third implementation of a structured BASIC (following Macintosh BASIC in 1984 and Amiga BASIC in 1985).
REM QBASIC example
REM Forward declaration - allows the main code to call a
REM subroutine that is defined later in the source code
DECLARE SUB PrintSomeStars (StarCount!)
REM Main program follows
DO
INPUT "How many stars do you want? (0 to quit) ", NumStars
CALL PrintSomeStars(NumStars)
LOOP WHILE NumStars>0
END
REM subroutine definition
SUB PrintSomeStars (StarCount)
REM This procedure uses a local variable called Stars$
Stars$ = STRING$(StarCount, "*")
PRINT Stars$
END SUB
Object oriented
Initial support for object-oriented programming provided only the re-use of objects created with other languages, such as how Visual Basic Visual Basic is a name for a family of programming languages from Microsoft. It may refer to:
* Visual Basic (.NET), the current version of Visual Basic launched in 2002 which runs on .NET
* Visual Basic (classic), the original Visual Basic suppo ...
and PowerBASIC supported the Microsoft Windows, Windows Component Object Model
Component Object Model (COM) is a binary-interface technology for software components from Microsoft that enables using objects in a language-neutral way between different programming languages, programming contexts, processes and machines ...
. As BASIC interpreters continued to evolve, they added support for object-oriented features such as Method (computer programming), methods, constructor (object-oriented programming), constructors, Memory management#DYNAMIC, dynamic memory allocation, property (programming), properties and temporary allocation.
Included assembler
The Integer BASIC ROMs also included a machine code monitor
A machine code monitor ( machine language monitor) is software that allows a user to enter commands to view and change memory address, memory locations on a computer, with options to load and save memory contents from/to secondary storage. Some f ...
, "mini-assembler (computing), assembler", and disassembler to create and debug assembly language programs.
One of the unique features of BBC BASIC was the inline assembler, allowing users to write assembly language programs for the MOS Technology 6502, 6502 and, later, the Zilog Z80, NS320xx, NS32016 and ARM architecture, ARM. The assembler was fully integrated into the BASIC interpreter and shared variables with it, which could be included between the [ and ] characters, saved via *SAVE and *LOAD, and called via the CALL or USR commands. This allowed developers to write not just assembly language code, but also BASIC code to emit assembly language, making it possible to use code-generation techniques and even write simple compilers in BASIC.
Execution
Debugging
As in most BASICs, programs were started with the command, and as was common, could be directed at a particular line number like . Execution could be stopped at any time using (or BREAK such as on the TRS-80) and then restarted with inue ( in Integer BASIC). Taking advantage of the unique capabilities of interpreted programs (code is processed in realtime one statement at a time, in contrast to compilers), the user at the console could examine variable data using the PRINT statement, and change such data on-the-fly, then resume program execution.
For step-by-step execution, the or instruction could be used at the command prompt or placed within the program itself. When it was turned on, line numbers were printed out for each line the program visited. The feature could be turned off again with or .
Some implementations such as the Microsoft interpreters for the various TRS-80
The TRS-80 Micro Computer System (TRS-80, later renamed the Model I to distinguish it from successors) is a desktop microcomputer developed by American company Tandy Corporation and sold through their Radio Shack stores. Launched in 1977, it is ...
models included the command . This would redirect program execution to a specified line number for special error handling.
Unlike most BASICs, Atari BASIC scanned the just-entered program line and reported syntax errors immediately. If an error was found, the editor re-displayed the line, highlighting the text near the error in inverse video.
In many interpreters, including Atari BASIC, errors are displayed as numeric codes, with the descriptions printed in the manual. Many MS-BASIC used two-character abbreviations (e.g., SN for SYNTAX ERROR). Palo Alto Tiny BASIC and Level I BASIC used three words for error messages: "WHAT?" for syntax errors, "HOW?" for run-time errors like GOTOs to a line that didn't exist or numeric overflows, and "SORRY" for out-of-memory problems.
Parsing
While the BASIC language has a simple syntax, mathematical expressions do not, supporting different precedence rules for parentheses and different mathematical operators. To support such expressions requires implementing a recursive descent parser.
This parser can be implemented in a number of ways:
* As a virtual machine, as discussed #Virtual_machines, above for many Tiny BASIC implementations. The value of the Tiny BASIC initiative was in specifying an implementation of a parser.
* As a finite-state machine, as in UIUC BASIC IUC, where it was implemented as a control table.
* Directly in code, as in Palo Alto Tiny BASIC and Integer BASIC. In Integer BASIC, the runtime interpreter used two stacks for execution: one for statement keywords and the other for evaluating the parameters. Each statement was given two priorities: one that stated where it should occur in a multi-step operation, like a string of mathematical operations to provide order of operations, and another that suggested when evaluation should occur, for instance, calculating internal values of a parenthesis formula. When variables were encountered, their name was parsed and then looked up in the symbol table. If it was not found, it was added to the end of the list. The address of the variable's storage, perhaps freshly created, was then placed on the evaluation stack.
Performance
The range of design decisions that went into programming a BASIC interpreter were often revealed through performance differences.
Line-management implementations often affected performance and typically used linear search. In Tiny BASIC, and others, in order to find a line the system had to read each byte of the source code looking for a CR, which indicated the next item was a line number. This meant the system had to read the entire program until it found its target for a GOTO or GOSUB, imposing a large performance penalty. MS-BASICs, and its many derivatives, stored a pointer to the next line, so if one line number was seen not to match, it could immediately move to the next line number. Atari BASIC used an 8-bit line length instead of a pointer, saving a byte. Many implementations would always search for a line number to branch to from the start of the program; MS-BASIC would search from the current line if the destination line number was greater. Pittman added a patch to his 6800 Tiny BASIC to use a binary search.
Working solely with integer math provides another major boost in speed. As many computer benchmarks of the era were small and often performed simple math that did not require floating-point, Integer BASIC trounced most other BASICs. On one of the earliest known microcomputer benchmarks, the Rugg/Feldman benchmarks, Integer BASIC was well over twice as fast as Applesoft BASIC on the same machine. In the Byte Sieve, where math was less important but array access and looping performance dominated, Integer BASIC took 166 seconds while Applesoft took 200. It did not appear in the Creative Computing Benchmark, which was first published in 1983, by which time Integer BASIC was no longer supplied by default. The following test series, taken from both of the original Rugg/Feldman articles,[ show Integer's performance relative the MS-derived BASIC on the same platform.
MS-BASIC only converted line numbers and a set of keywords into tokens, a process they referred to as "crunching". This meant that things like line numbers in GOTO statements were left in ASCII format, and had to be re-converted every time they were encountered. In contrast, a number of interpreters would convert everything into the runtime format, examples including Atari BASIC and Sinclair BASIC. In theory this would greatly speed performance over MS-style interpreters, as many bits of the program that would be bare ASCII did not have to be parsed at runtime. In general, however, these dialects often ran much slower for a variety of reasons. For instance, on two widely used Benchmark (computing), benchmarks of the era, ''Byte (magazine), Byte'' magazine's Byte Sieve, Sieve of Eratosthenes and the Creative Computing benchmark test written by David H. Ahl, Atari finished near the end of the list in terms of performance, and was much slower than the contemporary ]Apple II
Apple II ("apple Roman numerals, two", stylized as Apple ][) is a series of microcomputers manufactured by Apple Computer, Inc. from 1977 to 1993. The Apple II (original), original Apple II model, which gave the series its name, was designed ...
or Commodore PET
The Commodore PET is a line of personal computers produced starting in 1977 by Commodore International. A single all-in-one case combines a MOS Technology 6502 microprocessor, Commodore BASIC in read-only memory, keyboard, monochrome monitor ...
.
See also
* List of BASIC dialects
* List of Computers With On-Board BASIC
* Microsoft Binary Format
Notes
References
Bibliography
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Further reading
Source code and design documents, in chronological order of the release of the BASIC implementations:
*
*
*
*
*
*
*
*
{{BASIC
BASIC interpreters
Microcomputer software