The Structure of I-Code

From CoCopedia - The Tandy/Radio Shack Color Computer Wiki
Revision as of 11:44, 7 August 2009 by Wayne (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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. The table below defines the tokens.

(table to be reformatted)

00 01 READ 02 WRITE 03 UPDATE 04 DATA 05 STOP 06 BYE 07 08 09 0A DEG 0B RAD 0C RETURN 0D LET 0E 0F POKE 10 IF 11 ELSE 12 ENDIF 13 FOR 14 NEXT 15 WHILE 16 ENDWHILE 17 REPEAT 18 UNTIL 19 LOOP 1A ENDLOOP 1B EXITIF 1C ENDEXIT 1D ON 1E ERROR 1F GOTO 20 GOTO 21 GOSUB 22 GOSUB 23 RUN 24 KILL 25 INPUT 26 PRINT 27 CHD 28 CHX 29 CREATE 2A OPEN 2B SEEK 2C READ 2D WRITE 2E GET 2F PUT 30 CLOSE 31 RESTORE 32 DELETE 33 CHAIN 34 SHELL 35 BASE 0 36 BASE 1 37 REM 38 (* 39 END 3A 3B igt2 3C 3D 3E \ 3F eol 40 41 42 43 44 45 THEN 46 TO 47 STEP 48 DO 49 USING 4A : 4B , 4C 4D ( 4E ) 4F 50 51; 52 := 53 = 54 # 55 igt1 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 BYTE 81 INTEGER 82 REAL 83 BOOLEAN 84 STRING 85 udv 86 1dim 87 2dim 88 3dim 89 udtv 8A 8B 8C 8D bc 8E ic 8F rc 90 " 91 $ 92 ADDR() 93 94 SIZE() 95 SIZE() 96 POS() 97 ERR 98 MOD(,) 99 MOD(,) 9A RND() 9B PI 9C SUBSTR(,) 9D SGN() 9E SGN() 9F SIN() A0 COS() A1 TAN() A2 ASN() A3 ACS() A4 ATN() A5 EXP() A6 ABS() A7 ABS() A8 LOG() A9 LOG10() AA SQRT() AB AC INT() AD INT() AE FIX() AF FIX() B0 FLOAT() B1 FLOAT() B2 SQ() B3 SQ() B4 PEEK() B5 LNOT() B6 VAL() B7 LEN() B8 ASC() B9 LAND(,) BA LOR(,) BB LXOR(,) BC TRUE BD FALSE BE EOF() BF TRIM$() C0 MID$(,,) C1 LEFT$(,) C2 RIGHT$(,) C3 CHR$() C4 STR$() C5 STR$() C6 DATE$ C7 TAB C8 ritc C9 CA CB irtc CC CD NOT() CE CF D0 AND D1 OR D2 XOR D3 > D4 > D5 > D6 < D7 < D8 < D9 <> DA <> DB <> DC <> DD = DE = DF = E0 = E1 >= E2 >= E3 >= E4 <= E5 <= E6 <= E7 + E8 + E9 + EA - EB - EC * ED * EE / EF / F0 ^ F1 ** F2 avt F3 1dim F4 2dim F5 3dim F6 udtv F7 UPDATE F8 EXEC F9 DIR FA FB FC FD FE FF "

00 01 PARAM 02 TYPE 03 DIM 04 READ+EXEC 05 WRITE+EXEC 06 UPDATE+EXEC 3D PROCEDURE 81 READ+DIR 82 WRITE+DIR 83 UPDATE+DIR