Question: Modify your code from the following code so that it it now has a main and a separate function largest that take 3 parameters (r0,

Modify your code from the following code so that it it now has a main and a separate function largest that take 3 parameters (r0, r1, r2) and returns the largest of the three in r4. The main will load these values from memory, call the function and then store the result back into memory.

As this function is a leaf function, and should only use R0-R3, it can be written more simply than recursive fibonacci as it will not need to save and restore values from the stack. So this function will be structured more like function2 than function1 from the example above.

this code to find the largest number from three given number (ARM Assembly language)

adr R0, large MOV R5, #4 ldr R1, [R0], #4 ldr R2, [R0], #4 ldr R3, [R0], #4 MOV R4, #0 CMP R1, R2 BMI Big B Big2 Big CMP R2, R3 BMI Big3 B Big4 Big2 CMP R1, R3 BMI Big5 MOV R4, R1 ldr R0, =setlarge str R4, [R0], #4 END Big4 MOV R4, R2 ldr R0, =setlarge str R4, [R0], #4 END Big3 MOV R4,R3 ldr R0, =setlarge str R4, [R0], #4 END Big5 MOV R4,R3 ldr R0, =setlarge str R4, [R0], #4 large DCD 34,54,21 setlarge DCD 0 END

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!