Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

BASIC-PLUS

From Wikipedia, the free encyclopedia
Dialect of the BASIC Programming Language
BASIC-PLUS
Paradigmimperative
First appeared1970; 56 years ago (1970)
OSRSTS/E
Influenced by
Dartmouth BASIC,Tymshare SUPER BASIC
Influenced
Microsoft BASIC

BASIC-PLUS is an extended dialect of theBASICprogramming language that was developed by EGH forDigital Equipment Corporation (DEC) for use on itsRSTS/E time-sharing operating system for thePDP-11 series of 16-bitminicomputers in the early 1970s through the 1980s.

BASIC-PLUS was based on BASIC-8 for theTSS/8,[1] itself based very closely on the originalDartmouth BASIC. BASIC-PLUS added a number of new structures, as well as features fromJOSS concerning conditional statements and formatting. In turn, BASIC-PLUS was the version on which the originalMicrosoft BASIC was patterned.[2]

Notable among the additions made to BASIC-PLUS was the introduction of string functions likeMID$ andLEFT$, in addition to Dartmouth's original all-purposeCHANGE command. In future versions of the language, notably Microsoft's,CHANGE 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 truecompiler asBASIC-Plus-2, and was ported to theVAX-11 platform as that machine's native BASIC implementation. This version survived several platform changes, and is today known asVSI BASIC for OpenVMS.

History

[edit]

Earlier systems

[edit]

In the mid-1960s, DEC won a sale for aPDP-6mainframe computer to theRAND Corporation who were looking for a faster machine to run their interactiveJOSS programming language. The next year, DEC introduced the much smallerPDP-8, generally considered the first successfulminicomputer. For this machine they developed a cut-down version of JOSS known asFOCAL, which became popular on the PDP-8, one of the best-selling computers of the era.[3]

The same year that RAND introduced JOSS,Dartmouth University introduced the first version ofDartmouth 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 withtimesharing systems. By the late 1960s, most vendors were introducing a BASIC for their platform, includingIBM and the major online timesharing companies likeTymshare'sSUPER BASIC.

DEC continued to push FOCAL to their customers, as much fornot 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 1969David H. Ahl took it upon himself to hire a programmer to writeBASIC-8 for the PDP-8. It was an immediate success and became one of DEC's biggest software sellers.[3]

PDP-11

[edit]

The same year, DEC began the design effort for a new computer that emerged as thePDP-11.[4] The firstoperating system for the platform wasDOS-11, a single user system later retargeted forbatch processing. Timesharing was a major goal for the new machine, so a second system, MUM-1 for Multi-User Monitor, was developed based on DOS, along with aBASIC-11 that ran on top. The result was very slow.[5]

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 theTSS-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 acommand shell programming system as well.[5]

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.[5] In the end, they decided to do both, and have a BASIC dialect that would add some features from FOCAL as well.[4]

EGH takes over

[edit]

As the OS side of the project grew, the engineering load took over all of the available programming time and there was no one working on the BASIC.[5] At a chance meeting while buying an airplane, Tim Hart found the airplane's seller worked at DEC and they ended up talking about the problems DEC was having. Through this opening, Hart, along with two long-time friends Tom Evans and Tom Griffiths who had formed EGH Inc., received a tender from DEC on 25 August. Because they thought it would be a fun project, they put in a very low bid at $10,500 on 4 September. To their surprise they won the contract on 18 September, but DEC realized the price was too low and offered to make it up through a $3000 bonus clause.[6]

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.[6] 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[a] and related utilities, while DEC would write theruntime system which would be separate. The idea was that systems with limited amounts of memory andsecondary storage would be supplied only with the runtime and small size of the runtime and theintermediate 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.[5]

IOX was eventually renamed RSTS-11, and shipped with BASIC-PLUS in 1971.[6]

Operation

[edit]

Users would sit at a terminal and type in programming language statements. The statements could either be entered into the system'scommand interpreter directly, or entered into atext 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.

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 theRun Time System on RSTS/E). This limited user programs to about 32kB of memory.

Large programs were broken into separate executable pieces by use of theCHAIN statement, and programs couldchain 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 calledcore common also allowed programs to pass data to each other as needed.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.

Syntax and features

[edit]

BASIC-PLUS is patterned closely on later versions ofDartmouth BASIC, including its powerfulMAT commands. On top of this, DEC added a number of unique flow-control structures.

Editing

[edit]

Line numbers were positive integers from 1 to 32767.[7] Logical lines of code could be continued on multiple physical lines by using aline feed at the end of a line instead of the normalcarriage return character.[8] 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: as the statement separator.[8] The system allowed tabs to be used as inline whitespace, and was used to make loops more clear, as in modern languages.[9] Comments used either theREM keyword or the! character,[10] as opposed to MS BASICs, which usedREM and'.

Standard statements

[edit]

