NV UP EI PL NZ NA PO NC的含义(转)

原帖http://answers.yahoo.com/question/index?qid=20061110202234AATMzc7

The types of flags within the simple 8086 CPU are as follows, with their abbreviation in parentheses:

Overflow (OF)
Direction (DF)
Interrupt Enable (IF)
Sign (SF)
Zero (ZF)
Auxillary Carry (AF)
Parity (PF)
Carry (CF)

The functions of the flags are as follows ("cleared" means a value of 0 while "set" means a value of 1):

OF - set if the result of a signed arithmetic or logic operation is too large of a positive number or too small of a negative number to fit into the CPU's registers..

DF - set if the programmer wants to decrement the index registers (SI and DI) during string manipulation instructions. Cleared to 0 to increment.

IF - set to allow external devices to interrupt the CPU for service requests

SF - set if the most significant bit of an arithmetic/logic operation is set. Usually interpreted as a negative number when set.

ZF - set if the result of an arithmetic/logic operation is equal to 0.

AF - set if there was a carry from or borrow to bits 0-3 in the AL register.

PF - set if the number of 1s (or parity) in the low-order byte is even.

CF - set if there was a carry from or borrow to the most significant bit during last result calculation.

Now we know what the flags do, but why do their abbreviations not match the ones in your question? Because the ones in your question refer to STATES of these flags, not the flags themselves per se.

NV - means "no overflow", or the OF = 0

UP - means that string manipulation instructions will cause the index registers to increment, or DI = 0

EI - means interrupts are enabled, or IF = 1

PL - means a number is positive, or the SF = 0

NZ - means a number is not equal to 0, or the ZF = 0

NA - means no bits were carried or borrowed from bits 0-3 of the AL regiater, or the AF = 0

PO - means the number of ones is odd, or PF = 0

NC - means no bits were carried or borrowed from the most significant bit, or CF = 0

In conclusion, the 80x86 family has many more flags that do things such as processor control, program access control, power management, etc. Without these simple flags, computers would be utterly useless, not knowing how to compare and test binary data.

posted on 2013-05-06 21:03  铁树银花  阅读(1002)  评论(0编辑  收藏  举报

导航