Microprocessor 8085 Programming · Microprocessors and Computer Organization
7 questions · asked in 6 of 26 years (2001–2026)
MCQ 71-mark 6 · 2-mark 1
2001Questions per year2026
Questions 6–7 of 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
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
Answer: (B)
LXI SP, EFFFH
CALL 3000 H
CALL does a push and a jump:
Stack pointer after CALL:
Steps of the routine at 3000H:
CALL 3000 H
CALL does a push and a jump:
Stack pointer after CALL:
Steps of the routine at 3000H:
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
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
Answer: (B)
Trace of the program:
MVI B, 87H gives B = 87H, and MOV A, B gives A = 87H.
JMP NEXT jumps over the lines after START (MVI B, 00H, XRA B, OUT PORT1, HLT) to NEXT.
First pass: XRA B gives . The result is 00000000, so the sign flag S = 0 (positive).
JP means jump if positive (S = 0), so it jumps back to START. JMP NEXT runs again.
Second pass: XRA B gives , so S = 1 (negative).
Now JP does not jump, and execution goes on to OUT PORT2, which sends A = 87H to PORT2. Then HLT stops the program.
OUT PORT1 is never reached, and there is no infinite loop.
Answer: (B)
MVI B, 87H gives B = 87H, and MOV A, B gives A = 87H.
JMP NEXT jumps over the lines after START (MVI B, 00H, XRA B, OUT PORT1, HLT) to NEXT.
First pass: XRA B gives . The result is 00000000, so the sign flag S = 0 (positive).
JP means jump if positive (S = 0), so it jumps back to START. JMP NEXT runs again.
Second pass: XRA B gives , so S = 1 (negative).
Now JP does not jump, and execution goes on to OUT PORT2, which sends A = 87H to PORT2. Then HLT stops the program.
OUT PORT1 is never reached, and there is no infinite loop.
Answer: (B)
Keep practising
Topics in Microprocessors and Computer Organization
Basics of 8085 MicroprocessorInstructions of 8085 Microprocessor
Microprocessor 8085 ProgrammingYou are here
Microprocessor 8085 InterruptsInterfacing and Peripheral Devices