Create a procedure named FindLargest that receives two parameters: a pointer to a signed doubleword array and
Question:
Create a procedure named FindLargest that receives two parameters: a pointer to a signed doubleword array and the array's length. The procedure must return the value of the largest array member in EAX. Use the PROC directive with a parameter list when declaring the procedure. Preserve all registers (except EAX) that are modified by the procedure. Write a test program that calls FindLargest and passes three different arrays of lengths. Be sure to include negative values in your arrays. Create a PROTO declaration for FindLargest.
INCLUDE Irvine32.inc
.data
.code
FindLargest PROC,
arrayNum: ptr dword,
arraySize: dword
mov esi, arrayNum
mov ecx, arraySize
mov eax, [esi]
dec ecx
ScanArray:
add esi, 5
mov ebx, [esi]
cmp ebx, eax
jle checkNumber
mov eax, ebx
CheckNumber:
loop scanArray
ret
exit
FindLargest ENDP
END FindLargest
Database Systems Design Implementation and Management
ISBN: 978-1285196145
11th edition
Authors: Carlos Coronel, Steven Morris