I have to find the (beginning) positions of a substring in a string. I load the string byte by byte in AL and compare it using SCASB. How can I check if the bytes are equal or if SCASB is true?
clc
scasb ;compare the value from al with <es:di>
;al is loaded from <ds:si>(lodsb)
;I noticed that when the values are equal
;cf and af are 1
jnc nextElem ;if cf is 0 go to the next element
lahf
cmp ah,0
je nextElem ;if af is 0 go to next elem
The problem is that LAHF doesn't bring the value that I expected in ah, meaning is not 0 or 1, and I don't know any other way to check if the values in AL and are equal.