Microprocessor 8085 Programming

Question 1
The following FIVE instructions were executed on an 8085 microprocessor.
MVI A, 33H
MVI B, 78H
ADD B
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;
PTR: ADD B;
DCR B;
JNZ PTR;
ADI 03H;
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
4: ADD B
5: ANI 9BH
6: CPI 9FH
7: STA 3010H
8: HLT

After execution of line 7 of the program, the status of the CY and Z flags will be
A
CY = 0, Z = 0
B
CY = 0, Z = 1
C
CY = 1, Z = 0
D
CY = 1, Z = 1
GATE EC 2007   Microprocessors
Question 5 Explanation: 
\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}
Question 6
An 8085 assembly language program is given below.

Line 1: MVI A, B5H
2: MVI B, 0EH
3: XRI 69H
4: ADD B
5: ANI 9BH
6: CPI 9FH
7: STA 3010H
8: HLT

The contents of the accumulator just execution of the ADD instruction in line 4 will be
A
C3H
B
EAH
C
DCH
D
69H
GATE EC 2007   Microprocessors
Question 6 Explanation: 
After
\begin{aligned} Line 1 \rightarrow \quad A &\longleftrightarrow 10110101 \\ Line 2 \rightarrow \quad B &\longleftarrow 00001110 \\ Line 3 \rightarrow \quad 69 H &\longleftarrow 01101001 \\ \oplus \quad A &\longleftarrow \underline{11011100} \\ Line 4 \rightarrow \quad B &\longleftarrow \underline{01101001} \\ &+\underline{11101010}\\ A &\longleftarrow E A H \\ A \leftarrow E A H \\ \end{aligned}
Question 7
Following is the segment of a 8085 assembly language program
LXI SP, EFFF H
CALL 3000 H
:
:
:
3000 H : LXI H, 3CF4
PUSH PSW
SPHL
POP PSW
RET
On completion of RET execution, the contents of SP is
A
3CF0 H
B
3CF8 H
C
EFFD H
D
EFFF H
GATE EC 2006   Microprocessors
Question 7 Explanation: 
LXI SP, EFFFH
CALL 3000 H
\Rightarrow \quad \text { PUSH }+\text { JMP } \quad \mathrm{SP} \rightarrow \mathrm{SP}-2
\Rightarrow \quad \mathrm{SP}=\mathrm{EFFDH}
\begin{array}{ll}\\ 3000 \mathrm{H}: & \mathrm{LXIH}, 3 \mathrm{CF} 4 \mathrm{H} \\ & \mathrm{HL} \leftarrow 3 \mathrm{CF} 4 \\ \text { PUSHPSW } & \mathrm{SP} \leftarrow \mathrm{SP}-2=\mathrm{EFFBH} \\ \text { SPHL } & \mathrm{SP} \leftarrow 3 \mathrm{CF} 4 \\ \text { POP PSW } & \mathrm{SP} \leftarrow \mathrm{SP}+2=3 \mathrm{CF} 6 \\ \text { RET } & \mathrm{RET}=\mathrm{POP}+\mathrm{JMP} \text { i.e. } \\ & \mathrm{SP} \leftarrow \mathrm{SP}+2 \\ & \mathrm{SP} \leftarrow 3 \mathrm{CF} 8 \mathrm{H}\end{array}
Question 8
Consider the following assembly language program.
MVI B,87H
MOV A,B
START: JMP NEXT
MVI B,00H
XRA B
OUT PORT1
HLT
NEXT: XRA B
JP START
OUT PORT2
HLT
The execution of the above program in an 8085 microprocessor will result in
A
an output of 87H at PORT1
B
an output of 87H at PORT2
C
infinite looping of the program execution with accumulator data remaining at 00H
D
infinite looping of the program execution with accumulator data alternating between 00H and 87H
GATE EC 2002   Microprocessors
Question 8 Explanation: 
\begin{array}{llll} & \text { MVI B, 87H } & \mathrm{B} \leftarrow 10000111 \\ & \text { MOV A, B } & \mathrm{A} \leftarrow 10000111 \\ \text { START } & \text { JMP NEXT } & \\ & \text { MVI B, 00H } & \\ & \text { XRA B } & \\ & \text { OUTPORT 1 } & \\ & \text { HLT } & \\ \text { NEXT } & \text { XRA B } \rightarrow 00 \mathrm{H} & \mathrm{A} \rightarrow 00 \mathrm{H} \\ & \text { JP START } & \mathrm{B} \rightarrow 87 \mathrm{H}, \mathrm{A} \rightarrow 87 \mathrm{H} \\ & \text { OUTPORT 2 } & & \end{array}
HLT
XOR of A with B gives OOH.
\begin{aligned} 00 H &\rightarrow \quad 00000000\\ &\downarrow \\ &\text{Sign flag }=0 \text{ (plus)} \end{aligned}
JP takes the loop to START.
Again JMP NEXT is executed.
Now XOR of B with A gives 87H.
87 H \rightarrow 10000111
Sign flag =1(-v e)
\therefore 87 \text{H at} PORT 2
There are 8 questions to complete.
Like this FREE website? Please share it among all your friends and join the campaign of FREE Education to ALL.