Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

Timeline for final evaluation

Answered: 1 week ago