Sinclair BASIC
Encyclopedia
Sinclair BASIC is a dialect of the BASIC programming language
used in the 8-bit
home computer
s from Sinclair Research and Timex Sinclair
. The Sinclair BASIC interpreter
was made by Nine Tiles Networks Ltd.
Originally developed in 1979 to fit in the 4 kB
ROM
of the ZX80
, it was initially an incomplete implementation of the 1978 ANSI
minimal BASIC standard and evolved through the 8 kB ROM ZX81
and TS1000
to be an almost complete version in the 16 kB ROM ZX Spectrum
.
Commands found exclusively on the ZX81 and its clones, the TS1000 and TS1500 are:
On the ZX Spectrum each reserved word was assigned a character code between 165 and 255 in the latter half of the system character set, and expanded by referencing a token table held in ROM. As a result, any reserved word in a program listing occupied just one byte of memory, a significant saving over traditional letter-by-letter storage. This also meant that the BASIC interpreter could quickly determine any command or function by evaluating a single byte.
The 128k Spectrum models—the ZX Spectrum 128, +2, +3, +2A, and +2B—introduced a conventional letter-by-letter BASIC input system, and two new commands, neither of which was present in or recognised by the machine's legacy version of 48k BASIC:
The original Spanish ZX Spectrum 128 included four additional commands in Spanish, one of which was undocumented. These can be translated as:
, but not the TC2048
, which used the ordinary Sinclair BASIC, has the following six keywords as well as the ordinary Sinclair BASIC ones:
Timex of Portugal released a software extension called BASIC64 to allow better Basic programming with the advanced 512x192 graphic mode available only on Timex 2000 series computers. This extension added commands and do a complete memory remap to avoid the system to overwrite the extended screen memory area. Two versions existed: a version for TC2048 and a version for TS/TC2068 because they have different memory map.
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
used in the 8-bit
8-bit
The first widely adopted 8-bit microprocessor was the Intel 8080, being used in many hobbyist computers of the late 1970s and early 1980s, often running the CP/M operating system. The Zilog Z80 and the Motorola 6800 were also used in similar computers...
home computer
Home computer
Home computers were a class of microcomputers entering the market in 1977, and becoming increasingly 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 single nontechnical user...
s from Sinclair Research and Timex Sinclair
Timex Sinclair
Timex Sinclair was a joint venture between the British company Sinclair Research and Timex Corporation in an effort to gain an entry into the rapidly-growing early-1980s home computer market in the United States...
. The Sinclair BASIC interpreter
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...
was made by Nine Tiles Networks Ltd.
Originally developed in 1979 to fit in the 4 kB
Kilobyte
The kilobyte is a multiple of the unit byte for digital information. Although the prefix kilo- means 1000, the term kilobyte and symbol KB have historically been used to refer to either 1024 bytes or 1000 bytes, dependent upon context, in the fields of computer science and information...
ROM
Read-only memory
Read-only memory is a class of storage medium used in computers and other electronic devices. Data stored in ROM cannot be modified, or can be modified only slowly or with difficulty, so it is mainly used to distribute firmware .In its strictest sense, ROM refers only...
of the ZX80
Sinclair ZX80
The Sinclair ZX80 is a home computer brought to market in 1980 by Science of Cambridge Ltd. . It is notable for being the first computer available in the United Kingdom for less than a hundred pounds...
, it was initially an incomplete implementation of the 1978 ANSI
American National Standards Institute
The American National Standards Institute is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organization also coordinates U.S. standards with international...
minimal BASIC standard and evolved through the 8 kB ROM ZX81
Sinclair ZX81
The ZX81 was a home computer produced by Sinclair Research and manufactured in Scotland by Timex Corporation. It was launched in the United Kingdom in March 1981 as the successor to Sinclair's ZX80 and was designed to be a low-cost introduction to home computing for the general public...
and TS1000
Timex Sinclair 1000
The Timex Sinclair 1000 was the first computer produced by Timex Sinclair, a joint-venture between Timex Corporation and Sinclair Research. It was launched in July 1982....
to be an almost complete version in the 16 kB ROM ZX Spectrum
ZX Spectrum
The ZX Spectrum is an 8-bit personal home computer released in the United Kingdom in 1982 by Sinclair Research Ltd...
.
Reserved words
On the ZX Spectrum, there are 86 reserved words in Sinclair BASIC, denoting commands (of which there were 50), functions (31), and other keywords (5). They are entered via Sinclair's somewhat unorthodox keyword entry system. The most common commands require just a single keystroke; for example, pressing P causes the entire command PRINT to appear. Less frequent commands require more complex key sequences: BEEP (for example) is keyed by pressing CAPS SHIFT plus SYMBOL SHIFT to access extended mode (later models include an EXTENDED MODE key), keeping SYMBOL SHIFT held down and pressing Z. Keywords are colour-coded on the keyboard to indicate which SHIFT-sequence is required.- ABS, ACS, AND1, ASN, AT, ATN, ATTR, BEEP, BIN, BORDER, BRIGHT7, CAT2, CHR$3, CIRCLE, CLEAR, CLOSE#2, CLS, CODE3, CONTINUE, COPY, COS, DATA, DEF FN, DIM, DRAW, ERASE2, EXP, FLASH7, FN, FOR, FORMAT2, GO SUB, GO TO, IF4, IN, INK7, INKEY$3, INPUT, INT, INVERSE7, LEN, LET5, LINE, LIST, LLIST, LN, LOAD, LPRINT, MERGE, MOVE2, NEW, NEXT, NOT1, OPEN#2, OR1, OUT, OVER7, PAPER7, PAUSE, PEEK, PI, PLOT, POINT, POKE, PRINT, RANDOMIZE, READ, REM, RESTORE, RETURN, RND, RUN, SAVE, SCREEN$3, SGN, SIN, SQR, STEP, STR$3, TAB, TAN, THEN 4, TO, USR, VAL3, 6, VAL$3, VERIFY
Commands found exclusively on the ZX81 and its clones, the TS1000 and TS1500 are:
- FAST, SCROLL, SLOW, UNPLOT, GOSUB, GOTO (vs the Spectrum's functionally identical GO SUB, GO TO)
On the ZX Spectrum each reserved word was assigned a character code between 165 and 255 in the latter half of the system character set, and expanded by referencing a token table held in ROM. As a result, any reserved word in a program listing occupied just one byte of memory, a significant saving over traditional letter-by-letter storage. This also meant that the BASIC interpreter could quickly determine any command or function by evaluating a single byte.
The 128k Spectrum models—the ZX Spectrum 128, +2, +3, +2A, and +2B—introduced a conventional letter-by-letter BASIC input system, and two new commands, neither of which was present in or recognised by the machine's legacy version of 48k BASIC:
- PLAY (which operated the 128k models' AY-3-8910General Instrument AY-3-8910The AY-3-8910 is a 3-voice Programmable Sound Generator designed by General Instrument, initially for use with their 16-bit CP1610 or one of the PIC1650 series of 8-bit microcomputers...
music chip) - SPECTRUM (which switched the 128k Spectrum into a 48k Spectrum compatibility mode)
The original Spanish ZX Spectrum 128 included four additional commands in Spanish, one of which was undocumented. These can be translated as:
- EDIT (to edit a line number or invoke the full screen string editor)
- RENUM (to renumber the program lines)
- DELETE (to delete program lines)
- WIDTH (to set the column width of the RS232 device, but undocumented as the code was broken)
Timex BASIC
The Timex BASIC dialect, used on the Spectrum-compatible TS2068Timex Sinclair 2068
The Timex Sinclair 2068 , released in November 1983, was Timex Sinclair's fourth and last home computer for the United States market...
, but not the TC2048
Timex Computer 2048
The TC 2048 or Timex Computer 2048 is a computer created by "Timex of Portugal, Lda", a branch of Timex Corporation.It was highly compatible with the Sinclair ZX Spectrum computer, although differences in the ROM prevented 100% compatibility....
, which used the ordinary Sinclair BASIC, has the following six keywords as well as the ordinary Sinclair BASIC ones:
- DELETE deletes BASIC program line ranges. SHIFT + 0 with the K cursor produces the command DELETE.
- FREE is a function that gives the amount of free RAM. PRINT FREE will show how much RAM is free.
- ON ERR is an error detection function mostly used as ON ERR GO TO or ON ERR CONT.
- RESET can be used to reset the behaviour of ON ERR. It was also intended to reset peripherals.
- SOUND controls the AY-3-8192 sound chip.
- STICK is a function that gives the position of the internal joystick (Timex Sinclair 2090).
Timex of Portugal released a software extension called BASIC64 to allow better Basic programming with the advanced 512x192 graphic mode available only on Timex 2000 series computers. This extension added commands and do a complete memory remap to avoid the system to overwrite the extended screen memory area. Two versions existed: a version for TC2048 and a version for TS/TC2068 because they have different memory map.
See also
- Beta BASICBeta BASICBeta BASIC was a BASIC interpreter for the Sinclair Research ZX Spectrum microcomputer, written by Dr Andy Wright and sold by his one-man software house BetaSoft...
, written by Dr. Andy Wright, was originally a BASIC extensionBASIC extensionBASIC toolkits —not to be confused with widget toolkits—were a common type of program for 1980s 8-bit home computers...
, but ended up as a full-fledged interpreter. - SuperBASICSuperBASICSuperBASIC was 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 for a home computer, code-named SuperSpectrum, then under development...
, a much more advanced BASIC dialect, introduced with the Sinclair QLSinclair QLThe Sinclair QL , was a personal computer launched by Sinclair Research in 1984, as the successor to the Sinclair ZX Spectrum...
personal computer, with some similarities to the earlier Sinclair BASICs.
External links
- Sinclair ZX Spectrum BASIC Programming — The original 1982 manual by Steven Vickers (referenced above)
- Sinclair ZX81 Basic Programming — also by Vickers
- The History of Sinclair BASIC — By Andrew Owen
- Timex Computer World — Basic 64 user manual for Timex Computer 2048