Propeller Manual

Table Of Contents
ADDX – Assembly Language Reference
ADDX
Instruction: Add two unsigned values plus C.
ADDX Value1, # Value2
Result: Sum of unsigned Value1 and unsigned Value2 plus C flag is stored in Value1.
Value1 (d-field) is the register containing the value to add to Value2 plus C, 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 added into Value1.
Opcode Table:
–INSTR– ZCRI –CON– –DEST– –SRC– Z Result C Result Result Clocks
110010 001i 1111 ddddddddd sssssssss
Z & (D+S+C = 0)
Unsigned Carry Written 4
Concise Truth Table:
In Out
Destination
1
Source
1
Z
C
Effects
Destination Z C
$FFFF_FFFE; 4,294,967,294 $0000_0001; 1 x
0
wz wc
$FFFF_FFFF; 4,294,967,295 0 0
$FFFF_FFFE; 4,294,967,294 $0000_0001; 1 0
1
wz wc
$0000_0000; 0 0 1
$FFFF_FFFE; 4,294,967,294 $0000_0001; 1 1
1
wz wc
$0000_0000; 0 1 1
1
Both Source and Destination are treated as unsigned values.
Explanation
ADDX (Add Extended) sums the two unsigned values of Value1 and Value2 plus C, and stores
the result into the Value1 register. The
ADDX instruction is used to perform multi long
addition; 64-bit additions, for example.
In a multi-long operation, the first instruction is unsigned (ex:
ADD), any middle instructions
are unsigned, extended (ex:
ADDX), and the last instruction is unsigned, extended (ADDX) or
signed, extended (
ADDSX) depending on the nature of the original multi-long values. We’ll
discuss unsigned multi-long values here; see
ADDSX on page 262 for examples with signed,
multi-long values. Make sure to use the
WC, and optionally WZ, effect on the leading ADD and
ADDX instructions.
For example, an unsigned double-long (64-bit) addition may look like this:
add XLow, YLow wc wz 'Add low longs together; save C and Z
addx XHigh, YHigh 'Add high longs together
Page 264 · Propeller Manual v1.1