Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Programming Project

One of the very practical uses of assembly language programming is its ability to optimize the speed and size of computer programs. While programmers do not typically write large-scale applications in assembly language, it is not uncommon to solve a performance bottle neck by replacing code written in a high level language with an assembly language procedure.

In this programming project you will be given a C++ program that generates an array of pseudorandom integers, sorts the array, and then searches the array for a particular value. The C++ program uses the binary search algorithm to determine if the search value is one of the elements in the array. A binary search procedure is considered efficient.

Your job is to write an assembly language procedure that also performs the binary search. The C++ program will time multiple searches performed by both the C++ code and your assembly language procedure and compare the result. If all goes as expected, your assembly language procedure should be faster than the C++ code.

Chapter 13 of your text book contains a discussion of how to interface an assembly language procedure with a high-level programming language like C++. The author also provides an example of a C++ program linkedwith an assembly language procedure in the C:\Irvine\other examplesfolder. In addition, the author has provided batch files that will conveniently allow you to assemble the object code version of your assembly language procedure.You will need to link the object file to the existing C++ program files. Depending upon the version of Microsoft's Visual Studio IDE, you will find these batch files and instructions for their use in either:

Getting Started with MASM and Visual Studio 2012 OR
Getting Started with MASM and Visual Studio 2013.
Both can be found at the author's web site:
http://www.kipirvine.com/asm/

Search for "Assembling without Linking" to get to this material quickly.

The Visual Studio solution for the C++ program that you are to be given has been packaged and compressed into a file called "ProjectFour.zip".
Download the compressed file, ProjectFour.zip, and unpack it into
C:\Users\\Documents\Visual Studio 2012\Projects

Look in the \...\Projects\ProjectFour folder for a file named "ProjectFour.sln". The ".sln" file extension stands for solution. Double clicking on this file will start up the Visual Studio solution for ProjectFour and allow you to execute the C++ program.

A "stub" assembly language procedure has been provided so that you can execute the C++ program to get a feel for how it works. Your job is to improve on the efficiency of the C++ compiled code. Look in the \...\Projects\ProjectFour\ProjectFour folder for the assembly language stub file named "AsmBinarySearch.asm". This file is your starting point for creating an assembly language version of the binary search routine.

As always, start small. DO NOT be the Cookie Monster and gobble up the whole project at once. Steps you might consider, but are not limited to are:
- Have your assembly language procedure return the number of elements in the array. This will tell you if what is being passed as an argument is the value you expected.
- Have your assembly language procedure return the value of the first element in the array. This will tell you if you understand how to address and retrieve the value of an element in the array.
- Have your procedure return the second (or fifth) element in the array.
- Calculate the subscript of the "middle" element in the array and return the value of that subscript. This will confirm that you can make one of the calculations needed to implement the binary search and retrieve a particular element in the array.
- Calculate the subscript of the "middle" element in the array and return the value of that element in the array. This will confirm that you can retrieve any element in the array.

This project will provide you with the opportunity to:
- Link an assembly language procedure to an existing C++ program.
- Demonstrate your ability to work with a one-dimensional array.
- Show that you can implement a while loop in assembly language.
- Display your understanding of what an assembly language procedure is and how they can be used.
- Provides a chance for you to show that you understand how to compare values and take conditional action based on the results.
- Observe how assembly language procedures can be used to optimize.

Attachment:- ProjectFour.rar

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92042087

Have any Question?


Related Questions in Programming Language

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As