Datasheet
FS98O22
Rev. 1.6 143/146
SUBWF
Subtract W from f
Syntax SUBWF f, d
0 ≤ f ≤ FFh
d ∈ [0,1]
Operation
[Destination] ← [f] – [W]
Flag Affected C, DC, Z
Description Subtract the content of the W register from [f]. If d is 0, the result is stored in the W
register. If d is 1, the result is stored back in [f],
Cycle 1
Example 1:
SUBWF OPERAND,
1
Before instruction:
OPERAND = 33h, W = 01h
After instruction:
OPERAND = 32h
C = 1
Z = 0
Example 2:
SUBWF OPERAND,
1
Before instruction:
OPERAND = 01h, W = 01h
After instruction:
OPERAND = 00h
C = 1
Z = 1
Example 3:
SUBWF OPERAND,
1
Before instruction:
OPERAND = 04h, W = 05h
After instruction:
OPERAND = FFh
C = 0
Z = 0
SUBWFC
Subtract W and Carry from f
Syntax SUBWFC f, d
0 ≤ f ≤ FFh
d ∈ [0,1]
Operation
[Destination] ← [f] – [W] –C
‧
Flag Affected C, DC, Z
Description Subtract the content of the W register from [f]. If d is 0, the result is stored in the W
register. If d is 1, the result is stored back in [f].
Cycle 1
Example 1:
SUBWFC
OPERAND, 1
Before instruction:
OPERAND = 33h, W = 01h
C = 1
After instruction:
OPERAND = 32h, C = 1, Z = 0
Example 2:
SUBWFC
OPERAND, 1
Before instruction:
OPERAND = 02h, W = 01h
C = 0
After instruction:
OPERAND = 00h, C = 1, Z = 1
Example 3:
SUBWFC
OPERAND, 1
Before instruction:
OPERAND = 04h, W = 05h
C = 0
After instruction:
OPERAND = Feh, C = 0, Z = 0
FORTUNE'
Properties
For Reference Only