SUBWF
Subtract W from f
Subtract (2’s complement method) W register from register ‘f’. If ‘d’ is ‘0’, the result is stored in the W register. If ‘d’ is ‘1’, the result is stored back in register ‘f’.
[the_ad id="3059"]
Syntax:
[ label ] SUBWF f,d
Operation:
(f) - (W) → (destination)
Operands:
- f is from 0 to 127
- d is either 0 or 1
Status Affected: C, DC, Z
Example:
SUBWF REG,0
Before instruction:
REG = 0x04 W = 0x01
After instruction:
REG = 0x04 W = 0x03
[the_ad id="3059"]
Example:
SUBWF REG,1
Before instruction:
REG = 0x01 W = 0x04
After instruction:
REG = 0xFD ;two's complement W = 0x04