Instruction List (IL)
An instruction list (IL) consists of a series of instructions. Each instruction begins in a new line and contains an operator and, depending on the type of operation, one or more operands separated by commas. In front of an instruction there can be an identification mark (label) followed by a colon (:).
A comment must be the last element in a line. Empty lines can be inserted between instructions.
Example:
LD 17
ST lint (* comment *)
GE 5
JMPC next
LD idword
EQ istruct.sdword
STN test
next:
Modifiers and operators in IL
In the IL language the following operators and modifiers can be used.
Modifiers:
- C with JMP, CAL, RET: The instruction is only then executed if the result of the preceding expression is TRUE.
- N with JMPC, CALC, RETC: The instruction is only then executed if the result of the preceding expression is FALSE.
- N otherwise: Negation of the operand (not of the accumulator)
Below you find a table of all operators in IL with their possible modifiers and the relevant meaning:
Operator | Modifiers | Meaning |
---|---|---|
LD | N | Make current result equal to the operand |
ST | N | Save current result at the position of the Operand |
S |
| Put the Boolean operand exactly at TRUE if the current result is TRUE |
R |
| Put the Boolean operand exactly at FALSE if the current result is TRUE |
AND | N, ( | Bitwise AND |
OR | N, ( | Bitwise OR |
XOR | ( | Bitwise exklusive OR |
ADD | ( | Addition |
SUB | ( | Subtraction |
MUL | ( | Multiplication |
DIV | ( | Division |
GT | ( | > |
GE | ( | >= |
EQ | ( | = |
NE | ( | <> |
LE | ( | <= |
LT | ( | < |
JMP | CN | Jump to label |
CAL | CN | call function block |
RET | CN | Return from call of a function block |
) |
| Evaluate deferred operation |
You find a list of all IEC operators in the appendix.
Example of an IL program while using some modifiers:
LD TRUE (*load TRUE in the accumulator*)
ANDN BOOL1 (*execute AND with the negated value of the BOOL1 variable*)
JMPC label (*if the result was TRUE, then jump to the label "label"*)
LDN BOOL2 (*save the negated value of *)
ST ERG (*BOOL2 in ERG*)
label:
LD BOOL2 (*save the value of *)
ST ERG (*BOOL2 in ERG*)
It is also possible in IL to put parentheses after an operation. The value of the parenthesis is then considered as an operand.
For example:
LD 2
MUL 2
ADD 3
ST Erg
Here is the value of Erg 7. However, if one puts parentheses:
LD 2
MUL( 2
ADD 3
)
ST Erg
Here the resulting value for Erg is 10, then the operation MUL is only then evaluated if you come to ")"; as operand for MUL 5 is then calculated.