For each ICode instruction its operation code, its parameters and its meaning are given in the following. The meaning is given as text and as formula which describe operations on the runtime stack. To simplify the description, within formulas it is not taken care about the types of the stack elements.
If not further mentioned, the operations apply to the top of the stack, which contains the actual element. The following shorthand notations are used:
Note: The types integer, real and boolean are encoded with 1, 2, and 3. The boolean values FALSE and TRUE are encoded by 0 and 1.
load address with base and offset
SP:=SP+1 S[SP]:=base(l)+o;LDC t c
load constant c of type t
SP:=SP+1; S[SP]:=c;LDI load indirect
S[SP]:=S[S[SP]]
store into address contained in the element below the top
S[S[SP-1]]:=S[SP]; SP:=SP-1;
unconditional jump
PC:=a;FJP a
conditional jump
if not S[SP] then PC:=a; SP:=SP-1;
addition of type t
SP:=SP-1; S[SP]:=S[SP]+S[SP+1];SUB
integer subtraction
SP:=SP-1; S[SP]:=S[SP]-S[SP+1];MUL t
multiplication of type t
SP:=SP-1; S[SP]:=S[SP]*S[SP+1];
S[SP]:=not S[SP];LES t
less operation of type t
SP:=SP-1; S[SP]:=S[SP]Address Calculation Instructions
IXA c"compute indexed address
SP:=SP-1; S[SP]:=c*S[SP+1]+S[SP];Convert Instructions
FLTconverts from integer to real
S[SP]:=real(S[SP]);Input-Output Instructions
WRI t
write(S[SP]); SP:=SP-1;REA tSP:=SP+1; read(S[SP]);Subroutine Handling Instructions
MST lactivation record initialization:
S[SP+1]:=base(l);- store static predecessor S[SP+2]:=AP; - store dynamic predecessor SP:=SP+3; - return address (=S[SP+3]) is stored by JSRJSR o aset AP to point to new activation record
o = number of locations for parameters
AP:=SP-(o+2); S[AP+2]:=PC; - store return address PC:=a ; - set PC to first instruction of subroutineENT ostorage reservation for new block
o = length of local data segment
SP:=SP+oRETreturn from subroutine:
SP:=AP-1; PC:=S[SP+3]; - fetch return address to restore PC AP:=S[SP+2]; - restore activation record pointer APCheck Instructions
CHK c1 c2check against upper and lower bounds
if (S[SP]c2) then error
![]()