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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started