.model small
.data
arr db 2,4,6,8,10
mid db ?
num db 7
strfound db "Found" ,'$'
strNot db "Not Found" ,'$'
.code
mov ax,@data
mov ds,ax
LEA SI,arr
mov ax,SI
add ax,4
mov DI,ax
mov dl,2
L1:
mov ax,SI
add ax,DI
div dl
mov BX,00
mov Bl,al
mov bh,00
mov al,BYTE PTR [BX]
cmp al,num
je ans
jl Less
sub BX,1
mov DI,BX
cmp SI,DI
jle L1
jmp Nfound
Less:
add BX,1
mov SI,BX
cmp SI,DI
jle L1
jmp Nfound
ans:
mov ah,09h
LEA DX,strfound
int 21h
jmp ext
Nfound:
mov ah,09h
LEA DX,strNot
int 21h
jmp ext
ext:
mov ax,4C00h
int 21h
end