Past exam question: 2082 Chaitra (Regular), Q2
Open in the Padhaiko appDefine flags. Explain the flags associated with 8085 microprocessor.
Solution
Definition of Processor Flags: Flags are individual 1-bit flip-flops within the microprocessor's status register that are set (logic 1) or reset (logic 0) automatically by the Arithmetic Logic Unit (ALU) according to the outcome of an arithmetic or logical operation. They reflect status conditions (carry, zero, sign, parity) and are tested by conditional branch instructions to direct program flow.
The 8085 Flag Register Format: The Intel 8085 contains an 8-bit flag register consisting of 5 active status flags and 3 undefined (don't care) bit positions:
| Bit Position | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
|---|---|---|---|---|---|---|---|---|
| Flag | S (Sign) | Z (Zero) | X (Unused) | AC (Auxiliary Carry) | X (Unused) | P (Parity) | X (Unused) | CY (Carry) |
Detailed Explanation of 8085 Flags:
- Sign Flag (S): Reflects the Most Significant Bit (D7) of the ALU result. If D7 = 1, the result is negative in two's complement and S is set to 1. If D7 = 0, S is reset to 0 (positive).
- Zero Flag (Z): Set to 1 if the entire 8-bit ALU result is zero (00H). Reset to 0 if the result is non-zero.
- Auxiliary Carry Flag (AC): Set to 1 if an arithmetic operation generates a carry out of bit D3 into bit D4. Used internally by the
DAA(Decimal Adjust Accumulator) instruction for BCD arithmetic. It is not directly testable by jump instructions. - Parity Flag (P): Set to 1 if the result in the accumulator has an even number of 1s (even parity). Reset to 0 if the accumulator contains an odd number of 1s (odd parity).
- Carry Flag (CY): Set to 1 if an arithmetic addition produces a carry out of the MSB (bit D7), or if a subtraction requires a borrow into bit D7. Reset to 0 otherwise.
Flags are status flip-flops updated by the ALU after operations. The 8085 has five active flags: Sign (S), Zero (Z), Auxiliary Carry (AC), Parity (P), and Carry (CY), used for conditional branching and status monitoring.