Tandy 200 BASIC tokenized file
From Just Solve the File Format Problem
(Difference between revisions)
m (→File Format: File does not end line number set to 0x00 0x00.) |
(→Tokens: Add notes for oddly behaving tokens (ELSE, LOADM, single quote)) |
||
Line 14: | Line 14: | ||
! title="Hexadecimal code point" | Hex | ! title="Hexadecimal code point" | Hex | ||
! title="Decimal code point" | Dec | ! title="Decimal code point" | Dec | ||
− | ! title="BASIC element the token stands for" | Token meaning | + | ! title="BASIC element the token stands for" | Token meaning |
+ | ! title="Miscellany" | Notes | ||
|- | |- | ||
|- | |- | ||
Line 51: | Line 52: | ||
|90||144||WIDTH | |90||144||WIDTH | ||
|- | |- | ||
− | |91||145||ELSE | + | |91||145||ELSE||When tokenizing, the Tandy 200 always adds a colon (':') before the ELSE token |
|- | |- | ||
|92||146||LINE | |92||146||LINE | ||
Line 71: | Line 72: | ||
|9A||154||CLOSE | |9A||154||CLOSE | ||
|- | |- | ||
− | |9B||155||LOAD | + | |9B||155||LOAD||Note that LOADM is simply the token for LOAD followed by an ASCII 'M'. |
|- | |- | ||
|9C||156||MERGE | |9C||156||MERGE | ||
− | |- | + | |-QUOTE |
|9D||157||FILES | |9D||157||FILES | ||
|- | |- | ||
Line 271: | Line 272: | ||
|FE||254||MID$ | |FE||254||MID$ | ||
|- | |- | ||
− | |FF||255||' (QUOTE) | + | |FF||255||' (QUOTE) || When tokenizing, the single quote character expands to three characters: a colon, the byte for REM (0x8E), and then 0xFF. |
|} | |} | ||
Revision as of 06:38, 26 July 2022
Tandy 200 BASIC was a version of Microsoft BASIC for the Radio Shack Tandy 200 computer. The tokenization for the TRS-80 Model 100/102 and NEC PC-8201/8300 should be similar, if not identical.
Contents |
Tokens
Blank values indicate either that the token is unused or is used for something unknown.
Hex | Dec | Token meaning | Notes |
---|---|---|---|
80 | 128 | END | |
81 | 129 | FOR | |
82 | 130 | NEXT | |
83 | 131 | DATA | |
84 | 132 | INPUT | |
85 | 133 | DIM | |
86 | 134 | READ | |
87 | 135 | LET | |
88 | 136 | GOTO | |
89 | 137 | RUN | |
8A | 138 | IF | |
8B | 139 | RESTORE | |
8C | 140 | GOSUB | |
8D | 141 | RETURN | |
8E | 142 | REM | |
8F | 143 | STOP | |
90 | 144 | WIDTH | |
91 | 145 | ELSE | When tokenizing, the Tandy 200 always adds a colon (':') before the ELSE token |
92 | 146 | LINE | |
93 | 147 | EDIT | |
94 | 148 | ERROR | |
95 | 149 | RESUME | |
96 | 150 | OUT | |
97 | 151 | ON | |
98 | 152 | DSKO$ | |
99 | 153 | OPEN | |
9A | 154 | CLOSE | |
9B | 155 | LOAD | Note that LOADM is simply the token for LOAD followed by an ASCII 'M'. |
9C | 156 | MERGE | |
9D | 157 | FILES | |
9E | 158 | SAVE | |
9F | 159 | LFILES | |
A0 | 160 | LPRINT | |
A1 | 161 | DEF | |
A2 | 162 | POKE | |
A3 | 163 | ||
A4 | 164 | CONT | |
A5 | 165 | LIST | |
A6 | 166 | LLIST | |
A7 | 167 | CLEAR | |
A8 | 168 | CLOAD | |
A9 | 169 | CSAVE | |
AA | 170 | TIME$ | |
AB | 171 | DATE$ | |
AC | 172 | DAY$ | |
AD | 173 | COM | |
AE | 174 | MDM | |
AF | 175 | KEY | |
B0 | 176 | CLS | |
B1 | 177 | BEEP | |
B2 | 178 | SOUND | |
B3 | 179 | LCOPY | |
B4 | 180 | PSET | |
B5 | 181 | PRESET | |
B6 | 182 | MOTOR | |
B7 | 183 | MAX | |
B8 | 184 | POWER | |
B9 | 185 | CALL | |
BA | 186 | MENU | |
BB | 187 | IPL | |
BC | 188 | NAME | |
BD | 189 | KILL | |
BE | 190 | SCREEN | |
BF | 191 | NEW | |
C0 | 192 | TAB( | |
C1 | 193 | TO | |
C2 | 194 | USING | |
C3 | 195 | VARPTR | |
C4 | 196 | ERL | |
C5 | 197 | ERR | |
C6 | 198 | STRING$ | |
C7 | 199 | INSTR | |
C8 | 200 | DSKI$ | |
C9 | 201 | INKEY$ | |
CA | 202 | CSRLIN | |
CB | 203 | OFF | |
CC | 204 | HIMEM | |
CD | 205 | THEN | |
CE | 206 | NOT | |
CF | 207 | STEP | |
D0 | 208 | + | |
D1 | 209 | - | |
D2 | 210 | * | |
D3 | 211 | / | |
D4 | 212 | ^ | |
D5 | 213 | AND | |
D6 | 214 | OR | |
D7 | 215 | XOR | |
D8 | 216 | EQV | |
D9 | 217 | IMP | |
DA | 218 | MOD | |
DB | 219 | \ | |
DC | 220 | > | |
DD | 221 | = | |
DE | 222 | ||
DF | 223 | SGN | |
E0 | 224 | INT | |
E1 | 225 | ABS | |
E2 | 226 | FRE | |
E3 | 227 | INP | |
E4 | 228 | LPOS | |
E5 | 229 | POS | |
E6 | 230 | SQR | |
E7 | 231 | RND | |
E8 | 232 | LOG | |
E9 | 233 | EXP | |
EA | 234 | COS | |
EB | 235 | SIN | |
EC | 236 | TAN | |
ED | 237 | ATN | |
EE | 238 | PEEK | |
EF | 239 | EOF | |
F0 | 240 | LOC | |
F1 | 241 | LOF | |
F2 | 242 | CINT | |
F3 | 243 | CSNG | |
F4 | 244 | CDBL | |
F5 | 245 | FIX | |
F6 | 246 | LEN | |
F7 | 247 | STR$ | |
F8 | 248 | VAL | |
F9 | 249 | ASC | |
FA | 250 | CHR$ | |
FB | 251 | SPACE$ | |
FC | 252 | LEFT$ | |
FD | 253 | RIGHT$ | |
FE | 254 | MID$ | |
FF | 255 | ' (QUOTE) | When tokenizing, the single quote character expands to three characters: a colon, the byte for REM (0x8E), and then 0xFF. |
File Format
Tokenised BASIC code is a sequence of tokenized lines. Each tokenized line has the following format:
Name | Length | Description |
---|---|---|
PL PH | 2 bytes | Address of the next line in memory, little endian. This data can be ignored as it is only a placeholder. The value of PL PH in a file is moot because the address is recalculated every time the program loads. Once in memory, PL PH is used to skip to the line required for GOTO, GOSUB, and READ, thus speeding up the program. |
LL LH | 2 bytes | Line number, little endian. |
B0 … BN | Any number | Sequence of tokens or ASCII characters. If a character's value is ≥ 128, then it is a token. All tokens are a single byte. |
NULL | 1 byte | NULL byte (`0x00`) to signal end of line. |