; IN DS:SI offset of needle ; ES:DI offset to haystack table ; OUT ES:DI found offset in table ; ZF zero flag set if match string_search_token: push bp push cx .loop: cmp BYTE [es:di], 0 je .fail push si push di mov bp, di xor ch, ch mov cl, [es:di] inc di add bp, cx inc bp repe cmpsb pop di pop si je .end mov di, bp jmp .loop .fail: stc .end: pop cx pop cx ret