Scan string using SCASB : Assembly code

include irvine32.inc

.data
source byte "my name is usman",0

msg1 byte "String to b compare : ",0


msg3 byte "Latter is Found : ",0
msg4 byte "Latter Not Found : ",0

.code
Main proc
call clrscr
call crlf
mov edx,offset msg1
call writestring
call crlf

call crlf
mov edx,offset source
call writestring
call crlf


;---------------------------

mov edi,offset source
mov al,'g'
mov ecx,lengthof source
cld
repne scasb
je L1
jne L2
;----------------------

L1:
call crlf
mov edx,offset msg3
call writestring
call crlf
jmp e

L2:
call crlf
mov edx,offset msg4
call writestring
call crlf
jmp e


e:
exit
main endp
end main

No comments

Powered by Blogger.