Propeller Manual

Table Of Contents
SUBX – Assembly Language Reference
SUBX
Instruction: Subtract unsigned value plus C from another unsigned value.
SUBX Value1, # Value2
Result: Difference of unsigned Value1, and unsigned Value2 plus C flag, is stored in Value1.
Value1 (d-field) is the register containing the value to subtract Value2 plus C from,
and is the destination in which to write the result.
Value2 (s-field) is a register or a 9-bit literal whose value plus C is subtracted from
Value1.
Opcode Table:
INSTR– ZCRI
CON
DEST–
SRC
Z Result
C Result
Result Clocks
110011 001i 1111 ddddddddd sssssssss
Z & (D
(S+C) = 0)
Unsigned Borrow
Written 4
Concise Truth Table:
In Out
Destination
1
Source
1
Z
C
Effects
Destination Z C
$0000_0001; 1 $0000_0001; 1 0
0
wz wc
$0000_0000; 0 0 0
$0000_0001; 1 $0000_0001; 1 1
0
wz wc
$0000_0000; 0 1 0
$0000_0001; 1 $0000_0001; 1 x
1
wz wc
$FFFF_FFFF; 4,294,967,295 0 1
1
Both Source and Destination are treated as unsigned values.
Explanation
SUBX (Subtract Extended) subtracts the unsigned value of Value2 plus C from the unsigned
Value1 and stores the result into the Value1 register. The
SUBX instruction is used to perform
multi long subtraction; 64-bit subtractions, for example.
In a multi-long operation, the first instruction is unsigned (ex:
SUB), any middle instructions
are unsigned, extended (ex:
SUBX), and the last instruction is unsigned, extended (SUBX) or
signed, extended (
SUBSX) depending on the nature of the original multi-long values. We’ll
discuss unsigned multi-long values here; see
SUBSX on page 352 for examples with signed,
multi-long values. Make sure to use the
WC, and optionally WZ, effect on the leading SUB and
SUBX instructions.
Page 354 · Propeller Manual v1.1