Question: CODE in ASSEMBLY LANGUAGE!!!! For this program you will call a procedure that finds the minimum and maximum elements of an array, and the last

CODE in ASSEMBLY LANGUAGE!!!!

For this program you will call a procedure that finds the minimum and maximum elements of an array, and the last positions in the array where the minimum and maximum element occurs.

The output of the program is:

The position in array of last occurrence of minimum element is: 4

The minimum element in the array is: 5

The position in array of last occurrence of maximum element is: 6

The maximum element in the array is: 90

Use an array named Array to contain the elements (as DWORDS):

5, 46, 90, 50, 5, 6, 90, 8, 20

All variables in main are DWORDS.

The name of the procedure is MinandMax, and its equivalent call in C++ would be:

MinandMax(int &max, int &maxposn, int &min, int &maxposn,

int& Array, int Arrsze);

All arguments must be passed on the stack. You must use the C++ calling conventions for ordering of arguments on the stack.

Use the C++ calling conventions, i.e. caller saved regs (if necessary): EAX, ECX, EDX and callee saved regs (if necessary): EBX, EDI, ESI.

Assume that the registers EAX, EBX, ECX, EDX, EDI, ESI may be used for some purpose in MyProgram other than support for calling MinandMax. Since MinAndMax is called immediately in MyProgram, EAX is not used in MyProgram prior to calling MinAndMax.

Registers EAX, EBX, ECX, EDX, EDI, ESI can be used for some purpose in MinandMax, and you should make this assumption even if they are not actually used.

In MinandMax, there is only one loop. Thus, you must use conditionals within the loop to implement finding the maximum element, minimum element, position of the maximum element and position of the minimum element. The ebp register must be saved within MinandMax. The caller is responsible for cleaning up the stack.

Put MinandMax code after the end of MyProgram and before INCLUDE NoIrvineEnd.inc.

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!