Category:Sinclair ZX81 BASIC: Difference between revisions

From Rosetta Code
Content added Content deleted
mNo edit summary
mNo edit summary
Line 4: Line 4:
Sinclair ZX81 BASIC is the dialect of BASIC resident in ROM on the ZX81 home computer (1981) and compatibles (Timex Sinclair 1000, Lambda 8300, and many others). It was developed by John Grant and Steve Vickers. Today, ZX81 emulators exist for a wide range of platforms and operating systems.
Sinclair ZX81 BASIC is the dialect of BASIC resident in ROM on the ZX81 home computer (1981) and compatibles (Timex Sinclair 1000, Lambda 8300, and many others). It was developed by John Grant and Steve Vickers. Today, ZX81 emulators exist for a wide range of platforms and operating systems.


ZX81 BASIC is almost a subset of [[ZX Spectrum Basic]], but not quite: the exponentiation operator is spelled <code>**</code> rather than <code>↑</code> (mapped to ASCII <code>^</code>), the unconditional jump and subroutine call keywords are spelled <code>GOTO</code> and <code>GOSUB</code> rather than <code>GO TO</code> and <code>GO SUB</code>, etc. Note also that the ZX81 uses an idiosyncratic (non-ASCII) character set, so that the <code>CODE</code> and <code>CHR$</code> functions do not return the same values as they would on the Spectrum. Floating point operations, some string handling, and low-resolution graphics are supported; colour, sound, user-defined functions, the <code>READ</code>, <code>DATA</code>, and <code>RESTORE</code> keywords, and assorted other features are not.
ZX81 BASIC is almost a subset of [[ZX Spectrum Basic]], but not quite: the exponentiation operator is spelled <code>**</code> rather than <code>↑</code> (mapped to ASCII <code>^</code>), the jump and subroutine call keywords are spelled <code>GOTO</code> and <code>GOSUB</code> rather than <code>GO TO</code> and <code>GO SUB</code>, etc. Note also that the ZX81 uses an idiosyncratic (non-ASCII) character set, so that the <code>CODE</code> and <code>CHR$</code> functions do not return the same values as they would on the Spectrum. Floating point operations, some string handling, and low-resolution graphics are supported; colour, sound, user-defined functions, the <code>READ</code>, <code>DATA</code>, and <code>RESTORE</code> keywords, and assorted other features are not.


The ZX81 has no moving parts and only four microchips: the 3.25MHz Z80 CPU, an 8k ROM chip containing the operating system and BASIC, a 1k RAM chip, and an uncommitted logic array. Since there is no separate video chip, the CPU spends about 75% of its time driving the display and only 25% doing everything else. This can, however, be controlled under BASIC using the <code>FAST</code> and <code>SLOW</code> commands: <code>FAST</code> blanks the screen and allows the processor to operate at full speed, and <code>SLOW</code> reverts to the default behaviour. Even <code>FAST</code> mode can be slower than some other BASIC dialects running on comparable hardware, because ZX81 BASIC has no integer type: all numeric operations have to be done on 40-bit floats using software floating-point routines.
The ZX81 has no moving parts and only four microchips: the 3.25MHz Z80 CPU, an 8k ROM chip containing the operating system and BASIC, a 1k RAM chip, and an uncommitted logic array. Since there is no separate video chip, the CPU spends about 75% of its time driving the display and only 25% doing everything else. This can, however, be controlled under BASIC using the <code>FAST</code> and <code>SLOW</code> commands: <code>FAST</code> blanks the screen and allows the processor to operate at full speed, and <code>SLOW</code> reverts to the default behaviour. Even <code>FAST</code> mode can be slower than some other BASIC dialects running on comparable hardware, because ZX81 BASIC has no integer type: all numeric operations have to be done on 40-bit floats using software floating-point routines.

Revision as of 10:00, 26 August 2017

Language
Sinclair ZX81 BASIC
This programming language may be used to instruct a computer to perform a task.
See Also:


Listed below are all of the tasks on Rosetta Code which have been solved using Sinclair ZX81 BASIC.
Sinclair ZX81 BASIC is an implementation of BASIC. Other implementations of BASIC.

Sinclair ZX81 BASIC is the dialect of BASIC resident in ROM on the ZX81 home computer (1981) and compatibles (Timex Sinclair 1000, Lambda 8300, and many others). It was developed by John Grant and Steve Vickers. Today, ZX81 emulators exist for a wide range of platforms and operating systems.

ZX81 BASIC is almost a subset of ZX Spectrum Basic, but not quite: the exponentiation operator is spelled ** rather than (mapped to ASCII ^), the jump and subroutine call keywords are spelled GOTO and GOSUB rather than GO TO and GO SUB, etc. Note also that the ZX81 uses an idiosyncratic (non-ASCII) character set, so that the CODE and CHR$ functions do not return the same values as they would on the Spectrum. Floating point operations, some string handling, and low-resolution graphics are supported; colour, sound, user-defined functions, the READ, DATA, and RESTORE keywords, and assorted other features are not.

The ZX81 has no moving parts and only four microchips: the 3.25MHz Z80 CPU, an 8k ROM chip containing the operating system and BASIC, a 1k RAM chip, and an uncommitted logic array. Since there is no separate video chip, the CPU spends about 75% of its time driving the display and only 25% doing everything else. This can, however, be controlled under BASIC using the FAST and SLOW commands: FAST blanks the screen and allows the processor to operate at full speed, and SLOW reverts to the default behaviour. Even FAST mode can be slower than some other BASIC dialects running on comparable hardware, because ZX81 BASIC has no integer type: all numeric operations have to be done on 40-bit floats using software floating-point routines.

The original machine's 1k of RAM was shared between the display, the system variables and stack, and the user's program and variables. The Timex-branded model marketed in the United States had a minimum of 2k, as did many clones; an expansion pack was available from Sinclair to increase the RAM to 16k, and expansions of other sizes were produced by third parties.

A PDF version of the manual, ZX81 BASIC Programming by Steve Vickers, is available here.

If you do not have a ZX81 emulator installed on your computer, and your computer is not itself a ZX81 or ZX81 compatible, you can type any of these programs into the JtyOne online ZX81 emulator and see what they do.

Pages in category "Sinclair ZX81 BASIC"

The following 77 pages are in this category, out of 77 total.