I've been meaning to code a program which gets each character of a string and compare it with each character of another string. It basically counts the instances of the said character in the other string.
My problem is it does not seem to work on the second character onwards of the first string. Either I get a seg fault or the count equates to 0.
Any help would be appreciated. Thank you so much!
mov ecx, [len2] ; length of name2
mov esi, name1
mov edi, name2
mov byte[count], 0 ; counts instance
cld
loop1:
lodsb ; loads letter in name1
loop2:
cmp ecx, 0
jne cont1
mov ecx, [len2]
loop loop1
cont1:
scasb ; compares character in al to every char in name2
jne cont2
inc byte[count]
cont2:
loop loop2