Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribedimage text in transcribed

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

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

Database Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions

Question

4. How has e-commerce affected business-to-business transactions?

Answered: 1 week ago