79
CHAPTER 7 DETAILED EXECUTION INSTRUCTIONS
7.8 SUB (Subtract Word Data in Source Register from
Destination Register)

Subtracts the word data in "Rj" from the word data in "Ri", stores results to "Ri".

SUB (Subtract Word Data in Source Register from Destination Register)

Assembler format: SUB Rj, Ri
Operation: Ri – Rj Ri
Flag change:
N : Set when the MSB of the operation result is "1", cleared when the MSB is "0".
Z : Set when the operation result is "0", cleared otherwise.
V : Set when an overflow has occurred as a result of the operation, cleared otherwise.
C : Set when a borrow has occurred as a result of the operation, cleared otherwise.
Execution cycles: 1 cycle
Instruction format:
Example: SUB R2, R3
NZVC
CCCC
MSB LSB
10101100 Rj Ri
R2
R3
1234 5678
9999 9999
NZVC
CCR
R2
R3
CCR
0000
NZVC
1000
8765 4321
1234 5678
Before execution After execution

Instruction bit pattern : 1010 1100 0010 0011