home *** CD-ROM | disk | FTP | other *** search
- .386
- .model small
- public _strncpy
- .code
- _strncpy:
- push ebp
- mov ebp,esp
- push esi
- push edi
- mov edi,[ebp+12]
- mov ecx,-1
- sub al,al
- cld
- repne scasb
- neg ecx
- dec ecx
- dec ecx
- mov edx,[ebp+16]
- sub edx,ecx
- jge short useecx
- mov ecx,[ebp+16]
- useecx:
- mov esi,[ebp+12]
- mov edi,[ebp+8]
- cld
- rep movsb
-
- or edx,edx
- jle short nopad
- mov ecx,edx
- sub al,al
- rep stosb
-
- nopad:
- mov eax,[ebp+8]
- pop edi
- pop esi
- pop ebp
- ret
- end