# Microprocessor 8085 Programming

 Question 1
The following FIVE instructions were executed on an 8085 microprocessor.
MVI A, 33H
MVI B, 78H
CMA
ANI 32H
The Accumulator value immediately after the execution of the fifth instruction is
 A 00H B 10H C 11H D 32H
GATE EC 2017-SET-1   Microprocessors
Question 1 Explanation:
\begin{aligned} \text { MVI } A, 33 H &: (A)=33 H \\ \text { MVI B, } 78 \text { H } &: \text { (B) }=78 \mathrm{H} \\ \text { ADD } \mathrm{B} &: (\mathrm{A}) \leftarrow(\mathrm{A})+(\mathrm{B})=33 \mathrm{H} \\ +78 \mathrm{H}=\mathrm{AB} &\text { H } \Rightarrow (\mathrm{A})=\mathrm{AB} \mathrm{H} \\ &\text { (A) }=10101011\\ CMA&:\text{Complement}\\ \text { Accumulator } &\Rightarrow(A) =01010100 \\ \text { ANI } 32 \mathrm{H} &:\text { (A) } \leftarrow(\text { A) AND } 32 \mathrm{H} \\ &\quad 01010100\\ &\quad 00110010\\ &\quad 10010000 \Rightarrow(A)=10 H \end{aligned}
 Question 2
Which one of the following 8085 microprocessor programs correctly calculates the product of two 8-bit numbers stored in registers B and C?
 A MVI A, 00H JNZ LOOP CMP C LOOP: DCR B HLT B MVI A, 00H CMP C LOOP: DCR B JNZ LOOP HLT C MVI A, 00H LOOP: ADD C DCR B JNZ LOOP HLT D MVI A, 00H ADD C JNZ LOOP LOOP: INR B HLT
GATE EC 2015-SET-3   Microprocessors
Question 2 Explanation:
Product can be obtained by repeated addition.
Only {C) option satisfied addition repeatedly.
Here register 'B' is used as count to add register 'C' to accumulator, initially having OOH. Adding 'B' times 'C' to accumulator.

 Question 3
An 8085 microprocessor executes "STA 1234H" with starting address location 1FFEH (STA copies the contents of the Accumulator to the 16-bit address location). While the instruction is fetched and executed, the sequence of values written at the address pins $A_{15}-A_{8}$ is
 A 1FH, 1FH, 20H, 12H B 1FH, FEH, 1FH, FFH, 12H C 1FH, 1FH, 12H, 12H D 1FH, 1FH, 12H, 20H, 12H
GATE EC 2014-SET-4   Microprocessors
Question 3 Explanation:
Given STA 1234 H
Starting addressing location is 1 FFEH
1FFEH : STA 1234H
i.e. 1FFEH : XX Opcode fetch
$1FFFH \rightarrow 34 \mathrm{H}$
$2000 H \rightarrow 12 H$
Now after the instruction, 1234 H memory location will have the contents of accumulator.
So, the sequences of values written at the address pins $\mathrm{A}_{15}-\mathrm{A}_{8}$ is as shown above.
$1 \mathrm{FH}, 1 \mathrm{FH}, 20 \mathrm{H}, 12 \mathrm{H}$
 Question 4
For 8085 microprocessor, the following program is executed.
MVI A, 05H;
MVI B, 05H;
DCR B;
JNZ PTR;
HLT;
At the end of program, accumulator contains
 A 17H B 20H C 23H D 05H
GATE EC 2013   Microprocessors
Question 4 Explanation:
$\begin{array}{l} A=05+05+04+03+02+01+03 \\ A=23 \\ A=17 H \end{array}$
 Question 5
An 8085 assembly language program is given below.

Line 1: MVI A, B5H
2: MVI B, 0EH
3: XRI 69H
\begin{aligned} \text{After }A D D B&: \quad A \leftarrow E A H\\ A N \mid 9 B&: \quad A \leftarrow 8 A H \\ \quad C P \mid 9 F H&: \quad A \leftarrow 8 A H \\ \text{But }\quad[A]& \lt 9 F H \\ i.e. \quad 8 A& \lt 9 F H \\ \therefore \quad C Y&=1 ; Z=0 \end{aligned}