Minimal BASIC

Last updated

Minimal BASIC is a dialect of the BASIC programming language developed as an international standard. The effort started at ANSI in January 1974, and was joined in September by a parallel group at ECMA. The first draft was released for comments in January 1976 and the final standard, known alternately as ANSI X3.60-1978 or ECMA-55, was published in December 1977. The US Bureau of Standards introduced the NBSIR 77-1420 test suite to ensure implementations met the definition.

Contents

By this time, Microsoft BASIC was beginning to take over the market after its introduction on early microcomputers in 1975, and especially after the introduction of the 1977 "trinity" - the Apple II, Commodore PET and TRS-80, all of which would cement MS-style BASICs as the de facto standard. ISO standardization of Minimal BASIC began as ISO 6373:1984 but was abandoned in 1998. An effort to produce a more powerful dialect, Full BASIC (also known as Standard BASIC), was not released until January 1987 and had little impact on the market.

History

Previous developments

Dartmouth BASIC was introduced in May 1964 at Dartmouth College as a cleaned up, interactive language inspired by FORTRAN. [1] The system brought together several concepts which were hot topics in the computer industry at the time, notably timesharing to allow multiple users to access a single machine, and direct interaction with the machine using computer terminals. General Electric, who supplied the GE-225 computer it ran on, marketed a slight variation to commercial users and saw immediate uptake. [2] A number of other companies soon introduced similar systems of their own, selling online time by the minute. By the end of the 1960s there was a version of BASIC for almost every mainframe platform and online service. [3] [4]

In 1966, Hewlett-Packard (HP) introduced a new minicomputer, the HP 2100. Intended to be used in laboratories and factory settings, the company was surprised to find most were being sold for business processing. [5] Looking to take advantage of this, in November 1968 they introduced the HP 2000, a system using two HP 2100 CPUs which implemented timesharing to support up to 32 users. The system worked in a fashion similar to the Dartmouth model, using one machine to control input/output and another to run the programs. In contrast to the Dartmouth versions which were compilers, HP Time-Shared BASIC was an interpreter. [6]

Interpreters quickly became common on smaller machines and minicomputers. Other vendors quickly copied the HP dialect, notably Data General for their Nova series which were very successful in the early 1970s. Wang Laboratories also had some success with their dedicated BASIC machines, the Wang 2200 series. Each version had its own differences. One holdout was Digital Equipment Corporation (DEC), who had been involved with the JOSS program at the Stanford Research Institute (SRI) and introduced their FOCAL language based on it. By the early 1970s the success of BASIC forced DEC to introduce a BASIC of their own with its own set of modifications. [7]

Standards efforts

The divergence of BASIC led to interest in producing a standard to try to bring them back together. The first meetings on such a possibility took place in January 1974 under the newly-formed ANSI working group X3J2. This led to a corresponding group being set up in September 1974 in Europe under the ECMA, TC 21. The two groups remained in close contact throughout the effort and released their respective standards at the same time. The first draft, was released by ANSI in January 1976. The final version was prepared in June 1977, and officially adopted by the ECMA on 14 December 1977. [8]

X3J2's first few years were spent (in hindsight, some might say 'wasted') on standardizing what amounts to the original 1964 Dartmouth Basic... Minimal Basic was more a toy than an actual language.

Arthur Luehrmann [9]

Minimal BASIC was essentially the original 1964 Dartmouth BASIC written as a formal standard using an Extended Backus–Naur form with an associated test suite to ensure implementation complied with the definition. It clarified formerly undefined concepts like whether GO TO and GOTO were the same thing, in this case stating that goto statement = GO space* TO line number, meaning GOTO, GO TO and even GO     TO were identical. [10] Where differences between implementations existed, like in the handling of the FOR statements or whether or not spaces were required between keywords and values, the standard always selected the Dartmouth pattern. [9]

