Instruction Set ArchitectureIP2022 Users Manual
220
www.ubicom.com
Example 1:
subc 0x099,w
This example subtracts the contents of W and the
complement of the C bit from data memory
location 0x099. For example, if the data memory
location holds 0x35, W holds 0x06, and the C bit
is clear, this instruction subtracts 0x07 from 0x35
and writes the result 0x2E into the data memory
location. It also sets the C bit, clears the DC bit,
and clears the Z bit.
Example 2:
mov w,0x095;load W from 0x095
sub 0x097,w;subtract low bytes
;C = 0 for borrow out
mov w,0x096;load W from 0x096
subc 0x098,w;subtract high bytes
This example performs 16-bit subtraction of data
memory locations 0x095 (low byte) and 0x096
(high byte) from data memory locations 0x097
(low byte) and 0x098 (high byte).
The sub instruction subtracts the contents of
0x095 from 0x097 and clears the C bit if a borrow
occurs out of bit 7, or sets the C bit otherwise. The
subc instruction subtracts the contents of 0x096
from 0x097 with borrow-in using the C bit.