Next: , Previous: , Up: MIX instruction set   [Contents][Index]


2.1.2.6 Comparison operators

So far, we have learned how to move values around between the MIX registers and its memory cells, and also how to perform arithmetic operations using these values. But, in order to write non-trivial programs, other functionalities are needed. One of the most common is the ability to compare two values, which, combined with jumps, will allow the execution of conditional statements. The following instructions compare the value of a register with ‘V’, and set the CM indicator to the result of the comparison (i.e. to ‘E’, ‘G’ or ‘L’, equal, greater or lesser respectively).

CMPA

Compare [rA] with V. OPCODE = 56, MOD = fspec.

CMPX

Compare [rX] with V. OPCODE = 63, MOD = fspec.

CMPi

Compare [rIi] with V. OPCODE = 56 + i, MOD = fspec.

As explained above, these instructions modify the value of the MIX comparison indicator; but maybe you are asking yourself how do you use this value: enter jump operators, in the next subsection.