[NEXT] [PREV]
HANDBOOK
/ CASE STUDY
/ The Target Machine
/ICode Instructions 

Gentle
Applications Concepts Examples Handbook Support Download

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 InstructionsLDA l oload 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 InstructionsSTIstore into address contained in the element below the top
S[S[SP1]]:=S[SP]; SP:=SP1; Jump InstructionsJMP aunconditional jump
PC:=a;FJP a conditional jump
if not S[SP] then PC:=a; SP:=SP1; Arithmetic InstructionsADD taddition of type t
SP:=SP1; S[SP]:=S[SP]+S[SP+1];SUB integer subtraction
SP:=SP1; S[SP]:=S[SP]S[SP+1];MUL t multiplication of type t
SP:=SP1; S[SP]:=S[SP]*S[SP+1]; Logic InstructionsINVS[SP]:=not S[SP];LES t less operation of type t
SP:=SP1; S[SP]:=S[SP] 