Question

Write an ARM assembly program that checks bit 2 and bit 18 of R0. If the...

Write an ARM assembly program that checks bit 2 and bit 18 of R0. If the two bits are similar, then R8=R5<<2 (shift R5 left by 2 bits), otherwise clear the least most significant byte of R1.

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

MOV R3,R0 (Copy data in R0 to R3)

MOV R2,R0 (Copy data in R0 to R2)

AND R3,R3,0x0002 (Isolate bit2)

AND R2,R2,0x0200     (Isolate bit18)

LSR R2,R2,#16 (Shift bit18 to position of bit2)

CMP R3,R2 (Compare bit2, bit18)

MOVEQ R8,R5,LSL #5 (If R3 = R2, R8 = R5 << 5)

B end (Branch to end of program)

AND R1,R1,0xff00 (Clear least significant byte of R1)

end: (End of program)

Add a comment
Know the answer?
Add Answer to:
Write an ARM assembly program that checks bit 2 and bit 18 of R0. If the...
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
ADVERTISEMENT