SDS BASIC
   HOME

TheInfoList



OR:

SDS BASIC, also known as CP-V BASIC, Batch BASIC or Sigma BASIC depending on the version, is a
BASIC programming language Basic or BASIC may refer to: Science and technology * BASIC, a computer programming language * Basic (chemistry), having the properties of a base * Basic access authentication, in HTTP Entertainment * ''Basic'' (film), a 2003 film * Basic, on ...
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
for
Scientific Data Systems Scientific Data Systems (SDS), was an American computer company founded in September 1961 by Max Palevsky, Arthur Rock and Robert Beck, veterans of Packard Bell Corporation and Bendix, along with eleven other computer scientists. SDS was the f ...
's (SDS) Sigma series
mainframe A mainframe computer, informally called a mainframe or big iron, is a computer used primarily by large organizations for critical applications like bulk data processing for tasks such as censuses, industry and consumer statistics, enterpris ...
computers, originally released in 1967.
Xerox Xerox Holdings Corporation (, ) is an American corporation that sells print and electronic document, digital document products and services in more than 160 countries. Xerox was the pioneer of the photocopier market, beginning with the introduc ...
purchased SDS in 1969 and began rebranding it as Xerox Data Systems, and finally just Xerox, at which time the language became known as Xerox BASIC. The original versions did not include support for string variables, although this was added for the version running under the
CP-V operating system The Universal Time-Sharing System (UTS) is a discontinued operating system for the XDS Sigma series of computers, succeeding Batch Processing Monitor (BPM)/Batch Time-Sharing Monitor (BTM). UTS was announced in 1966, but because of delays did no ...
when it was released in 1971. The string library allowed manipulation of strings using
array slicing In computer programming, array slicing is an operation that extracts a subset of elements from an array and packages them as another array, possibly in a different dimension from the original. Common examples of array slicing are extracting a ...
syntax, similar to the system found in
HP Time-Shared BASIC HP Time-Shared BASIC (HP TSB) is a BASIC, BASIC programming language Interpreter (computing), interpreter for Hewlett-Packard's HP 2100#HP 2000, HP 2000 line of minicomputer-based time-sharing computer systems. TSB is historically notable as th ...
and a number of
microcomputer A microcomputer is a small, relatively inexpensive computer having a central processing unit (CPU) made out of a microprocessor. The computer also includes memory and input/output (I/O) circuitry together mounted on a printed circuit board (P ...
BASICs like
Integer BASIC Integer BASIC is a BASIC interpreter written by Steve Wozniak for the Apple I and Apple II computers. Originally available on Cassette tape, cassette for the Apple I in 1976, then included in Read-only memory, ROM on the Apple II from its release ...
and
Atari BASIC Atari BASIC is an interpreter for the BASIC programming language that shipped with Atari 8-bit computers. Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC and differs in significant way ...
. This style of string manipulation differs from the model introduced in DEC's
BASIC-PLUS BASIC-PLUS is an extended dialect of the BASIC programming language that was 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 thro ...
, which used string functions.
Altair BASIC Altair BASIC is a discontinued interpreter for the BASIC programming language that ran on the MITS Altair 8800 and subsequent S-100 bus computers. It was Microsoft's first product (as Micro-Soft), distributed by MITS under a contract. Altair B ...
was patterned on BASIC-PLUS, and this style became the ''de facto'' standard after the cross-platform version,
Microsoft BASIC Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first v ...
, became almost universal during the
home computer Home computers were a class of microcomputers that entered the market in 1977 and became common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a s ...
era. This makes conversion from SDS to modern dialects somewhat difficult. SDS BASIC is historically notable as the platform on which the original ''Star Trek''
computer game A video game or computer game is an electronic game that involves interaction with a user interface or input device (such as a joystick, controller, keyboard, or motion sensing device) to generate visual feedback from a display device, mo ...
was written in the summer of 1971.


Syntax

In keeping with the original
Dartmouth BASIC Dartmouth BASIC is the original version of the BASIC programming language. It was designed by two professors at Dartmouth College, John G. Kemeny and Thomas E. Kurtz. With the underlying Dartmouth Time-Sharing System (DTSS), it offered an interac ...
model, and in common with most
mainframe A mainframe computer, informally called a mainframe or big iron, is a computer used primarily by large organizations for critical applications like bulk data processing for tasks such as censuses, industry and consumer statistics, enterpris ...
-based BASICs, SDS BASIC was a compiler, not an interpreter, and used separate but tightly integrated tools for editing and running. The editor was dedicated to BASIC; as lines are entered they are analyzed for correct syntax and then stored in tokenized form. If a line is entered with a number at the start, it is placed into the appropriate location in the program based on the number, lines without numbers were immediately processed and then forgotten. SDS allowed line numbers in the range 1 to 99999. A simple example is: 10 PRINT "HELLO WORLD" Like many versions of BASIC, SDS allowed a single line of code to contain multiple statements. In most dialects this is indicated using the colon, but SDS used either the backslash, or ampersand, . An equivalent line in SDS would be: 10 PRINT "HELLO" \ PRINT "WORLD" Because SDS was a compiler, and the user's
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
was stored separately, it preserved leading spaces in the code. They suggested using this to more clearly indicate the structure of loops: 10 LET J=0, K=1 20 FOR I=K TO 8 30 PRINT J 40 M=J, J=K, K=K+1 50 NEXT I This example also includes the ability to set multiple values in a single LET statement, as seen in lines 10 and 40. This feature was also found in HP BASIC. As in most versions of BASIC, the keyword is optional, and is left out of line 40. Line 40 also illustrates the alternate form of assignment seen in a number of early BASICs, where multiple assignments can be separated with commas. Common mathematical operations included , , and , using or for exponents. Logical comparisons, like HP, could be written in any order, so was equivalent to , and was the same as . Most dialects only allow the later syntax in both cases. Unlike HP BASIC, SDS did not include the ability to use the hash, , as an alternate form of . SDS supported computed GOTO using ON, but also allowed the alternate syntax with the ON at the end of the line instead of the front: GOTO 140,160,180 ON Y An alternate form of REM was a leading star, , similar in purpose to the short-form found in MS-derived BASICs, the single quote, .


String handling

The early versions of SDS BASIC, sometimes known as Batch BASIC or BTM BASIC, did not support string variables. However, string values could be assigned to numeric variables which could store six characters as their
EBCDIC Extended Binary Coded Decimal Interchange Code (EBCDIC; ) is an eight- bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems. It descended from the code used with punched cards and the corresponding si ...
numeric values. The later CP-V BASIC added true string variables containing up to 132 characters that could be indicated with a trailing dollar sign, , or uncommonly, a leading $ — and are equivalent. The manual notes that the latter format was added for compatibility with A00 BASIC. Internally, CP-V used a fixed-length string layout consisting of an array of bytes that could not be changed in size at runtime. This was similar to the other BASICs that used slicing notation, like HP and Atari. It contrasts with the DEC/Microsoft style, where strings were dynamically allocated on a heap. Unlike the other fixed-length BASIC dialects, string variables did not have to be DIMmed prior to use, instead, all strings defaulted to a maximum length of 72 characters. This was a global setting that could be changed to better manage memory by setting it to a smaller value, or allow longer strings up to a maximum of 132 characters. This was accomplished using . Confusingly, SET was also used for the entirely unrelated task of allowing variables to be used in DIM statements. Because strings in CP-V did not present themselves publicly as arrays of characters, the slicing syntax was not based on array syntax. This meant CP-V also allowed the construction of arrays of strings, something dialects like HP and Atari lacked because they used array notation for slicing. One could thus make a matrix of strings using DIM: 10 DIM A$(5,10) would define a matrix containing a total of 50 72-character strings in a 5 by 10 matrix. Because the system supported arrays, slicing syntax was somewhat more complex than the system found in other versions. Examples include: A$(1) selects the first string in an array of strings, while: A$(1,5) selects a string from location 1,5 in a 2D array (matrix). Slicing was handled by adding a colon within the parens: A$(:4) returned everything from the 4th character on: A$(:4,5) selects five characters starting with the 4th character, while: A$(1,5:4,5) selects five characters starting with the 4th character of the string in locations 1,5 in a 2D array. String constants could be delimited with either single or double quotes, making it easier to enclose quotes within lines. Valid examples include: PRINT 'THIS IS A STRING LITERAL' PRINT "THIS IS ANOTHER ONE" PRINT 'AND THIS IS "A THIRD"' PRINT "AND 'A FOURTH'" CP-V also includes the CHANGE command from Dartmouth BASIC, which converts a string into a series of
EBCDIC Extended Binary Coded Decimal Interchange Code (EBCDIC; ) is an eight- bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems. It descended from the code used with punched cards and the corresponding si ...
numeric values and places them into a numeric array: 10 DIM B(6) 20 CHANGE "ABCDEF" TO B B will now contain a series of numbers corresponding to the EBCDIC values for each character.


Input/output

SDS included a robust system for input/output based on "stream" numbers that could be specified in PRINT and INPUT statements. For instance, data could be read from a file using: 10 OPEN 'FILE1' TO :1,INPUT 20 INPUT :1,A The first line opens a disk file with the name "FILE1", assigns it to stream 1, and indicates it will be used for input. The second line reads the next data from stream 1, in this case the first value, and assigns the resulting data to variable A. The system also included a unique "key" system that allowed data to be numbered and then accessed randomly. This was accomplished by adding the key number after a semicolon: INPUT :1;9999,A will attempt to read record 9999. Valid keys were in the range .001 to 9999.999, and if no keys were assigned in the files, lines were assigned numbers 1.000, 2.000, etc. The highest-valued key in a file could read using: KEY(1) where the 1 is the stream number. Unstructured binary data could be read and written byte-at-a-time using GET and PUT.


MAT commands

Later versions of Dartmouth BASIC included a suite of MAT commands that allowed operations on entire arrays (
matrices Matrix (: matrices or matrixes) or MATRIX may refer to: Science and mathematics * Matrix (mathematics), a rectangular array of numbers, symbols or expressions * Matrix (logic), part of a formula in prenex normal form * Matrix (biology), the ...
) with a single statement. These were also available in SDS BASIC. In their simplest form, the MAT is used like an alternate form of LET, applying an expression to all the elements in an array. For instance: 100 DIM A(20),B(20) ... 200 MAT A=A+B Will add the value of every value in B to every entry in A, in the same fashion as: 100 DIM A(20),B(20) ... 200 FOR I=1 TO 20 210 A(I)=A(I)+B(I) 220 NEXT I As well as making the code shorter and more obvious, these commands also have the advantage of being highly optimized, easily outperforming the use of FOR/NEXT. Additional functions and statements modify PRINT and INPUT, invert arrays, and build identity matrixes and such in a single statement.


Notes


References


Citations


Bibliography

* * , Part No. 22687-90001 {{BASIC BASIC compilers BASIC programming language BASIC programming language family