qdosmsq:sbinternal:toktype

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.

TokenLengthByte 1Byte 2Word 2Comments
space2 bytes$80s - s is the number of spaces (1 - 127)
keyword2 bytes$81keywd - See below
symbol2 bytes$84symb - See below
operator2 bytes$85op - See below
monadic op2 bytes$86 monop - See below
name4 bytes$88 0 number of entry in name table
short integer2 bytes$89i-Minerva
long integer4 bytes$8A0iMinerva
string4+ bytes$8B' or " n n characters follow padded to even
text4+ bytes$8C0n n characters follow padded to even
line no4 bytes$8D0number of line
separator2 bytes$8Esep-see below
bin6 bytes$D8remainder of exponenttop 2 bytes of mantissathe bottom two bytes of the mantissa follow (not QDOS)
hex6 bytes$E8remainder of exponenttop 2 bytes of mantissathe bottom two bytes of the mantissa follow (not QDOS)
fp6 bytes$F0 to $FFremainder of exponenttop 2 bytes of mantissathe bottom two bytes of the mantissa follow
Keywd
ValueItem
$01END
£02FOR
$03IF
$04REPeat
$05SELect
$06WHEN
$07DEFine
$08PROCedure
$09FuNction
$0AGO
$0BTO
$0CSUB
$0EERRor
$11RESTORE
$12NEXT
$13EXIT
$14ELSE
$15ON
$16RETurn
$17REMAINDER
$18DATA
$19DIM
$1ALOCal
$1BLET
$1CTHEN
$1DSTEP
$1EREMark
$1FMISTake
Symb
ValueItem
$01=
$02:
$03#
$04,
$05(
$06)
$07{
$08}
$09forced space
$0Aline feed
Op
ValueItem
$01+
$02-
$03*
$04/
$05>=
$06>
$07==
$08=
$09<>
$0A
$0B<
$0CSee Note 1
$0D&&
$0ESee Note 2
$0FSee Note 3
$10&
$11OR
$12AND
$13XOR
$14MOD
$!5DIV
$16INSTR
Monop
ValueItem
$01-
$02+
$03~~
$04NOT
Sep
ValueItem
$01,
$02;
$03\
$04!
$05TO

Notes

1. The operator is two vertical lines ||.

2. The operator is a double caret ^^.

3. The operator is a single caret ^.

  • qdosmsq/sbinternal/toktype.txt
  • Last modified: 2011/12/31 11:22
  • by george.gwilt