HP Time-Shared BASIC

Last updated
HP Time-Shared BASIC
Paradigm imperative
Developer Mike Green
First appearedbefore 1969;53 years ago (1969)
OS HP 2100
Influenced by
Dartmouth BASIC
Influenced
Cf. SDS BASIC, Integer BASIC, Atari BASIC, many others

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 versions of the game Star Trek .

Contents

The system implements a dialect of BASIC as well as a rudimentary user account and program library that allows multiple people to use the system at once. The systems were a major force in the early-to-mid 1970s and generated a large number of programs. HP maintained a database of contributed-programs and customers could order them on punched tape for a nominal fee.

Most BASICs of the 1970s trace their history to the original Dartmouth BASIC of the 1960s, but early versions of Dartmouth did not handle string variables or offer string manipulation features. Vendors added their own solutions; HP used a system similar to Fortran and other languages with array slicing, while DEC later introduced the MID/LEFT/RIGHT functions.

As microcomputers began to enter the market in the mid-1970s, many new BASICs appeared that based their parsers on DEC's or HP's syntax. Altair BASIC, the original version of what became Microsoft BASIC, was patterned on DEC's BASIC-PLUS. Others, including Apple's Integer BASIC, Atari BASIC and North Star BASIC were patterned on the HP style. This made conversions between these platforms somewhat difficult if string handling was encountered.

Nomenclature

The software was also known by its versioned name, tied to the hardware version on which it ran, such as HP 2000C Time-Shared BASIC and the operating system came in different varieties — 2000A, 2000B, 2000C, High-Speed 2000C, 2000E, and 2000F.

HP also referred to the language as "Access BASIC" in some publications. This matched the naming of the machines on which it ran, known as the "2000/Access" in some publications. This terminology appears to have been used only briefly when the platform was first launched.

Platform details

Except for the 2000A and 2000E systems, the system is implemented using a dual-processor architecture. One fully configured HP 2100-series processor is used for the execution of most of the system code and all of the user code, while a second, smaller HP 2100-series processor is used to handle the RS-232 serial lines through which the time-sharing users connected. Depending on the hardware configuration, the system supports up to 16 or up to 32 simultaneous remote users.

The usual terminal for a TSB system was a Teletype Model 33 ASR and connected directly to the I/O processor or through a modem or acoustic coupler. Account names are a combination of one alphabetic character, followed by three decimal digits, e.g., B001. Privileged accounts started with the letter "A" and had some additional command and program storage capabilities. The superuser account is A000. This scheme allows up to 26,000 user accounts.

During execution, user programs are swapped to a fixed head drive  — physically a disk, but operating like a magnetic drum. When not executing, user programs are stored on moving-head cartridge- or pack-loaded disk storage. Privileged users can also store programs on the much-faster drum. The hard drive was backed up to magnetic tape.

Program and file names consist of a mix of up to six alphabetic characters (A-Z) and numbers (0-9). Programs are stored in a tokenized format, using the SAVE command. They can also be stored in a semi-compiled format, using the CSAVE command, which allows them to start quicker. Since the system was closely tied to the use of commonly available teleprinters, line endings in files consisted of the carriage return character (ASCII CR, 0D hexadecimal), followed by the linefeed character (ASCII LF, 0A hexadecimal).

Syntax

The language is a fairly standard implementation of BASIC, providing an integrated editing and runtime environment. Statements are analyzed for correct syntax as they are entered and then stored in tokenized form. Each BASIC statement has to be on a uniquely numbered line, e.g.

10PRINT"HELLO WORLD"

Line numbers are mandatory, and statements are automatically placed in ascending numeric sequence. TSB lines can contain one statement; chaining multiple statements with the colon as in MS BASIC is not supported. Multiple variable assignments are allowed, e.g., 20LETA=B=C=42. As in most versions of BASIC, use of the word "LET" was optional.

In the earliest version (2000A), the language supported the following features. [1] Later versions added many more features. [2]

String handling

Strings in TSB are treated as an array of characters, 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 mentioned before use. For instance, DIMA$[10] will set up a string that can hold a maximum of 10 characters. The maximum length of a string in TSB is 72 characters. [3]

Substrings within strings are accessed using a "slicing" notation: A$(L,R) or A$[L,R], where the substring begins with the leftmost character specified by the index L and continues to the rightmost character specified by the index R, or the A$[L] form where the substring starts at the leftmost character specified by the index L and continues to the end of the string. TSB accepts () or [] interchangeably. Array and substring indices start with 1.

This is in sharp contrast to BASICs following the DEC pattern that use functions such as LEFT$(), MID$(), and RIGHT$() to access substrings, although ANSI BASIC continues to use a similar substring syntax to that introduced by Hewlett-Packard. HP's notation can also be used on the destination side of a LET or INPUT statement to modify part of an existing string value, for example 100A$[3,5]="XYZ" or 120B$[3]="CHANGE ALL BUT FIRST TWO CHARS", which cannot be done with early implementations of LEFT/MID/RIGHT.

