Close

Syntax and semantics

A project log for One kilobyte Tiny BASIC for the 8080 and Z80

BASIC for the 8080 and Z80, fits in 1K of memory, runs BASIC games on a 2K system. Features similar to Palo Alto Tiny BASIC.

willstevenswill.stevens 01/04/2024 at 20:530 Comments

The following statements are supported:

and additionally, these commands can be issued if not prefixed by a line number:

<var> is a letter A-Z. A single array called @ is supported, its elements are @( <expression> ).  The array uses all remaining memory after the program - it will eventually collide with the stack. Two system variables are available in ^ (address of start of array) and _ (current state of Random Number Generator). ^ can be used to work out how much free memory there is by subtracting it from the highest RAM address, and then subtracting 8+however much stack the program is likely to use (a few tens of bytes typically).

Signed 16-bit integer arithmetic is supported, with no overflow detection. Operators are + - * /.

Comparison operators are = <> < > <= >=. The result of a comparison is 1 if true, 0 if false.

Three functions taking a single parameter are available: ABS, USR and RND. The USR(x) function calls the address x. The RND(x) function returns a random number between 0 and x-1.

Program editing features are minimal - lines can be deleted by typing the line number by itself. Unlike in most BASIC implementations, overwriting a line is not permitted, a line must be deleted and then re-entered.

Discussions