Work / Virtual Machine / Instruction Set
2012-01-14 21:38:31
Conditional
JMP (UNCONDITIONAL JUMP)
Usage:
1 2 3 | jmp symbol ; branch control to specified local symbol |
Operation:
- Increments EIP by the relative offset of the specified symbol from the current value of EIP.
Note: The value stored in the bytecode is the relative offset of the symbol in relation to the current location of EIP. This is the case for all jump instructions.
JZ (JUMP IF ZERO)
Usage:
1 2 3 | jz n, symbol ; branch control to specified local symbol if value of local variable n is zero |
Operation:
- Reads the condition value from specified local variable.
- If the condition value is zero, EIP is incremented by the relative offset of the symbol from the current vaue of EIP.
- If the condition value is not zero, EIP is incremented to point to the next instruction.
JNZ (JUMP IF NOT ZERO)
Usage:
1 2 3 | jnz n, symbol ; branch control to specified local symbol if value of local variable n is not zero |
Operation:
- Reads the condition value from specified local variable.
- If the condition value is not zero, EIP is incremented by the relative offset of the symbol from the current vaue of EIP.
- If the condition value is zero, EIP is incremented to point to the next instruction.
JCMP (JUMP IF COMPARABLE)
Usage:
1 2 3 | jcmp n, m, symbol ; branch control to specified local symbol if local variables n and m are equal in value |
Operation:
- Reads the condition values from specified local variables.
- If the condition values are the same, EIP is incremented by the relative offset of the symbol from the current vaue of EIP.
- If the condition values are not the same, EIP is incremented to point to the next instruction.
JNCMP (JUMP IF NOT COMPARABLE)
Usage:
1 2 3 | jncmp n, m ; comment |
Operation:
- operation
JG (JUMP IF GREATER)
Usage:
1 2 3 | jg n, m ; comment |
Operation:
- operation
JL (JUMP IF LESS)
Usage:
1 2 3 | jl n, m ; comment |
Operation:
- operation
JGE (JUMP IF GREATER THAN OR EQUAL)
Usage:
1 2 3 | jge n, m ; comment |
Operation:
- operation
JLE (JUMP IF LESS THAN OR EQUAL)
Usage:
1 2 3 | jle n, m ; comment |
Operation:
- operation
JGZ (JUMP IF GREATER THAN ZERO)
Usage:
1 2 3 | jgz n, m ; comment |
Operation:
- operation
JLZ (JUMP IF LESS THAN ZERO)
Usage:
1 2 3 | jlz n, m ; comment |
Operation:
- operation
JIG (JUMP IF GREATER THAN)
Usage:
1 2 3 | jig n, m ; comment |
Operation:
- operation
JIL (JUMP IF LESS THAN)
Usage:
1 2 3 | jil n, m ; comment |
Operation:
- operation
JIGE (JUMP IF GREATER THAN OR EQUAL)
Usage:
1 2 3 | jige n, m ; comment |
Operation:
- operation
JILE (JUMP IF LESS THAN OR EQUAL)
Usage:
1 2 3 | jile n, m ; comment |
Operation:
- operation
JIGZ (JUMP IF GREATER THAN ZERO)
Usage:
1 2 3 | jigz n, m ; comment |
Operation:
- operation