SUB
|
Subtraction without borrow
|
SUB
|
SUBtract
|
[Syntax]
(1)SUB src, dest
(2)SUB src, src2, dest
[Operation]
(1)dest = dest - src;
(2)dest = src2 - src;
[Function]
- | (1)This instruction subtracts src from dest and places the result in dest. |
- | (2)This instruction subtracts src from src2 and places the result in dest. |
[Instruction Format]
|
|
|
|
|
|
(1)SUB src, dest
|
|
#UIMM:4
|
–
|
Rd
|
|
|
Rs
|
–
|
Rd
|
|
|
[Rs].memex
|
–
|
Rd
|
|
|
dsp:8[Rs].memex
|
–
|
Rd
|
|
|
dsp:16[Rs].memex
|
–
|
Rd
|
|
(2)SUB src, src2, dest
|
|
Rs
|
Rs2
|
Rd
|
|
[Flag Change]
Conditions
C : The flag is set if an unsigned operation produces no overflow; otherwise it is cleared.
Z : The flag is set if dest is 0 after the operation; otherwise it is cleared.
S : The flag is set if the MSB of dest after the operation is 1; otherwise it is cleared.
O : The flag is set if a signed operation produces an overflow; otherwise it is cleared.
[Description Example]
SUB #15, R2
SUB R1, R2
SUB [R1], R2
SUB 1[R1].B, R2
SUB R1, R2, R3