ThePRINT command divided the screen into regions 14 spaces wide, and the comma was used to move between these locations;PRINT 1,2,3 would output 1, 2 and 3 in a spaced-out fashion,[11] whilePRINT 1;2;3 would leave a single space and produce "1 2 3".[12][b]INPUT allowed a prompt string to be specified, but used the semicolon to separate it rather than the comma;INPUT"WHAT IS THE VALUE";A.[13]

Strings could be delimited by single or double quotes.[14] In addition to theCHR andASCII functions that converted single characters to and from string format,[15] BASIC-PLUS also supported Dartmouth'sCHANGE command.CHANGE iterated the string and returned each character's ASCII value as a slot in a numeric array. For instance,CHANGE 'HELLO' TO X 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.[16] One could reverse the operation as well,CHANGE X TO A$ would read the individual numbers in the X array and convert it to a string.[17]

Statement modifiers

[edit]

BASIC-PLUS added the concept of "statement modifiers",JOSS-like conditions that could be applied to any statement. For instance,PRINTIIFI<>10 is the equivalent ofIFI<>10THENPRINTI[18] The opposite was also provided,PRINTIUNLESSI=10 was the equivalent ofIFI<>10THENPRINTI.[19]

FOR loops worked as in other versions of BASIC, and theNEXT command could not be used in an expression to exit early.[20] Instead, theUNTIL andWHILE keywords could be used to control early exits. For instance,FORI=1UNTILI=10 continue looping until I=10, with the assumption that following code would set the value of I,[21] meaning it might not exit after 10 iterations but as soon as the code set I to 10.[22] Modifiers could also be used to build compact one-line loops, for instance,X=X+1WHILEX<100 would loop until X was 100.[23]

Variables, expressions and matrixes

[edit]

Variable names in the early versions of BASIC-PLUS could be a single letter or a single letter followed by a single digit.[9] 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. Every variable name still had to begin with a letter.[c] As in most versions of BASIC, theLET keyword, for variable assignment, was optional. It could set multiple variables to a single value, likeLETA,B,C=10.[24]

The language supported three data types; floating-point numbers, integers, and strings. Variables with no suffix were floating point (8 bytes, range 0.29×10−38 to 1.7×1038, up to 16 digits of precision). Integer variables (16-bit, range −32768 to +32767) were indicated with a% suffix,[25] string variables (variable length) were indicated with a$ suffix.[14]

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^ forcomputer 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.[26] Logical operators included the typicalNOT A,A AND B andA OR B, along withA XOR B,A EQV B which return true if both A and B are true or both are false, andA IMP B which is false if A is true and B is false and otherwise always true.[27]

TheDIM statement could allocate one-dimensional and two-dimensional arrays of any of the three data types. The range of subscripts always began with 0 (butMAT statements did not set elements in row 0 or column 0).[28][29]

The language also included a number ofMAT commands to work with the entire array (or MATrix). TheMATREAD command would fill the matrix with values in aDATA statement,[30]MATINPUT would fill the array with user-typed values, andMATPRINT would print out the elements in a 1D or 2D format.[31]MAT could also be used to set default values in a matrix using associated keywords, for instance,MAT A=ZER would fill the A array with zeros.[32]TRN would transpose an entire matrix, andINV would invert it.[33] Additionally,+,-, and* could be used on matrixes, performing the associated matrix operation.[34]

File processing

[edit]

TheDIM# "virtual DIM" statement could map "virtual data array(s)" or "virtual array(s)" to a disk file, which allowed arrays larger than the computer's available memory (or even its address space), and allowed use of array elements to read, write, and extend disk files (persistent storage). They called this arrangement "virtual data storage" and "virtual core", but it did not use the modern approach of allocating the arrays and amemory-mapped file. Instead, a single buffer was used to store 512 bytes of data at a time, and when an entry in the virtual array was accessed, the corresponding data was read, and old data written, as required. TheCLOSE statement caused the buffer to be written back (if necessary) before closing the file. Because no additional sectors were cached, accessing data in the "wrong" order could multiply the number of disk accesses. Additional rules were imposed on virtual arrays, such that one datum could never span a record boundary: Each data type was aligned to a multiple of its size. Virtual strings were stored as fixed-length ASCIIZ data, with sizes restricted to 2, 4, 8, 16, 32, 64, 128, 256, or 512 bytes, and were accessed usingLSET andRSET.[35]

Virtual machine

[edit]

BASIC-PLUS was not an interpreter but acompile and go system: each line of BASIC was translated into "PPCODE" (Push-Pop Code) as it was entered, for subsequent fast execution on its virtual machine. These translations did not tokenize the BASIC lines but rewrote them for use on astack machine; you could not translate these representations back to BASIC statements. This avoided the need to repeatedly decode the keywords as strings: once converted to PPCODE the keywords were numbers that pointed to routines to run that function (in other words,threaded code). BASIC-PLUS included aCOMPILE command, but this was not a true compiler; this simply saved the program's PPCODE representation so that it did not have to be recompiled when the BASIC program was next loaded into memory. The system stored a user's program in two formats. One was the editablesource code in text format, created using theSAVE command and normally placed in a .BAS file. The other was the PPCODE version of the program created by theCOMPILE command and saved to a .BAC file; .BAC files were smaller and loaded and ran faster, but could not be edited.[36][37]

