Professional Documents
Culture Documents
Rehmat Ullah
Flag Register in 8086
● A flag is a flip flop which indicates some conditions produced by the
execution of an instruction or controls certain operations ot the Execution
Unit (EU).
● It is a 16 bit register.
● Flag register is divided into useful/active and undefined bits.
● There are total 9 useful bits.
■ Further divided into:
● 6 status flags which contains some conditions
● 3 control flags enable or disable certain operations of the microprocessor.
● There are total 7 undefined/unused bits represented by x
Flag Register in 8086
Status Flags
● Carry Flag (CF)
● Parity Flag (PF)
● Auxiliary Flag (AF)
● Zero Flag (ZF)
● Sign Flag (OF)
Control Flags
● Direction Flag (DF)
● Trap Flag (TF)
● Interrupt Flag (IF)
Flag Register in 8086
Flag Register in 8086
Carry Flag (CF):
● CF will be on when last carry out occur from MSB during some calculation or
when Cout=1 , CF will be on.
● CF will be on when the borrow occur on MSB during some calculation
● Otherwise CF will be off.
● Sub 7591h, 8248h
❖ Suppose al=EFh and bI= 18h
Last Carry out = 1 0001 1000 CF = 1
0000 0111
1110 1111
Parity Flag
● When there are even no of 1’s in the lower byte then Parity flag will be on.
● When there are odd no of 1’s in the lower byte then Parity flag will be off.
● FE sum 97
1 0010101
Total 1’s = 4
Since 4 is even so, PF=1
Parity Flag (PF) in 8086
● Suppose cx= 7591h and dx 8248h
● Borrow
Total 1’s =4
Since 4 is even so PF =1
As carry occurs on 4th bit, so AF=1
Zero Flag (ZF) in 8086
● When the result is zero, ZF will be on
● When the result is not zero, ZF will be off