SuperBASIC
Template:Short description Template:About {{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1 | unknown = Template:Main other | preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y | AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid }}Template:Main other SuperBASIC is an advanced variant of the BASIC programming language with many structured programming additions. It was developed at Sinclair Research by Jan Jones during the early 1980s.
Originally SuperBASIC was intended as the BASIC interpreter for a home computer code-named SuperSpectrum, then under development. This project was later cancelled; however, SuperBASIC was subsequently included in the ROM firmware of the Sinclair QL microcomputer (announced in January 1984), also serving as the command line interpreter for the QL's QDOS operating system.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
It was one of the first second-generation BASICs to be integrated into a microcomputer's operating system (unlike BBC BASIC which preceded it in 1981), making the OS user-extendable—as done by Linus Torvalds in his formative years.
ReceptionEdit
BYTE in September 1984 approved of SuperBASIC's improvements over Sinclair BASIC but criticized its "very, very slow" performance on the Byte Sieve, writing that "With a 7.5-MHz 68008, you'd think it would take some effort to get a language to run that slowly". The magazine also noted that SuperBASIC's seven-digit precision made it unsuitable for business use ("you can represent numbers far larger than the number of quarks in the universe, but not the pennies on your balance sheet if your turnover exceeds £99,000").<ref name="pountain198409">Template:Cite magazine</ref>
Advanced featuresEdit
- RESPR for resident procedures, e.g. to extend QDOS
- choice of parameters passed to procedures
- procedures return parameters as chosen
IF
-THEN
-ELSE
-END IF
FOR
-NEXT
-EXIT
-END FOR
REPeat
-NEXT
-EXIT
-END REPeat
SELect ON
-ON
-REMAINDER
-END SELect
- arbitrarily
RETurn
from within procedures & functions - data type coercion between numeric and string variables
- actual parameters passing data type to formal parameters
- array operations: slicing, joining etc.
LOCal
arrays & (string) variablesAUTOmatic
line numbering- relative
RESTORE
&DATA
The function below illustrates the last eight of these features. After having RUN
it, entering
PRINT weekdays$(Iso("19631122",1))
will print FRI to the screen. Until cleared (e.g. by entering NEW
), the function Template:Mono<ref>gopher://sdf.org/0/users/retroburrowers/TemporalRetrology/QL/JG</ref> will act like an extension to the operating system. Similarly, according to the QL User Guide, "many of the operating system commands are themselves defined as procedures."<ref>Template:Cite book</ref>
ExampleEdit
AUTO 11,2 DEFine FN Iso(S,O) LOCal y%,m%,d%,i$,n%,w% REM Step 0 - to isolate components of date-stamp S="YEARMoDa" LET y%=S(1TO 4) : m%=S(5TO 6) : d%=S(7TO 8) REM Step 1 - to initiate Lachman's Congruence<ref>Template:Citation</ref> LET i$=m%*2.56+ 193 : S=S(1TO 6)- 3 REM Step 2 - to compute the day-number within the week LET w%=(S(1TO 2)&"32"DIV 16+ S(1TO 4)DIV 4+ y%+ i$(2TO 3)+ d%)MOD 7 REM Step 3 - to return result SELect ON O ON O= 5 : n%=i$(2TO 3) ON O= 4 : n%=y% ON O= 3 : n%=m% ON O= 2 : n%=d% ON O= 1 : n%=w% ON O= REMAINDER : n%=-1 END SELect RETurn n% REM data statements DIM weekdays$(6,3) RESTORE 190 FOR count=0 TO 6 : READ weekdays$(count)
Template:Keypress <syntaxhighlight lang="basic">
100 DIM month$(12,9) 110 RESTORE 120 REM QL User Guide's "Data Read Restore" example ii 130 REM appropriately amended relative to example i 140 FOR count=1 TO 12 : READ month$(count) 150 DATA "January","February","March" 160 DATA "April","May","June" 170 DATA "July","August","September" 180 DATA "October","November","December" 190 DATA "SUN","MON","TUE","WED","THU","FRI","SAT" 199 END DEFine Iso
</syntaxhighlight>
BibliographyEdit
- Donald Alcock: Illustrating Superbasic on the Sinclair QL. Cambridge University Press, 1985. Template:ISBN
- Roy Atherton: Good Programming with QL Superbasic. Longman Software, 1984. Template:ISBN
- A. A. Berk: QL SuperBasic. Granada Publishing, 1984. Template:ISBN
- {{#invoke:citation/CS1|citation
|CitationClass=web }}
- Jan Jones: QL SuperBasic: The Definitive Handbook. McGraw-Hill, 1984 Template:ISBN (e-book reissue 2014)
- Dick Meadows, Robin Bradbeer, Nigel Searle: Introduction to Superbasic on the Sinclair QL. Hutchinson Computer Publishing, 1984. Template:ISBN
- Dick Meadows, Robin Bradbeer, Nigel Searle: Making the Most of the Sinclair QL: QL Superbasic and Its Applications. Hutchinson Computer Publishing, 1985. Template:ISBN
- Andrew Nelson: Exploring the Sinclair QL: An Introduction to SuperBasic. Interface Publications, 1984. Template:ISBN
- John K. Wilson: QL Superbasic: A Programmer's Guide. Micro Press, 1984. Template:ISBN
ReferencesEdit
<references/>
External linksEdit
- The Quantum Leap - to where?: a chapter from Sinclair and the 'Sunrise' Technology