BASIC Plus 2

[edit]
Main article:VSI BASIC for OpenVMS

A related product calledBasic Plus 2 ("BP2" orBASIC-Plus-2), was later developed by DEC to add additional features and increased performance.

It used true compilation intothreaded 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.[38] (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 theRSX-11 operating system. BP2 programs were also more compatible with the laterVAX BASIC.

Comparison to MS BASIC

[edit]

Microsoft BASIC was patterned very closely on BASIC-PLUS.[2] Earlier versions of MS BASIC, the 1.x series, lacked integer variables, but these were added in the 2.x series that was found on many machines, including the later models of theCommodore PET andCommodore 64. The ability to place logical and loop commands in-line, likeI = I + 1 UNTIL I = 10 was not copied over and does not appear on any common version of microcomputer BASIC. MS BASIC also lacked the matrix commands.

See also

[edit]

Notes

[edit]
  1. ^In modern terms this would be considered a tokenizer, not a compiler in the current use of the term.
  2. ^The space in front of the numbers was left for a possible minus sign, this was the standard in almost all BASICs
  3. ^Before the introduction of Extend mode, white space was not required between variables and other language elements:FORI=STOP would be interpreted asFORI=STOP.

References

[edit]

Citations

[edit]
  1. ^Bell, C. Gordon; Mudge, J. Craig; McNamara, John N. (1978).Computer Engineering: A DEC View of Hardware Systems Design(PDF).Digital Press.ISBN 0-932376-00-2.
  2. ^abManes, Stephen (1993).Gates. Doubleday. p. 61.ISBN 9780385420754.
  3. ^abAhl 2013.
  4. ^abFleig 1983, p. 52.
  5. ^abcdeDick 1990.
  6. ^abcFleig 1983, p. 53.
  7. ^PLUS 1972, p. 2-1.
  8. ^abPLUS 1972, p. 2-3.
  9. ^abPLUS 1972, p. 2-6.
  10. ^PLUS 1972, p. 3-1.
  11. ^PLUS 1972, p. 3-7.
  12. ^PLUS 1972, p. 3-8.
  13. ^PLUS 1972, p. 3-10.
  14. ^abPLUS 1972, p. 5-2.
  15. ^PLUS 1972, p. 5-12.
  16. ^PLUS 1972, p. 5-5.
  17. ^PLUS 1972, p. 5-7.
  18. ^PLUS 1972, p. 8-17.
  19. ^PLUS 1972, p. 8-18.
  20. ^PLUS 1972, p. 3-19.
  21. ^PLUS 1972, p. 8-14.
  22. ^PLUS 1972, p. 8-15.
  23. ^PLUS 1972, p. 8-20.
  24. ^PLUS 1972, p. 3-3.
  25. ^PLUS 1972, p. 6-1, 6-2.
  26. ^PLUS 1972, p. 2-9.
  27. ^PLUS 1972, p. 2-10.
  28. ^PLUS 1972, p. 3-21.
  29. ^PLUS 1972, p. 5-3.
  30. ^PLUS 1972, p. 7-2.
  31. ^PLUS 1972, p. 7-3.
  32. ^PLUS 1972, p. 7-5.
  33. ^PLUS 1972, p. 7-7.
  34. ^PLUS 1972, p. A-1.
  35. ^PLUS 1972, p. 9-17.
  36. ^"BASIC-PLUS inline operators, do they actually make sense?". Retrieved2020-08-05.
  37. ^Gary Luckenbaugh."Internals of BASIC-PLUS".2024-04-02.
  38. ^BASIC V2 Reference Manual(PDF). Maynard, Massachusetts: Digital Equipment Corporation. 1991.

Bibliography

[edit]
  • BASIC-PLUS Language Manual (PDF). Maynard, Massachusetts: Digital Equipment Corporation. 1972.
  • Ahl, David; Ahl, Betsy (3–4 April 2013)."Dave Ahl and Betsy Ahl" (Interview). Interviewed by Kevin Savetz. ANTIC: The Atari 8-Bit Podcast.
  • Fleig, Clare (March 1983). "Evans, Griffiths & Hart Prospers Under RSTS/E".Hardcopy.
  • Dick, Peter (1990).RSTS 80th Birthday. DECUS USA RSTS SIG.
Dialects of theBASIC programming language (list)
Classic
Microsoft
Texas Instruments
Hewlett-Packard
Locomotive Software
Microcomputers
Minicomputers
Time-sharing computers
Other
Extenders
Procedure-
oriented
Proprietary
Free and
open source
Withobject
extensions
Proprietary
Free and
open source
RAD
designers
Proprietary
Free and
open source
Defunct
Authority control databases: NationalEdit this at Wikidata
Retrieved from "https://en.wikipedia.org/w/index.php?title=BASIC-PLUS&oldid=1333767087"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp