Propeller Manual

Table Of Contents
SUBABS – Assembly Language Reference
SUBABS
Instruction: Subtract an absolute value from another value.
SUBABS Value, # SValue
Result: Difference of Value and absolute of signed SValue is stored in Value.
Value (d-field) is the register containing the value to subtract the absolute of SValue
from, 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 subtracted from
Value.
Opcode Table:
–INSTR– ZCRI –CON– –DEST– –SRC– Z Result C Result Result Clocks
100011 001i 1111 ddddddddd sssssssss
D - |S| = 0 Unsigned Borrow
1
Written 4
1
If S is negative, C Result is the inverse of unsigned carry (for D + S).
Concise Truth Table:
In Out
Destination
1
Source Z
C
Effects
Destination Z C
$0000_0003; 3 $FFFF_FFFC; -4 -
-
wz wc
$FFFF_FFFF; 4,294,967,295 0 0
$0000_0003; 3 $FFFF_FFFD; -3 -
-
wz wc
$0000_0000; 0 1 1
$0000_0003; 3 $FFFF_FFFE; -2 -
-
wz wc
$0000_0001; 1 0 1
$0000_0003; 3 $FFFF_FFFF; -1 -
-
wz wc
$0000_0002; 2 0 1
$0000_0003; 3 $0000_0002; 2 -
-
wz wc
$0000_0001; 1 0 0
$0000_0003; 3 $0000_0003; 3 -
-
wz wc
$0000_0000; 0 1 0
$0000_0003; 3 $0000_0004; 4 -
-
wz wc
$FFFF_FFFF; 4,294,967,295 0 1
1
Destination is treated as an unsigned value.
Explanation
SUBABS subtracts the absolute of SValue from Value 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 subtraction resulted in an unsigned borrow
(32-bit overflow). The result is written to Value unless the
NR effect is specified.
Page 350 · Propeller Manual v1.1