In ARM assembly program of only two instructions addition an

In ARM assembly program of only two instructions (addition and/or subtraction) implement the following calculation: a*105 (hint: 105=15*7). (8 p.)

Write in ARM assembly language the following pseudo code. Assume the variables are already loaded in some registers (8 p).

Solution

Assembly Puedocode to calculate a*105:

Mov r1 a // move initial values

Mov r2 105 //move initial values

loop:

add r1 r1 a // add a to value in r1

sub r2 r2 1   // decrease value of r2 by 1

cmp r2 0

JNE loop // if r2 does not contain 0 then jump to loop else ret

ret

In ARM assembly program of only two instructions (addition and/or subtraction) implement the following calculation: a*105 (hint: 105=15*7). (8 p.) Write in ARM

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site