Skip to content

Every keyword

All 85 of them, alphabetically, each with an example you can type straight in. The output printed under each one is what the machine prints.

By what it does

JobKeywords
Writing and runningRUN, LIST, NEW, CLR, REM, END, STOP, CONT
ValuesLET, DIM, DEF, FN
Showing thingsPRINT, TAB, SPC, POS, HEX
AskingINPUT, INKEY, JOY
DecidingIF, THEN, ELSE, AND, OR, NOT
RepeatingFOR, NEXT, TO, STEP
JumpingGOTO, GOSUB, RETURN, ON
Built-in listsDATA, READ, RESTORE
ArithmeticSGN, INT, ABS, SQR, RND, LOG, EXP, SIN, COS, TAN, ATN, MIN, MAX
TextLEN, LEFT$, RIGHT$, MID$, CHR$, ASC, STR$, VAL
Screen and soundCLS, LOCATE, COLOR, SOUND, VOL
The memory cardDIR, LOAD, SAVE, DEL, DISK, FORMAT, BLOAD, BSAVE
Clock and lasting memoryTIME, DATE, SETTIME, SETDATE, NVRAM
The machine underneathPEEK, POKE, SYS, BANK, MEM, FRE, WAIT, PAUSE, BRK

Operator precedence

Highest first. Anything on the same row goes left to right, and parentheses beat all of it.

Operators
Power^
Unary-+
Multiplicative*/
Additive+-
Relational=<><><=>=
Logical NOTNOT
Logical ANDAND
Logical OROR

The keywords

ABS

ABS(x)

The size of a number, ignoring its sign.

PRINT ABS(-5); ABS(5)
 5 5

AND

a AND b

True when both sides are true — and, underneath, a bit-by-bit AND of two whole numbers.

PRINT (5 > 3) AND (2 > 1)
PRINT 12 AND 10
-1
 8

See also:OR, NOT

ASC

ASC(s$)

The code of the first character of a string.

PRINT ASC("A")
 65

Errors:?ILLEGAL QUANTITY ERROR

See also:CHR$

ATN

ATN(x)

Arctangent, in radians. `ATN(1) * 4` is a serviceable π.

PRINT ATN(1) * 4
 3.14159265

See also:SIN, COS, TAN

BANK

BANK n

Choose which bank of extra RAM appears in the window at 32768.

BANK 1
POKE 32768, 42
BANK 0
PRINT PEEK(32768)
BANK 1
PRINT PEEK(32768)
 0
 42

See also:PEEK, POKE

BLOAD

BLOAD addr, "name"

Read a file of raw bytes straight back into memory.

POKE 2560, 42
BSAVE 2560, 1, "SCORE.DAT"
POKE 2560, 0
BLOAD 2560, "SCORE.DAT"
PRINT PEEK(2560)
 42

See also:BSAVE

BRK

BRK

Drop into the machine-code Monitor. `X` at the Monitor's `.` prompt comes back to BASIC.

BRK

The Monitor starts and shows the registers.

See also:SYS

BSAVE

BSAVE addr, len, "name"

Write raw bytes straight from memory to a file — a high score, a screen, a level.

POKE 2560, 42
BSAVE 2560, 1, "SCORE.DAT"
DIR
SCORE   .DAT 1

See also:BLOAD

CHR$

CHR$(n)

The character with code `n`.

PRINT CHR$(72); CHR$(73)
HI

Errors:?ILLEGAL QUANTITY ERROR

See also:ASC

CLR

CLR

Clear the variables, arrays and strings but keep the program.

A = 5
CLR
PRINT A
 0

See also:NEW, FRE

CLS

CLS

Clear the screen and put the cursor at the top left.

10 CLS
20 PRINT "A FRESH SCREEN"

See also:LOCATE, COLOR

COLOR

COLOR fg, bg

Set the text and background colors, each 0 to 15, for everything printed from now on.

10 CLS
20 COLOR 1, 15
30 PRINT "DARK ON WHITE"

Errors:?ILLEGAL QUANTITY ERROR

See also:CLS, LOCATE

CONT

CONT

Carry on from a `STOP` or a stopped program, at the line after the one it stopped on. Editing any line first makes it impossible.

10 PRINT "A"
20 STOP
30 PRINT "B"
A
BREAK IN 20
B

