Sub Subtract - Samsung S3C9444 User Manual

8-bit cmos microcontrollers
Table of Contents

Advertisement

S3C9444/F9444_UM_REV1.10
SUB
— Subtract
SUB
dst,src
dst ← dst – src
Operation:
The source operand is subtracted from the destination operand and the result is stored in the
destination. The contents of the source are unaffected. Subtraction is performed by adding the
two's complement of the source operand to the destination operand.
Flags:
C:
Set if a "borrow" occurred; cleared otherwise.
Z:
Set if the result is "0"; cleared otherwise.
S:
Set if the result is negative; cleared otherwise.
V:
Set if arithmetic overflow occurred, that is, if the operands were of opposite signs and the sign of
the result is of the same as the sign of the source operand; cleared otherwise.
Format:
opc
opc
opc
Examples:
Given: R1 = 12H, R2 = 03H, register 01H = 21H, register 02H = 03H, register 03H = 0AH:
SUB
SUB
SUB
SUB
SUB
SUB
In the first example, if working register R1 contains the value 12H and if register R2 contains the
value 03H, the statement "SUB R1,R2" subtracts the source value (03H) from the destination value
(12H) and stores the result (0FH) in destination register R1.
dst | src
src
dst
dst
src
R1,R2
R1 = 0FH, R2 = 03H
R1,@R2
R1 = 08H, R2 = 03H
01H,02H
Register 01H = 1EH, register 02H = 03H
01H,@02H →
Register 01H = 17H, register 02H = 03H
01H,#90H
Register 01H = 91H; C, S, and V = "1"
01H,#65H
Register 01H = 0BCH; C and S = "1", V = "0"
SAM88RCRI INSTRUCTION SET
Bytes
Cycles
Opcode
2
4
6
3
6
6
3
6
Addr Mode
(Hex)
dst
src
22
r
r
23
r
lr
24
R
R
25
R
IR
26
R
IM
6-47

Advertisement

Table of Contents
loading

This manual is also suitable for:

S3f9444

Table of Contents