Metropoli BBS
VIEWER: strstr.asm MODE: TEXT (ASCII)
.386p
locals

extrn   STRLEN:near

public  STRSTR

_TEXT           segment byte public use32 'CODE'
assume  cs:_TEXT

STRSTR:
        push ebx esi edi
        cld

        mov edi,[esp+4+12+04h]
        push edi
        call STRLEN
        or eax,eax
        jz short @@00

        mov ebx,eax
        mov esi,[esp+4+12+00h]
        push esi
        call STRLEN

        sub ebx,eax
        jc short @@01

        lea edx,[eax-1]
        or eax,eax
        mov eax,edi
        jz short @@00

        lodsb
@@01l:
        mov ecx,ebx
        jecxz short @@01

        repne scasb
        jne short @@01
        mov ebx,ecx

        mov ecx,edx
        jecxz short @@02

        push esi edi
        repe cmpsb
        pop edi esi
        jne @@01l

@@02:
        lea eax,[edi-1]
        jmp short @@00

@@01:
        xor eax,eax

@@00:
        pop edi esi ebx
        ret 08h

_TEXT           ends
end

[ RETURN TO DIRECTORY ]