|This article does not cite any references or sources. (December 2009)|
BASIC-PLUS was an extended dialect of the BASIC programming language 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 through the 1980s.
Users would sit at a terminal and type in programming language statements. The statements could either be entered into the system's command interpreter directly, or entered into a text editor, saved to a file, and loaded into the command interpreter from the file. Errors in source code were reported to the user immediately after the line was typed.
The language system provided two modes of storage:
- A program could be stored on the system in an editable source file (a .BAS file) using the "SAVE" command, or
- Semi-compiled into a non-editable binary .BAC file by the "COMPILE" command.
Source programs could be edited and run, similar to the BASIC interpreter which years later was included with the IBM PC in ROM.
While the command interpreter had a "COMPILE" command, it was not a true native machine language compiler. The language was a semi-compiled language, in which a source program was "compiled" into byte code called "PPCODE" (Push-Pop Code), for a virtual stack machine, and the tokens interpretively executed, in a manner similar today to the execution of programs using the Java language.
Programs were entered into the command interpreter starting with line numbers, integers from 1 to 32767, and were continued on multiple lines by using a line feed at the end of a line instead of the return (enter) key. For ease of external editing of the source file, later versions of BASIC-PLUS also allowed the & character as a line-continuation character. Multiple statements could be placed on a single line using \ or : as the statement separator.
Variable names in the early versions of BASIC-PLUS could be a single letter or a single letter followed by a single digit. With the inclusion of "Extend mode" in later versions, variable names could be up to 29 characters long, and dot (.) was added as a permitted character, but every variable name still had to begin with a letter. (Before the introduction of Extend mode, white space was not required between variables and other language elements: "FOR I=STOP" would be interpreted as "FOR I = S TO P".) Integer variables (16-bit, range -32768 to +32767) were indicated with a % suffix; string variables (variable length) were indicated with a $ suffix. Variables with no suffix were floating point (8 bytes, range .29 x 10E-38 to 1.7 x 10E38, up to 16 digits of precision). Arrays could have one or two dimensions. Virtual arrays (stored in disk files) allowed storage of far more data elements than could fit in program memory, and could be saved permanently on disk.
The virtual address space of a RSTS/E user was limited to a little less than 64KB of space. Using BASIC-PLUS, about half of this virtual address space was used by the combined command interpreter and run-time library (named the Run Time System on RSTS/E). This limited user programs to about 32KB of memory. Large programs were broken up into various pieces by use of the "CHAIN" statement, and programs could chain to specific line numbers in a secondary program to indicate that program should begin execution at a different point than its first line. This feature of chaining to a certain line number allowed programs to signal to each other that they were being called from another program. The use of a shared memory section called core common also allowed programs to pass data among each other as needed. Disk files could also be used but were slower.
To conserve memory, the interpreter included a garbage collecting memory manager, used for both string data and byte-code.
A running program could be interrupted, have variables examined and modified, and then be resumed.
Many of the control structures used in other high-level languages existed in BASIC-PLUS, including WHILE and UNTIL, and the language also supported the use of modifiers on a line to control execution such as
PRINT I UNLESS I < 10
BASIC Plus 2
A related product called Basic Plus 2 ("BP2" or BASIC-Plus-2), was later developed by DEC to add additional features and increased performance. It used true compilation into threaded code and wrote its output to object files compatible with the machine code object files produced by the assember and other language systems. These object files could be kept in libraries. A linker (the TKB taskbuilder) then created executable files from object files and the libraries. TKB also supported overlays; this allowed individual routines to be swapped into the virtual address space as needed, overlaying routines not currently being used. Additionally, BP2 programs ran under the RSX Run Time System; this RTS only occupied 8KB of the user's virtual address space, leaving 56KB for the user's program. (RSTS/E version 9 introduced separate Instruction and Data space, and the "disappearing" RSX Run Time System, permitting up to 64KB of each of instruction code and data.) These two factors allowed individual BP2 programs to be much larger than BASIC-PLUS programs, often reducing the need for CHAINing among multiple programs.