I'm doing a small program where i input an array and then get the maximum and minimum number in it . I've succeeded in getting the minimum number but there is a problem in having the maximum number any help what's the problem
my code :
INCLUDE Irvine32.inc
Arr_size equ 5
.data
Arr1 SDword Arr_size dup(0)
minVal SDwORD 7fffffffh
maxVal SDwORD 000000000
strprompt Byte 'Enter integer Array items: ',0
strMsg byte 'the Min value an Max value is ', 0
.code
main PROC
mov edx , offset strprompt
call writestring
mov ecx, LENGTHOF Arr1
mov edi, offset Arr1
L1:
call readint
mov [edi],eax
add edi, Type Arr1
cmp eax,minVal
jge Loop_stat
mov minval,eax
cmp eax, maxVal
jnge lop_state
mov maxval,eax
Loop_stat:
loop L1
mov edx, offset strMsg
call writestring
mov eax, minval
call writeint
call crlf
lop_state:
loop L1
mov eax, maxVal
call writeint
call crlf
exit
main ENDP
END main