The content of the accumulator after the execution of the following 8085…
2016
The content of the accumulator after the execution of the following 8085 assembly language program, is :
MVI A, 42H
MVI B, 05H
UGC: ADD B
DCR B
JNZ UGC
ADI 25H
HLT
- A.
82 H
- B.
78 H
- C.
76 H
- D.
47 H
Attempted by 41 students.
Show answer & explanation
Correct answer: C
Solution: compute the accumulator step by step.
Initial values: A = 42H, B = 05H.
Iteration 1: ADD B -> A = 42H + 05H = 47H. DCR B -> B = 04H.
Iteration 2: ADD B -> A = 47H + 04H = 4BH. DCR B -> B = 03H.
Iteration 3: ADD B -> A = 4BH + 03H = 4EH. DCR B -> B = 02H.
Iteration 4: ADD B -> A = 4EH + 02H = 50H. DCR B -> B = 01H.
Iteration 5: ADD B -> A = 50H + 01H = 51H. DCR B -> B = 00H and loop exits.
After the loop, A = 51H.
Then ADI 25H -> A = 51H + 25H = 76H.
Final answer: the accumulator contains 76H.