;linear search
.model small;set model small
.stack 110h;set or leave 100 bytes for stack
.data
text db ‘#pm hello i have face some problem in need your help’
count dw 13 ;13 char in hello world so i set it to 13
search db ‘#pm’;i want to search #pm;#pm is exists
found db ‘tags found: $’ ;shows if found char
notfound db ‘tags not found :$’ ; shows if char not found
.code
main proc near ;main program start from here
mov ax , @data ;move all data into ax register
mov ds,ax; now move all data in ax move to ds (data segment)
mov es,ax;and move as well as es(extra segment)
mov di, offset text
mov cx,count
mov al,search
;scasb=scan char byte by byte
;repne = repeted operation
;if char found then zero flag is set
repne scasb
jz yes
mov ah,09h;09h is print string on dos
mov dx, offset notfound;set offset for notfound string
int 21h;dos interrupt
jmp over
yes:
mov ah,09h
mov dx,offset found
int 21h
over:
mov ah,4ch
int 21h
endp
end main