INCLUDE C:\IRVINE\IRVINE32.INC
.386
.STACK 4096
EXITPROCESS PROTO,DWEXITCODE:DWORD
.DATA
array dword 4,6,3,5,2,5,7,3,5,6
max dword ?
min dword ?
str1 BYTE "Maximum Number in This Array is : ",0
str2 BYTE "Minimum Number in This Array is : ",0
.CODE
MAIN PROC
call MAM
INVOKE EXITPROCESS,0
MAIN ENDP
MAM proc
mov edx,OFFSET array
mov ecx,LENGTHOF array
mov esi,0
mov eax,array[esi]
mov max,eax
mov ebx, array[esi]
mov min,ebx
l1::
cmp ecx,0
je next
cmp eax,array[esi]
ja next1
mov eax,array[esi]
add esi ,4
loop l1
jmp next
next1:
cmp ebx,array[esi]
jb again
mov ebx,array[esi]
add esi,4
dec ecx
jmp l1
again:
add esi,4
dec ecx
jmp l1
next:
mov max,eax
mov edx,OFFSET str1
call WriteString
call WriteInt
call crlf
mov edx,OFFSET str2
call WriteString
mov eax,ebx
call WriteInt
ret
MAM endp
END MAIN
No comments:
Post a Comment