Errors:?CAN'T CONTINUE ERROR

See also:STOP

COS

COS(x)

Cosine of an angle in radians.

PRINT COS(0)
 1

See also:SIN, TAN, ATN

DATA

DATA item [, item ...]

A list of values baked into the program for `READ` to work through. Skipped when the program runs past it.

10 DATA 262, 294, 330
20 READ A, B, C
30 PRINT A; B; C
 262 294 330

See also:READ, RESTORE

DATE

DATE

Print today's date from the battery-backed clock.

SETDATE 20, 26, 8, 3
DATE
2026-08-03

See also:SETDATE, TIME

DEF

DEF FN name(var) = expr

Define your own one-line function.

10 DEF FN F(C) = C * 9 / 5 + 32
20 PRINT FN F(100)
 212

See also:FN

DEL

DEL "name"

Delete a file from the current disk.

DEL "HELLO.TXT"
DIR
DISK 0

See also:DIR

DIM

DIM var(size) [, var(size) ...]

Make an array. One dimension only, and you get elements `0` to `size` — so `DIM S(9)` is ten of them.

10 DIM S(3)
20 S(0) = 10
30 S(3) = 40
40 PRINT S(0); S(3)
 10 40

Errors:?BAD SUBSCRIPT ERROR, ?REDIM'D ARRAY ERROR, ?OUT OF MEMORY ERROR

DIR

DIR

List the files on the current disk, with their sizes in bytes.

DIR
DISK 0
HELLO   .TXT 6

See also:DISK, LOAD, SAVE

DISK

DISK n

Choose which of the card's 256 one-megabyte disks to work with.

DISK 3
MEM
DISK 3

Errors:?SYNTAX ERROR, ?ILLEGAL QUANTITY ERROR

See also:DIR, FORMAT

ELSE

IF expr THEN stmt ELSE stmt

What to do when the test does not hold.

10 IF 1 = 2 THEN PRINT "YES" ELSE PRINT "NO"
NO

See also:IF

END

END

Stop the program and return to the prompt. Variables keep their values.

10 PRINT "DONE"
20 END
30 PRINT "NEVER"
DONE

See also:STOP

EXP

EXP(x)

`e` raised to the power `x`.

PRINT EXP(1)
 2.71828183

Errors:?OVERFLOW ERROR

See also:LOG

FN

FN name(expr)

Call a function you defined with `DEF`.

10 DEF FN D(N) = N * 2
20 PRINT FN D(21)
 42

Errors:?UNDEF'D STATEMENT ERROR

See also:DEF

FOR

FOR var = start TO limit [STEP step]

Count from one number to another, running everything up to `NEXT` each time through.

10 FOR N = 1 TO 4
20 PRINT N; " SQUARED IS"; N * N
30 NEXT N
 1 SQUARED IS 1
 4 SQUARED IS 16

Errors:?OUT OF MEMORY ERROR

See also:NEXT, STEP, TO

FORMAT

FORMAT

Erase the current disk and start it fresh. Asks first.

FORMAT

It asks before erasing anything.

See also:DISK, DIR

FRE

FRE(x)

How many bytes are left for variables, arrays and strings. The argument is ignored.

NEW
PRINT FRE(0)
 30718

See also:MEM, CLR

GOSUB

GOSUB linenum

Jump to a subroutine, remembering where you came from. `RETURN` comes back.

10 GOSUB 100
20 PRINT "BACK"
30 END
100 PRINT "IN THE SUBROUTINE"
110 RETURN
IN THE SUBROUTINE
BACK

Errors:?UNDEF'D STATEMENT ERROR, ?OUT OF MEMORY ERROR

See also:RETURN, ON

GOTO

GOTO linenum

Jump to a line and carry on from there.

10 PRINT "HELLO"
20 GOTO 40
30 PRINT "SKIPPED"
40 PRINT "END"
HELLO
END

Errors:?UNDEF'D STATEMENT ERROR

HEX

HEX(n)

A number written in hexadecimal, always four digits with a `$` in front. `n` is 0 to 65535.

PRINT HEX(255); " "; HEX(4096)
$00FF $1000

Errors:?ILLEGAL QUANTITY ERROR

IF

