IP2022 Users ManualInstruction Set Architecture
www.ubicom.com
217
SUB W,#lit8
Subtract W from Literal into W
Operation:
W = lit8 - W
Bits affected:
C, DC, Z
Opcode:
0111 1010 kkkk kkkk
Description:
This instruction subtracts the contents of W from
an 8-bit literal and writes the 8-bit result into W.
The register contents are treated as unsigned
values.
If the result of subtraction is negative (W is larger
than lit8), 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 bit is cleared.
Cycles:
1