1
130kviews
Explain the flag register of 8086.

Mumbai University > Electronics and Telecommunication > Sem 4 > Microprocessor and peripherals

Marks: 5M

Year: May 2015

1 Answer
5
6.2kviews

The 8086 flag register contents indicate the results of computation in the ALU. It also contains some flag bits to control the CPU operations.

  1. A 16 bit flag register is used in 8086. It is divided into two parts . o Condition code or status flags o Machine control flags
  2. The condition code flag register is the lower byte of the 16-bit flag register. The condition code flag register is identical to 8085 flag register, with an additional overflow flag.
  3. The control flag register is the higher byte of the flag register. It contains three flags namely direction flag (D), interrupt flag (I) and trap flag (T).

Figure below shows the details of the 16 bit flag register of 8086 CPU.

enter image description here

  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:

  1. Carry flag (CY)-
  • 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.
  1. Parity flag (PF)-
  2. It is set if the result has even parity. If parity is odd, PF is reset.
  3. This flag is normally used for data transmission errors.

  4. Auxiliary carry flag (AC)-

  5. It is set if a carry is generated out of the lower nibble.
  6. It is used only in 8 bit operations like DAA and DAS.

  7. Zero flag (ZF)-

  8. It is set if the result is zero.

  9. Sign flag (SF)-

  10. It is set if the MSB of the result is 1. For signed operations such a number is treated as negative.

  11. Overflow flag (OF)-

  12. It will be set if the result of a signed operation is too large to fit in the number of bits available to represent it.
  13. It can be checked using the instruction INTO (Interrupt on Overflow).

Control flags:

  1. Trap flag (TF)-
  2. It is used to set the trace mode i.e. start single stepping mode.
  3. Here the microprocessor is interrupted after every instruction so that the program can be debugged.

  4. Interrupt enable flag (IF)-

  5. It is used to mask (disable) or unmask (enable) the INTR interrupt.
  6. If user sets IF flag, the CPU will recognize external interrupt requests. Clearing IF disables these interrupts.

  7. Direction flag (DF)-

  8. If this flag is set, SI and DI are in auto-decrementing mode in string operations.
Please log in to add an answer.