It was always understood that Minimal BASIC was not really useful on its own as it lacked many common features like string manipulation. These more advanced features would be a focus of the follow-up effort, Full BASIC, which began serious work after the publication of Minimal. Full BASIC was not simply a version of Minimal with more features, instead, it was based on Dartmouth's Structured BASIC efforts and was designed to offer structured programming to support the construction of large programs. In contrast to Minimal, Standard BASIC was designed to significantly update BASIC. [11]

Irrelevance

While the Minimal BASIC effort was taking place, the first widely available microcomputer was released, the Altair 8800. Shortly thereafter, Altair BASIC was released by Microsoft. Within the year, dozens of new micros were released and as many new versions of BASIC. By the time the Minimal standard was ratified, there were already tens of thousands of machines running some variation of the language. Which dialect any particular interpreter followed was generally based on the machines used to develop it; MS BASIC was developed on a PDP-10 [12] and has many features from DEC's BASIC-PLUS, while Apple BASIC was written by Steve Wozniak based on an HP manual and uses HP's system of string handling. [13] [lower-alpha 1]

The first draft of the Minimal standard was released for comments in January 1976. Numerous comments were used to update the draft and its final release was prepared in June 1977 and formally ratified by the ECMA on 14 December 1977. [14] The US Bureau of Standards released the NBSIR 77-1420 test suite to allow vendors to test compliance with the standard. [15] As there were no microcomputer vendors in the standards groups, the system mostly found use on mainframe versions, which invariably had many extensions. One of the few microcomputer versions to implement the standard was Microsoft's BASIC-80 for the Zilog Z80, better known as MBASIC, which gained compliance with the standard in its 5.0 version. [16]

After the release of Minimal, the standards groups turned their attention to Full BASIC, but this dragged on for years. The effort proceeded so slowly that the Dartmouth participants left and released their own version of the still-emerging standard as True Basic in 1984. This was bug-ridden and confusing, leading Jerry Pournelle to deride it as "madness" [17] and John Dvorak to dismiss it as "sad" and "doomed to failure." [18] Plans to move Minimal BASIC to the International Organization for Standardization (ISO) were abandoned, [19] and the ANSI group broke up leaving the original standards inactive. [20]

Description

Minimal BASIC is closely based on early versions of Dartmouth BASIC and follows its conventions. The standard mostly clarifies certain limitations in an effort to produce a standard that can run on almost any machine. The following description assumes a basic familiarity with common BASICs, and highlights the differences in Minimal.

Program code

Like most BASIC implementations, Minimal is based on the underlying source code being edited using a line editor and thus every line of code in Minimal has to have a line number. The standard allows line numbers between 0 and 9999. In contrast to some interpreters, Minimal requires a space before every keyword, and a space or end-of-line after it. [21]

Keywords include REM, DIM, OPTION, DEF ,LET, PRINT, INPUT, READ, DATA, RESTORE, IF...THEN, FOR...TO...STEP...NEXT, GO TO, GO SUB...RETURN, ON...GO TO and ON...GO SUB..., RANDOMIZE, STOP and END. [22]

Programs are required to have an END as their last line. [23] INPUT may have an optional prompt string, but that is up to the implementation, not part of the standard. [24] RESTORE did not allow a line number, an option seen in most interpreters of the era. FOR...NEXT loops are top tested, and will not execute their body if the test fails on the first iteration. [25]

Variable names can consist of a single letter, or a letter and a single digit. Two-letter variable names are not allowed. [26] Numbers are limited to the range 1E-38 to 1E38. [21] String variables can have a maximum of 18 characters. [27] Arrays can be one or two dimensional using DIM, but only numeric arrays are supported. All variables are normally allocated space in an associated one-dimensional array without using DIM, they are given space for 11 items, indexes 0 to 10. The lower bound for arrays is typically 0, but using OPTION BASE 1 can change the index to 1. [28]

There are 11 defined functions; ABS, ATN, COS, EXP, INT, LOG, RND, SGN, SIN, SQR and TAN. [29] Operators include =, <=, >=, <>. Strings could only be compared for equals or not-equals, larger and smaller comparisons were not supported. Note that the logical operators, AND, OR and NOT, are not supplied. [10]

User-defined functions using DEF FN were supported, but only for numerics. No built-in or user functions for strings were available. [30]

