SUBSX – Assembly Language Reference SUBSX Instruction: Subtract signed value plus C from another signed value.
SUBSX SValue1, 〈#〉 SValue2 Result: Difference of signed SValue1, and signed SValue2 plus C flag, is stored in SValue1. • •
SValue1 (d-field) is the register containing the value to subtract SValue2 plus C from, and is the destination in which to write the result. SValue2 (s-field) is a register or a 9-bit literal whose value plus C is subtracted from SValue1.
Opcode Table: –INSTR– ZCRI –CON–
–DEST–
–SRC–
Z Result
110111 001i 1111 ddddddddd sssssssss Z & (D–(S+C) = 0)
C Result Signed Overflow
Result Written
Clocks 4
Concise Truth Table: In Destination
Source
Z C Effects
$0000_0001; $0000_0001;
1 1
$0000_0001; $0000_0001;
1 1
0 0 1 0
wz wc
$0000_0001;
1
$0000_0001;
Out Destination
Z C
wz wc
$0000_0000; $0000_0000;
0 0
0 1
0 0
1
x 1
wz wc
$FFFF_FFFF; -1
0
0
$FFFF_FFFF; -1 $FFFF_FFFF; -1
$FFFF_FFFF; -1 $FFFF_FFFF; -1
0 0 1 0
wz wc wz wc
$0000_0000; 0 $0000_0000; 0
0 1
0 0
$FFFF_FFFF; -1
$FFFF_FFFF; -1
x 1
wz wc
$FFFF_FFFF; -1
0
0
$8000_0000; -2,147,483,648 0 $7FFF_FFFF; 2,147,483,647 0
0 1
$8000_0000; -2,147,483,648 0 $7FFF_FFFF; 2,147,483,647 0
1 0
$8000_0001; -2,147,483,647 $8000_0001; -2,147,483,647
$0000_0001; $0000_0001;
1 1
x 0 x 1
wz wc
$7FFF_FFFF; $7FFF_FFFF;
$FFFF_FFFF; -1 $FFFF_FFFF; -1
x 0 x 1
wz wc
2,147,483,647 2,147,483,647
wz wc wz wc
Explanation SUBSX (Subtract Signed, Extended) subtracts the signed value of SValue2 plus C from SValue1, and stores the result into the SValue1 register. The SUBSX instruction is used to perform signed multi-long subtraction; 64-bit subtractions, for example. In a signed multi-long operation, the first instruction is unsigned (ex: SUB), any middle instructions are unsigned, extended (ex: SUBX), and the last instruction is signed, extended Page 352 · Propeller Manual v1.1