BASIC-PLUS is an extended dialect of the BASIC programming language that was developed by EGH for Digital Equipment Corporation (DEC) for use on its RSTS/E time-sharing operating system for the PDP-11 series of 16-bit in the early 1970s through the 1980s.
BASIC-PLUS was based on BASIC-8 for the TSS/8, itself based very closely on the original Dartmouth BASIC. BASIC-PLUS added a number of new structures, as well as features from JOSS concerning conditional statements and formatting. In turn, BASIC-PLUS was the version on which the original Microsoft BASIC was patterned.
Notable among the additions made to BASIC-PLUS was the introduction of string functions like and , in addition to Dartmouth's original all-purpose command. In future versions of the language, notably Microsoft's, was removed and BASIC-PLUS's string functions became the only ways to perform these sorts of operations. Most BASICs to this day follow this convention.
The language was later rewritten as a true compiler as BASIC-Plus-2, and was ported to the VAX-11 platform as that machine's native BASIC implementation. This version survived several platform changes, and is today known as VSI BASIC for OpenVMS.
The same year that RAND introduced JOSS, Dartmouth University introduced the first version of Dartmouth BASIC. This was soon ported to several other platforms, and by the late 1960s it was making major inroads to the computer industry as an interactive language intended to be used with timesharing systems. By the late 1960s, most vendors were introducing a BASIC for their platform, including IBM and the major online timesharing companies like Tymshare's SUPER BASIC.
DEC continued to push FOCAL to their customers, as much for not invented here reasons as any technical advantage. By the late 1968s, DEC's educational department was finding it increasingly difficult to pitch FOCAL to prospective customers as BASIC began to take over. Management was uninterested, so in 1969 David H. Ahl took it upon himself to hire a programmer to write BASIC-8 for the PDP-8. It was an immediate success and became one of DEC's biggest software sellers.
The company eventually concluded it needed an entirely new timesharing OS, and put Tom Barnett and Nathan Teicholtz in charge of developing it. They formed a new team to develop what was then known as IOX, Input Output eXecutive, on 11 June 1970. Teicholtz, the technical lead, was formerly part of the TSS-8 effort on the PDP-8. Among the many new concepts IOX was to include was the idea of using a programming language that could act as a command shell programming system as well.
An argument broke out in the company about what language it should be based on. Some suggested it be FOCAL, largely because DEC felt they should do their own thing. Others felt that not supporting BASIC would be a major problem for the machine's popularity. As there seemed to be no overwhelming argument either way on technical grounds, the decision was left to the marketing department, who chose BASIC. In the end, they decided to do both, and have a BASIC dialect that would add some features from FOCAL as well.
Previously, DEC had introduced several different BASIC dialects for their different platforms, and these were both different enough to require conversion when moving between machines, as well as generally underwhelming compared to other platforms. BASIC-PLUS introduced many new features that made it among the more complete dialects, including matrix math, file handing, and other features previously only seen on mainframe systems. BASIC-PLUS would go on to be the basis for all future dialects from the company.
The original concept was that EGH would write only the compiler and related utilities, while DEC would write the runtime system which would be separate. The idea was that systems with limited amounts of memory and secondary storage would be supplied only with the runtime and small size of the runtime and the intermediate language (IL) code from the compiler would allow it to run. Development in BASIC would require a machine with more resources, but simply running the resulting programs would work even on the smallest machines. EGH was initially supposed to write only the compiler, but over time they were put in charge of the entire system, which they delivered in January 1971. The idea of a runtime-only system was later dropped.
IOX was eventually renamed RSTS-11, and shipped with BASIC-PLUS in 1971.
As a smart terminal with cursor control could not be guaranteed, BASIC-PLUS used the common system of prefixing all source code with a line number. The code was edited by typing in the number and then changing the contents of the following code. A line of code could be removed by typing in its line number and nothing else, thereby setting it to an empty line.
The virtual address space of an 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 runtime system on RSTS/E). This limited user programs to about 32 kilobyte of memory.
Large programs were broken into separate executable pieces by use of the statement, and programs could chain loading to specific line numbers in a secondary program to indicate that a program should begin execution at a different point from 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 to each other as needed. Hard disk files could also be used but were slower.
To conserve memory, the system 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.
Multiple statements could be placed on a single line using as the statement separator. The system allowed tabs to be used as inline whitespace, and was used to make loops more clear, as in modern languages. Comments used either the keyword or the character, as opposed to MS BASICs, which used and .
Strings could be delimited by single or double quotes. In addition to the and functions that converted single characters to and from string format, BASIC-PLUS also supported Dartmouth's command. iterated the string and returned each character's ASCII value as a slot in a numeric array. For instance, would return an array with the five ASCII codes, 110, 105, 114, 114, 105, in elements 1 through 5, and the number 5, the length of the string, in element 0. One could reverse the operation as well, would read the individual numbers in the X array and convert it to a string.
loops worked as in other versions of BASIC, and the command could not be used in an expression to exit early. Instead, the and keywords could be used to control early exits. For instance, continue looping until I=10, with the assumption that following code would set the value of I, meaning it might not exit after 10 iterations but as soon as the code set I to 10. Modifiers could also be used to build compact one-line loops, for instance, would loop until X was 100.
The language supported three data types; floating-point numbers, integers, and strings. Variables with no suffix were floating point (8 bytes, range 0.29 to 1.7, up to 16 digits of precision). Integer variables (16-bit, range −32768 to +32767) were indicated with a suffix, string variables (variable length) were indicated with a suffix.
The list of mathematical and logical operators was typical of most BASICs, with some extensions. For math, , , , and were supported, along with as an alternate form of for computer terminals that might not have that character. Standard logical comparisons were , , , , , and . One interesting addition was the operator, for "approximately equal". This would return true if the two numbers would be printed the same, that is, their six most significant digits were the same. Logical operators included the typical , and , along with , which return true if both A and B are true or both are false, and which is false if A is true and B is false and otherwise always true.
The statement could allocate one-dimensional and two-dimensional arrays of any of the three data types. The range of subscripts always began with 0 (but statements did not set elements in row 0 or column 0).
The language also included a number of commands to work with the entire array (or MATrix). The command would fill the matrix with values in a statement, would fill the array with user-typed values, and would print out the elements in a 1D or 2D format. could also be used to set default values in a matrix using associated keywords, for instance, would fill the A array with zeros. would transpose an entire matrix, and would invert it. Additionally, , , and could be used on matrixes, performing the associated matrix operation.
It used true compilation into threaded code and wrote its output to object files compatible with the machine code object files produced by the assembler and other language systems. These object files could be kept in libraries. A linker (the TKB, also known as the 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.
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.
|
|