Example

This code implements the Sieve of Eratosthenes: [31]

1000REM SIEVE OF ERATOSTHENES 1010REM MODIFIED FROM QUICK BASIC MATH PROJECT DEMO1020REM 2010REM L IS THE LIMIT OF THE SIEVE2020REM WE WILL FIND ALL PRIME NUMBERS UP TO L2030LETL=10002040REM N IS THE SIEVE ITSELF2050DIMN(1000)2060REM FILL THE SIEVE WITH ALL NUMBERS UP TO L2070FORI=1TOL2080LETN(I)=I2090NEXTI2100REM START WITH THE FIRST PRIME NUMBER: 22110LETP=22120PRINTP,2130REM "CROSS OUT" MULTIPLES OF P2140FORI=PTOLSTEPP2150LETN(I)=02160NEXTI2170REM FIND THE NEXT NUMBER NOT CROSSED OUT2180LETP=P+12190IFP=LTHEN22202200IFN(P)<>0THEN21202210GOTO21802220PRINT2230END

Notes

  1. Wozniak later lamented that the market abandoned HP's string handling and used DEC/MS style, which he derided as "abysmal". [13]

Related Research Articles

<span class="mw-page-title-main">BASIC</span> Family of programming languages

BASIC 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 in 1963. They wanted to enable students in non-scientific fields to use computers. At the time, nearly all computers required writing custom software, which only scientists and mathematicians tended to learn.

<span class="mw-page-title-main">True BASIC</span> Programming language

True BASIC is a variant of the BASIC programming language descended from Dartmouth BASIC—the original BASIC. Both were created by college professors John G. Kemeny and Thomas E. Kurtz.

<span class="mw-page-title-main">BBC BASIC</span> Version of the BASIC programming language

BBC BASIC is a version of the BASIC programming language released in 1981 as the native programming language for the BBC Micro home/personal computer, providing a standardized language for a UK computer literacy project of the BBC. It was written mainly by Sophie Wilson.

Tiny BASIC is a family of dialects of the BASIC programming language that can fit into 4 or fewer KBs of memory. Tiny BASIC was designed in response to the open letter published by Bill Gates complaining about users pirating Altair BASIC, which sold for $150. Tiny BASIC was intended to be a completely free version of BASIC that would run on the same early microcomputers.

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 version of BASIC published by Microsoft as well as the first high-level programming language available for the Altair 8800 microcomputer.

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 version of BASIC used by many early home computer owners.

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 interactive programming environment to all undergraduates as well as the larger university community.

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 incrementing by 1 for each successive line.

<span class="mw-page-title-main">TI BASIC (TI 99/4A)</span> Programming language for TI-99 home computers

TI BASIC is an ANSI-compliant interpreter for the BASIC programming language built into the 1979 Texas Instruments TI-99/4 home computer and its improved 1981 version, the TI-99/4A.

MBASIC is the Microsoft BASIC implementation of BASIC for the CP/M operating system. MBASIC is a descendant of the original Altair BASIC interpreters that were among Microsoft's first products. MBASIC was one of the two versions of BASIC bundled with the Osborne 1 computer. The name "MBASIC" is derived from the disk file name MBASIC.COM of the BASIC interpreter.

HP Time-Shared BASIC 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 versions of the game Star Trek.

<i>BASIC Computer Games</i>

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 Star Trek.

The Byte Sieve is a computer-based implementation of the Sieve of Eratosthenes published by Byte as a programming language performance benchmark. It first appeared in the September 1981 edition of the magazine and was revisited on occasion. Although intended to compare the performance of different languages on the same computers, it quickly became a widely used machine benchmark.

The Rugg/Feldman benchmarks are a series of seven short BASIC programming language programs that are used to test the performance of BASIC implementations on various microcomputers. They were published by Tom Rugg and Phil Feldman in the June 1977 issue of the US computer magazine, Kilobaud.

