SUB Instruction

Purpose:To perform arithmetic subtraction
Format:opcode sub.rx, dif.mx
opcode sub.rx, min.rx, dif.wx
Operation:dif <- dif - sub;
dif <- min - sub;
Condition
Codes:
N <- dif LSS 0;
Z <- dif EQL 0;
V <- Overflow;
C <- {borrow from most significant bit} (Integer);
C <- 0 (Floating);
Exceptions:Integer Overflow
Floating Overflow
Floating Underflow
Reserved Operand (Floating)
Opcodes:
82SUBB2/td>Subtract Byte 2 Operand
83SUBB3/td>Subtract Byte 3 Operand
A2SUBW2/td>Subtract Byte 2 Operand
A3SUBW3/td>Subtract Byte 3 Operand
C2SUBL2/td>Subtract Byte 2 Operand
C3SUBL3/td>Subtract Byte 3 Operand
42SUBF2/td>Subtract Byte 2 Operand
43SUBF3/td>Subtract Byte 3 Operand
62SUBD2/td>Subtract Byte 2 Operand
63SUBD3/td>Subtract Byte 3 Operand
Description: In the 2 operand format, the subtrahend operand is subtracted from the the difference operand and the difference operand is replaced with the result.

In the 3 Operand format, the subtrahend is subtracted from the minuend operand and the difference operand is replaced with the result.

In the floating point format, the result is rounded.

Notes:
1.
Integer overflow occurs if the input operands to the subtract are of different signs and the sign of the result is the sign of the subtrahend. On Overflow, the difference operand is replaced by the low order bits of the true result.
2.
On a floating reserved operand fault, the difference operand is unaffected and the condition codes are unpredictable.
3.
On floating point underflow, the difference operand is replaced by 0.
4.
On floating point overflow, the difference operand is replaced by an operand of all 0 bits except for a sign bit of 1 (a reserved operand fault). N <- 1; Z <- 0; V & lt- 1; and C <- 0;