Application: Sequential Search in asm ?

hi 
This question and the code works
But the problem is that it when u the number not found the prog print both msg

help me
thank you
noor.
_____________________________________________________----
write a program that asks the user to enter an integer
       By writing
Enter the Number ----------------------------- :
And then perform the  Linear Search for the user entered number in an Integer Array given below :
intArray    SDWORD   -18,40,5,-11,66,4,-7,10,16
If the number is found , it displays ,
Yes the numbers exists in the list.
If the number is not found then it  displays.
The number is not found in the list.
___________________________________________----
TITLE sum of the integer
.686
.MODEL FLAT,STDCALL
.STACK

INCLUDE Irvine32.inc

.data
a sdword ?
str1 byte "enter the number   :  ",0
str2 byte "Yes the numbers exists in the list",0
str3 BYTE "The number is not found in the list",0
intarray sdword -18,40,5,-11,66,4,-7,10,16

.CODE
MAIN PROC
mov edx,offset str1
call writestring
call ReadInt
mov a,eax
call Search
exit
main endp


Searchproc proc uses ecx

jne notfound
mov esi,offset intarray
mov ecx,lengthof intarray
l1:
cmp[esi],eax
je found
add esi,4
loop l1
jmp notfound


notfound:
mov edx,offset str3
call writestring
;call writeint
call crlf

found:
mov edx,offset str2
call writestring
call crlf
ret
exit
Searchendp
end main
_______________________________________________


a7la nono (author) 5 years ago
this answer but with out the processor


TITLE sum of the integer
.686
.MODEL FLAT,STDCALL
.STACK

INCLUDE Irvine32.inc
.data
a sdword ?
str1 byte "enter the number : ",0
str2 byte "Yes the numbers exists in the list",0
str3 BYTE "The number is not found in the

list",0
intarray sdword -18,40,5,-11,66,4,-7,10,16

.CODE
MAIN PROC
mov edx,offset str1
call writestring
call ReadInt
mov a,eax
mov esi,offset intarray
mov ecx,lengthof intarray


l1:
cmp[esi],eax
je found
add esi,4
loop l1
jmp notfound

found:
mov edx,offset str2
call writestring
call crlf
jmp q

notfound:
mov edx,offset str3
call writestring
;call writeint
call crlf
exit

q:
call crlf
exit
main endp
end main