home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / STR / MEMCPY.S < prev    next >
Encoding:
Text File  |  1993-01-02  |  784 b   |  37 lines

  1. / memcpy.s (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes
  2.  
  3.         .globl _memcpy
  4.  
  5. / void *memcpy (void *s1, const void *s2, size_t n)
  6. / {
  7. /   size_t i;
  8. /   
  9. /   for (i = 0; i < n; ++i)
  10. /       ((char *)s1)[i] = ((char *)s2)[i];
  11. /   return (s1);
  12. / }
  13.  
  14. / assumes ds=es!
  15.  
  16.         .text
  17.  
  18.         .align  2, 0x90
  19.  
  20. _memcpy:
  21.         pushl   %esi
  22.         pushl   %edi
  23.         movl    3*4(%esp), %edi         / s1
  24.         movl    4*4(%esp), %esi         / s2
  25.         movl    5*4(%esp), %ecx         / n
  26.         shrl    $2, %ecx
  27.         rep
  28.         movsl
  29.         movl    5*4(%esp), %ecx         / n
  30.         andl    $3, %ecx
  31.         rep
  32.         movsb
  33.         movl    3*4(%esp), %eax         / s1
  34.         popl    %edi
  35.         popl    %esi
  36.         ret
  37.