Southampton BASIC System
Encyclopedia
Southampton BASIC System (SOBS) was a dialect of the BASIC
programming language developed for and used on ICT 1900 series
computers in the late 60s and early 70s; it was implemented under the MINIMOP
operating system at the University of Southampton
.
It was operated from a Teletype
terminal.
s, both to allow a user to add new lines to the program in the desired place and also as targets for
Other than line numbers, all numeric values were represented internally as floating point
.
Note in particular the lack of a
names for numeric values were either a single letter, or a single letter followed by a single numeric digit, thus allowing for 286 discreet variables in total. Strings were supported; variable names for them had the same restriction but were followed by a pound (
Support for strings was more limited, with only one function,
10 LET A£ = "FOO"
20 PRINT A£[2,3]
would print
This syntax was also supported on the left-hand side of an assignment, so
10 LET A£ = "FOO"
20 LET A£[2,2] = "BAR"
30 PRINT A£
would print
operations such as matrix addition
, matrix subtraction, matrix multiplication
, and finding the inverse matrix for a square matrix.
Example:
10 DIM A(3,3)
20 MAT READ A
30 DATA 1,1,2,1,0,2,0,2,1
40 DIM B(3,3)
50 MAT READ B
60 DATA 0,0,1,0,1,0,1,0,0
70 DIM C(3,3),D(3,3)
80 MAT C=A*B
90 MAT D=INV(C)
100 MAT PRINT D,
The output would be
2 2 1
1 -1 0
4 -3 -2
BASIC
BASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code....
programming language developed for and used on ICT 1900 series
ICT 1900 series
ICT 1900 was the name given to a series of mainframe computers released by International Computers and Tabulators and later International Computers Limited during the 1960s and '70s...
computers in the late 60s and early 70s; it was implemented under the MINIMOP
MINIMOP
MINIMOP was an operating system which ran on the International Computers Limited 1900 series of computers. MINIMOP provided an on-line, time-sharing environment . Batch facilities could be provided by simultaneously running George 2 on the same machine...
operating system at the University of Southampton
University of Southampton
The University of Southampton is a British public university located in the city of Southampton, England, a member of the Russell Group. The origins of the university can be dated back to the founding of the Hartley Institution in 1862 by Henry Robertson Hartley. In 1902, the Institution developed...
.
It was operated from a Teletype
Teletype Corporation
The Teletype Corporation, a part of American Telephone and Telegraph Company's Western Electric manufacturing arm since 1930, came into being in 1928 when the Morkrum-Kleinschmidt Company changed its name to the name of its trademark equipment...
terminal.
Language characteristics
In common with many early implementations of BASIC, SOBS needed lines to have line numberLine number
In computing, a line number is a method used to specify a particular sequence of characters in a text file. The most common method of assigning numbers to lines is to assign every line a unique number, starting at 1 for the first line, and incrementing by 1 for each successive line.In the C...
s, both to allow a user to add new lines to the program in the desired place and also as targets for
GOTO
and GOSUB
statements. A RENUMBER
facility was available to allow for sections of the code to be renumbered, by default in increments of 10, to allow more space in the middle of a program.Other than line numbers, all numeric values were represented internally as floating point
Floating point
In computing, floating point describes a method of representing real numbers in a way that can support a wide range of values. Numbers are, in general, represented approximately to a fixed number of significant digits and scaled using an exponent. The base for the scaling is normally 2, 10 or 16...
.
Statements
The language had relatively few statements by comparison with modern programming languages:Statement | Purpose |
---|---|
DATA |
Stored data for READ ing into variables at runtime |
DIM var(size)... |
Dimension an array. One-, two- and three-dimensional arrays were supported. |
END |
Halt execution of the program. |
FOR var=start TO end [STEP incr] |
Perform a set of statements repeatedly for varying values of var |
GOSUB line |
Call a subroutine at a given line number; flow would return to the next statement when a RETURN was executed. |
GOTO line |
Unconditional branch to a given line number. |
IF expr THEN line [ELSE line] |
Conditionally branch. The THEN and ELSE parts could only give line numbers to go to. |
INPUT var |
Prompt the user for input data |
LET var=expr |
Assign a value to a variable. Unlike many modern dialects of BASIC, LET was not an optional word. |
NEXT var |
Perform the next iteration of a FOR loop. |
PRINT |
Output to the Teletype |
READ var... |
Read data from DATA statements into variables |
REM |
Short for REM ark, this allowed for a comment to be placed on a line |
RESTORE [line] |
Reset the READ pointer in order to re-read DATA |
RETURN |
Return to the line following a GOSUB . |
Note in particular the lack of a
WHILE
-like statement; FOR
was the only looping construct available to programmers.Variables
VariableVariable (programming)
In computer programming, a variable is a symbolic name given to some known or unknown quantity or information, for the purpose of allowing the name to be used independently of the information it represents...
names for numeric values were either a single letter, or a single letter followed by a single numeric digit, thus allowing for 286 discreet variables in total. Strings were supported; variable names for them had the same restriction but were followed by a pound (
£
) symbol.Functions
A limited number of numeric functions were provided, all of which took one numeric parameter:Function | Function() returned |
---|---|
SIN |
|
COS |
|
ATN |
|
SQR |
|
LOG |
|
EXP |
|
INT |
The largest integer not greater than |
SGN |
−1, 0, or 1, depending on whether was less than, equal to, or greater than zero |
ABS |
if was negative, otherwise |
Support for strings was more limited, with only one function,
LEN
, which returned the length of the string parameter. Sub-strings were supported with square brackets, so A£[2,3]
referred to the sub-string of the string A£
from the 2nd character to the 3rd character inclusive, so10 LET A£ = "FOO"
20 PRINT A£[2,3]
would print
OO
This syntax was also supported on the left-hand side of an assignment, so
10 LET A£ = "FOO"
20 LET A£[2,2] = "BAR"
30 PRINT A£
would print
FBARO
Arrays
Support for handling arrays of data was relatively strong, withMAT
statements able to read an entire array from DATA
statements, and perform useful matrixMatrix (mathematics)
In mathematics, a matrix is a rectangular array of numbers, symbols, or expressions. The individual items in a matrix are called its elements or entries. An example of a matrix with six elements isMatrices of the same size can be added or subtracted element by element...
operations such as matrix addition
Matrix addition
In mathematics, matrix addition is the operation of adding two matrices by adding the corresponding entries together. However, there are other operations which could also be considered as a kind of addition for matrices, the direct sum and the Kronecker sum....
, matrix subtraction, matrix multiplication
Matrix multiplication
In mathematics, matrix multiplication is a binary operation that takes a pair of matrices, and produces another matrix. If A is an n-by-m matrix and B is an m-by-p matrix, the result AB of their multiplication is an n-by-p matrix defined only if the number of columns m of the left matrix A is the...
, and finding the inverse matrix for a square matrix.
Example:
10 DIM A(3,3)
20 MAT READ A
30 DATA 1,1,2,1,0,2,0,2,1
40 DIM B(3,3)
50 MAT READ B
60 DATA 0,0,1,0,1,0,1,0,0
70 DIM C(3,3),D(3,3)
80 MAT C=A*B
90 MAT D=INV(C)
100 MAT PRINT D,
A is read from the first DATA statement |
|
B is read from the second DATA statement |
|
C is calculated by multiplying A and B |
|
D is calculated as the inverse of C |
The output would be
2 2 1
1 -1 0
4 -3 -2
Debugging
SOBS had primitive debugging capabilities, limited mostly to theTRACE
statement. TRACE ON
would cause the interpreter to print each line number as it was executed.