IP2022 Users ManualInstruction Set Architecture
www.ubicom.com
215
SUB W,fr
Subtract W from fr into W
Operation:
W = fr - W
Bits affected:
C, DC, Z
Opcode:
0000 100f ffff ffff
Description:
This instruction subtracts the contents of W from
the contents of the specified data memory
location and writes the 8-bit result into W. The
data memory location is left unchanged. The
register contents are treated as unsigned values.
If the result of subtraction is negative (W is larger
than fr), the C bit is cleared and the lower eight
bits of the result are written to W. Otherwise, the
C bit is set.
If there is a borrow from bit 3 to bit 4, the DC (digit
carry) bit is cleared. Otherwise, the bit is set.
If the result of subtraction is zero, the Z bit is set.
Otherwise, the Z bit is cleared.
Cycles:
1