SCELBAL, short for SCientific ELementary BAsic Language, is a version of the BASIC programming language released in 1976 for the SCELBI and other early Intel 8008 and 8080-based microcomputers like the Mark-8. Later add-ons to the language included an extended math package and string handling. The original version required 8 kB of RAM, while the additions demanded at least 12 kB.

SDS BASIC, also known as CP-V BASIC, Batch BASIC or Sigma BASIC depending on the version, is a BASIC programming language compiler for Scientific Data Systems's (SDS) Sigma series mainframe computers, originally released in 1967. Xerox purchased SDS in 1969 and began rebranding it as Xerox Data Systems, and finally just Xerox, at which time the language became known as Xerox BASIC.

<span class="mw-page-title-main">BASIC interpreter</span> Interpreter that enables users to enter and run programs in the BASIC language

A BASIC interpreter is an interpreter that enables users to enter and run programs in the BASIC language and was, for the first part of the microcomputer era, the default application that computers would launch. Users were expected to use the BASIC interpreter to type in programs or to load programs from storage.

BASIC-8, is a BASIC programming language for the Digital Equipment (DEC) PDP-8 series minicomputers. It was the first BASIC dialect released by the company, and its success led DEC to produce new BASICs for its future machines, notably BASIC-PLUS for the PDP-11 series. DEC's adoption of BASIC cemented the use of the language as the standard educational and utility programming language of its era, which combined with its small system requirements, made BASIC the major language during the launch of microcomputers in the mid-1970s.

Full BASIC, sometimes known as Standard BASIC or ANSI BASIC, is an international standard defining a dialect of the BASIC programming language. It was developed by the American National Standards Institute (ANSI) X3.60 group in partnership with the European ECMA. It describes an advanced version of BASIC with many features including structured programming, matrix math, input/output for file handling, and many other options.

References

Citations

  1. Kurtz 1981, p. 532.
  2. Kurtz 1981, pp. 532, 534.
  3. McCracken 2014.
  4. "IBM VS the World: That's How It Is". Computerworld. 5 December 1973. Archived from the original on 28 January 2022. Retrieved 26 April 2022.
  5. Leibson, Steve (2017). "HP: The Accidentally, On-Purpose Computer Company". HP9825.COM. Archived from the original on 2019-10-21. Retrieved 2022-04-26.
  6. "Hewlett-Packard 2100 Processor Description, 1972" (PDF). Archived (PDF) from the original on 2021-04-12. Retrieved 2020-08-18.
  7. Savetz, Kevin (April 2013). "Dave Ahl and Betsy Ah" (Interview). Archived from the original on 2022-03-31. Retrieved 2022-04-26.
  8. ECMA 1978, p. iii.
  9. 1 2 Luehrmann 1984, p. 173.
  10. 1 2 ECMA 1978, p. 15.
  11. Luehrmann 1984, p. 171.
  12. Fridson 1999, p. 116.
  13. 1 2 Wozniak 2014.
  14. ECMA 1978, p. i.
  15. Gilsinn & Sheppard 1978.
  16. BASIC-80 Reference Manual. Microsoft. 1981. Archived from the original on 2022-05-21. Retrieved 2022-04-26.
  17. Pournelle 1985, p. 366.
  18. Dvorak 1984, p. 88.
  19. "ISO 6373:1984". Archived from the original on 2021-03-03. Retrieved 2022-04-26.
  20. "ECMA-55 Minimal BASIC". ECMA International. Archived from the original on 2022-04-03. Retrieved 2022-04-26.
  21. 1 2 ECMA 1978, p. 6.
  22. ECMA 1978.
  23. ECMA 1978, p. 5.
  24. ECMA 1978, p. 22.
  25. ECMA 1978, p. 17.
  26. ECMA 1978, p. 8.
  27. ECMA 1978, p. 9.
  28. ECMA 1978, p. 25.
  29. ECMA 1978, p. 11.
  30. ECMA 1978, p. 13.
  31. Ham, John Gatewood (May 15, 2015). "ERATOSTHENESE.BAS". Sourceforge. Archived from the original on 2022-04-26. Retrieved 2022-04-26.

Bibliography

Further reading

Currently Maintained Open Source Implementations