SuperBASIC Tokens
A SuperBASIC program is held internally in tokenised form. In this form each line is headed by a word whose value is the difference in length of the current line from the previous one. The value for the first line is its length (in bytes). If the next line were two bytes less in length than the first its header would be -2.
After the word header there follows a list of tokens each of which has a specific length associated with it as shown below.
Token | Length | Byte 1 | Byte 2 | Word 2 | Comments |
space | 2 bytes | $80 | s | - | s is the number of spaces (1 - 127) |
keyword | 2 bytes | $81 | keywd | - | See below |
symbol | 2 bytes | $84 | symb | - | See below |
operator | 2 bytes | $85 | op | - | See below |
monadic op | 2 bytes | $86 | monop | - | See below |
name | 4 bytes | $88 | 0 | number of entry in name table | |
short integer | 2 bytes | $89 | i | - | Minerva |
long integer | 4 bytes | $8A | 0 | i | Minerva |
string | 4+ bytes | $8B | ' or " | n | n characters follow padded to even |
text | 4+ bytes | $8C | 0 | n | n characters follow padded to even |
line no | 4 bytes | $8D | 0 | number of line | |
separator | 2 bytes | $8E | sep | - | see below |
bin | 6 bytes | $D8 | remainder of exponent | top 2 bytes of mantissa | the bottom two bytes of the mantissa follow (not QDOS) |
hex | 6 bytes | $E8 | remainder of exponent | top 2 bytes of mantissa | the bottom two bytes of the mantissa follow (not QDOS) |
fp | 6 bytes | $F0 to $FF | remainder of exponent | top 2 bytes of mantissa | the bottom two bytes of the mantissa follow |
Tables
Keywd
Value | Item |
$01 | END |
£02 | FOR |
$03 | IF |
$04 | REPeat |
$05 | SELect |
$06 | WHEN |
$07 | DEFine |
$08 | PROCedure |
$09 | FuNction |
$0A | GO |
$0B | TO |
$0C | SUB |
$0E | ERRor |
$11 | RESTORE |
$12 | NEXT |
$13 | EXIT |
$14 | ELSE |
$15 | ON |
$16 | RETurn |
$17 | REMAINDER |
$18 | DATA |
$19 | DIM |
$1A | LOCal |
$1B | LET |
$1C | THEN |
$1D | STEP |
$1E | REMark |
$1F | MISTake |
Symb
Value | Item |
$01 | = |
$02 | : |
$03 | # |
$04 | , |
$05 | ( |
$06 | ) |
$07 | { |
$08 | } |
$09 | forced space |
$0A | line feed |
Op
Value | Item |
$01 | + |
$02 | - |
$03 | * |
$04 | / |
$05 | >= |
$06 | > |
$07 | == |
$08 | = |
$09 | <> |
$0A | ⇐ |
$0B | < |
$0C | See Note 1 |
$0D | && |
$0E | See Note 2 |
$0F | See Note 3 |
$10 | & |
$11 | OR |
$12 | AND |
$13 | XOR |
$14 | MOD |
$!5 | DIV |
$16 | INSTR |
Monop
Value | Item |
$01 | - |
$02 | + |
$03 | ~~ |
$04 | NOT |
Sep
Value | Item |
$01 | , |
$02 | ; |
$03 | \ |
$04 | ! |
$05 | TO |
Notes
1. The operator is two vertical lines ||.
2. The operator is a double caret ^^.
3. The operator is a single caret ^.