Southampton BASIC System
From Seo Wiki - Search Engine Optimization and Programming Languages
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.
In common with many early implementations of BASIC, SOBS needed lines to have line numbers, both to allow a user to add new lines to the program in the desired place and also as targets for
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.
The language had relatively few statements by comparison with modern programming languages:
| || Stored data for |
| ||Dimension an array. One-, two- and three-dimensional arrays were supported.|
| ||Halt execution of the program.|
| ||Perform a set of statements repeatedly for varying values of var|
| || Call a subroutine at a given line number; flow would return to the next statement when a |
| ||Unconditional branch to a given line number.|
| || Conditionally branch. The |
| ||Prompt the user for input data|
| || Assign a value to a variable. Unlike many modern dialects of BASIC, |
| || Perform the next iteration of a |
| ||Output to the teletype|
| || Read data from |
| || Short for |
| || Reset the |
| || Return to the line following a |
Note in particular the lack of a
FOR was the only looping construct available to programmers.
Variable 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 (
A limited number of numeric functions were provided, all of which took one numeric parameter:
| ||<math>\sin x</math>|
| ||<math>\cos x</math>|
| ||<math>\arctan x</math>|
| ||<math>\log x</math>|
| ||The largest integer not greater than <math>x</math>|
| ||−1, 0, or 1, depending on whether <math>x</math> was less than, equal to, or greater than zero|
| ||<math>-x</math> if <math>x</math> was negative, otherwise <math>x</math>|
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, so
10 LET A£ = "FOO" 20 PRINT A£[2,3]
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£
Support for handling arrays of data was relatively strong, with
MAT statements able to read an entire array from
DATA statements, and perform useful matrix operations such as matrix addition, matrix subtraction, matrix multiplication, and finding the inverse matrix for a square matrix.
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,
1 & 1 & 2 \\ 1 & 0 & 2 \\ 0 & 2 & 1
0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0
2 & 1 & 1 \\ 2 & 0 & 1 \\ 1 & 2 & 0
2 & 2 & 1 \\ 1 & -1 & 0 \\ 4 & -3 & -2
The output would be
2 2 1 1 -1 0 4 -3 -2
|File:Wiki letter w.svg||This section requires expansion.|
SOBS had primitive debugging capabilities, limited mostly to the
TRACE ON would cause the interpreter to print each line number as it was executed.
- ↑ Rees, M.J.; Oppenheimer, A.W. (21 January 1977). "SOBS - an incremental BASIC system". Software. Wiley InterScience. doi:10.1002/spe.4380070508. http://www3.interscience.wiley.com/journal/113444749/abstract?CRETRY=1&SRETRY=0. Retrieved 18 May 2009.