RUN runs what is stored, LIST shows it, NEW throws it away. The prompt is OK.COUNT and COURSE are the same variable. A name containing a keyword will not parse: SCORE has OR in it.| Keyword | Syntax | What it does |
|---|---|---|
| LET | [LET] var = expr | Give a variable a value. LET is optional and almost nobody types it. |
| 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. | |
| INPUT | INPUT ["prompt";] var [, var ...] | Stop and wait for the person at the keyboard to type something. Only works inside a program. |
| GOTO | GOTO linenum | Jump to a line and carry on from there. |
| GOSUB | GOSUB linenum | Jump to a subroutine, remembering where you came from. RETURN comes back. |
| RETURN | RETURN | Go back to the line after the GOSUB that called this subroutine. |
| 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. |
| IF | IF expr THEN stmt|linenum [ELSE stmt|linenum] | Do something only when a test holds. THEN 100 is short for THEN GOTO 100. |
| THEN | IF expr THEN stmt|linenum | The part of IF that says what to do when the test holds. |
| ELSE | IF expr THEN stmt ELSE stmt | What to do when the test does not hold. |
| FOR | FOR var = start TO limit [STEP step] | Count from one number to another, running everything up to NEXT each time through. |
| TO | FOR var = start TO limit | The part of FOR that says where to count to. |
| STEP | FOR var = start TO limit STEP step | How much to add each time through. Negative counts down. |
| 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. |
| DEF | DEF FN name(var) = expr | Define your own one-line function. |
| FN | FN name(expr) | Call a function you defined with DEF. |
| END | END | Stop the program and return to the prompt. Variables keep their values. |
| STOP | STOP | Pause the program and say where it stopped. CONT picks it up again. |
| 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. |
| REM | REM [text] | A remark. Everything after REM on the line is for people, not the machine. |
| Keyword | Syntax | What it does |
|---|---|---|
| RUN | RUN [linenum] | Run the program from the top, or from a line number if you give one. Clears the variables first. |
| LIST | LIST | Show the program you have. It takes no line number — LIST lists the lot. |
| NEW | NEW | Throw the program away and clear the variables. There is no undo. |
| CLR | CLR | Clear the variables, arrays and strings but keep the program. |
| 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. |
| DATA | DATA item [, item ...] | A list of values baked into the program for READ to work through. Skipped when the program runs past it. |
| READ | READ var [, var ...] | Take the next value from the DATA lists and put it in a variable. |
| RESTORE | RESTORE | Go back to the first DATA item, so you can read the list again. |
| Keyword | Syntax | What it does |
|---|---|---|
| CLS | CLS | Clear the screen and put the cursor at the top left. |
| LOCATE | LOCATE row, col | Put the cursor somewhere. Rows are 0 to 23 down the screen, columns 0 to 39 across. |
| COLOR | COLOR fg, bg | Set the text and background colors, each 0 to 15, for everything printed from now on. |
| 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. |
| VOL | VOL n | Set the overall volume, 0 to 15. |
| INKEY | INKEY | The code of a key being pressed right now, or 0 if none. Does not wait — put it in a loop. |
| 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. |
| 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. |
| PAUSE | PAUSE n | Do nothing for n hundredths of a second. |
| Keyword | Syntax | What it does |
|---|---|---|
| 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. |
| SAVE | SAVE "name" | SAVE | Write the program to the card. Bare SAVE sends it over the serial port instead, by XModem. |
| DIR | DIR | List the files on the current disk, with their sizes in bytes. |
| DEL | DEL "name" | Delete a file from the current disk. |
| DISK | DISK n | Choose which of the card's 256 one-megabyte disks to work with. |
| FORMAT | FORMAT | Erase the current disk and start it fresh. Asks first. |
| BLOAD | BLOAD addr, "name" | Read a file of raw bytes straight back into memory. |
| BSAVE | BSAVE addr, len, "name" | Write raw bytes straight from memory to a file — a high score, a screen, a level. |
| Keyword | Syntax | What it does |
|---|---|---|
| TIME | TIME | Print the time of day from the battery-backed clock. |
| DATE | DATE | Print today's date from the battery-backed clock. |
| SETTIME | SETTIME hh, mm, ss | Set the clock. It keeps running with the power off. |
| SETDATE | SETDATE cc, yy, mm, dd | Set the date: century, year within it, month, day. 2026 is 20, 26. |
| 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. |
| Keyword | Syntax | What it does |
|---|---|---|
| PEEK | PEEK(addr) | Read one byte of memory, 0 to 255. |
| POKE | POKE addr, value | Write one byte of memory. value is 0 to 255. |
| SYS | SYS addr | Call machine code at an address and come back when it returns. |
| BANK | BANK n | Choose which bank of extra RAM appears in the window at 32768. |
| 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. |
| FRE | FRE(x) | How many bytes are left for variables, arrays and strings. The argument is ignored. |
| BRK | BRK | Drop into the machine-code Monitor. X at the Monitor's . prompt comes back to BASIC. |
| Keyword | Syntax | What it does |
|---|---|---|
| TAB | TAB(n) | Inside PRINT, move to column n of the line. |
| SPC | SPC(n) | Inside PRINT, print n spaces from wherever the cursor is. |
| 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. |
| AND | a AND b | True when both sides are true — and, underneath, a bit-by-bit AND of two whole numbers. |
| OR | a OR b | True when either side is true — and, underneath, a bit-by-bit OR. |
| SGN | SGN(x) | -1 for a negative number, 0 for zero, 1 for a positive one. |
| INT | INT(x) | Round down to a whole number — down towards minus infinity, so INT(-3.7) is -4. |
| ABS | ABS(x) | The size of a number, ignoring its sign. |
| POS | POS(x) | Which column the cursor is on. The argument is ignored; give it 0. |
| SQR | SQR(x) | Square root. |
| 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. |
| LOG | LOG(x) | Natural logarithm. |
| EXP | EXP(x) | e raised to the power x. |
| COS | COS(x) | Cosine of an angle in radians. |
| SIN | SIN(x) | Sine of an angle in radians. |
| TAN | TAN(x) | Tangent of an angle in radians. |
| ATN | ATN(x) | Arctangent, in radians. ATN(1) * 4 is a serviceable π. |
| LEN | LEN(s$) | How many characters are in a string. |
| STR$ | STR$(n) | A number turned into a string — keeping the leading space that PRINT puts where a minus sign would go. |
| VAL | VAL(s$) | A string turned into a number. Reads as far as it can and gives 0 if that is nowhere. |
| ASC | ASC(s$) | The code of the first character of a string. |
| CHR$ | CHR$(n) | The character with code n. |
| LEFT$ | LEFT$(s$, n) | The first n characters of a string. |
| RIGHT$ | RIGHT$(s$, n) | The last n characters of a string. |
| MID$ | MID$(s$, start [, len]) | Characters from the middle of a string, counting from 1. Leave len out to take the rest. |
| HEX | HEX(n) | A number written in hexadecimal, always four digits with a $ in front. n is 0 to 65535. |
| MIN | MIN(a, b) | The smaller of two numbers. |
| MAX | MAX(a, b) | The larger of two numbers. |
| Rank | Level | Operators |
|---|---|---|
| 1 | Power | ^ |
| 2 | Unary | - + |
| 3 | Multiplicative | * / |
| 4 | Additive | + - |
| 5 | Relational | = <> < > <= >= |
| 6 | Logical NOT | NOT |
| 7 | Logical AND | AND |
| 8 | Logical OR | OR |
-1 for true and 0 for false, and AND, OR and NOT work bitwise on the integer part — which is exactly why the joystick test is IF (JOY(1) AND 16) = 0.FOR tests its limit at the NEXT, so FOR N = 1 TO 0 still runs the body one time.NEXT J, I is not accepted, whatever else you may have read — it fails mid-loop with ?NEXT WITHOUT FOR ERROR. Close each loop with its own NEXT.0, not 1. An untouched stick is 255.| The machine prints | Because |
|---|---|
| ?SYNTAX ERROR | BASIC could not parse the line — a typo, a missing bracket, or a keyword buried in a name |
| ?OVERFLOW ERROR | A result too big for a five-byte float |
| ?OUT OF MEMORY ERROR | Program, variables and the GOSUB / FOR stack together filled the space |
| ?UNDEF'D STATEMENT ERROR | GOTO or GOSUB naming a line number that is not in the program |
| ?BAD SUBSCRIPT ERROR | An array index outside 0 to the size given to DIM |
| ?REDIM'D ARRAY ERROR | DIM used twice on the same array |
| ?DIVISION BY ZERO ERROR | A divide with zero on the bottom |
| ?ILLEGAL DIRECT ERROR | A statement that only works inside a program, typed at the prompt |
| ?TYPE MISMATCH ERROR | A string where a number belongs, or the other way around |
| ?STRING TOO LONG ERROR | A string over 255 characters |
| ?FORMULA TOO COMPLEX ERROR | An expression nested deeper than the evaluator can hold |
| ?ILLEGAL QUANTITY ERROR | A number outside what the statement accepts — voice 0, volume 16, color 16 |
| ?RETURN WITHOUT GOSUB ERROR | A RETURN reached without a GOSUB to come back from |
| ?NEXT WITHOUT FOR ERROR | A NEXT with no FOR open — or a comma list after it, which is not accepted |
| ?OUT OF DATA ERROR | READ ran past the last DATA item. RESTORE goes back to the start |
| ?NO DEVICE ERROR | The statement needs a card this machine has not got |
| ?CAN'T CONTINUE ERROR | CONT after an error, NEW, CLR or RUN — there is nothing to resume |
| Key | Does |
|---|---|
| Esc | Stops a running program. This is the one to remember. |
| Ctrl + C | The same thing, for people used to typing it |
| CONT | Carries on from where STOP or Esc left off |
| Reset button | Warm start — your program and variables survive |