Instructions of 8085 Microprocessor · Microprocessors and Computer Organization
16 questions · asked in 12 of 26 years (2001–2026)
MCQ 15 · NAT 11-mark 13 · 2-mark 3
2001Questions per year2026
Questions 11–15 of 16
Consider an 8085-microprocessor system.
The following program starts at location 0100H.
LXI SP, 00FF
LXI H, 0107
MVI A, 20H
SUB M
If in addition following code exists from 0109H onwards.
ORI 40 H
ADD M
What will be the result in the accumulator after the last instruction is executed ?
The following program starts at location 0100H.
LXI SP, 00FF
LXI H, 0107
MVI A, 20H
SUB M
If in addition following code exists from 0109H onwards.
ORI 40 H
ADD M
What will be the result in the accumulator after the last instruction is executed ?
Answer: (C)
Find where the added code starts. From 0100H: LXI SP is 3 bytes (0100H to 0102H), LXI H is 3 bytes (0103H to 0105H), MVI A,20H is 2 bytes (0106H to 0107H) and SUB M is 1 byte (0108H). So the next instruction is at 0109H: ORI 40H (0109H to 010AH), then ADD M at 010BH.
The pointer is HL = 0107H. M is the memory byte at 0107H, which is the operand byte of MVI A,20H, so M = 20H.
MVI A,20H sets A = 20H. SUB M gives .
ORI 40H: .
ADD M: .
Answer: (C)
The pointer is HL = 0107H. M is the memory byte at 0107H, which is the operand byte of MVI A,20H, so M = 20H.
MVI A,20H sets A = 20H. SUB M gives .
ORI 40H: .
ADD M: .
Answer: (C)
Consider an 8085-microprocessor system.
The following program starts at location 0100H.
LXI SP, 00FF
LXI H, 0107
MVI A, 20H
SUB M
The content of accumulator when the program counter reaches 0109 H is
The following program starts at location 0100H.
LXI SP, 00FF
LXI H, 0107
MVI A, 20H
SUB M
The content of accumulator when the program counter reaches 0109 H is
Answer: (C)
Find the address of each instruction:
SUB M is one byte long and sits at 0108H, so when the PC reaches 0109H it has already executed.
After MVI, . M means the memory byte whose address is in HL. HL holds 0107H, and the byte at 0107H is the data byte . So
Answer: (C)
SUB M is one byte long and sits at 0108H, so when the PC reaches 0109H it has already executed.
After MVI, . M means the memory byte whose address is in HL. HL holds 0107H, and the byte at 0107H is the data byte . So
Answer: (C)
It is desired to multiply the numbers 0AH by 0BH and store the result in the accumulator. The numbers are available in registers B and C respectively. A part of the 8085 program for this purpose is given below :
MVI A, 00H
LOOP:
------
------
-----
HLT
END
The sequence of instructions to complete the program would be
MVI A, 00H
LOOP:
------
------
-----
HLT
END
The sequence of instructions to complete the program would be
Answer: (D)
Multiplication by repeated addition: add B (0AH = 10) to the accumulator C (0BH = 11) times.
MVI A, 00H clears the accumulator. The loop body is:
1. ADD B: A = A + B.
2. DCR C: C = C - 1. This sets the zero flag when C becomes 00H.
3. JNZ LOOP: jump back to LOOP while the zero flag is not set, that is, while C is not 00H.
The loop runs 11 times, so A = 11 x 10 = 110 = 6EH, which fits in 8 bits.
JNZ must come right after DCR C, because it tests the flag that DCR C sets.
Option (B), ADD B, JNZ LOOP, DCR C: JNZ tests the flag set by ADD B, not by DCR C, so C never controls the loop and the count of 11 is lost.
Option (C), DCR C, JNZ LOOP, ADD B: the jump goes back to DCR C, so ADD B runs only once after the loop ends, giving A = 0AH only.
Option (A) puts JNZ LOOP first, before the loop has done any work.
Answer: (D)
MVI A, 00H clears the accumulator. The loop body is:
1. ADD B: A = A + B.
2. DCR C: C = C - 1. This sets the zero flag when C becomes 00H.
3. JNZ LOOP: jump back to LOOP while the zero flag is not set, that is, while C is not 00H.
The loop runs 11 times, so A = 11 x 10 = 110 = 6EH, which fits in 8 bits.
JNZ must come right after DCR C, because it tests the flag that DCR C sets.
Option (B), ADD B, JNZ LOOP, DCR C: JNZ tests the flag set by ADD B, not by DCR C, so C never controls the loop and the count of 11 is lost.
Option (C), DCR C, JNZ LOOP, ADD B: the jump goes back to DCR C, so ADD B runs only once after the loop ends, giving A = 0AH only.
Option (A) puts JNZ LOOP first, before the loop has done any work.
Answer: (D)
Consider the sequence of 8085 instructions given below
LXI H, 9258
MOV A, M
CMA
MOV M, A
Which one of the following is performed by this sequence ?
LXI H, 9258
MOV A, M
CMA
MOV M, A
Which one of the following is performed by this sequence ?
Answer: (A)
Trace the program:
LXI H,9258H sets , so M means the memory byte at 9258H.
MOV A,M copies the byte at 9258H into the accumulator.
CMA complements every bit of A.
MOV M,A stores the complemented value back at 9258H.
So the byte at 9258H is read into A, complemented and written back to 9258H.
(A) describes a step that really happens (MOV A,M). (B) is wrong because CMA complements A and nothing is compared (that would be CMP). (C) and (D) name locations 8529H and 5892H, which are never used; the address used is 9258H.
Answer: (A)
LXI H,9258H sets , so M means the memory byte at 9258H.
MOV A,M copies the byte at 9258H into the accumulator.
CMA complements every bit of A.
MOV M,A stores the complemented value back at 9258H.
So the byte at 9258H is read into A, complemented and written back to 9258H.
(A) describes a step that really happens (MOV A,M). (B) is wrong because CMA complements A and nothing is compared (that would be CMP). (C) and (D) name locations 8529H and 5892H, which are never used; the address used is 9258H.
Answer: (A)
The number of memory cycles required to execute the following 8085 instructions
(i) LDA 3000 H
(ii) LXI D, FOF1H
would be
(i) LDA 3000 H
(ii) LXI D, FOF1H
would be
Answer: (B)
Count the machine (memory) cycles for each instruction. Both are 3-byte instructions.
(i) LDA 3000H: opcode fetch, read of the low address byte, read of the high address byte, and a read of the data from 3000H. That is cycles.
(ii) LXI D,F0F1H: opcode fetch, read of the low data byte, read of the high data byte. That is cycles.
So 4 cycles for (i) and 3 for (ii). LDA needs one more cycle than LXI because it also reads the data from memory.
Answer: (B)
(i) LDA 3000H: opcode fetch, read of the low address byte, read of the high address byte, and a read of the data from 3000H. That is cycles.
(ii) LXI D,F0F1H: opcode fetch, read of the low data byte, read of the high data byte. That is cycles.
So 4 cycles for (i) and 3 for (ii). LDA needs one more cycle than LXI because it also reads the data from memory.
Answer: (B)
Keep practising
Topics in Microprocessors and Computer Organization
Basics of 8085 Microprocessor
Instructions of 8085 MicroprocessorYou are here
Microprocessor 8085 ProgrammingMicroprocessor 8085 InterruptsInterfacing and Peripheral Devices