Next: Input-output operators, Previous: Comparison operators, Up: MIX instruction set
The MIX computer has an internal register, called the location
counter, which stores the address of the next instruction to be fetched
and executed by the virtual CPU. You cannot directly modify the contents
of this internal register with a load instruction: after fetching the
current instruction from memory, it is automatically increased in one
unit by the MIX. However, there is a set of instructions (which we call
jump instructions) which can alter the contents of the location counter
provided some condition is met. When this occurs, the value of the next
instruction address that would have been fetched in the absence of the
jump is stored in `rJ' (except for JSJ
), and the location
counter is set to the value of `M' (so that the next instruction is
fetched from this new address). Later on, you can return to the point
when the jump occurred reading the address stored in `rJ'.
The MIX computer provides the following jump instructions: With these instructions you force a jump to the specified address. Use `JSJ' if you do not care about the return address.
JMP
JSJ
These instructions check the overflow toggle to decide whether to jump or not.
JOV
JNOV
In the following instructions, the jump is conditioned to the contents of the comparison flag:
JL
[CM] = L
. OPCODE = 39, MOD = 4.
JE
[CM] = E
. OPCODE = 39, MOD = 5.
JG
[CM] = G
. OPCODE = 39, MOD = 6.
JGE
[CM]
does not equal L
. OPCODE = 39, MOD = 7.
JNE
[CM]
does not equal E
. OPCODE = 39, MOD = 8.
JLE
[CM]
does not equal G
. OPCODE = 39, MOD = 9.
You can also jump conditioned to the value stored in the MIX registers, using the following instructions:
JAN
JAZ
JAP
JANN
JANZ
JANP
JXN
JXZ
JXP
JXNN
JXNZ
JXNP
JiN
JiZ
JiP
JiNN
JiNZ
JiNP