IF expr THEN stmt|linenum [ELSE stmt|linenum]

Do something only when a test holds. `THEN 100` is short for `THEN GOTO 100`.

10 A = 7
20 IF A > 5 THEN PRINT "BIG" ELSE PRINT "SMALL"
BIG

See also:THEN, ELSE, AND, OR, NOT

INKEY

INKEY

The code of a key being pressed right now, or `0` if none. Does not wait — put it in a loop.

PRINT INKEY
 0

See also:INPUT, JOY

INPUT

INPUT ["prompt";] var [, var ...]

Stop and wait for the person at the keyboard to type something. Only works inside a program.

10 INPUT "HOW OLD ARE YOU"; A
20 PRINT "IN DOG YEARS:"; A * 7
IN DOG YEARS: 63

Errors:?ILLEGAL DIRECT ERROR, ?REDO FROM START ERROR, ?EXTRA IGNORED ERROR

INT

INT(x)

Round down to a whole number — down towards minus infinity, so `INT(-3.7)` is `-4`.

PRINT INT(3.7); INT(-3.7)
 3-4

JOY

JOY(n)

Read joystick 1 or 2. The bits are **active low** — a bit that reads `0` is a direction being pushed, so test with `= 0`, not with `<> 0`.

PRINT JOY(1)

255 with nothing being pushed: every bit high.

See also:INKEY

LEFT$

LEFT$(s$, n)

The first `n` characters of a string.

PRINT LEFT$("HELLO", 2)
HE

See also:RIGHT$, MID$

LEN

LEN(s$)

How many characters are in a string.

PRINT LEN("HELLO")
 5

LET

[LET] var = expr

Give a variable a value. `LET` is optional and almost nobody types it.

LET P = 3
PRINT P * 100
 300

Errors:?SYNTAX ERROR, ?TYPE MISMATCH ERROR

LIST

LIST

Show the program you have. It takes no line number — `LIST` lists the lot.

10 PRINT "HELLO"
20 GOTO 10
10 PRINT "HELLO"
20 GOTO 10

Errors:?SYNTAX ERROR

LOAD

LOAD "name" | LOAD

Read a program back off the card, replacing whatever is in memory. Bare `LOAD` receives one over the serial port by XModem.

10 PRINT "KEEP ME"
SAVE "KEEPER"
NEW
LOAD "KEEPER"
RUN
KEEP ME

Errors:?LOAD ERROR

See also:SAVE, DIR

LOCATE

LOCATE row, col

Put the cursor somewhere. Rows are 0 to 23 down the screen, columns 0 to 39 across.

10 CLS
20 LOCATE 5, 10
30 PRINT "OVER HERE"

Errors:?ILLEGAL QUANTITY ERROR

See also:CLS, COLOR

LOG

LOG(x)

Natural logarithm.

PRINT LOG(1)
 0

Errors:?ILLEGAL QUANTITY ERROR

See also:EXP

MAX

MAX(a, b)

The larger of two numbers.

PRINT MAX(3, 7)
 7

See also:MIN

MEM

MEM

Print free memory, which cards the machine found, and the current disk. A statement, not a function — `PRINT MEM` is a syntax error.

MEM

Free bytes, the fitted-hardware byte, and the selected disk.

See also:FRE

MID$

MID$(s$, start [, len])

Characters from the middle of a string, counting from 1. Leave `len` out to take the rest.

PRINT MID$("HELLO", 2, 3)
PRINT MID$("HELLO", 3)
ELL
LLO

Errors:?ILLEGAL QUANTITY ERROR

See also:LEFT$, RIGHT$

MIN

MIN(a, b)

The smaller of two numbers.

PRINT MIN(3, 7)
 3

See also:MAX

NEW

NEW

Throw the program away and clear the variables. There is no undo.

10 PRINT "HELLO"
NEW
PRINT FRE(0)
 30718

30718 bytes free — the same as a machine that has just been switched on, because the program is gone.

See also:CLR, FRE

NEXT

NEXT [var]

End of a loop: add the step and go around again. One variable only — `NEXT J, I` is not accepted, so close each loop with its own `NEXT`.

10 FOR I = 1 TO 2
20 FOR J = 1 TO 2
30 PRINT I; J
40 NEXT J
50 NEXT I
 1 1
 2 2

