Code: Select all
.ff_search_loop:
mov si, dx ;; beginning of string
mov di, bx ;; entry to search
push cx ;; save loop counter
mov cx, 11 ;; length of filename
.ff_strcmp_loop:
cmpsb ;; compare bytes
jne .ff_next ;; if unequal, try next entry
loop .ff_strcmp_loop
jmp ff_search_done ;; if loop finishes, then it matches
.ff_next:
add bx, 32 ;; try next entry (32-byte entries)
pop cx ;; restore original loop counter
loop .ff_search_loop ;; if loop finishes, then not found -- this is the problem
ff_not_found:
mov word [ebp - 4], 0xffff ;; return val: not found
jmp ff_done
ff_search_done:
mov word [ebp - 4], bx ;; save entry offset
ff_done:
Code: Select all
eax: 0x00000280 640
ecx: 0x00000200 512
edx: 0x00008f1b 36635
ebx: 0x00009ea0 40608
esp: 0x00009be5 39909
ebp: 0x00009bf9 39929
esi: 0x00008f1c 36636
edi: 0x00009e81 40577
eip: 0x00008d98
eflags 0x00000286
id vip vif ac vm rf nt IOPL=0 of df IF tf SF zf af PF cf
Code: Select all
eax: 0x00000280 640
ecx: 0x00000000 0
edx: 0x00008f1b 36635
ebx: 0x0000de80 56960
esp: 0x00009be5 39909
ebp: 0x00009bf9 39929
esi: 0x00008f1c 36636
edi: 0x0000de61 56929
eip: 0x00008d9a
eflags 0x00000282
id vip vif ac vm rf nt IOPL=0 of df IF tf SF zf af pf cf
Edit:
Note that it also clears the parity flag; is that relevant?