home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / SOFTWARE / LIBS / PMC101.ZIP / LIBSRC.ZIP / STRNCPY.ASM (.txt) < prev    next >
Assembly Source File  |  1994-06-14  |  849b  |  54 lines

  1. .386p
  2. locals
  3.  
  4. extrn   STRLEN:near
  5. extrn   MEMCPY:near
  6. extrn   MEMSET:near
  7.  
  8. public  STRNCPY
  9.  
  10. _TEXT           segment byte public use32 'CODE'
  11. assume  cs:_TEXT
  12.  
  13. STRNCPY:
  14.         push ebx esi edi
  15.  
  16.         mov edi,[esp+4+12+08h]
  17.         mov ebx,[esp+4+12+04h]
  18.         push ebx
  19.         call STRLEN
  20.         mov esi,eax
  21.         mov eax,[esp+4+12+00h]
  22.         cmp esi,eax
  23.         jbe short @@01
  24.  
  25.         push edi
  26.         push ebx
  27.         push eax
  28.         call MEMCPY
  29.         jmp short @@00
  30.  
  31. @@01:
  32.         push edi
  33.         push ebx
  34.         push esi
  35.         call MEMCPY
  36.  
  37.         mov eax,[esp+4+12+00h]
  38.         sub eax,esi
  39.         add esi,edi
  40.         push esi
  41.         push 0
  42.         push eax
  43.         call MEMSET
  44.  
  45. @@00:
  46.         mov eax,edi
  47.  
  48.         pop edi esi ebx
  49.         ret 0ch
  50.  
  51. _TEXT           ends
  52. end
  53.  
  54.