BASIC-PLUS

From Wikipedia, the free encyclopedia

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 ficitious stack machine, and the tokens interpretively executed, in a manner similar today to the execution of programs using the Java programming 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.

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 (called 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

[edit] 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. These two factors allowed individual BP2 programs to be much larger than BASIC-PLUS programs., often eliminating the need for CHAINing among multiple programs.

Unlike BASIC-PLUS (which was only available on RSTS/E), BP2 was also available for the RSX-11 operating system. BP2 programs were also more compatible with the later VAX BASIC.