Beruflich Dokumente
Kultur Dokumente
1. Flag register is a part of EU (Execution Unit). It is a 16 bit register with each bit
corresponding to a flip-flop.
2. A flag is a flip-flop. It indicates some condition produced by the execution of an
instruction. For example the zero flag (ZF) will set if the result of execution of an
instruction is zero.
3. Figure below shows the details of the 16 bit flag register of 8086 CPU.
1. It consists of 9 active flags out of 16. The remaining 7 flags marked ‘U’ are
undefined flags.
2. These 9 flags are of two types:
6 Status flags
3 Control flags
Status flags:
It is set whenever there is a carry or borrow out of the MSB (most significant bit)
of a result. D7 bit for an 8 bit operation and D15 bit for a 16 bit operation.
Control flags:
1.Carry Flag (CF) - this flag is set to 1 when there is an unsigned overflow. For example
when you add bytes 255 + 1 (result is not in range 0...255). When there is no overflow
this flag is set to 0.
2.Parity Flag (PF) - this flag is set to 1 when there is even number of one bits in result,
and to 0 when there is odd number of one bits.
3.Auxiliary Flag (AF) - set to 1 when there is an unsigned overflow for low nibble (4 bits).
4.Zero Flag (ZF) - set to 1 when result is zero. For non-zero result this flag is set to 0.
5.Sign Flag (SF) - set to 1 when result is negative. When result is positive it is set to0.
(This flag takes the value of the most significant bit.)
6.Trap Flag (TF) - Used for on-chip debugging.
7.Interrupt enable Flag (IF) - when this flag is set to 1 CPU reacts to interrupts from
external devices.
8.Direction Flag (DF) - this flag is used by some instructions to process data chains,
when this flag is set to 0 - the processing is done forward, when this flag is set to 1the
processing is done backward.
9.Overflow Flag (OF) - set to 1 when there is a signed overflow. For example, when you
add bytes 100 + 50 (result is not in range -128...127)
8085 Microprocessor
Flag Registers In 8086
Flag Register:-
It is a 16-bit register with each bit corresponding to a flip-flop. It changes its status
according to the stored output in the accumulator. A flag can control certain
operation of the EU.
Active flag:- There are nine active flags out of 16, in the 8086 flag register. The remaining
are undefined flag.
Control Flag:- Out of nine active flags, six are conditional flags and the remaining three
are called as the control flag. The three control flags are:
· If TF=1, the CPU automatically generates an internal interrupt after each instruction,
· If DF=1, the string instruction will automatically decrement the pointer. If DF=0,the