ASSEMBLY CODE Write an assembly code that calculates the value of the following
ID: 3594626 • Letter: A
Question
ASSEMBLY CODEWrite an assembly code that calculates the value of the following polynomial , assuming x and y are stored in register r0 and r1, respectively. Use x=-1 as an initial value. Cant use multiplication instruction more than two times
y= 7x^3+8x^2-12x
need asap will rate right away!! ASSEMBLY CODE
Write an assembly code that calculates the value of the following polynomial , assuming x and y are stored in register r0 and r1, respectively. Use x=-1 as an initial value. Cant use multiplication instruction more than two times
y= 7x^3+8x^2-12x
need asap will rate right away!! ASSEMBLY CODE
Write an assembly code that calculates the value of the following polynomial , assuming x and y are stored in register r0 and r1, respectively. Use x=-1 as an initial value. Cant use multiplication instruction more than two times
y= 7x^3+8x^2-12x
need asap will rate right away!!
Explanation / Answer
main:
push {r7}
sub sp, sp, #12
add r7, sp, #0
ldr r3, [r7, #4]
ldr r2, [r7, #4]
mul r2, r2, r3
mov r3, r2
lsl r3, r3, #1
adds r3, r3, r2
ldr r2, [r7, #4]
mul r2, r2, r3
ldr r3, [r7, #4]
ldr r1, [r7, #4]
mul r3, r1, r3
mov r1, r3
lsl r3, r3, #3
subs r3, r1, r3
adds r1, r2, r3
ldr r2, [r7, #4]
mov r3, r2
lsl r3, r3, #2
adds r3, r3, r2
lsl r3, r3, #1
adds r3, r1, r3
sub r3, r3, #11
str r3, [r7, #0]
mov r3, #0
mov r0, r3
add r7, r7, #12
mov sp, r7
pop {r7}
bx lr