Intel 8XC196NT User Manual page 413

Table of Contents

Advertisement

8XC196NT USER'S MANUAL
Mnemonic
C
The carry flag is set to indicate an arithmetic carry from the MSB of the ALU or the state of
the last bit shifted out of an operand. If a subtraction operation generates a borrow, the carry
flag is cleared.
C
0
1
Normally, the result is rounded up if the carry flag is set. The sticky bit flag allows a finer
resolution in the rounding decision.
C ST
0 0
0 1
1 0
1 1
N
The negative flag is set to indicate that the result of an operation is negative. The flag is
correct even if an overflow occurs. For all shift operations and the NORML instruction, the
flag is set to equal the most-significant bit of the result, even if the shift count is zero.
ST
The sticky bit flag is set to indicate that, during a right shift, a "1" has been shifted into the
carry flag and then shifted out. This bit is undefined after a multiply operation. The sticky bit
flag can be used with the carry flag to allow finer resolution in rounding decisions. See the
description of the carry (C) flag for details.
V
The overflow flag is set to indicate that the result of an operation is too large to be
represented correctly in the available space.
For shift operations, the flag is set if the most-significant bit of the operand changes during
the shift. For divide operations, the quotient is stored in the low-order half of the destination
operand and the remainder is stored in the high-order half. The overflow flag is set if the
quotient is outside the range for the low-order half of the destination operand. (Chapter 3,
"Programming Considerations," defines the operands and possible values for each.)
Instruction Quotient Stored in:
DIVB
DIV
DIVUB
DIVU
VT
The overflow-trap flag is set when the overflow flag is set, but it is cleared only by the CLRVT,
JVT, and JNVT instructions. This allows testing for a possible overflow at the end of a
sequence of related arithmetic operations, which is generally more efficient than testing the
overflow flag after each operation.
Z
The zero flag is set to indicate that the result of an operation was zero. For multiple-precision
calculations, the zero flag cannot be set by the instructions that use the carry bit from the
previous calculation (e.g., ADDC, SUBC). However, these instructions can clear the zero
flag. This ensures that the zero flag will reflect the result of the entire operation, not just the
last calculation. For example, if the result of adding together the lower words of two double
words is zero, the zero flag would be set. When the upper words are added together using
the ADDC instruction, the flag remains set if the result is zero and is cleared if the result is not
zero.
A-4
Table A-2. Processor Status Word (PSW) Flags
Value of Bits Shifted Off
< ½ LSB
≥ ½ LSB
Value of Bits Shifted Off
= 0
> 0 and < ½ LSB
= ½ LSB
> ½ LSB and < 1 LSB
Short-Integer
Integer
Byte
Word
Description
V Flag Set if Quotient is:
< –128 or > +127 (< 81H or > 7FH)
< –32768 or > +32767 (< 8001H or > 7FFFH)
> 255 (FFH)
> 65535 (FFFFH)

Advertisement

Table of Contents
loading

Table of Contents