Question Details

An 8085 microprocessor accesses two memory locations (2001 H) and (2002 H), that contain 8-bits
numbers 98 H and B1 H, respectively. The following program is executed :
LXI H, 2001 H
MVI A, 21 H
INX H
ADD M
INX H
MOV M, A
HLT
At the end of this program, the memory location 2003 H contains the number in decimal (base 10) form

Show Answer

Correct Answer :

210

Solution :

The correct answer is 210.


Step 1: Understand the Given Memory Setup

According to the question, two memory locations contain specific 8-bit values in hexadecimal:

Memory location 2001 H contains the value 98 H.
Memory location 2002 H contains the value B1 H.


Step 2: Trace the 8085 Assembly Program Line by Line

1. LXI H, 2001 H
This instruction loads the 16-bit memory address 2001 H into the HL register pair.
So, HL = 2001 H.


2. MVI A, 21 H
This instruction moves the immediate 8-bit value 21 H into the Accumulator (register A).
So, Accumulator (A) = 21 H.


3. INX H
This instruction increments the content of the HL register pair by 1.
HL = 2001 H + 1 = 2002 H.


4. ADD M
This instruction adds the contents of the memory location pointed to by the HL register pair to the accumulator, storing the result in register A.
Since HL points to 2002 H, the value at memory location 2002 H is B1 H.
Accumulator (A) = (A) + (2002 H) = 21 H + B1 H.


Let's perform the hexadecimal addition of 21 H and B1 H:

In the lower nibble: 1 + 1 = 2.
In the upper nibble: 2 + B (where B in decimal is 11) = 2 + 11 = 13 (which is D in hexadecimal).


Therefore, 21 H + B1 H = D2 H.
So, Accumulator (A) now holds the hexadecimal value D2 H.


5. INX H
Increments the HL register pair by 1 again.
HL = 2002 H + 1 = 2003 H.


6. MOV M, A
Moves the contents of the accumulator (A) into the memory location pointed to by HL.
Since HL = 2003 H and A = D2 H, memory location 2003 H now stores D2 H.


7. HLT
Stops the execution of the program.


Step 3: Convert Hexadecimal D2 H to Decimal (Base 10)

The value stored in memory location 2003 H is D2 H. To convert D2 H to decimal:

( D2 ) 16 = ( D × 16 1 ) + ( 2 × 16 0 )

Since the hex digit D equals 13 in decimal:

( D2 ) 16 = ( 13 × 16 ) + ( 2 × 1 ) = 208 + 2 = 210


Thus, the number stored in memory location 2003 H in decimal form is 210.

Unlock Our Free Library

Access expert-curated educational resources and study materials—completely free.

Discover more resources

You may also like

Ask AI Tutor
5 left
Q1 View Question & Options
AI Tutor is solving this question...
Reading question context & options...