Pratidin
2026 · Electrical Engineering Optional Paper II · 10 marksMainsQuestion 1b

Upon execution of the following routine, find the value stored at location 00FFH.
MVI B, 0FH
MVI C, ABH
MOV A, C
ADD B
SBI 02H
STA 00FFH
Also write the status of each flag after completion of execution.

10 marks · directive: Find

Answer

The core of a good answer

Location 00FFH holds B8H (1011 1000); after SBI 02H the flags are S = 1, Z = 0, P = 1, CY = 0, and AC = 1 when the subtraction is taken as two's complement addition.

An outline written by upsc.help, not an official UPSC answer; every fact checked by a separate review. How we work

What the question asks

The question tests tracing 8085 instructions and knowing which instructions affect flags. MVI, MOV and STA do not affect any flag, so the final flag status is decided by SBI 02H alone (ADD B sets the borrow input CY used by SBI). Each flag must be stated with its reason.

Answer outline

Introduction

Trace register contents instruction by instruction, then evaluate the five flags (S, Z, AC, P, CY) after the last flag-affecting instruction, SBI 02H.

Step 1: Load registers

Step 2: ADD B

Step 3: SBI 02H (A ← A − 02H − CY)

Step 4: STA 00FFH

Step 5: Flag status after SBI 02H

Conclusion

Memory location 00FFH = B8H. Flag register: S = 1, Z = 0, AC = 1, P = 1, CY = 0. Check: 171 + 15 − 2 = 184 decimal = B8H.

Examples and data to cite

Facts

Facts to remember

Sources used for the explanation

Write a timed answer in the app