Question

Write a program to add the 32-bit numbers stored at data memory locations 0x200~0x203 and 0x204~0x207,...

Write a program to add the 32-bit numbers stored at data memory locations 0x200~0x203 and 0x204~0x207, respectively, and store the sum at 0x208~0x20B.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

In this question it is given that the two 32 bit numbers are stored at loacations 200 to 203 and 204 to 207.

In both cases the 8bit numbers are stored in the loacations and this shows it is probably 8 bit microcontroller(8051 series)

The assembly language program for this question is given below

MOV DPTR,#200H; // DPTR POINTS TO FIRST BYTE ADRESS

MOV A,@DPTR;//LOAD THE BYTE FROM ADRESS 200H TO ACC.

MOV R0,A; // COPY DATA IN R0

INC DPTR;//INCREMENT DPTR

MOV A,@DPTR;//LOAD DATA IN ACC

MOV R1,A;

INC DPTR;

MOV A,@DPTR;

MOV R2,A;

INC DPTR;

MOV A,@DPTR;

MOV R3,A;

INC DPTR;

MOV A,@DPTR;

MOV R4,A;

INC DPTR;

MOV A,@DPTR;

MOV R5,A;

INC DPTR;

MOV A,@DPTR;

MOV R6,A;

INC DPTR;

MOV A,@DPTR;

MOV R7,A;

MOV A,R8;

ADD A,R3;// ADD LOWER TWO BYTES

MOV DPTR,#20BH;DPTR POINTS TO HIGHEST MEMORY ADRESS TO STORE THE RESULT

MOV @DPTR,A;

MOV A,R6;

ADDC A,R2;// ADD R2 AND ACC. AND STORE RESULT IN ACC.

DEC DPL;// DECREMENT THE ADRESS TO STORE NEXT HIGHER BYTE OF RESULT

MOV @DPTR,A;

MOV A,R5;

ADDC A,R1;

DEC DPL;

MOV @DPTR,A;

MOV A,R4;

ADDC A,R0;

DEC DPL;

MOV @DPTR,A;

Add a comment
Know the answer?
Add Answer to:
Write a program to add the 32-bit numbers stored at data memory locations 0x200~0x203 and 0x204~0x207,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT