Lecture-3 (Microprocessor Internal Architectres - Flag) NOTES
Lecture-3 (Microprocessor Internal Architectres - Flag) NOTES
Flags are useful in programming e.g. when writing conditions such as:
• If answer is zero, do … else …. // zero flag comes in hand here
• If answer is less than zero, do … else …. // sign flag can be used here
� Parity Flag (PF) - set to ’1’ when there is even number of one bits
is positive it is reset to ‘0’. (This flag takes the value of the most
significant bit).
OF=1 AF=0
Set because there is a carry from the 7th bit to the 8th bit Reset because there is NO carry from the
ONLY lower nibble to the upper nibble
Carry 1 1 1
� MOV AL, 50
50h ( 0 1 0 1 0 0 0 0 )
� MOV BL, 32h
32 ( 0 0 1 1 0 0 1 0 )
� ADD AL, BL (x 1 0 0 0 0 0 1 0 )
ZF=0
CF=0 Reset because the answer is NOT zero
Reset because the answer has NO carry
PF=1
Set because the answer has an EVEN
SF=1 number of 1s
Set because the MSB is 1 indicating a
negative answer
OF=0
Reset because there is a carry from the 7th bit to the 8th
bit and from the 8th bit to the 9th bit at THE SAME
TIME
Carry 1 1 1 1 1 1 1 1 AF=1
Set because there IS a carry from the
lower nibble to the upper nibble
� ADD AX, BX