- Asked 2/14
- 2074 Bhadra · 4 marks
- 2069 Bhadra · 4 marks
Short note: flags in 8086
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.
Write a short note on flags in 8086 microprocessor.
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.
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.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- 8085 flags and their effect · Microprocessor, chapter 2 · asked 3×
- Internal architecture of 8086 · Microprocessor, chapter 3 · asked 4×
- 8086 assembly language operators · Microprocessor, chapter 3 · asked 3×
- Interrupt processing in 8086 · Microprocessor, chapter 5 · asked 3×
- Addressing modes of 8086 · Microprocessor, chapter 3 · asked 2×
- 8086 speed over 8-bit; major registers · Microprocessor, chapter 3