---
title: "Short note: flags in 8086"
subject: "Microprocessor"
chapter: 3
key: "semester_4/microprocessor:8086-flags"
source: https://www.bctengineer.com/q/semester_4/microprocessor/8086-flags
site: BCT Engineering
---

# Short note: flags in 8086

Microprocessor · Chapter 3: Programming with 8086 Microprocessor

- Asked in: 2074 Bhadra, 4 marks; 2069 Bhadra, 4 marks (asked 2 times)
- Video: [Flag Register in Microprocessor 8086 | Status Register of 8086 | Basics](https://www.youtube.com/watch?v=X50H1Hh4dBo) — Engineering Funda
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_4/microprocessor/8086-flags
- Whole chapter: https://www.bctengineer.com/md/semester_4/microprocessor/chapter-3

## Question

Write a short note on flags in 8086 microprocessor.

## Short answer

The 16-bit flag register has six status flags: CF (carry), PF (parity), AF (auxiliary carry), ZF (zero), SF (sign), OF (overflow) set by ALU results; and three control flags: TF (single-step trap), IF (maskable interrupt enable), DF (string direction). They govern conditional jumps.

## Answer

The 8086 has a 16-bit **flag register** of which 9 bits are used. Six are **status (conditional) flags** set by the ALU after an operation, and three are **control flags** set by the programmer.

```text
 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
  -  -  -  - OF DF IF TF SF ZF  - AF  - PF  - CF
```

#### Status flags
| Flag | Name | Set (1) when |
|---|---|---|
| CF | Carry | Carry out of MSB in addition or borrow in subtraction |
| PF | Parity | Low byte of result has an even number of 1s |
| AF | Auxiliary carry | Carry from bit 3 to bit 4 (used by DAA/DAS) |
| ZF | Zero | Result is zero |
| SF | Sign | MSB of result is 1 (negative) |
| OF | Overflow | Signed result is too large for the destination |

#### Control flags
| Flag | Name | Function |
|---|---|---|
| TF | Trap | When 1, processor executes in single-step mode (type-1 interrupt after each instruction) |
| IF | Interrupt | When 1, the maskable INTR interrupt is enabled (`STI` sets, `CLI` clears) |
| DF | Direction | 0 = string instructions auto-increment SI/DI; 1 = auto-decrement (`CLD`, `STD`) |

**Example:** `MOV AL,0FFH` then `ADD AL,01H` gives AL = 00H with CF = 1, ZF = 1, AF = 1, PF = 1, SF = 0, OF = 0. Flags are tested by conditional jumps such as JC, JZ, JS, JO, JP.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. How many of the 16 flag bits are used and how are they split?
   A. 9: six status and three control
   B. 16: all status
   C. 6: all control
   D. 12: eight status and four control
   Answer: A. Status flags: CF, PF, AF, ZF, SF, OF; control flags: TF, IF, DF. (Key point: Flag classes)

2. What does DF = 1 do?
   A. Enables interrupts
   B. String instructions auto-decrement SI/DI
   C. Enables single stepping
   D. Sets the carry
   Answer: B. DF=1 makes SI/DI decrement; CLD/STD clear/set it. (Key point: Control flag DF)

3. After MOV AL,0FFH then ADD AL,01H, which flags are set?
   A. CF=0, ZF=0
   B. CF=1, ZF=1, AF=1, PF=1
   C. SF=1, OF=1
   D. Only OF=1
   Answer: B. Result 00H with carry out: CF, ZF, AF and PF set; SF and OF are 0. (Key point: Example result)

## Related in Microprocessor

- [8085 flags and their effect](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3A8085-flags-effect) — Microprocessor, chapter 2, asked 3×
- [Internal architecture of 8086](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3A8086-architecture-block-diagram) — Microprocessor, chapter 3, asked 4×
- [8086 assembly language operators](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3A8086-operators) — Microprocessor, chapter 3, asked 3×
- [Interrupt processing in 8086](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Ainterrupt-processing-8086) — Microprocessor, chapter 5, asked 3×
- [Addressing modes of 8086](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3A8086-addressing-modes) — Microprocessor, chapter 3, asked 2×
- [8086 speed over 8-bit; major registers](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3A8086-faster-registers) — Microprocessor, chapter 3
