
A BASIC interpreter is an
interpreter that enables users to enter and run programs in the
BASIC
BASIC (Beginners' All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming languages designed for ease of use. The original version was created by John G. Kemeny and Thomas E. Kurtz at Dartmouth College ...
language
Language is a structured system of communication. The structure of a language is its grammar and the free components are its vocabulary. Languages are the primary means by which humans communicate, and may be conveyed through a variety of ...
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
Application may refer to:
Mathematics and computing
* Application software, computer software designed to help the user to perform specific tasks
** Application layer, an abstraction layer that specifies protocols and interface methods used in a c ...
that computers would launch. Users were expected to use the BASIC interpreter to
type in programs or to load programs from storage (initially
cassette tapes then
floppy disk
A floppy disk or floppy diskette (casually referred to as a floppy, or a diskette) is an obsolescent 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 ...
s).
BASIC interpreters are of historical importance.
Microsoft
Microsoft Corporation is an American multinational corporation, multinational technology company, technology corporation producing Software, computer software, consumer electronics, personal computers, and related services headquartered at th ...
'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 BAS ...
), 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 any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ver ...
(for instance, the
Apple I
The Apple Computer 1, originally released as the Apple Computer and known later as the Apple I or Apple-1, is an 8-bit desktop computer released by the Apple Computer Company (now Apple Inc.) in 1976. It was designed by Steve Wozniak. The idea ...
). 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
The Altair 8800 is a microcomputer designed in 1974 by MITS and based on the Intel 8080 CPU. Interest grew quickly after it was featured on the cover of the January 1975 issue of Popular Electronics and was sold by mail order through advertisem ...
, microcomputers were expected to ship bundled with BASIC interpreters of their own (e.g., the
Apple II
The Apple II (stylized as ) is an 8-bit home computer and one of the world's first highly successful mass-produced microcomputer products. It was designed primarily by Steve Wozniak; Jerry Manock developed the design of Apple II's foam-mold ...
, 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 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, or a diskette) is an obsolescent 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 ...
or
online
In computer technology and telecommunications, online indicates a state of connectivity and offline indicates a disconnected state. In modern terminology, this usually refers to an Internet connection, but (especially when expressed "on line" o ...
or
bulletin board system
A bulletin board system (BBS), also called computer bulletin board service (CBBS), is a computer server running software that allows users to connect to the system using a terminal program. Once logged in, the user can perform functions such ...
s, making the need for an underlying standardized language less important. Additionally, increasingly sophisticated
command shell
In computing, a shell is a computer program that exposes an operating system's services to a human user or other programs. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending ...
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 oper ...
and the
Apple Macintosh
The Mac (known as Macintosh until 1999) is a family of personal computers designed and marketed by Apple Inc. Macs are known for their ease of use and minimalist designs, and are popular among students, creative professionals, and software ...
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 f ...
, 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 sharing of a computing resource among many users at the same time by means of multiprogramming and multi-tasking.DEC Timesharing (1965), by Peter Clark, The DEC Professional, Volume 1, Number 1
Its emergence ...
systems.
General Electric
General Electric Company (GE) is an American multinational conglomerate founded in 1892, and incorporated in New York state and headquartered in Boston. The company operated in sectors including healthcare, aviation, power, renewable energ ...
, having worked on the
Dartmouth Time Sharing System 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 inte ...
, wrote their own underlying
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
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 class of smaller general purpose computers that developed in the mid-1960s and sold at a much lower price than mainframe and mid-size computers from IBM and its direct competitors. In a 1970 survey, ...
market, which was emerging at the same time as the time-sharing services. These machines had very small
main memory
Computer 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 processing unit (CPU) of a comput ...
, 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 platters coated with magne ...
s that make compilers practical. In contrast, an
interpreter 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 headquartered in Palo Alto, California. HP developed and provided a wide variety of hardware components ...
introduced the
HP 2000, a system that was based around its
HP Time-Shared BASIC
HP Time-Shared BASIC (HP TSB) is a BASIC programming language interpreter for Hewlett-Packard's HP 2000 line of minicomputer-based time-sharing computer systems. TSB is historically notable as the platform that released the first public vers ...
interpreter. In 1969,
Dan Paymar Dan Paymar is a video poker expert with a background in computer programming and engineering. He has worked for such companies as Encyclopædia Britannica, Bendix Computer, and Control Data in a career spanning 30 years. He also helped start Educ ...
and Ira Baxter wrote another early BASIC interpreter for the
Data General Nova.
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 unti ...
(DEC), the leading minicomputer vendor. They had released a new language known as
FOCAL, based on the earlier
JOSS Joss may refer to:
* Joss (name), including a list of people with the name
* JOSS, a time-sharing programming language
* Joss (Chinese statue), a religious object
* Joss JP1, an Australian-built supercar
* Joss paper, a type of burnt offering ...
developed on a DEC machine at the
Stanford Research Institute
SRI International (SRI) is an American nonprofit organization, nonprofit scientific research, scientific research institute and organization headquartered in Menlo Park, California. The trustees of Stanford University established SRI in 1946 as ...
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 12-bit minicomputer that was produced by Digital Equipment Corporation (DEC). It was the first commercially successful minicomputer, with over 50,000 units being sold over the model's lifetime. Its basic design follows the pioneeri ...
, which often shipped with 4 KB of
main memory
Computer 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 processing unit (CPU) of a comput ...
. 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
The HP 9800 is a family of what were initially called programmable calculators and later desktop computers that were made by Hewlett-Packard, replacing their first HP 9100 calculator. It is also named "98 line". The 9830 and its successors wer ...
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 s ...
(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 (U of I, Illinois, University of Illinois, or UIUC) is a public land-grant research university in Illinois in the twin cities of Champaign and Urbana. It is the flagship institution of the Uni ...
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 designed in 1974 by MITS and based on the Intel 8080 CPU. Interest grew quickly after it was featured on the cover of the January 1975 issue of Popular Electronics and was sold by mail order through advertisemen ...
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
Five- and eight-hole punched paper tape
Paper tape reader on the Harwell computer with a small piece of five-hole tape connected in a circle – creating a physical program loop
Punched tape or perforated paper tape is a form of data storage ...
format for the
Altair 8800
The Altair 8800 is a microcomputer designed in 1974 by MITS and based on the Intel 8080 CPU. Interest grew quickly after it was featured on the cover of the January 1975 issue of Popular Electronics and was sold by mail order through advertisemen ...
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 electronics engineer, computer programmer, philanthropist, inventor, and technology entrepreneur. In 1976, with business partner Steve Jobs, he c ...
attended the first meeting of the
Homebrew Computer Club 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 headquartered in Palo Alto, California. HP developed and provided a wide variety of hardware components ...
and used their minicomputer dialect,
HP Time-Shared BASIC
HP Time-Shared BASIC (HP TSB) is a BASIC programming language interpreter for Hewlett-Packard's HP 2000 line of minicomputer-based time-sharing computer systems. TSB is historically notable as the platform that released the first public vers ...
, 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 for the Apple I in 1976, then included in ROM on the Apple II from its release in 1977, it was the first ver ...
was released on cassette for the
Apple I
The Apple Computer 1, originally released as the Apple Computer and known later as the Apple I or Apple-1, is an 8-bit desktop computer released by the Apple Computer Company (now Apple Inc.) in 1976. It was designed by Steve Wozniak. The idea ...
, and was supplied in
ROM when the
Apple II
The Apple II (stylized as ) is an 8-bit home computer and one of the world's first highly successful mass-produced microcomputer products. It was designed primarily by Steve Wozniak; Jerry Manock developed the design of Apple II's foam-mold ...
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, complaining about this early example of
software piracy
Copyright infringement (at times referred to as piracy) is the use of works protected by copyright without permission for a usage where such permission is required, thereby infringing certain exclusive rights granted to the copyright holder, ...
. 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
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 ...
urged
Dennis Allison to write their own variation of the language. How to design and implement a stripped-down version of an
interpreter 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 Fir ...
'' 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
Li-Chen Wang (born 1935) is an American computer engineer, best known for his ''Palo Alto Tiny BASIC'' for Intel 8080-based microcomputers. He was a member of the Homebrew Computer Club and made significant contributions to the software for early ...
, 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 or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, ...
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 software users, namely the freedoms to run the software, to study the software, to modify the software, and to share copies of the s ...
.
Many firms developed BASIC interpreters. In 1976,
SCELBI 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. It is the state's land-grant and primary research university,, and the lead university in the Idaho Space Grant Consortium. The University ...
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 launched in 1977 and sold by Tandy Corporation through their Radio Shack stores. The name is an abbreviation of ...
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, 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 of the 1980s included it in
ROM. In 1980, as part of a larger licensing deal that included other languages and
PC DOS, 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 interpre ...
, 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 IBM PC model line and the basis for the IBM PC compatible de facto standard. Released on August 12, 1981, it was created by a tea ...
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 ...
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 was finishing Cromemco 16K Structured BASIC for the
Z80-based
Cromemco
Cromemco 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 Harry Ga ...
S-100 bus
The S-100 bus or Altair bus, IEEE 696-1983 ''(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 industry. computers, consisting of ...
machines. Paul Laughton and Kathleen O'Brien then created
Atari BASIC
Atari BASIC is an interpreter for the BASIC programming language that shipped with the Atari 8-bit family of 6502-based home computers. Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC a ...
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. Miller interview, Robinett says he was 26 in November 1977. is a designer of interactive computer graphics software, notable as the developer of the Atari 2600's ''Adventure'' — ...
developed the
BASIC Programming
''BASIC Programming'' is an Atari Video Computer System (later called the Atari 2600) cartridge that teaches simple computer programming using a dialect of BASIC. Written by Warren Robinett and released by Atari, Inc. in 1979, this BASIC inte ...
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 technology company headquartered in Dallas, Texas, that designs and manufactures semiconductors and various integrated circuits, which it sells to electronics designers and manufacturers globa ...
released
TI BASIC (TI 99/4A) 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 and Timex Sinclair. The Sinclair BASIC interpreter was made by Nine Tiles Networks Ltd.
History
Sinclair BASIC was or ...
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, who helped design the BBC Micro and ARM architecture.
Wilson first designed a microcomputer during a break from studies at Selwyn College, Cambridge. She s ...
of
Acorn Computers
Acorn Computers Ltd. was a British computer company established in Cambridge, England, in 1978. The company produced a number of computers which were especially popular in the United Kingdom, UK, including the Acorn Electron and the Acorn Archi ...
developed
Atom BASIC
Acorn System BASIC and Atom BASIC are two closely related dialects of the BASIC programming language developed by Acorn Computers for their early microcomputers like the Acorn System 3 and Acorn Atom. Developed in-house, they have a number of s ...
, which she later evolved into
BBC BASIC, 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
COMAL (''Common Algorithmic Language'') is a computer programming language developed in Denmark by Børge R. Christensen and Benedict Løfstedt and originally released in 1975. COMAL was one of the few structured programming languages that was ...
.
Jan Jones developed
SuperBASIC, another British BASIC supporting structured programming, for the
Sinclair QL. In 1983,
Randall Hyde
Randall Hyde (born 1956) is best known as the author of ''The Art of Assembly Language'', a popular book on assembly language programming. He created the Lisa assembler in the late 1970s and developed the High Level Assembly (HLA) language.
Bio ...
developed SmartBASIC for the
Coleco Adam
The Coleco Adam is a home computer and expansion device for the ColecoVision released in 1983 by American toy and video game manufacturer Coleco. It was an attempt to follow on the success of the company's ColecoVision video game console. The Ad ...
. Richard Clayton, Chris Hall, and Paul Overell developed
Mallard BASIC for the
BBC Micro
The British Broadcasting Corporation Microcomputer System, or BBC Micro, is a series of microcomputers and associated peripherals designed and built by Acorn Computers in the 1980s for the BBC Computer Literacy Project. Designed with an empha ...
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 S ...
, both supporting commands for an
ISAM indexed file system. In 1985,
MetaComCo released ABasiC for the
Amiga
Amiga is a family of personal computers introduced by Commodore International, Commodore in 1985. The original model is one of a number of mid-1980s computers with 16- or 32-bit processors, 256 KB or more of RAM, mouse-based GUIs, and sign ...
and
ST BASIC
Atari ST BASIC (or ST Basic) was the first dialect of BASIC that was produced for the Atari ST line of computers. This BASIC interpreter was bundled with all new STs in the early years of the ST's lifespan, and quickly became the standard BASIC for ...
for the
Atari ST.
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 systems and later
graphical user interface
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows User (computing), users to Human–computer interaction, interact with electronic devices through graphical icon (comp ...
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 portable computer introduced in April 26th, 1983. It is one of the first notebook-style computers, featuring a keyboard and liquid crystal display, in a battery-powered package roughly the size and shape of a notepad o ...
portable computer
A portable computer is a computer designed to be easily moved from one place to another and included a display and keyboard together, with a single plug, much like later desktop computers called '' all-in-ones'' (AIO), that integrate the ...
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, multinational technology company, technology corporation producing Software, computer software, consumer electronics, personal computers, and related services headquartered at th ...
product that
Bill Gates
William Henry Gates III (born October 28, 1955) is an American business magnate and philanthropist. He is a co-founder of Microsoft, along with his late childhood friend Paul Allen. During his career at Microsoft, Gates held the positions ...
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 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 IBM PC model line and the basis for the IBM PC compatible de facto standard. Released on August 12, 1981, it was created by a tea ...
. 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.
MacBASIC
Macintosh Basic, or MacBASIC, was both a comprehensive programming language and a fully interactive development environment designed by Apple Computer for the original Macintosh computer. It was developed by original Macintosh team member Donn ...
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
A software release life cycle is the sum of the stages of development and maturity for a piece of computer software ranging from its initial development to its eventual release, and including updated versions of the released version to help impr ...
in 1985 and was adopted for use in places such as the
Dartmouth College
Dartmouth College (; ) is a private research university in Hanover, New Hampshire. Established in 1769 by Eleazar Wheelock, it is one of the nine colonial colleges chartered before the American Revolution. Although founded to educate Native ...
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
The Apple II (stylized as ) is an 8-bit home computer and one of the world's first highly successful mass-produced microcomputer products. It was designed primarily by Steve Wozniak; Jerry Manock developed the design of Apple II's foam-mold ...
.

BASIC interpreters were not just an American/British development. In 1984,
Hudson Soft
was a Japanese video game company that released numerous games for video game consoles, home computers and mobile phones, mainly from the 1980s to the 2000s. It was headquartered in the Midtown Tower in Tokyo Midtown, Akasaka, Minato, Tokyo ...
released
Family BASIC in the Japanese market for Nintendo's
Family Computer
The Nintendo Entertainment System (NES) is an 8-bit third-generation home video game console produced by Nintendo. It was first released in Japan in 1983 as the commonly known as the The NES, a redesigned version, was released in American ...
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 (of or related to)
**Germania (historical use)
* Germans, citizens of Germany, people of German ancestry, or native speakers of the German language
** For citizens of Germany, see also German nationality law
**Ger ...
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.
Hi ...
''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 (computing), keyboard by the reader and then saved to Compact Cassette (data), cassette tape or ...
. 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, in 1988, and
AMOS BASIC
Amos or AMOS may refer to:
Arts and entertainment
* Amos Records, an independent record label established in Los Angeles, California, in 1968
* Amos (band), an American Christian rock band
* ''Amos'' (album), an album by Michael Ray
* ''Amos' ...
for the
Amiga
Amiga is a family of personal computers introduced by Commodore International, Commodore in 1985. The original model is one of a number of mid-1980s computers with 16- or 32-bit processors, 256 KB or more of RAM, mouse-based GUIs, and sign ...
, 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 (now simply referred to as "Visual Basic"), the current version of Visual Basic launched in 2002 which runs on .NET
* Visual Basic (c ...
, a
third-generation event-driven programming language known for its
Component Object Model (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 stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases spa ...
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 expo ...
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 Web. ...
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.0 built into most desktop Microsoft Office applications. Although based on pre-.NET Visual Basic, which is no longer supporte ...
, a scripting language for
Microsoft Office
Microsoft Office, or simply Office, is the former name of a family of client software, server software, and services developed by Microsoft. It was first announced by Bill Gates on August 1, 1988, at COMDEX in Las Vegas. Initially a ma ...
applications, which supersedes and expands on the abilities of earlier application-specific
macro
Macro (or MACRO) may refer to:
Science and technology
* Macroscopic, subjects visible to the eye
* Macro photography, a type of close-up photography
* Image macro, a picture with text superimposed
* Monopole, Astrophysics and Cosmic Ray Observat ...
programming languages such as
Word's WordBASIC (which had been introduced in 1989).
In 1996, Microsoft released
VBScript
VBScript (''"Microsoft Visual Basic Scripting Edition"'') is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It allows Microsoft Windows system administrators to generate powerful tools for managing computers ...
as an alternative to
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
for adding interactive
client-side
Client-side refers to operations that are performed by the client in a client–server relationship in a computer network.
General concepts
Typically, a client is a computer application, such as a web browser, that runs on a user's local comp ...
functionality to
web pages viewed with
Internet Explorer
Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, commonly abbreviated IE or MSIE) is a series of graphical user interface, graphical web browsers developed by Microsoft which was used in the Microsoft Wind ...
.
In 1999,
Benoît Minisini released
Gambas as an alternative for Visual Basic developers who had decided to migrate to
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
.
In 2000, Lee Bamber and Richard Vanner released
DarkBASIC
The Game Creators Ltd (TGC; formerly Dark Basic Software Limited) is a British software house based in Macclesfield, Cheshire, England, which specialises in software for video game development, originally for the Microsoft Windows platform. ...
, a game creation system for
Microsoft Windows, 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 Chipmunk Basic is a freeware interpreter for the BASIC programming language maintained by Ron Nicholson.
Chipmunk basic was originally developed for the Macintosh and has been ported to Linux and Microsoft Windows. The "windowed" Macintosh versi ...
.
In 2002, Emmanuel Chailloux, Pascal Manoury and Bruno Pagano published a Tiny BASIC as an example of developing applications with
Objective Caml
OCaml ( , formerly Objective Caml) is a general-purpose, multi-paradigm programming language which extends the Caml dialect of ML with object-oriented features. OCaml was created in 1996 by Xavier Leroy, Jérôme Vouillon, Damien Doligez, D ...
.
In 2011, Microsoft released
Small Basic
Microsoft Small Basic is a programming language, interpreter and associated IDE. Microsoft's simplified variant of BASIC, it is designed to help students who have learnt visual programming languages such as Scratch learn text-based programming ...
(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) is any programming language that lets users create programs by manipulating program elements ''graphically'' rather than by specifying them ''textually''. A VPL ...
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 are used for programming, scripting, or markup languages, such as HTML. The feature displays text, especially source code, in different colours and fonts according to the category of terms. ...
,
intelligent code completion, 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 is application software 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 screen. Browsers are used on ...
.
In 2014, Robin H. Edwards released Arduino BASIC for the
Arduino
Arduino () is an open-source hardware and software company, project, and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devices. Its hardware products are licensed und ...
, 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 portable computer device that combines mobile telephone and computing functions into one unit. They are distinguished from feature phones by their stronger hardware capabilities and extensive mobile operating systems, whic ...
s and tablets via the Apple
App Store, or
Google Play
Google Play, also known as the Google Play Store and formerly the Android Market, is a digital distribution service operated and developed by Google. It serves as the official app store for certified devices running on the Android (operating sys ...
store for Android.
Today, coding BASIC interpreters has become part of the
retrocomputing 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 b ...
es, variable management is simple with
associative arrays, and program execution is easy with
eval
In some programming languages, eval , short for the English 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 ha ...
functions. As examples, see the
open-source project Vintage BASIC, written in
Haskell 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 inte ...
, 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 any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ver ...
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 both 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 t ...
. 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 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 processing unit (CPU) of a comput ...
, 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 platters coated with magne ...
. 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
Five- and eight-hole punched paper tape
Paper tape reader on the Harwell computer with a small piece of five-hole tape connected in a circle – creating a physical program loop
Punched tape or perforated paper tape is a form of data storage ...
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 mag ...
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 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
''BASIC Computer Games'' is a compilation of type-in computer games in the BASIC programming language collected by David H. Ahl. Some of the games were written or modified by Ahl as well. Among its better-known games are '' Hamurabi'' and ''Super ...
''. Based on these sources, Wozniak began sketching out a
syntax 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, an integer-only implementation, was the inspiration for Atari BASIC.
In contrast,
Dennis Allison, a member of the Computer Science faculty at
Stanford University, wrote a specification for a simple version of the language.
[ The ]ACM
ACM or A.C.M. may refer to:
Aviation
* AGM-129 ACM, 1990–2012 USAF cruise missile
* Air chief marshal
* Air combat manoeuvring or dogfighting
* Air cycle machine
* Arica Airport (Colombia) (IATA: ACM), in Arica, Amazonas, Colombia
Computing
* ...
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, who had seen BASIC on
minicomputer
A minicomputer, or colloquially mini, is a class of smaller general purpose computers that developed in the mid-1960s and sold at a much lower price than mainframe and mid-size computers from IBM and its direct competitors. In a 1970 survey, ...
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 Fir ...
(PCC) newsletter.
The grammar is listed below in
Backus–Naur form
In computer science, Backus–Naur form () or Backus normal form (BNF) is a metasyntax notation for context-free grammars, often used to describe the syntax of languages used in computing, such as computer programming languages, document format ...
. 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 som ...
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 and Timex Sinclair. The Sinclair BASIC interpreter was made by Nine Tiles Networks Ltd.
History
Sinclair BASIC was or ...
used as its language definition the 1978
American National Standards Institute
The American National Standards Institute (ANSI ) is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organ ...
(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
The octal numeral system, or oct for short, is the radix, base-8 number system, and uses the Numerical digit, digits 0 to 7. This is to say that 10octal represents eight and 100octal represents sixty-four. However, English, like most languages, ...
. 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 for the Apple I in 1976, then included in ROM on the Apple II from its release in 1977, it was the first ver ...
by hand, translating the
assembler code
In computer programming, assembly language (or 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 be ...
instructions into their
machine code
In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ver ...
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 entrepreneur, industrial designer, media proprietor, and investor. He was the co-founder, chairman, and CEO of Apple; the chairman and majority shareholder of Pixar; ...
, 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 byte-oriented microprocessor designed by Computer Terminal Corporation (CTC), implemented and manufactured by Intel, and introduced in April 1972. It is an 8-bit CP ...
emulator
In computing, an emulator is 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 software or use peri ...
for their previous venture,
Traf-O-Data, 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 sharing of a computing resource among many users at the same time by means of multiprogramming and multi-tasking.DEC Timesharing (1965), by Peter Clark, The DEC Professional, Volume 1, Number 1
Its emergence ...
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 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 computer programming, assembly language (or 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 b ...
with non-standard mnemonics.
Li-Chen Wang
Li-Chen Wang (born 1935) is an American computer engineer, best known for his ''Palo Alto Tiny BASIC'' for Intel 8080-based microcomputers. He was a member of the Homebrew Computer Club and made significant contributions to the software for early ...
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 k ...
for the Paisley XBASIC interpreter for
Burroughs large systems
The Burroughs Large Systems Group produced a family of large 48-bit mainframes using stack machine instruction sets with dense syllables.E.g., 12-bit syllables for B5000, 8-bit syllables for B6500 The first machine in the family was the B5000 in ...
. 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 (computing), keyboard by the reader and then saved to Compact Cassette (data), cassette tape or ...
, was Classic BASIC, written by Lennart Benschop in
Forth
Forth or FORTH may refer to:
Arts and entertainment
* ''forth'' magazine, an Internet magazine
* ''Forth'' (album), by The Verve, 2008
* ''Forth'', a 2011 album by Proto-Kaw
* Radio Forth, a group of independent local radio stations in Scotla ...
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 the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
(as with Tiny BASIC) or published later by the authors. The complete annotated
source code
In computing, source code, or simply code, is any collection of code, with or without comment (computer programming), comments, written using a human-readable programming language, usually as plain text. The source code of a Computer program, p ...
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/ emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized har ...
to add a layer of abstraction and conciseness above native
machine language
In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ver ...
.
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 thr ...
, 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 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, 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
TI-BASIC is the official name of a BASIC-like language built into Texas Instruments (TI)'s graphing calculators.
TI-BASIC is a language family of three different and incompatible versions, released on different products:
* TI-BASIC 83 (on Z80 ...
, 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 computer programming, assembly language (or 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 b ...
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 (norma ...
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. When BASIC was running, a
command prompt
Command Prompt, also known as cmd.exe or cmd, is the default command-line interpreter for the OS/2, eComStation, ArcaOS, Microsoft Windows ( Windows NT family and Windows CE family), and ReactOS operating systems. On Windows CE .NET 4.2, Wi ...
was displayed where the user could enter statements. This was known as "
direct mode". 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 ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because ...
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 unit ...
s or
word
A word is a basic element of language that carries an objective or practical 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 consen ...
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 i ...
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 launched in 1977 and sold by Tandy Corporation through their Radio Shack stores. The name is an abbreviation of ...
, which used PATB, and was also found in
Atari BASIC
Atari BASIC is an interpreter for the BASIC programming language that shipped with the Atari 8-bit family of 6502-based home computers. Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC a ...
and the BASIC of various
Sharp Pocket Computers.
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 any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ver ...
(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 and Timex Sinclair. The Sinclair BASIC interpreter was made by Nine Tiles Networks Ltd.
History
Sinclair BASIC was or ...
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 computer
A pocket computer was a 1980s-era user programmable calculator-sized computer that had fewer screen lines,
Some had only one line and often fewer characters per line, than the Pocket-sized computers introduced beginning in 1989. Manufacturers i ...
s" 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
TI-BASIC is the official name of a BASIC-like language built into Texas Instruments (TI)'s graphing calculators.
TI-BASIC is a language family of three different and incompatible versions, released on different products:
* TI-BASIC 83 (on Z80 ...
. The BASIC expansion for the
Bally Astrocade 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 implemented as a
linear collection (technically not a
list
A ''list'' is any set of items in a row. List or lists may also refer to:
People
* List (surname)
Organizations
* List College, an undergraduate division of the Jewish Theological Seminary of America
* SC Germania List, German rugby uni ...
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 (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 extensive use of the structured control flow constructs of selection ( if/then/else) and repetition (w ...
constructs to BASIC, they often removed the need for line numbers altogether and added
text editors and, later,
integrated development environment
An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools a ...
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 inte ...
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 floati ...
, and A# for
double precision
Double-precision floating-point format (sometimes called FP64 or float64) is a floating-point number format, usually occupying 64 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point.
F ...
.
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
* Hash, a nickname for hashish, a cannabis product
Hash mark
*Hash mark (sports), a marking on hockey rinks and gridiron football field ...
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 ...
.
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 locations on a computer, with options to load and save memory contents from/to secondary storage. Some full-feature ...
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, espec ...
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:
* The ability to read or write multiple bits at a time, and
* Using an a ...
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 launched in 1977 and sold by Tandy Corporation through their Radio Shack stores. The name is an abbreviation of ...
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 (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
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 that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can be ...
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, 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 32- bit units. Compared to smaller bit widths, 32-bit computers can perform large calcula ...
(plus or minus 2,147,483,648) and "triple precision" (plus or minus 1.4x10^14).
Other computer number formats were sometimes used. For instance, the MINOL Tiny BASIC supported only unsigned
Unsigned can refer to:
* An unsigned artist is a musical artist or group not attached or signed to a record label
** Unsigned Music Awards, ceremony noting achievements of unsigned artists
** Unsigned band web, online community
* Similarly, the ...
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 unit ...
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
Li-Chen Wang (born 1935) is an American computer engineer, best known for his ''Palo Alto Tiny BASIC'' for Intel 8080-based microcomputers. He was a member of the Homebrew Computer Club and made significant contributions to the software for early ...
's public domain version of Tiny BASIC. This required only 2 KB of memory for the interpreter, 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 leather goods company based in Fort Worth, Texas, United States. Tandy Leather was founded in 1919 as a leather supply store. By the end of the 1950s, under the tutelage of then-CEO Charles Tandy, ...
's then-President Charles Tandy
Charles David Tandy (15 May 1918 – 4 November 1978) was the chairman of the board, president, and chief executive officer of the Tandy Corporation.
Early life
Charles Tandy was born in Brownsville, Texas to Dave L. Tandy, who ran the Hinckley-T ...
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 that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can be ...
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 that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can be r ...
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 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 that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can b ...
, 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 for implementing the transcendental functions 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. It is the state's land-grant and primary research university,, and the lead university in the Idaho Space Grant Consortium. The University ...
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 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 te ...
: 1 bit
* Exponent
Exponentiation is a mathematical operation, written as , involving two numbers, the '' base'' and the ''exponent'' or ''power'' , and pronounced as " (raised) to the (power of) ". When is a positive integer, exponentiation corresponds to re ...
width: 8 bits
* Significand
The significand (also mantissa or coefficient, sometimes also argument, or ambiguously fraction or characteristic) is part of a number in scientific notation or in floating-point representation, consisting of its significant digits. Depending on ...
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 ...
for the MOS 6502, 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-TSB-inspired . Binary operators, such as , and , weren't in every implementation, and some did Boolean algebra
In mathematics and mathematical logic, Boolean algebra is a branch of algebra. It differs from elementary algebra in two ways. First, the values of the variables are the truth values ''true'' and ''false'', usually denoted 1 and 0, whereas ...
and some did not.
Dartmouth BASIC's initial edition included the following functions: ( absolute value), (arctangent
In mathematics, the inverse trigonometric functions (occasionally also called arcus functions, antitrigonometric functions or cyclometric functions) are the inverse functions of the trigonometric functions (with suitably restricted domains). S ...
), ( cosine), ('' e'' raised to the power), (truncate any fractional value, returning an integer), (logarithm
In mathematics, the logarithm is the inverse function to exponentiation. That means the logarithm of a number to the base is the exponent to which must be raised, to produce . For example, since , the ''logarithm base'' 10 of ...
), (pseudorandom number generator
A pseudorandom number generator (PRNG), also known as a deterministic random bit generator (DRBG), is an algorithm for generating a sequence of numbers whose properties approximate the properties of sequences of random numbers. The PRNG-generate ...
), (sine
In mathematics, sine and cosine are trigonometric functions of an angle. The sine and cosine of an acute angle are defined in the context of a right triangle: for the specified angle, its sine is the ratio of the length of the side that is opp ...
), (square root
In mathematics, a square root of a number is a number such that ; in other words, a number whose ''square'' (the result of multiplying the number by itself, or ⋅ ) is . For example, 4 and −4 are square roots of 16, because .
...
), and (tangent
In geometry, the tangent line (or simply tangent) to a plane curve at a given point is the straight line that "just touches" the curve at that point. Leibniz defined it as the line through a pair of infinitely close points on the curve. Mo ...
). 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 inte ...
supported 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 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 processing unit (CPU) of a comput ...
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 In computer programming, a variable-length array (VLA), also called variable-sized or runtime-sized, is an array data structure whose length is determined at run time (instead of at compile time).
In C, the VLA is said to have a variably modified ...
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 In computer programming, a dope vector is a data structure used to hold information about a data object, especially its memory layout.
Purpose
Dope vectors are most commonly used to describe arrays, which commonly store multiple instances of a par ...
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 programming language interpreter for Hewlett-Packard's HP 2000 line of minicomputer-based time-sharing computer systems. TSB is historically notable as the platform that released the first public vers ...
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$ 0/syntaxhighlight> will set up a string that can hold a maximum of 10 characters.[, Part No. 22687-90001]
Substrings within strings are accessed using a " slicing" notation: A$(L,R) or A$ ,R/syntaxhighlight>, 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$ /syntaxhighlight> 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$ ,5"XYZ" or 120 B$ "CHANGE ALL BUT FIRST TWO CHARS", which cannot be done with early implementations of .
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
North Star BASIC was a dialect of the BASIC programming language for the Intel 8080 microprocessor used on the North Star Horizon and available for purchase on other S-100 bus machines of the late 1970s.Richard Milewski,Micro Mike's baZic release 1 ...
and Atari BASIC
Atari BASIC is an interpreter for the BASIC programming language that shipped with the Atari 8-bit family of 6502-based home computers. Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC a ...
mimicked HP's approach, which again contrasted with the style found in BASICs derived from 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 ...
, where strings are an intrinsic variable-length type.
Some of the Tiny BASIC 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 of the heap
Heap or HEAP may refer to:
Computing and mathematics
* Heap (data structure), a data structure commonly used to implement a priority queue
* Heap (mathematics), a generalization of a group
* Heap (programming) (or free store), an area of memory f ...
, a form of automatic memory management
Memory management is a form of resource management applied to computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and free it for reuse when ...
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
Applesoft BASIC is a dialect of Microsoft BASIC, developed by Marc McDonald and Ric Weiland, supplied with the Apple II series of computers. It supersedes Integer BASIC and is the BASIC in ROM in all Apple II series computers after the origina ...
on the Apple II
The Apple II (stylized as ) is an 8-bit home computer and one of the world's first highly successful mass-produced microcomputer products. It was designed primarily by Steve Wozniak; Jerry Manock developed the design of Apple II's foam-mold ...
family, repeatedly scanned the string descriptors for the string having the highest address in order to compact it toward high memory, resulting in 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/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 i ...
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
A Cartesian coordinate system (, ) in a plane is a coordinate system that specifies each point uniquely by a pair of numerical coordinates, which are the signed distances to the point from two fixed perpendicular oriented lines, measured i ...
and 0 to 47 for the Y-axis
A Cartesian coordinate system (, ) in a plane is a coordinate system that specifies each point uniquely by a pair of numerical coordinates, which are the signed distances to the point from two fixed perpendicular oriented lines, measured i ...
. 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
Text-based semigraphics or pseudographics is a primitive method used in early text mode video hardware to emulate raster graphics without having to implement the logic for such a display mode.
There are two different ways to accomplish the emu ...
, simple shapes and icons treated as special characters
Character or Characters may refer to:
Arts, entertainment, and media Literature
* ''Character'' (novel), a 1936 Dutch novel by Ferdinand Bordewijk
* ''Characters'' (Theophrastus), a classical Greek set of character sketches attributed to The ...
. Examples included the block graphics of the ZX-81, and the card symbols of ♠, ♣, ♥ and ♦ in the Commodore International
Commodore International (other names include Commodore International Limited) was an American home computer and electronics manufacturer founded by Jack Tramiel. Commodore International (CI), along with its subsidiary Commodore Business Mac ...
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 interpre ...
: , (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
A logo (abbreviation of logotype; ) is a graphic mark, emblem, or symbol used to aid and promote public identification and recognition. It may be of an abstract or figurative design or include the text of the name it represents as in a wordm ...
-like syntax. Bill Gates
William Henry Gates III (born October 28, 1955) is an American business magnate and philanthropist. He is a co-founder of Microsoft, along with his late childhood friend Paul Allen. During his career at Microsoft, Gates held the positions ...
and Neil Konzen wrote DONKEY.BAS, a bundled game, to demonstrate the interpreter's color graphics
Graphics () are visual images or designs on some surface, such as a wall, canvas, screen, paper, or stone, to inform, illustrate, or entertain. In contemporary usage, it includes a pictorial representation of data, as in design and manufacture, ...
and sound
In physics, sound is a vibration that propagates as an acoustic wave, through a transmission medium such as a gas, liquid or solid.
In human physiology and psychology, sound is the ''reception'' of such waves and their ''perception'' by ...
.
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 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 inte ...
lacked a command for getting input from the keyboard without pausing the program. To support videogames
Video games, also known as computer games, are electronic games that involves interaction with a user interface or input device such as a joystick, controller, keyboard, or motion sensing device to generate visual feedback. This feedbac ...
, 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 ...
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 for the Apple I in 1976, then included in ROM on the Apple II from its release in 1977, it was the first ver ...
supported a game controller
A game controller, gaming controller, or simply controller, is an input device used with video games or entertainment systems to provide input to a video game, typically to control an object or character in the game. Before the seventh generation ...
, 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 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 extensive use of the structured control flow constructs of selection ( if/then/else) and repetition (w ...
, through the examples of ALGOL 58
ALGOL 58, originally named IAL, is one of the family of ALGOL computer programming languages. It was an early compromise design soon superseded by ALGOL 60. According to John Backus
The Zurich ACM-GAMM Conference had two principal motives in p ...
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 k ...
, 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 ...
), (in Turbo-Basic XL), and even clauses (both in 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 thr ...
).
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 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
COMAL (''Common Algorithmic Language'') is a computer programming language developed in Denmark by Børge R. Christensen and Benedict Løfstedt and originally released in 1975. COMAL was one of the few structured programming languages that was ...
. Second-generation BASICs—for example, SBASIC (1976), BBC BASIC (1981), True BASIC (1983), Beta BASIC
Beta BASIC is a BASIC interpreter for the Sinclair Research ZX Spectrum microcomputer, written by Dr Andrew Wright in 1983 and sold by his one-man software house BetaSoft. BetaSoft also produced a regular newsletter/magazine, BetaNews.
Original ...
(1983), QuickBASIC (1985), and AmigaBASIC
AmigaBASIC is an interpreted BASIC programming language implementation for the Amiga, designed and written by Microsoft. AmigaBASIC shipped with AmigaOS versions 1.1 to 1.3. It succeeded MetaComCo's ABasiC, which was included in AmigaOS 1.0 a ...
(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 labels
A label (as distinct from signage) is a piece of paper, plastic film, cloth, metal, or other material affixed to a container or product, on which is written or printed information or symbols about the product or item. Information printed dir ...
(for GOTO
GoTo (goto, GOTO, GO TO or other case combinations, depending on the programming language) is a statement found in many computer programming languages. It performs a one-way transfer of control to another line of code; in contrast a function c ...
) and 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
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
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 (now simply referred to as "Visual Basic"), the current version of Visual Basic launched in 2002 which runs on .NET
* Visual Basic (c ...
and PowerBASIC supported the Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ...
Component Object Model. As BASIC interpreters continued to evolve, they added support for object-oriented features such as methods, constructors, dynamic memory allocation
Memory management is a form of resource management applied to computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and free it for reuse when ...
, properties
Property is the ownership of land, resources, improvements or other tangible objects, or intellectual property.
Property may also refer to:
Mathematics
* Property (mathematics)
Philosophy and science
* Property (philosophy), in philosophy an ...
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 locations on a computer, with options to load and save memory contents from/to secondary storage. Some full-feature ...
, "mini- assembler", and disassembler to create and debug assembly language programs.
One of the unique features of BBC BASIC was the inline assembler In computer programming, an inline assembler is a feature of some compilers that allows low-level code written in assembly language to be embedded within a program, among code that otherwise has been compiled from a higher-level language such as ...
, allowing users to write assembly language programs for the 6502 and, later, the Zilog Z80
The Z80 is an 8-bit computing, 8-bit microprocessor introduced by Zilog as the startup company's first product. The Z80 was conceived by Federico Faggin in late 1974 and developed by him and his 11 employees starting in early 1975. The first wor ...
, NS32016
The NS32000, sometimes known as the 32k, is a series of microprocessors produced by National Semiconductor. The first member of the family came to market in 1982, briefly known as the 16032 before becoming the 32016. It was the first 32-bit general ...
and 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 compiler
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
s), 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 marks of TRS-80
The TRS-80 Micro Computer System (TRS-80, later renamed the Model I to distinguish it from successors) is a desktop microcomputer launched in 1977 and sold by Tandy Corporation through their Radio Shack stores. The name is an abbreviation of ...
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
Reverse video (or invert video or inverse video or reverse screen) is a computer display technique whereby the background and text color values are inverted. On older computers, displays were usually designed to display text on a black backgroun ...
.
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 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
A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number ...
, 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
In mathematics and computer programming, the order of operations (or operator precedence) is a collection of rules that reflect conventions about which procedures to perform first in order to evaluate a given mathematical expression.
For exam ...
, 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 computer science, a linear search or sequential search is a method for finding an element within a list. It sequentially checks each element of the list until a match is found or the whole list has been searched.
A linear search runs in at ...
. Delimiting each line with a CR would make a GOTO or GOSUB to a later line would take longer, as the program would need to iterate over all the lines to find the target line number. In some implementations, such as Atari BASIC, the length of each line was recorded and stored after the line number, so that the program did not have to scan each character of the line to find the next carriage return. 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.
In theory, Atari BASIC should have run faster than contemporary BASICs based on the Microsoft pattern. Because the source code is fully tokenized when it is entered, the entire tokenization and parsing steps are already complete. Even complex mathematical operations are ready-to-run, with any numerical constants already converted to its internal 48-bit format, and variables values are looked up by address rather than having to be searched for. In spite of these theoretical advantages, in practice, Atari BASIC is slower than other home computer BASICs, often by a large amount. In practice, this was not borne out. On two widely used benchmarks of the era, '']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 unit ...
'' magazine's Sieve of Eratosthenes
In mathematics, the sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to any given limit.
It does so by iteratively marking as composite (i.e., not prime) the multiples of each prime, starting with the first prime ...
and the Creative Computing benchmark test written by David H. Ahl, the Atari finished near the end of the list in terms of performance, and was much slower than the contemporary Apple II
The Apple II (stylized as ) is an 8-bit home computer and one of the world's first highly successful mass-produced microcomputer products. It was designed primarily by Steve Wozniak; Jerry Manock developed the design of Apple II's foam-mold ...
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, ...
, in spite of having the same CPU but running it at roughly twice the speed of either. It finished behind relatively slow machines like the Sinclair ZX81 and even some programmable calculators.
Most of the language's slowness stemmed from three problems. The first is that the floating-point math routines were poorly optimized. In the Ahl benchmark, a single exponent operation, which internally loops over the slow multiplication function, was responsible for much of the machine's poor showing. Second, the conversion between the internal floating-point format and the 16-bit integers used in certain parts of the language was relatively slow. Internally, these integers were used for line numbers and array indexing, along with a few other tasks, but numbers in the tokenized program were always stored in binary-coded decimal
In computing and electronic systems, binary-coded decimal (BCD) is a class of binary encodings of decimal numbers where each digit is represented by a fixed number of bits, usually four or eight. Sometimes, special bit patterns are used fo ...
(BCD) format. Whenever one of these is encountered, for instance, in the line number in , the tokenized BCD value has to be converted to an integer, an operation that can take as long as 3500 microseconds. Other BASICs avoided this delay by special-casing the conversion of numbers that could only possibly be integers, like the line number following a , switching to special ASCII-to-integer code to improve performance. Third was how Atari BASIC implemented branches and FOR
loops. To perform a branch in a GOTO
or GOSUB
, the interpreter searches through the entire program for the matching line number it needs. One minor improvement found in most Microsoft-derived BASICs is to compare the target line number to the current line number, and search forward from that point if it is greater, or start from the top if less. This improvement was missing in Atari BASIC. Unlike almost all other BASICs, which would push a pointer
Pointer may refer to:
Places
* Pointer, Kentucky
* Pointers, New Jersey
* Pointers Airport, Wasco County, Oregon, United States
* The Pointers, a pair of rocks off Antarctica
People with the name
* Pointer (surname), a surname (including a list ...
to the location of the FOR
on a stack, so when it reached the NEXT
it could easily return to the FOR
again in a single branch operation, Atari BASIC pushed the line number instead. This meant every time a NEXT
was encountered, the system had to search through the entire program to find the corresponding FOR
line. As a result, any loops in an Atari BASIC program cause a large loss of performance relative to other BASICs.
See also
* List of BASIC dialects
This is an alphabetical list of BASIC dialects — interpreted and compiled variants of the BASIC programming language. Each dialect's platform(s), i.e., the computer models and operating systems, are given in parentheses along with any ot ...
* List of Computers With On-Board BASIC
This is a list of computers with on-board BASIC. They shipped standard with a version of BASIC that was installed in the computer. The computers can access the BASIC language without the user inserting cartridges or loading software from external m ...
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
Assembly language software