GATE 2014 EE (EE2) – Question 62
The following 8085 program executes. Find register A at termination.
2000H XRA A
2001H MVI B,04H
2003H MVI A,03H
2005H RAR
2006H DCR B
2007H JNZ 2005
200AH HLTPractise this question in The GATE Grind →
Show answer and explanation
Correct answer: (A) 60H
Explanation
XRAAinitially clearsAand carry;MVIB,04Hsets four iterations,andMVIA,03HloadsA. RARrotates through carry,whileDCRBdoes not change carry. The(A,carry)sequence is(01H,1),(80H,1),(C0H,0),(60H,0). After the fourth decrementB=0andJNZfalls through. Thus **A=60H,A**.