The contents of the flag register after execution of the following program by…

2015

The contents of the flag register after execution of the following program by 8085 microprocessor will be

Program
SUB A
MVI B,(01)H
DCR B
HLT

  1. A.

    (54)H

  2. B.

    (00)H

  3. C.

    (01)H

  4. D.

    (45)H

Attempted by 63 students.

Show answer & explanation

Correct answer: A

The program execution proceeds as follows:

1. SUB A: The accumulator is subtracted from itself, resulting in 0. This sets the Zero (Z) flag to 1 and Parity (P) flag to 1. The Carry (CY) flag is reset to 0, and Sign (S) flag is 0.

2. MVI B, 01H: Loads the value 01H into register B. This instruction does not affect any flags.

3. DCR B: Decrements register B to 00H. In the 8085 microprocessor, DCR does not affect the flags.

4. HLT: Halts the processor.

Final Flag Status: S=0, Z=1, AC=1, P=1, CY=0. This corresponds to the hexadecimal value 54H.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Isro