Question

Microprocessor

assmebly language and c

Write a program to add 10 byte-wide values stored in SRAM starting at address 0x0150. Use register indirect addressing mode w

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

Algorithm:

Step 1: Point HL register pair to memory location 0150H (indirect addressing)

Step 2: Set up a decrement counter, say C from 0AH (for 10 data)

Step 3: Load Accumulator with 00H to clear content

Step 4: Move content of memory location to register B

Step 5: Add B with Accumulator (A) and store to A. (ADD command)

Step 6: Increase memory location by one (post increment)

Step 7: Decrease C counter by one

Step 8: Until C is not equal to 0 repeat program control from Step 4:

Step 9: Store content of Accumulator to memory location 0200H (direct addressing)

Step 10: Terminate the program

Code:

LXI H, 0150H ; HL register pair points at memory location 0150H

MVI C, 0A H ; Sets up a decrement counter

MVI A, 00H ; Clears Accumulator

Jump: MOV B, M ; Moves content of memory location to B

ADD B ; Adds A and B and stores result at A

INX H ; HL pair points at M+1 memory location

DCR C ; Decreases C counter by one

JNZ Jump: ; Until C is not control jumps to jump1:

STA 0200H ; Stores result at 0200H (when C=0)

HLT

Add a comment
Know the answer?
Add Answer to:
Microprocessor assmebly language and c Write a program to add 10 byte-wide values stored in SRAM...
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
Active Questions
ADVERTISEMENT