The main advantage to this style of string access is that it eliminates the need for complex memory management that is otherwise required when string lengths change. MS BASIC had a lengthy library to handle the compression of memory by removing dead space in the string heap when the system ran out of memory. It was also notoriously slow, and was modified several times over its lifetime in order to improve performance or fix bugs. [4] The downside to the TSB style is that the string always takes up the full amount of DIMed space even if the string inside is empty, and simple tasks like concatenation can potentially overflow the string unless it was set to a large size to begin with.

Later versions of Dartmouth BASIC did include string variables, based on the same pattern found in BASIC-PLUS and MS BASIC. However, this version 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. HP included identical functionality, changing only the name to CONVERT. [5] [lower-alpha 1] 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. [6]

MAT commands

Later versions of Dartmouth BASIC included a suite of MAT commands that allowed operations on entire arrays (matrices) with a single statement. These were also available in later versions of TSB. In their simplest form, the MAT is used like an alternate form of LET, applying an expression to all the elements in an array. For instance:

100DIMA(20),B(20)...200MATA=A+B

Will add the value of every value in B to every entry in A, in the same fashion as:

100DIMA(20),B(20)...200FORI=1TO20210A[I]=A[I]+B[I]220NEXTI

As well as making the code shorter and more obvious, these commands also have the advantage of being highly optimized, easily outperforming the use of FOR/NEXT. [7] Additional functions and statements modify PRINT and INPUT, invert arrays, and build identity matrixes and such in a single statement. [8]

Other differences

TSB also includes a number of more minor differences with other dialects. Among the most important are:

See also

Notes

  1. Wang BASIC also used CONVERT, but it converted numbers in strings, like the VAL function.

Related Research Articles

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 original Apple II model. It is also referred to as FP BASIC because of the Apple DOS command used to invoke it, instead of INT for Integer BASIC.

BASIC 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, Thomas E. Kurtz at Dartmouth College in 1964. 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.

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.

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 BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC and differs in significant ways. It includes keywords for Atari-specific features and lacks support for string arrays, for example.

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.

RPL is a handheld calculator operating system and application programming language used on Hewlett-Packard's scientific graphing RPN calculators of the HP 28, 48, 49 and 50 series, but it is also usable on non-RPN calculators, such as the 38, 39 and 40 series.

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.

FOCAL is an interactive interpreted programming language based on JOHNNIAC Open Shop System (JOSS) and mostly used on Digital Equipment Corporation (DEC) Programmed Data Processor (PDP) series machines.

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.

Systems Programming Language, often shortened to SPL but sometimes known as SPL/3000, was a procedurally-oriented programming language written by Hewlett-Packard for the HP 3000 minicomputer line and first introduced in 1972. SPL was used to write the HP 3000's primary operating system, Multi-Programming Executive (MPE). Similar languages on other platforms were generically referred to as system programming languages, confusing matters.

IBM System/36 BASIC was an interpreter for the IBM System/36 midrange computer.

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.

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.

Data General Extended BASIC, also widely known as Nova Extended BASIC, was a BASIC programming language interpreter for the Data General Nova series minicomputers. It was based on the seminal Dartmouth BASIC, including the Fifth Edition's string variables and powerful MAT commands for matrix manipulation. In contrast to the compile-and-go Dartmouth BASIC, Extended BASIC was an interpreter.

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.

BASIC interpreter 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.

Wang BASIC is a series of BASIC programming languages for computers from Wang Laboratories. The term can be used to refer to the BASIC on any Wang machine, but is mostly associated with the versions on the Wang 2200 minicomputer series of the early 1970s. When these machines were updated to the VP series in 1976, BASIC-2 was introduced and remained the pattern for future machines in the 2200 series. A planned BASIC-3 was never released.

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.

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.

CALL/360:BASIC was an IBM dialect of the BASIC programming language for the System/360 and later platforms. It was based on mid-1960s versions of Dartmouth BASIC but added a number of extensions. Most of these were related to file handling, which, at that time, Dartmouth lacked. It also added support for the mathematical symbols found on some IBM terminals, so that <= could be entered directly as . Differences are otherwise minor.

References

Citations

  1. HP 2000A - User's Guide, August 1969 Part Number 02000-90002, . Retrieved 2016-05-09
  2. HP 2000/Access BASIC - Reference Manual Part No. 22687-90001, . Retrieved 2016-05-09
  3. Ref 1976, p. 4-3.
  4. "Create your own Version of Microsoft BASIC".
  5. Ref 1976, p. 4-6.
  6. Ref 1976, p. 4-2.
  7. Ref 1976, p. 11-50.
  8. Ref 1976, pp. 11–49, 11–55.
  9. Ref 1976, p. 2-5.
  10. Ref 1976, p. F-4.
  11. Ref 1976, p. 2-15.
  12. Ref 1976, p. 2-10.
  13. Ref 1976, p. 2-9.
  14. Ref 1976, p. 2-11.

Bibliography