MediaWiki:Sitenotice:
2024-03-02: The wiki ran out of disk space, so things were not working. This has been resolved by adding another 5GB of quota ;-) Thanks to Tim Lindner for reporting the issues.
2020-05-17: If a page gives you an error about some revision not being found, just EDIT the page and the old page should appear in the editor. If it does, just SAVE that and the page should be restored. OS-9 Al (talk) 12:22, 17 May 2020 (CDT)
The Structure of I-Code
The 'I' in I-Code stands for Intermediate. Intermediate code is code that is a step between interpreted source statements and fully compiled machine code. Typically, intermediate code uses tokens to represent the instructions to be executed. Basic09 I-Code goes a step further by re-arranging the source code instructions in post-fix notation (also known as Reverse Polish Notation) order.
The tokens used by Basic09 are a single byte ranging from $00 to $FF. See I-Code Token List
Module Format
File Access Mode Tokens
READ+WRITE = UPDATE
80 | DIR | ||
---|---|---|---|
01 | READ | 81 | READ+DIR |
02 | WRITE | 82 | WRITE+DIR |
03 | UPDATE | 83 | UPDATE+DIR |
04 | EXEC | 84 | EXEC+DIR |
05 | READ+EXEC | 85 | READ+EXEC+DIR |
06 | WRITE+EXEC | 86 | WRITE+EXEC+DIR |
07 | UPDATE+EXEC | 87 | UPDATE+EXEC+DIR |
I-Code Instruction Variable Tokens
I have never liked the usage of MIRROR in this instance. I have no better way to describe these tokens at this time. I referred to them as mirror tokens, because in some instances they act as a duplicate of the variable, such as in the case of a:=a+1. Both 'a' variables refer to the same variable, but in the I-Code, each has a separate token, and with the exception of 80-84 (in the instruction area) point to the VDT. 80-83 in the instruction area point to data memory addresses, and 84 points to the DSAT.
VARIABLE | FIELD | PARAMETER | ||||
---|---|---|---|---|---|---|
TYPE | TOKEN | MIRROR | TOKEN | MIRROR | TOKEN | MIRROR |
BYTE | 80 | F2 | F6 | 89 | 85 | F2 |
INTEGER | 81 | F2 | F6 | 89 | 85 | F2 |
REAL | 82 | F2 | F6 | 89 | 85 | F2 |
BOOLEAN | 83 | F2 | F6 | 89 | 85 | F2 |
STRING | 84 | F2 | F6 | 89 | 85 | F2 |
RECORD | 85 | F2 | F6 | 89 | 85 | F2 |
VECTOR | 85/86 | F3 | F7 | 8A | 85/86 | F3 |
TABLE | 85/87 | F4 | F8 | 8B | 85/87 | F4 |
MATRIX | 85/88 | F5 | F9 | 8C | 85/88 | F5 |
I-Code Token List
Token | Name | Used In | Description |
---|---|---|---|
00 | GLOBAL | Reserved | Global Variable |
01 | PARAM | Editor | |
01 | READ | I-Code | File Mode |
02 | TYPE | Editor | |
02 | WRITE | I-Code | File Mode |
03 | DIM | Editor | |
03 | UPDATE | I-Code | File Mode |
04 | DATA | I-Code/Editor | |
04 | EXEC | I-Code | File Mode |
05 | STOP | I-Code/Editor | |
05 | READ+EXEC | I-Code | File Mode |
06 | BYE | I-Code/Editor | |
06 | WRITE+EXEC | I-Code | File Mode |
07 | TRON | I-Code/Editor | |
07 | UPDATE+EXEC | I-Code | File Mode |
08 | TROFF | I-Code/Editor | |
09 | PAUSE | I-Code/Editor | |
0A | DEG | I-Code/Editor | |
0B | RAD | I-Code/Editor | |
0C | RETURN | I-Code/Editor | |
0D | LET | I-Code/Editor | |
0E | <cva> | I-Code/Editor | Complex Variable Assignment |
0F | POKE | I-Code/Editor | |
10 | IF | I-Code/Editor | |
11 | ELSE | I-Code/Editor | |
12 | ENDIF | I-Code/Editor | |
13 | FOR | I-Code/Editor | |
14 | NEXT | I-Code/Editor | |
15 | WHILE | I-Code/Editor | |
16 | ENDWHILE | I-Code/Editor | |
17 | REPEAT | I-Code/Editor | |
18 | UNTIL | I-Code/Editor | |
19 | LOOP | I-Code/Editor | |
1A | ENDLOOP | I-Code/Editor | |
1B | EXITIF | I-Code/Editor | |
1C | ENDEXIT | I-Code/Editor | |
1D | ON | I-Code/Editor | |
1E | ERROR | I-Code/Editor | |
1F | GOTO | Editor | Unbound |
20 | GOTO | I-Code/Editor | Bound |
21 | GOSUB | Editor | Unbound |
22 | GOSUB | I-Code/Editor | Bound |
23 | RUN | I-Code/Editor | |
24 | KILL | I-Code/Editor | |
25 | INPUT | I-Code/Editor | |
26 | I-Code/Editor | ? Becomes PRINT in the Editor | |
27 | CHD | I-Code/Editor | |
28 | CHX | I-Code/Editor | |
29 | CREATE | I-Code/Editor | |
2A | OPEN | I-Code/Editor | |
2B | SEEK | I-Code/Editor | |
2C | READ | I-Code/Editor | |
2D | WRITE | I-Code/Editor | |
2E | GET | I-Code/Editor | |
2F | PUT | I-Code/Editor | |
30 | CLOSE | I-Code/Editor | |
31 | RESTORE | I-Code/Editor | |
32 | DELETE | I-Code/Editor | |
33 | CHAIN | I-Code/Editor | |
34 | SHELL | I-Code/Editor | |
35 | BASE0 | I-Code/Editor | |
36 | BASE1 | I-Code/Editor | |
37 | REM | Editor | ! Becomes REM in the Editor |
38 | (* | Editor | |
39 | END | I-Code/Editor | |
3A | <ulrf> | Editor | Unbound Line Reference |
3B | <blrf> | I-Code/Editor | Bound Line Reference |
3C | <dex> | I-Code/Editor | Direct Execution (Unimplemented) |
3D | PROCEDURE | Editor | Procedure start |
3D | <erl> | Editor/Debug | Error Line |
3E | \ | I-Code/Editor | End-of-Instruction, Continue Line |
3F | <eol> | I-Code/Editor | End-of-Instruction and Line |
40 | BYTE | Editor | |
40 | fbyte | I-Code/Editor | VDT Entry, Field Byte Variable |
41 | INTEGER | Editor | |
41 | finteger | I-Code/Editor | VDT Entry, Field Integer Variable |
42 | REAL | Editor | |
42 | freal | I-Code/Editor | VDT Entry, Field Real Variable |
43 | BOOLEAN | Editor | |
43 | fboolean | I-Code/Editor | VDT Entry, Field Boolean Variable |
44 | STRING | Editor | |
44 | fstring | I-Code/Editor | VDT Entry, Field String Variable |
45 | THEN | I-Code/Editor | |
45 | frecord | I-Code/Editor | VDT Entry, Field Record Variable |
46 | TO | I-Code/Editor | |
47 | STEP | I-Code/Editor | |
48 | DO | I-Code/Editor | |
48 | fvectorb | I-Code/Editor | VDT Entry, Field 1 Dimensional Byte Array |
49 | USING | I-Code/Editor | |
49 | fvectori | I-Code/Editor | VDT Entry, Field 1 Dimensional Integer Array |
4A | : | I-Code/Editor | File Mode Operator |
4A | fvectorr | I-Code/Editor | VDT Entry, Field 1 Dimensional Real Array |
4B | , | I-Code/Editor | Comma Separator |
4B | fvectorl | I-Code/Editor | VDT Entry, Field 1 Dimensional Boolean Array |
4C | : | I-Code/Editor | Colon |
4C | fvectors | I-Code/Editor | VDT Entry, Field 1 Dimensional String Array |
4D | ( | I-Code/Editor | Left Parenthesis |
4D | fvectoru | I-Code/Editor | VDT Entry, Field 1 Dimensional Record Array |
4E | ) | I-Code/Editor | Right Parenthesis |
4F | [ | I-Code/Editor | Left Bracket |
50 | ] | I-Code/Editor | Right Bracket |
50 | ftableb | I-Code/Editor | VDT Entry, Field 2 Dimensional Byte Array |
51 | ; | I-Code/Editor | Semi-colon |
51 | ftablei | I-Code/Editor | VDT Entry, Field 2 Dimensional Integer Array |
52 | := | I-Code/Editor | AssignmentOperator |
52 | ftabler | I-Code/Editor | VDT Entry, Field 2 Dimensional Real Array |
53 | = | I-Code/Editor | AssignmentOperator |
53 | ftablel | I-Code/Editor | VDT Entry, Field 2 Dimensional Boolean Array |
54 | # | I-Code/Editor | Channel (Path) Number Operator |
54 | ftables | I-Code/Editor | VDT Entry, Field 2 Dimensional String Array |
55 | <ivgt> | I-Code/Editor | Invisible GOTO (used in many statements) |
55 | <ivgt> | I-Code/Editor | Invisible GOTO (special case in ON var GOTO/GOSUB statements) |
55 | ftableu | I-Code/Editor | VDT Entry, Field 2 Dimensional Record Array |
56 | Unused | ||
57 | Unused | ||
58 | fmatrixb | I-Code/Editor | VDT Entry, Field 3 Dimensional Byte Array |
59 | fmatrixi | I-Code/Editor | VDT Entry, Field 3 Dimensional Integer Array |
5A | fmatrixr | I-Code/Editor | VDT Entry, Field 3 Dimensional Real Array |
5B | fmatrixl | I-Code/Editor | VDT Entry, Field 3 Dimensional Boolean Array |
5C | fmatrixs | I-Code/Editor | VDT Entry, Field 3 Dimensional String Array |
5D | fmatrixu | I-Code/Editor | VDT Entry, Field 3 Dimensional Record Array |
5E | Unused | ||
5F | Unused | ||
60 | byte | I-Code/Editor | VDT Entry, Byte Variable |
61 | integer | I-Code/Editor | VDT Entry, Integer Variable |
62 | real | I-Code/Editor | VDT Entry, Real Variable |
63 | boolean | I-Code/Editor | VDT Entry, Boolean Variable |
64 | string | I-Code/Editor | VDT Entry,StringVariable |
65 | record | I-Code/Editor | VDT Entry, Record Variable |
66 | Unused | ||
67 | Unused | ||
68 | vectorb | I-Code/Editor | VDT Entry, 1 Dimensional Byte Array |
69 | vectori | I-Code/Editor | VDT Entry, 1 Dimensional Integer Array |
6A | vectorr | I-Code/Editor | VDT Entry, 1 Dimensional Real Array |
6B | vectorl | I-Code/Editor | VDT Entry, 1 Dimensional Boolean Array |
6C | vectors | I-Code/Editor | VDT Entry, 1 Dimensional String Array |
6D | vectoru | I-Code/Editor | VDT Entry, 1 Dimensional Record Array |
6E | Unused | ||
6F | Unused | ||
70 | tableb | I-Code/Editor | VDT Entry, 2 Dimensional Byte Array |
71 | tablei | I-Code/Editor | VDT Entry, 2 Dimensional Integer Array |
72 | tabler | I-Code/Editor | VDT Entry, 2 Dimensional Real Array |
73 | tablel | I-Code/Editor | VDT Entry, 2 Dimensional Boolean Array |
74 | tables | I-Code/Editor | VDT Entry, 2 Dimensional String Array |
75 | tableu | I-Code/Editor | VDT Entry, 2 Dimensional Record Array |
76 | Unused | ||
77 | Unused | ||
78 | matrixb | I-Code/Editor | VDT Entry, 3 Dimensional Byte Array |
79 | matrixi | I-Code/Editor | VDT Entry, 3 Dimensional Integer Array |
7A | matrixr | I-Code/Editor | VDT Entry, 3 Dimensional Real Array |
7B | matrixl | I-Code/Editor | VDT Entry, 3 Dimensional Boolean Array |
7C | matrixs | I-Code/Editor | VDT Entry, 3 Dimensional String Array |
7D | matrixu | I-Code/Editor | VDT Entry, 3 Dimensional Record Array |
7E | Unused | ||
7F | Unused | ||
80 | byte | I-Code/Editor | Instruction, Simple Byte Variable |
80 | pbyte | I-Code/Editor | VDT Entry, Parameter Byte Variable |
80 | DIR | I-Code | File Mode |
81 | integer | I-Code/Editor | Instruction, Simple Integer Variable |
81 | pinteger | I-Code/Editor | VDT Entry, Parameter Integer Variable |
81 | READ+DIR | I-Code | File Mode |
82 | real | I-Code/Editor | Instruction, Simple Real Variable |
82 | preal | I-Code/Editor | VDT Entry, Parameter Real Variable |
82 | WRITE+DIR | I-Code | File Mode |
83 | boolean | I-Code/Editor | Instruction, Simple Boolean Variable |
83 | pboolean | I-Code/Editor | VDT Entry, Parameter Boolean Variable |
83 | UPDATE+DIR | I-Code | File Mode |
84 | string | I-Code/Editor | Instruction, Simple String Variable |
84 | pstring | I-Code/Editor | VDT Entry, Parameter String Variable |
84 | EXEC+DIR | I-Code | File Mode |
85 | record/p | I-Code/Editor | Instruction,Record, Parameter (Simple/Record) Variable |
85 | vector/p | I-Code/Editor | Instruction, 1 Dimensional Array, Parameter 1 Dimensional Array Variable |
85 | table/p | I-Code/Editor | Instruction, 2 Dimensional Array, Parameter 2 Dimensional Array Variable |
85 | matrix/p | I-Code/Editor | Instruction, 3 Dimensional Array, Parameter 3 Dimensional Array Variable |
85 | precord | I-Code/Editor | VDT Entry, Parameter Record Variable |
85 | READ+EXEC+DIR | I-Code | File Mode |
86 | vector/p | I-Code/Editor | Instruction, 1 Dimensional Array |
86 | WRITE+EXEC+DIR | I-Code | File Mode |
87 | table/p | I-Code/Editor | Instruction, 2 Dimensional Array |
87 | UPDATE+EXEC+DIR | I-Code | File Mode |
88 | matrix/p | I-Code/Editor | Instruction, 3 Dimensional Array |
88 | pvectorb | I-Code/Editor | VDT Entry, Parameter 1 Dimensional Byte Array |
89 | varm | I-Code/Editor | Instruction, Simple/Record Variable Mirror |
89 | pvectori | I-Code/Editor | VDT Entry, Parameter 1 Dimensional Integer Array |
8A | fvectorm | I-Code/Editor | VDT Entry, Field 1 Dimensional Array Mirror |
8A | pvectorr | I-Code/Editor | VDT Entry, Parameter 1 Dimensional Real Array |
8B | ftablem | I-Code/Editor | VDT Entry, Field 2 Dimensional Array Mirror |
8B | pvectorl | I-Code/Editor | VDT Entry, Parameter 1 Dimensional Boolean Array |
8C | fmatrixm | I-Code/Editor | VDT Entry, Field 3 Dimensional Array Mirror |
8C | pvectors | I-Code/Editor | VDT Entry, Parameter 1 Dimensional String Array |
8D | <bc> | I-Code/Editor | BYTE Constant (Literal) |
8D | pvectoru | I-Code/Editor | VDT Entry, Parameter 1 Dimensional Record Array |
8E | <ic> | I-Code/Editor | INTEGER Constant (Literal) |
8F | <rc> | I-Code/Editor | REAL Constant (Literal) |
90 | " | I-Code/Editor | STRING Constant (Literal) - Beginning |
90 | ptableb | I-Code/Editor | VDT Entry, Parameter 2 Dimensional Byte Array |
91 | $ | I-Code/Editor | Hexadecimal Constant (Literal) |
91 | ptablei | I-Code/Editor | VDT Entry, Parameter 2 Dimensional Integer Array |
92 | ADDR() | I-Code/Editor | |
92 | ptabler | I-Code/Editor | VDT Entry, Parameter 2 Dimensional Real Array |
93 | <addr> | I-Code/Editor | Second Byte of ADDR() |
93 | ptablel | I-Code/Editor | VDT Entry, Parameter 2 Dimensional Boolean Array |
94 | SIZE() | I-Code/Editor | |
94 | ptables | I-Code/Editor | VDT Entry, Parameter 2 Dimensional String Array |
95 | <size> | I-Code/Editor | Second Byte of SIZE() |
95 | ptableu | I-Code/Editor | VDT Entry, Parameter 2 Dimensional Record Array |
96 | POS() | I-Code/Editor | |
97 | ERR() | I-Code/Editor | |
98 | MOD() | I-Code/Editor | Byte/Integer |
98 | pmatrixb | I-Code/Editor | VDT Entry, Parameter 3 Dimensional Byte Array |
99 | MOD() | I-Code/Editor | Real |
99 | pmatrixi | I-Code/Editor | VDT Entry, Parameter 3 Dimensional Integer Array |
9A | RND() | I-Code/Editor | |
9A | pmatrixr | I-Code/Editor | VDT Entry, Parameter 3 Dimensional Real Array |
9B | PI | I-Code/Editor | |
9B | pmatrixl | I-Code/Editor | VDT Entry, Parameter 3 Dimensional Boolean Array |
9C | SUBSTR() | I-Code/Editor | |
9C | pmatrixs | I-Code/Editor | VDT Entry, Parameter 3 Dimensional String Array |
9D | SGN() | I-Code/Editor | |
9D | pmatrixu | I-Code/Editor | VDT Entry, Parameter 3 Dimensional Record Array |
9E | SGN() | I-Code/Editor | |
9F | SIN() | I-Code/Editor | |
A0 | COS() | I-Code/Editor | |
A0 | <subr> | I-Code/Editor | Named Subroutine |
A1 | TAN() | I-Code/Editor | |
A2 | ASN() | I-Code/Editor | |
A3 | ACS() | I-Code/Editor | |
A4 | ATN() | I-Code/Editor | |
A5 | EXP() | I-Code/Editor | |
A6 | ABS() | I-Code/Editor | |
A7 | ABS() | I-Code/Editor | |
A8 | LOG() | I-Code/Editor | |
A9 | LOG10() | I-Code/Editor | |
AA | SQRT() | I-Code/Editor | |
AB | SQR() | I-Code/Editor | Becomes SQRT() in the Code |
AC | INT() | I-Code/Editor | Byte/Integer |
AD | INT() | I-Code/Editor | Real |
AE | FIX() | I-Code/Editor | Byte/Integer |
AF | FIX() | I-Code/Editor | Real |
B0 | FLOAT() | I-Code/Editor | Byte/Integer |
B1 | FLOAT() | I-Code/Editor | Real |
B2 | SQ() | I-Code/Editor | Byte/Integer |
B3 | SQ() | I-Code/Editor | Real |
B4 | PEEK() | I-Code/Editor | |
B5 | LNOT() | I-Code/Editor | LogicalNOT |
B6 | VAL() | I-Code/Editor | |
B7 | LEN() | I-Code/Editor | |
B8 | ASC() | I-Code/Editor | |
B9 | LAND() | I-Code/Editor | Logical AND |
BA | LOR() | I-Code/Editor | Logical OR |
BB | LXOR() | I-Code/Editor | Logical XOR |
BC | TRUE | I-Code/Editor | |
BD | FALSE | I-Code/Editor | |
BE | EOF() | I-Code/Editor | |
BF | TRIM$() | I-Code/Editor | |
C0 | MID$() | I-Code/Editor | |
C1 | LEFT$() | I-Code/Editor | |
C2 | RIGHT$() | I-Code/Editor | |
C3 | CHR$() | I-Code/Editor | |
C4 | STR$() | I-Code/Editor | Byte/Integer |
C5 | STR$() | I-Code/Editor | Real |
C6 | DATE$ | I-Code/Editor | |
C7 | TAB | I-Code/Editor | |
C8 | <ritc> | I-Code/Editor | Real->Byte/Integer Type Conversion |
C8 | <fix1> | I-Code/Editor | Fix Top of Stack |
C9 | <fix2> | I-Code/Editor | Fix Second on Stack |
CA | <fix3> | I-Code/Editor | Fix Third on Stack |
CB | <irtc> | I-Code/Editor | Byte/Integer->Real Type Conversion |
CB | <flt1> | I-Code/Editor | Float Top of Stack |
CC | <flt2> | I-Code/Editor | Float Second on Stack |
CD | NOT() | I-Code/Editor | |
CE | - | I-Code/Editor | (Monadic) Negate Byte/Integer |
CF | - | I-Code/Editor | (Monadic) Negate Real |
D0 | AND | I-Code/Editor | |
D1 | OR | I-Code/Editor | |
D2 | XOR | I-Code/Editor | |
D3 | > | I-Code/Editor | Byte/Integer Comparison Operator |
D4 | > | I-Code/Editor | Real Comparison Operator |
D5 | > | I-Code/Editor | String Comparison Operator |
D6 | < | I-Code/Editor | Byte/Integer Comparison Operator |
D7 | < | I-Code/Editor | Real Comparison Operator |
D8 | < | I-Code/Editor | String Comparison Operator |
D9 | <> | I-Code/Editor | Byte/Integer Comparison Operator >< is converted to <> in the code |
DA | <> | I-Code/Editor | Real Comparison Operator >< is converted to <> in the code |
DB | <> | I-Code/Editor | String Comparison Operator >< is converted to <> in the code |
DC | <> | I-Code/Editor | Boolean Comparison Operator >< is converted to <> in the code |
DD | = | I-Code/Editor | Byte/Integer Comparison Operator |
DE | = | I-Code/Editor | Real Comparison Operator |
DF | = | I-Code/Editor | String Comparison Operator |
E0 | = | I-Code/Editor | Boolean Comparison Operator |
E1 | >= | I-Code/Editor | Byte/Integer Greater/Equal Operator |
E2 | >= | I-Code/Editor | Real Greater/Equal Operator |
E3 | >= | I-Code/Editor | String Greater/Equal Operator |
E4 | <= | I-Code/Editor | Byte/Integer Less/Equal Operator |
E5 | <= | I-Code/Editor | Real Less/Equal Operator |
E6 | <= | I-Code/Editor | String Less/Equal Operator |
E7 | + | I-Code/Editor | Byte/Integer Add Operator |
E8 | + | I-Code/Editor | Real Add Operator |
E9 | + | I-Code/Editor | String Concantenate Operator |
EA | - | I-Code/Editor | Byte/Integer Subtract Operator (Dyadic) |
EB | - | I-Code/Editor | Real Subtract Operator (Dyadic) |
EC | * | I-Code/Editor | Byte/Integer Multiply Operator |
ED | * | I-Code/Editor | Real Multiply Operator |
EE | / | I-Code/Editor | Byte/Integer Divide Operator |
EF | / | I-Code/Editor | Real Divide Operator |
F0 | ^ | I-Code/Editor | Exponent Operator |
F1 | ** | I-Code/Editor | Exponent Operator |
F2 | varm/p | I-Code/Editor | Instruction, Simple/Record, Parameter Variable Mirror |
F3 | vectorm/p | I-Code/Editor | Instruction, 1 Dimensional Array, Parameter 1 Dimensional Array Mirror |
F4 | tablem/p | I-Code/Editor | Instruction, 2 Dimensional Array, Parameter 2 Dimensional Array Mirror |
F5 | matrixm/p | I-Code/Editor | Instruction, 3 Dimensional Array, Parameter 3 Dimensional Array Mirror |
F6 | field | I-Code/Editor | Instruction, Field Variable |
F7 | UPDATE | Editor | File Mode |
F7 | fvector | I-Code/Editor | Instruction, Field 1 Dimensional Array |
F8 | EXEC | Editor | File Mode |
F8 | ftable | I-Code/Editor | Instruction, Field 2 Dimensional Array |
F9 | DIR | Editor | File Mode |
F9 | fmatrix | I-Code/Editor | Instruction, Field 3 Dimensional Array |
FA | Unused | ||
FB | Unused | ||
FC | Unused | ||
FD | Unused | ||
FE | Unused | ||
FF | " | I-Code/Editor | STRING Constant (Literal) - Terminator |