© 2000 Scenix Semiconductor, Inc. All rights reserved.
67
SX Users Manual Rev. 3.1
www.scenix.com
Chapter 3 Instruction Set
3.6.1
ADD fr,W
Add W to fr
Operation:
fr = fr + W
Bits affected:
C, DC, Z
Opcode:
0001 111f ffff
Description:
This instruction adds the contents of W to the contents of the specified file register
and writes the 8-bit result into the same file register. W is left unchanged. The reg-
ister contents are treated as unsigned values.
If the result of addition exceeds FFh, the C bit is set and the lower eight bits of the
result are written to the file register. Otherwise, the C bit is cleared.
If there is a carry from bit 3 to bit 4, the DC (digit carry) bit is set. Otherwise, the
bit is cleared.
If the result of addition is 00h, the Z bit is set. Otherwise, the bit is cleared. An
addition result of 100h is considered zero and therefore sets the Z bit.
Config. Option:
If the CF bit in the FUSEX configuration register has been programmed to 0, this
instruction also adds the C bit as a carry-in input:
fr = fr + W + C
Cycles:
1
Example:
add
$12,W
This example adds the contents of W to file register 12h. For example, if the file
register contains 7Fh and W contains 02h, this instruction adds 02h to 7Fh and
writes the result, 81h, into the file register; and clears the C and Z bits. It sets the
DC bit because of the carry from bit 3 to bit 4.