Errors:?NEXT WITHOUT FOR ERROR

See also:FOR

NOT

NOT expr

Flips every bit, which turns true (`-1`) into false (`0`) — but `NOT 1` is `-2`, not `0`, so use it on comparisons rather than on counts.

PRINT NOT (1 = 2)
PRINT NOT 1
-1
-2

See also:AND, OR

NVRAM

NVRAM addr, value | NVRAM(addr)

256 bytes of memory on the clock card that survive a power cut. A statement to write one, a function to read one.

NVRAM 0, 123
PRINT NVRAM(0)
 123

Errors:?ILLEGAL QUANTITY ERROR

ON

ON expr GOTO l1 [,l2 ...] | ON expr GOSUB l1 [,l2 ...]

Pick a destination by number: 1 takes the first line in the list, 2 the second. Out of range falls through to the next line.

10 N = 2
20 ON N GOSUB 100, 200
30 END
100 PRINT "FIRST"
110 RETURN
200 PRINT "SECOND"
210 RETURN
SECOND

Errors:?ILLEGAL QUANTITY ERROR

See also:GOTO, GOSUB

OR

a OR b

True when either side is true — and, underneath, a bit-by-bit OR.

PRINT (1 > 2) OR (3 > 2)
PRINT 12 OR 10
-1
 14

See also:AND, NOT

PAUSE

PAUSE n

Do nothing for `n` hundredths of a second.

10 PRINT "WAIT FOR IT"
20 PAUSE 50
30 PRINT "THERE"
WAIT FOR IT
THERE

PEEK

PEEK(addr)

Read one byte of memory, 0 to 255.

PRINT PEEK(781)

The byte at address 781 — the machine's record of which cards are fitted.

Errors:?ILLEGAL QUANTITY ERROR

See also:POKE, BANK

POKE

POKE addr, value

Write one byte of memory. `value` is 0 to 255.

POKE 2560, 42
PRINT PEEK(2560)
 42

Errors:?ILLEGAL QUANTITY ERROR

See also:PEEK

POS

POS(x)

Which column the cursor is on. The argument is ignored; give it `0`.

PRINT "AB"; POS(0)
AB 2

See also:PRINT, TAB

PRINT

PRINT [item] [;|, item ...]

Show numbers and text. `;` joins items tightly, `,` moves to the next 14-column zone, and a trailing `;` or `,` holds the cursor on the line.

PRINT "TOTAL:"; 6 * 7
TOTAL: 42

Errors:?SYNTAX ERROR

See also:TAB, SPC, POS

READ

READ var [, var ...]

Take the next value from the `DATA` lists and put it in a variable.

10 DATA 10, 20
20 READ X
30 READ Y
40 PRINT X + Y
 30

Errors:?OUT OF DATA ERROR, ?TYPE MISMATCH ERROR

See also:DATA, RESTORE

REM

REM [text]

A remark. Everything after `REM` on the line is for people, not the machine.

10 REM SCORE KEEPER
20 S = 100
30 PRINT S
 100

RESTORE

RESTORE

Go back to the first `DATA` item, so you can read the list again.

10 DATA 5, 6
20 READ A
30 RESTORE
40 READ B
50 PRINT A; B
 5 5

See also:DATA, READ

RETURN

RETURN

Go back to the line after the `GOSUB` that called this subroutine.

10 GOSUB 100
20 END
100 PRINT "AND BACK"
110 RETURN
AND BACK

Errors:?RETURN WITHOUT GOSUB ERROR

See also:GOSUB

RIGHT$

RIGHT$(s$, n)

The last `n` characters of a string.

PRINT RIGHT$("HELLO", 3)
LLO

See also:LEFT$, MID$

RND

RND(x)

A random number from 0 up to (but not including) 1. A negative argument reseeds from that number, so the same seed replays the same sequence.

10 FOR N = 1 TO 3
20 PRINT INT(RND(1) * 6) + 1;
30 NEXT N

Three dice rolls, each from 1 to 6.

RUN

RUN [linenum]

Run the program from the top, or from a line number if you give one. Clears the variables first.

10 PRINT "ONE"
20 PRINT "TWO"
30 PRINT "THREE"
TWO
THREE

See also:GOTO, LIST

