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

extrn   STRLEN:near
extrn   MEMCPY:near
extrn   MEMSET:near

public  STRNCPY

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

STRNCPY:
        push ebx esi edi

        mov edi,[esp+4+12+08h]
        mov ebx,[esp+4+12+04h]
        push ebx
        call STRLEN
        mov esi,eax
        mov eax,[esp+4+12+00h]
        cmp esi,eax
        jbe short @@01

        push edi
        push ebx
        push eax
        call MEMCPY
        jmp short @@00

@@01:
        push edi
        push ebx
        push esi
        call MEMCPY

        mov eax,[esp+4+12+00h]
        sub eax,esi
        add esi,edi
        push esi
        push 0
        push eax
        call MEMSET

@@00:
        mov eax,edi

        pop edi esi ebx
        ret 0ch

_TEXT           ends
end

[ RETURN TO DIRECTORY ]