SUMZ
Instruction: Sum a signed value with another whose sign is inverted depending on Z.
SUMZ SValue1, < # > SValue2
Result: Sum of signed SValue1 and ±SValue2 is stored in SValue1.
- SValue1 (d-field) is the register containing the value to sum with either –SValue2 or SValue2, and is the destination in which to write the result.
- SValue2 (s-field) is a register or a 9-bit literal whose value is sign-affected by Z and summed into SValue1.
Opcode Table:
–INSTR– ZCRI –CON– –DEST– –SRC– | Z Result | C Result | Result | Clocks |
100110 001i 1111 ddddddddd sssssssss | D ± S = 0 | Signed Overflow | Written | 4 |
Concise Truth Table:
In | Out | ||||||
Destination | Source | Z | C | Effects | Destination | Z | C |
$0000_0001; 1 | $0000_0001; 1 | 0 | - | wz wc | $0000_0002; 2 | 0 | 0 |
$0000_0001; 1 | $0000_0001; 1 | 1 | - | wz wc | $0000_0000; 0 | 1 | 0 |
$0000_0001; 1 | $FFFF_FFFF; -1 | 0 | - | wz wc | $0000_0000; 0 | 1 | 0 |
$FFFF_FFFF; -1 | $FFFF_FFFF; -1 | 0 | - | wz wc | $FFFF_FFFE; -2 | 0 | 0 |
$FFFF_FFFF; -1 | $FFFF_FFFF; -1 | 1 | - | wz wc | $0000_0000; 0 | 1 | 0 |
$FFFF_FFFF; -1 | $0000_0001; 1 | 0 | - | wz wc | $0000_0000; 0 | 1 | 0 |
$8000_0000; -2,147,483,648 | $0000_0001; 1 | 0 | - | wz wc | $8000_0001; -2,147,483,647 | 0 | 0 |
$8000_0000; -2,147,483,648 | $0000_0001; 1 | 1 | - | wz wc | $7FFF_FFFF; 2,147,483,647 | 0 | 1 |
$8000_0000; -2,147,483,648 | $FFFF_FFFF; -1 | 0 | - | wz wc | $7FFF_FFFF; 2,147,483,647 | 0 | 1 |
$7FFF_FFFF; 2,147,483,647 | $FFFF_FFFF; -1 | 0 | - | wz wc | $7FFF_FFFE; 2,147,483,646 | 0 | 0 |
$7FFF_FFFF; 2,147,483,647 | $FFFF_FFFF; -1 | 1 | - | wz wc | $8000_0000; -2,147,483,648 | 0 | 1 |
$7FFF_FFFF; 2,147,483,647 | $0000_0001; 1 | 0 | - | wz wc | $8000_0000; -2,147,483,648 | 0 | 1 |
Explanation
SUMZ (Sum with Z-affected sign) adds the signed value of SValue1 to –SValue2 (if Z = 1) or to SValue2 (if Z = 0) and stores the result into the SValue1 register.
If the WZ effect is specified, the Z flag is set (1) if SValue1 ± SValue2 equals zero. If the WC effect is specified, the C flag is set (1) if the summation resulted in a signed overflow. The result is written to SValue1 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.