Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shift right and Add in one command

I am learning assembly language for ARM Cortex and I have the following problem:

Write one line of assembly instruction for the following calculation: Apply Arithmetic Shift Right on the content of R2, then add the contents of R1 and R2 and store the result in R0.

I understand the Arithmetic Shift Right as:

ASR R0, R2, #9

And to do an add is simply:

ADD R0, R1, R2

But i am unsure how to combine these into one command. So far I have come up with the following from an example i saw that looked as if they were doing two commands on one line in a similar way:

ASR R0, R2, #9, [ADD R1, R2]

I know this is probably wrong, so can anyone explain to me how this should be done?

like image 890
Cody Pritchard Avatar asked Oct 12 '25 21:10

Cody Pritchard


1 Answers

It seems that you are on the right track now.

add rd, rn, rm, asr #n
like image 61
InfinitelyManic Avatar answered Oct 15 '25 01:10

InfinitelyManic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!