SAVE

SAVE "name" | SAVE

Write the program to the card. Bare `SAVE` sends it over the serial port instead, by XModem.

10 PRINT "KEEP ME"
SAVE "KEEPER"
DIR
KEEPER  .    18

Errors:?SAVE ERROR

See also:LOAD, DIR

SETDATE

SETDATE cc, yy, mm, dd

Set the date: century, year within it, month, day. 2026 is `20, 26`.

SETDATE 20, 26, 12, 25
DATE
2026-12-25

See also:DATE

SETTIME

SETTIME hh, mm, ss

Set the clock. It keeps running with the power off.

SETTIME 12, 30, 0
TIME

The clock now reads half past twelve.

See also:TIME

SGN

SGN(x)

`-1` for a negative number, `0` for zero, `1` for a positive one.

PRINT SGN(-4); SGN(0); SGN(9)
-1 0 1

SIN

SIN(x)

Sine of an angle in radians.

PRINT SIN(0)
 0

See also:COS, TAN, ATN

SOUND

SOUND voice, freq, dur

Play a note: `voice` 1 to 3, `freq` in hertz, `dur` in hundredths of a second. The program waits for the note to finish.

10 VOL 15
20 SOUND 1, 262, 20
30 SOUND 1, 330, 20
40 SOUND 1, 392, 20

Three notes — the bottom of a C major chord.

See also:VOL

SPC

SPC(n)

Inside `PRINT`, print `n` spaces from wherever the cursor is.

PRINT "A"; SPC(5); "B"
A     B

See also:PRINT, TAB

SQR

SQR(x)

Square root.

PRINT SQR(144)
 12

Errors:?ILLEGAL QUANTITY ERROR

STEP

FOR var = start TO limit STEP step

How much to add each time through. Negative counts down.

10 FOR N = 10 TO 1 STEP -3
20 PRINT N;
30 NEXT N
 10 7 4 1

See also:FOR

STOP

STOP

Pause the program and say where it stopped. `CONT` picks it up again.

10 PRINT "FIRST"
20 STOP
30 PRINT "SECOND"
FIRST
BREAK IN 20

See also:CONT, END

STR$

STR$(n)

A number turned into a string — keeping the leading space that `PRINT` puts where a minus sign would go.

PRINT "[" + STR$(42) + "]"
[ 42]

See also:VAL

SYS

SYS addr

Call machine code at an address and come back when it returns.

POKE 2560, 96
SYS 2560
PRINT "BACK FROM MACHINE CODE"
BACK FROM MACHINE CODE

See also:POKE

TAB

TAB(n)

Inside `PRINT`, move to column `n` of the line.

PRINT "NAME"; TAB(12); "SCORE"
NAME        SCORE

See also:PRINT, SPC, POS

TAN

TAN(x)

Tangent of an angle in radians.

PRINT TAN(0)
 0

See also:SIN, COS, ATN

THEN

IF expr THEN stmt|linenum

The part of `IF` that says what to do when the test holds.

10 IF 2 + 2 = 4 THEN PRINT "ARITHMETIC WORKS"
ARITHMETIC WORKS

See also:IF

TIME

TIME

Print the time of day from the battery-backed clock.

TIME

The time, as `HH:MM:SS`.

See also:SETTIME, DATE

TO

FOR var = start TO limit

The part of `FOR` that says where to count to.

10 FOR N = 3 TO 5
20 PRINT N;
30 NEXT N
 3 4 5

See also:FOR

VAL

VAL(s$)

A string turned into a number. Reads as far as it can and gives `0` if that is nowhere.

PRINT VAL("3.5"); VAL("12ABC"); VAL("ABC")
 3.5 12 0

See also:STR$

VOL

VOL n

Set the overall volume, 0 to 15.

10 VOL 8
20 SOUND 1, 440, 10
30 PRINT "THAT WAS A CONCERT A"
THAT WAS A CONCERT A

See also:SOUND

WAIT

WAIT addr, mask

Hold the program until reading `addr` and ANDing it with `mask` gives something other than zero. Nothing else happens while it waits.

POKE 2560, 1
WAIT 2560, 1
PRINT "BIT IS SET"
BIT IS SET

See also:PEEK

Written for BIOS v1.5. Released under the MIT License.