SCELBAL

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

SCELBAL, short for SCientific ELementary BAsic Language, is a version of the BASIC programming language released in 1976 for the SCELBI and other early Intel 8008 and 8080-based microcomputers like the Mark-8. Later add-ons to the language included a extended math package and string handling. The original version required 8 kB of RAM, while the additions demanded 16 kB.

The language was published in book form, with introductory sections followed by flowcharts and then the 8008 assembler code. The book described ways to save more memory, turning off arrays for instance, and how to add new features by the user.

History[edit]

The primary author of SCELBAL is Mark Arnold, who was a high-school student in 1974 when the SCELBI was announced. Arnold was friends with professors at the University of Wyoming (UW), and through them had arranged to have an account on their Sigma 7 mainframe computer. The first version of what became SCELBAL was written for this machine. Later that year, he wrote an 8008 cross compiler on that platform.

Arnold entered UW in 1975 and contacted Nat Wadsworth, one of the founders of SCELBI, pitching the idea of a compiled version of BASIC for their new platform. This would be a multi-pass system that would save the intermediate versions on cassette tape. This would be very tedious to use but would produce programs that would run on the 4 kB 8H models of the system. Wadsworth favored an interpreter, which would require 8 kB, which would be available on the new 8B models of the system.

It took Wadsworth several months to finally arrange a contract, which included sending Arnold an 8B development system. This significantly delayed the release of the language into 1976. Arnold speculated that, lacking these delays, SCELBAL would have been released at about the same time as Altair BASIC.

SCLEBAL was announced in an advertisement in Byte's June 1976 issue. The ad did not specifically link the language to the SCELBI platform, instead, it simply offered itself in book form as a complete source listing to create a version of BASIC on any 8008 or 8080 system with the requisite 8 kB of RAM. The book's price was $49, about $216 in 2018.[1]

Description[edit]

SCELBAL used a 32-bit (four byte) floating point format for numeric calculations, with a 23-bit mantissa, 1-bit sign for the mantissa, a 7-bit exponent, and 1-bit sign for the exponent. These were organized in reverse order, with the least significant byte of the mantissa in the first byte, followed by the middle and then most significant byte with the sign in the high bit. The exponent came last, again with the sign in the high bit.[2] The manual provides well-documented assembly code for the entire math package, including entry points and usage notes.[3] 32-bit formats were common in this era, while later versions of BASIC, starting with Microsoft BASIC for the MOS 6502, generally adopted a 40-bit (five byte) format for added precision.[4]

SCELBAL was otherwise similar to other BASIC dialects, including early MS versions like Altair BASIC, lacking string variables and operators and a number of mathematic functions. Other differences were less pronounced. The IF statement had an optional form IF...GOTO that removed the need for THEN and allowed a somewhat more compact syntax, IF X<Y GOTO 100.[5] Oddly, it also retained the MS-style short form for the same action, removing the GOTO, IF X<Y THEN 100. SCELBAL did, however, allow the use of variables for lines, allowing you to, for instance, IF X<>5 THEN LL, which would jump to the line in variable LL.[6]

The base language did not support string handling, although literal (constant) strings could be used in PRINT, and had the supporting functions of CHR to print non-printable characters, and TAB to provide layout. Oddly, the system required ASCII codes to have the high-bit set, so to convert from normal ASCII to SCELBI character codes, one had to add or subtract 127. For instance, PRINT "HELLO";CHR(171);CHR(159);"WORLD" to produce the string "HELLO, WORLD" in the output.[7]

INPUT would normally read the user-entered text as a number, but allowed the dollar sign to indicate the value should be read as the SCELBI code instead. For instance, INPUT A would read the user input "1" into A as the floating-point value 1, while INPUT A$ would result in A being set to 176, 49 (ASCII for "1") + 127. Additionally, when the dollar sign is used, the traditional "?" prompt is not printed, and command returned to the language as soon as a single character is entered, instead of waiting for the carriage return as in the normal case.[7]

Among the few other differences was that the NEW command found in MS, which clears out existing program code and data, is called SCR for "scratch",[8] and the USR function, which called a machine language routine, was UDF for "user defined function".[9] USR did not accept an address or parameters, only a single user-defined function at a fixed location was supported. Another oddity is that the STEP in FOR loops required the step value to be inside parens.[10]

Error codes were reduced to two letters, and code for LOAD and SAVE were provided in boilerplate form and expected to be implemented when ported to different platforms.[11] Line numbers could be between 1 and 999999,[9] whereas most BASICs used a 16-bit integer and thus supported lines from 1 to 32767 or 1 to 65535.

Language features[edit]

Taken from the 1976 manual unless otherwise noted.[12]

Commands[edit]

Immediate-mode only[edit]

Referred to as "executive" mode in the documentation.

SCR scratch, equivalent to MS NEW
LIST
RUN
LOAD
SAVE

Immediate or program mode[edit]

