I was looking at this code and I am confused about the cmpsb rep line .
.LOOP:
push cx
mov cx, 0x000B ; eleven character name
mov si, ImageName ; image name to find
push di
rep cmpsb ; test for entry match
pop di
je LOAD_FAT
pop cx
add di, 0x0020 ; queue next directory entry
loop .LOOP
jmp FAILURE
I understand that it repeats cmpsb cx times, but how does it compare two lines? Say, for example, there was a comparison of "Hey \ 0" and "hey \ 0", and this loop compared 4 lines of characters. The first characters are different, and the EFlags case will be set accordingly. However, the cmpsb command repeats and the following characters are the same. I may not understand how cmpsb works , but it looks like this loop is incorrectly matching two lines. Does this loop really work?
source
share