ADDABS
Instruction: Add an absolute value to another value.
ADDABS Value, < # > SValue
Result: Sum of Value and absolute of signed SValue is stored in Value.
- Value (d-field) is the register containing the value to add to the absolute of SValue and is the destination in which to write the result.
- SValue (s-field) is a register or a 9-bit literal whose absolute value is added into Value. Literal SValues are zero-extended (always positive values) so ADDABS is best used with register SValues.
Opcode Table:
–INSTR– ZCRI –CON– –DEST– –SRC– | Z Result | C Result | Result | Clocks |
100010 001i 1111 ddddddddd sssssssss | D + |S| = 0 | Unsigned Carry1 | Written | 4 |
1 If S is negative, C Result is the inverse of unsigned borrow (for D - S).
Concise Truth Table:
In | Out | ||||||
Destination1 | Source | Z | C | Effects | Destination | Z | C |
$FFFF_FFFD; 4,294,967,293 | $0000_0004; 4 | - | - | wz wc | $0000_0001; 1 | 0 | 1 |
$FFFF_FFFD; 4,294,967,293 | $0000_0003; 3 | - | - | wz wc | $0000_0000; 0 | 1 | 1 |
$FFFF_FFFD; 4,294,967,293 | $0000_0002; 2 | - | - | wz wc | $FFFF_FFFF; 4,294,967,295 | 0 | 0 |
$FFFF_FFFD; 4,294,967,293 | $FFFF_FFFF; -1 | - | - | wz wc | $FFFF_FFFE; 4,294,967,294 | 0 | 1 |
$FFFF_FFFD; 4,294,967,293 | $FFFF_FFFE; -2 | - | - | wz wc | $FFFF_FFFF; 4,294,967,295 | 0 | 1 |
$FFFF_FFFD; 4,294,967,293 | $FFFF_FFFD; -3 | - | - | wz wc | $0000_0000; 0 | 1 | 0 |
$FFFF_FFFD; 4,294,967,293 | $FFFF_FFFC; -4 | - | - | wz wc | $0000_0001; 1 | 0 | 0 |
1 Destination is treated as an unsigned value.
Explanation
ADDABS sums Value and the absolute of SValue together and stores the result into the Value register.
If the WZ effect is specified, the Z flag is set (1) if Value + |SValue| equals zero. If the WC effect is specified, the C flag is set (1) if the summation resulted in an unsigned carry (32-bit overflow). The result is written to Value unless the NR effect is specified.
Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.