Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In 80x86 Assembly language: In this assignment, we will get some experience with defining and calling functions with parameters. Please carry out the following steps:

In 80x86 Assembly language:

In this assignment, we will get some experience with defining and calling functions with parameters. Please carry out the following steps:

Make a copy of the CS238/VS2012_files/windows32 folder in your CS238 folder, and give HA8 as the name of this new copy.

Start VS2012, and open the project file CS238/HA8/windows32.sln.

In the Solutions Explorer window on the right, choose the file windows32/Source Files/example.asm and look at its text in the left window.

Change this program completely into one that contains a mainline and a gcd function that returns the greatest common divisor of two unsigned integers. The mainline should read two unsigned integers from the keyboard after displaying appropriate prompts. The mainline should then call the gcd function with those two values as arguments, obtain their greatest common-divisor from the function, and display it in an appropriate message. The gcd function should be based upon the following recursive C-like pseudo-code:

unsigned int gcd ( unsigned int a, unsigned int b ) { if ( a > b ) return gcd ( a - b, b ) ; if ( a < b ) return gcd ( a, b - a ) ; return a ; }

 

The parameters a and b should be passed to the above function by any caller on stack. The function returns its computed greatest common divisor value back to its caller in register eax. It should preserve the values of all other general-purpose registers.

The following 3 windows are an example interaction of the complete program (output in red, input in blue):

a: 24 b: 54 gcd: 6 

Submit your modified example.asm file on Blackboard for this assignment.

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 Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

How do you monitor the effectiveness of the coaching?

Answered: 1 week ago

Question

=+ 4. How can policymakers infl uence a nations saving rate?

Answered: 1 week ago