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: Difference between revisions

From CoCopedia - The Tandy/Radio Shack Color Computer Wiki
Jump to navigation Jump to search
(in-depth description of I-Code)
 
(added I-Code token list)
Line 5: Line 5:
The tokens used by Basic09 are a single byte ranging from $00 to $FF. The table below defines the tokens.
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
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
!01
10 IF         11 ELSE       12 ENDIF       13 FOR         14 NEXT       15 WHILE       16 ENDWHILE   17 REPEAT
| READ
18 UNTIL       19 LOOP       1A ENDLOOP     1B EXITIF     1C ENDEXIT     1D ON         1E ERROR       1F GOTO
!02
20 GOTO       21 GOSUB       22 GOSUB       23 RUN         24 KILL       25 INPUT       26 PRINT       27 CHD
| WRITE
28 CHX         29 CREATE     2A OPEN       2B SEEK       2C READ       2D WRITE       2E GET         2F PUT
!03
30 CLOSE       31 RESTORE     32 DELETE     33 CHAIN       34 SHELL       35 BASE 0     36 BASE 1     37 REM
| UPDATE
38 (*         39 END         3A             3B igt2       3C             3D             3E \           3F eol
!04
40             41             42             43             44             45 THEN       46 TO         47 STEP
| DATA
48 DO         49 USING       4A :           4B ,           4C             4D (           4E )           4F  
!05
50             51;           52 :=         53 =           54 #           55 igt1       56             57  
| STOP
58             59             5A             5B             5C             5D             5E             5F  
!06
60             61             62             63             64             65             66             67  
| BYE
68             69             6A             6B             6C             6D             6E             6F  
!07
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
!08
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
!09
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()
!0A
A8 LOG()       A9 LOG10()     AA SQRT()     AB             AC INT()       AD INT()       AE FIX()       AF FIX()
| DEG
B0 FLOAT()     B1 FLOAT()     B2 SQ()       B3 SQ()       B4 PEEK()     B5 LNOT()     B6 VAL()       B7 LEN()
!0B
B8 ASC()       B9 LAND(,)     BA LOR(,)     BB LXOR(,)     BC TRUE       BD FALSE       BE EOF()       BF TRIM$()
| RAD
C0 MID$(,,)   C1 LEFT$(,)   C2 RIGHT$(,)   C3 CHR$()     C4 STR$()     C5 STR$()     C6 DATE$       C7 TAB
!0C
C8 ritc       C9             CA             CB irtc       CC             CD NOT()       CE             CF  
| RETURN
D0 AND         D1 OR         D2 XOR         D3 >           D4 >           D5 >           D6 <           D7 <
!0D
D8 <           D9 <>         DA <>         DB <>         DC <>         DD =           DE =           DF =
| LET
E0 =           E1 >=         E2 >=         E3 >=         E4 <=         E5 <=         E6 <=         E7 +
!0E
E8 +           E9 +           EA -           EB -           EC *           ED *           EE /           EF /
|
F0 ^           F1 **         F2 avt         F3 1dim       F4 2dim       F5 3dim       F6 udtv       F7 UPDATE
!0F
F8 EXEC       F9 DIR         FA             FB             FC             FD             FE             FF "
| POKE
 
|-
00             01 PARAM       02 TYPE       03 DIM         04 READ+EXEC   05 WRITE+EXEC 06 UPDATE+EXEC
!10
3D PROCEDURE   81 READ+DIR   82 WRITE+DIR   83 UPDATE+DIR
| 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
|}

Revision as of 17:15, 7 August 2009

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.

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