© 2000 Scenix Semiconductor, Inc. All rights reserved.
95
SX Users Manual Rev. 3.1
www.scenix.com
Chapter 3 Instruction Set
3.6.25
MOV W,fr-W
Move (fr-W) to W
Operation:
W = fr - W
Bits affected:
C, DC, Z
Opcode:
0000 100f ffff
Description:
This instruction subtracts the contents of W from the contents of the specified file
register and writes the 8-bit result into W. The file register 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 to 0
and the lower eight bits of the result are written to W. Otherwise, the C bit is set to 1.
If there is a borrow from bit 3 to bit 4, the DC (digit carry) bit is cleared to 0.
Otherwise, the bit is set to 1.
If the result of subtraction is 00h, the Z bit is set. Otherwise, the bit is cleared.
Config. Option:
If the CF bit in the FUSEX configuration register has been programmed to 0, this
instruction also subtracts the complement of the C bit as a borrow-in input:
W = fr - W - /C
Cycles:
1
Example:
mov
W,$0D-W
This example subtracts the contents of W from global file register 0Dh and moves
the result into W. For example, if the file register contains 35h and W contains 06h,
this instruction subtracts 06h from 35h and writes the result, 2Fh, into W. It also sets
the C bit, clears the DC bit, and clears the Z bit. The file register is left unchanged.