HP Time-Shared BASIC
HP Time-Shared BASIC (HP TSB) was an interpreter software system sold by the Hewlett-Packard Company in the late 1960s and 1970s, based on their HP 2100 line of minicomputers. The system implemented a dialect of the BASIC programming language and a rudimentary user account and program library system. 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, 2000F, and 2000/Access.
Except for the 2000A and 2000E systems, the system was implemented using a dual-processor architecture. One fully configured HP 2100-series processor was used for execution of most of the system code and all of the user code and a second, smaller HP 2100-series processor was used to handle the RS-232 serial lines through which the time-sharing users connected. Depending on the hardware configuration, the system supported between 16 and 32 simultaneous remote users with the possibility of hundreds of user accounts. 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 were 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 was A000. This scheme allowed up to 26,000 user accounts. (In the offshoot system created by BTI Computer Systems accounts beginning with "@" were superuser accounts.)
During execution, user programs were swapped to fixed-head drum memory. When not executing, user programs were stored on moving-head cartridge- or pack-loaded disk storage. Privileged users could also store programs on the much-faster drum. Backup was on magnetic tape.
Program and file names consisted of a mix of up to six alphabetic characters (A-Z) and numbers (0-9). Programs were stored in ASCII format, using the SAVE command. They could also be stored in a semi-compiled format, using the CSAVE command, which would allow 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).
The language was a fairly standard implementation of BASIC, providing an integrated editing and runtime environment. Statements were analyzed for correct syntax as they were entered and then stored in semi-compiled form. Each BASIC statement had to be on a uniquely numbered line, e.g.,
10 PRINT "HELLO WORLD" and could only contain one statement, although multiple variable assignments were allowed, e.g.,
20 LET A=B=C=42. Line numbers were mandatory and had to be in ascending numeric sequence.
The language supported:
- Unconditional program flow-control via
GOTOstatements, and subroutines via the
- Conditional flow-control via
IF/THENstatement and simple variable-based block loop
- Calculated flow-control via the
- Numeric variables of the form "A" or "An" (where A is a single letter and n a single, optional digit) stored as 4-byte floating-point numbers.
- String variables of the form "A$" or "A0$", "A1$" ... "Z9$", storing from 0 to 255 characters
- One- or two-dimensional matrix (array) variables of the form "A[x,y]" or "An[x,y]"
- Matrix operations via
- Logical operators
- Simple built-in mathematical functions including trigonometric (
SIN, COS, TAN), logarithms (
LOG, EXP), square root (
SQR), and random number generator (
- File operations
- Punched tape operations using Teletype Model 33 electromechanical teleprinter remote terminals
Substrings within strings were accessed using a substring notation: "A$[L,R]" where L specified the leftmost byte to be accessed and R specified the rightmost byte to be accessed. This is in sharp contrast to some later microcomputer BASICs 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. Array and substring indices started with 1.
- The Hewlett Packard Company (May 1976). HP 2000/Access BASIC Reference Manual, Part No. 22687-90001
- The Hewlett Packard Company (May 1976). Learning Timeshare BASIC
- HP 2000/Access BASIC Reference Manual, page 11-16. Part No. 22687-90001.
- HP 2000/Access BASIC Reference Manual, page 11-11. Part No. 22687-90001.