Could anyone tell me how to compare two strings in assembly language, I`ve written the followign, but it does not seem to work.
assume cs:code, ds:data
data seg
I had the same problem when I was writing asm in school, years ago. The problem I encountered was that I wanted to compare the word "exit" with a user entry. If they typed "exit", the application quit. If they typed anything else, then a message appeared telling them there was an erroneous entry.
The way I solved the issue was to compare the strings character-by-character, until the characters no longer matched, or vice-versa.
This also might be of some use. Here are some code examples relating to string comparison in assembly language: http://www.daniweb.com/software-development/assembly/threads/58667/assembly-language-comparing-strings
You might also want to look at this article relating to regular expressions (regex) in assembly language: Regular Expressions and Assembly
j is jump l is less e is equel if bl=a & bh=k here cmp is work like a-k
if here 0 or less-equal value then jle work. then n will work. if positive value jle is not work.
cmp bl,bh jle n
mov ah,2 mov dl,bh int 21h
n: mov ah,2 mov dl,bl int 21h