PRINT
INPUT Like MS, could accept multiple variables, INPUT A,B,C. Did not include a prompt string.
LET Like MS, the LET was optional, so 15 LET X=10 and 15 X=10 are equivalent.
IF...THEN
IF...GOTO Alternate form of IF...THEN.
GOTO It appears the "spaced version, GO TO, was not supported.
GOSUB...RETURN
FOR...TO...STEP...NEXT As in MS, STEP is optional and assumed to be 1. NEXT required a variable, unlike later MS versions.
REM
END
DIM Arrays worked as in MS, but were optional and could be turned off to save memory. Only single-dimension arrays were supported, and the total number of elements for all arrays combined was 64 numbers.

Functions[edit]

INT
SGN
ABS
SQR
RND As in MS, takes a dummy variable and returns a value between 0 and 1.
CHR Note the lack of the $ found in MS, which uses CHR$.
TAB
UDF

Extensions[edit]

SCHELBI published two extensions to the system, the Mathematical Functions Supplement, and the Strings Supplement.

Math Functions Supplement[edit]

The Mathematical Functions Supplement added five new transcendental functions, SIN, COS, EXP, LOG, and ATN.[13]

String Supplement[edit]

The String Supplement was somewhat larger than the Math Functions, including a number of new features.

Strings could be up to 80 characters long, and the system could hold a total of 64 string variables. Any one of those 64, or all of them, could be one-dimensional arrays, but the total number still had to be 64 strings in total. Oddly, string arrays did not require a DIM statement.[14]

In contrast to MS BASIC, and the Dartmouth BASIC string handling that inspired it, SCELBI used the "slicing" style of string manipulation found in contemporary BASICs like HP Time-Shared BASIC and Northstar BASIC, or the later Atari BASIC. Instead of using functions like LEFT$, RIGHT$, MID$ to access substrings, the array-access syntax was used with colons separating the starting point and length. As SCELBAL also supported string arrays, the first number in the array accessors was the array index, and was optional if the variable was not an array. So, for instance, the code:[14]

10 LET A$="HELLO"
20 PRINT A$(:2:3)

would result in "ELL" being printed to the output. If an array was used the syntax required the array index in the first parameter:[14]

100 LET A$(1)="HELLO"
150 LET A$(2)="WORLD"
200 PRINT A$(2:2:3)

would result in "ORL" being printed to the output.

There is a major difference in the way this works in comparison to the other BASICs that used slicing syntax, in that the last parameter is the length, not a position. For instance, in Atari BASIC the similar-looking code:[15]

20 PRINT A$(2,3)

Would instead output "EL", as the instruction translates to "print all characters between positions 2 and 3". In this fashion, SCELBAL works in a fashion more similar to MS BASIC, where the equivalent would be:[16]

20 PRINT MID$(A$,2,3)

To add full support for strings, the Supplement replaced the original CHR with CHR$, which matched the syntax of its MS counterpart.[14] Likewise, INPUT was modified so string variables worked like numeric ones, waiting for the carriage return and then assigning the entire user input to the associated string variable.[17] It also added the support functions LEN and ASC,[14] and VAL$ to convert a string containing a numeric value to a string representation of that number. As in MS, concatenation used the + operator.{{sfn|Strings|1977|p=2}

References[edit]

Citations[edit]

  1. ^ "Shocking!". Byte. June 1976. p. 47.
  2. ^ Arnold & Wadsworth 1976, p. 10.1.
  3. ^ Arnold & Wadsworth 1976, p. 10.
  4. ^ Steil, Michael (20 October 2008). "Create your own Version of Microsoft BASIC for 6502".
  5. ^ Arnold & Wadsworth 1976, p. 14.10.
  6. ^ Arnold & Wadsworth 1976, p. 2.3.
  7. ^ a b Arnold & Wadsworth 1976, p. 14.16.
  8. ^ Arnold & Wadsworth 1976, p. 14.1.
  9. ^ a b Arnold & Wadsworth 1976, p. 14.17.
  10. ^ Arnold & Wadsworth 1976, p. 14.3.
  11. ^ Arnold & Wadsworth 1976, p. 14.18.
  12. ^ Arnold & Wadsworth 1976.
  13. ^ Math 1977, p. 1.
  14. ^ a b c d e Strings 1977, p. 1.
  15. ^ Small, David, ed. (1983). "Atari Strings and Text Handling". The Creative Atari. Creative Computing.
  16. ^ Strings 1977, p. 3.
  17. ^ Strings 1977, p. 2.

Bibliography[edit]

  • Arnold, Mark; Wadsworth, Nat (1976). SCELBAL: A higher level language for 8008/8080 systems (PDF). SCELBI Computer Consulting.
  • Arnold, Mark (1977). SCELBAL Mathematical Functions Supplement. SCELBI Computer Consulting.
  • Arnold, Mark (1977). SCELBAL Strings Supplement. SCELBI Computer Consulting.