Next: , Previous: Storing operators, Up: MIX instruction set


2.1.2.4 Arithmetic operators

The following instructions perform arithmetic operations between rA and rX register and memory contents.

ADD
Add and set OV if overflow. OPCODE = 1, MOD = fspec. rA <- rA +V.
SUB
Sub and set OV if overflow. OPCODE = 2, MOD = fspec. rA <- rA - V.
MUL
Multiply V times rA and store the 10-bytes product in rAX. OPCODE = 3, MOD = fspec. rAX <- rA x V.
DIV
rAX is considered a 10-bytes number, and it is divided by V. OPCODE = 4, MOD = fspec. rA <- rAX / V, rX <- reminder.

In all the above instructions, `[rA]' is one of the operands of the binary arithmetic operation, the other being `V' (that is, the specified subfield of the memory cell with address `M'), padded with zero bytes on its left-side to complete a word. In multiplication and division, the register `X' comes into play as a right-extension of the register `A', so that we are able to handle 10-byte numbers whose more significant bytes are those of `rA' (the sign of this 10-byte number is that of `rA': `rX''s sign is ignored).

Addition and substraction of MIX words can give rise to overflows, since the result is stored in a register with room to only 5 bytes (plus sign). When this occurs, the operation result modulo 1,073,741,823 (the maximum value storable in a MIX word) is stored in `rA', and the overflow toggle is set to TRUE.