Wednesday 1 July 2015

Q5,p3,D14. How many times will the following loop be executed ?



LXI B, 0007 H
LOP : DCX B
MOV A, B
ORA C
JNZ LOP
(A) 05 (B) 07
(C) 09 (D) 00

Answer b
Explanation.
LXI B,0007H ;Load register pair B with 00H and C with 07H.
A is set with B Values.
OR with A and C  now accumulator contains 07h.
Result is not zero  it loops again
Now DCX reduce value of c as 06.
A is set with 0.
ORA C sets  A as 06
It agains loop.
Similarly it loops till the A value is 0.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.