Question: Code in C. Please make comments on each line of code specifiy the function, etc. 2.2 Calling an assembly subroutine from C It is also

Code in C. Please make comments on each line of code specifiy the function, etc.

Code in C. Please make comments on each line of code specifiythe function, etc. 2.2 Calling an assembly subroutine from C It is

2.2 Calling an assembly subroutine from C It is also possible to mix C and assembly. You will need to do this from Lab 3 onwardPerform the following steps to write a C program which calls an assembly subroutine. Create a new C project, as you did in Section 2.1 Add a file to your project called "subroutine.s. (The filename does not matter, but it should have the .s extension.) Copy the code from Figure 2 into "subroutine.s". This code computes the maximum of two numbers and returns the result. Notice that the subroutine does not bother to save and restore the caller state. This is sometimes OK to do, in subroutines which do not change the state. Next, edit your C program so that it contains the code in Figure3 This code uses the assembly subroutine to compute the max of two numbers. Compile and run the program. Find the main section and the MAX 2 section, and put break- points to see the processor run those sections. Finally, rewrite your C program to find the max of a list using the MAX 2 subroutine. 2.2 Calling an assembly subroutine from C It is also possible to mix C and assembly. You will need to do this from Lab 3 onwardPerform the following steps to write a C program which calls an assembly subroutine. Create a new C project, as you did in Section 2.1 Add a file to your project called "subroutine.s. (The filename does not matter, but it should have the .s extension.) Copy the code from Figure 2 into "subroutine.s". This code computes the maximum of two numbers and returns the result. Notice that the subroutine does not bother to save and restore the caller state. This is sometimes OK to do, in subroutines which do not change the state. Next, edit your C program so that it contains the code in Figure3 This code uses the assembly subroutine to compute the max of two numbers. Compile and run the program. Find the main section and the MAX 2 section, and put break- points to see the processor run those sections. Finally, rewrite your C program to find the max of a list using the MAX 2 subroutine

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!