Without using the mul instruction give the instructions to m

Without using the mul instruction, give the instructions to multiply r3 by following constants, leaving the result in r0. You may also use r1 and r2 to hold temporary results, and you do not need to preserve the original contents of r3. 10 100 575 123

Solution

a)

Start:

Mov r1 10 //move initial values

Mov r0 0 //move initial values

loop

loop:

add r0 r0 r3 // add r3 to value in r0

sub r1 r1 1   // decrease value of r1 by 1

cmp r1 0

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

ret

b)

Start:

Mov r1 100 //move initial values

Mov r0 0 //move initial values

loop

loop:

add r0 r0 r3 // add r3 to value in r0

sub r1 r1 1   // decrease value of r1 by 1

cmp r1 0

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

ret

c)

Start:

Mov r1 575 //move initial values

Mov r0 0 //move initial values

loop

loop:

add r0 r0 r3 // add r3 to value in r0

sub r1 r1 1   // decrease value of r1 by 1

cmp r1 0

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

ret

d)

Start:

Mov r1 123 //move initial values

Mov r0 0 //move initial values

loop

loop:

add r0 r0 r3 // add r3 to value in r0

sub r1 r1 1   // decrease value of r1 by 1

cmp r1 0

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

ret

 Without using the mul instruction, give the instructions to multiply r3 by following constants, leaving the result in r0. You may also use r1 and r2 to hold te
 Without using the mul instruction, give the instructions to multiply r3 by following constants, leaving the result in r0. You may also use r1 and r2 to hold te

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site