Question: Design an assembly program that includes a RECURSIVE function for computing the largest number in an array of 3 2 - bit integers. All function

Design an assembly program that includes a RECURSIVE function for computing the largest number in an array of 32-bit integers. All function parameters must be passed in stack.
The first function MAX1(int array[], int from, int to) should accept an array passed by reference and two indices "from" and "to" passed by value. It should be based on the divide-and-conquer approach to compute the maximum by splitting the array A into two (almost) equal parts A_0 and A_1 in the middle, recursively compute the maximum m0 over A_0 and m1 over A_1, and return the maximum of two numbers m0 and m1. It should be invoked as MAX1(A,0, n), where n is the array length. In other words, the recursive formula is as follows:
max{a0, a1,..., an-1}= max{m0, m1}= max{max{a0,..., an/2}, max{an/2+1,..., an-1}}
where m0= max{a0,..., an/2} and m1= max{an/2+1,..., an-1}
Please be in the form:
;-------------------------------------
AREA RAM, DATA, NOINIT, READWRITE, ALIGN=3
;------------------------------------- ;
AREA |.text|, CODE, READONLY
main PROC ; main user code
loop ; periodic task starts here
b loop ; repeat periodic task
ENDP
;-------------------------------------
;prompt DCB "Enter a number: ",0
ALIGN
END

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 Programming Questions!