IP2022 Users ManualInstruction Set Architecture
www.ubicom.com
213
SUB fr,W
Subtract W from fr into fr
Operation:
fr = fr - W
Bits affected:
C, DC, Z
Opcode:
0000 101f 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 the same
data memory location. W 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 the data memory
location. 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 bit is cleared.
Cycles:
1