Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need as soon as possible! Please code all three functions ( main , sort, search ) in program and follow instructions! Thank you! Question 4

Need as soon as possible! Please code all three functions(main, sort, search) in program and follow instructions! Thank you! Question 4- search.
The search function should do the following:
accept the number from main in the RCX register (i.e. incoming frame macro should
be at least 1)
create a local variable and save this number on the stack (i.e. the second parameter
of frame macro should be at least 1).
return -1 in RAX register if the value is not found in the array
return the location of the value in the RAX register if the value is found in the array.
no other restrictions on number of used register.
no other restrictions is placed on stack use and local variables.
A sample search outline can be given as:
Constraints
Please note that values can only be passed into function using specific registers in strict
order. Also certain registers must be preserved inside functions. Therefore, care must be
taken in selection of which registers to use. Thank you, The last laboratory exercise requires you to code the Search and Sort algorithm from Lab 6
as functions in assembly.
Please create a file named SortSearchFun. asm in ebe.
Question 1- Outline.
The sixth laboratory exercise required you to code the Insertion Sort algorithm and sort
a given array of integers and then find the index of a given value using the Linear Search
algorithm.
In this lab, you are required to split this code into three distinct functions:
main - the main function, which will call the sort and search function, and handles the
user input and output functions.
sort - function to sort the data using Insertion Sort Algorithm.
search - function to search for a value in the sorted array using Linear Search Algo-
rithm. The general outline of the code is given as: Question 2- main.
The main function should do the following:
call the sort function
ask the user to input an unsigned integer number between 0,100(inclusive) in the
terminal, using scanf and save this number in the location val.
call the search function and pass the val to the function using the RCX register.
if the return value of the RAX register is -1, then print to the terminal the string array
printf_notfound. This require the val as one of the parameters.
if the return value of the RAX register is the location of the found val, then print to
the terminal the string array printf_found. This requires the val and the location
as returned by the RAX register. A sample main outline can be given as:Question 3- sort.
The sort function should do the following:
sort the array in place using Insertion Sort Algorithm.
no restrictions on number of used register.
no restrictions is placed on stack use and local variables.
A sample sort outline can be given as:
image text in transcribed

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

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

It would have become a big deal.

Answered: 1 week ago