home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / system / source / a_memory.asm next >
Encoding:
Assembly Source File  |  2009-09-14  |  3.0 KB  |  136 lines

  1. ;    VirtualDub - Video processing and capture application
  2. ;    System library component
  3. ;    Copyright (C) 1998-2004 Avery Lee, All Rights Reserved.
  4. ;
  5. ;    Beginning with 1.6.0, the VirtualDub system library is licensed
  6. ;    differently than the remainder of VirtualDub.  This particular file is
  7. ;    thus licensed as follows (the "zlib" license):
  8. ;
  9. ;    This software is provided 'as-is', without any express or implied
  10. ;    warranty.  In no event will the authors be held liable for any
  11. ;    damages arising from the use of this software.
  12. ;
  13. ;    Permission is granted to anyone to use this software for any purpose,
  14. ;    including commercial applications, and to alter it and redistribute it
  15. ;    freely, subject to the following restrictions:
  16. ;
  17. ;    1.    The origin of this software must not be misrepresented; you must
  18. ;        not claim that you wrote the original software. If you use this
  19. ;        software in a product, an acknowledgment in the product
  20. ;        documentation would be appreciated but is not required.
  21. ;    2.    Altered source versions must be plainly marked as such, and must
  22. ;        not be misrepresented as being the original software.
  23. ;    3.    This notice may not be removed or altered from any source
  24. ;        distribution.
  25.  
  26.         segment    .text
  27.  
  28.     global    _VDFastMemcpyPartialScalarAligned8
  29. _VDFastMemcpyPartialScalarAligned8:
  30.         mov        eax, [esp+12]
  31.         mov        edx, [esp+4]
  32.         mov        ecx, [esp+8]
  33.         add        ecx, eax
  34.         add        edx, eax
  35.         neg        eax
  36.         jz        .nobytes
  37.         add        eax, 8
  38.         jz        .doodd
  39.         jmp        short .xloop
  40.         align    16
  41. .xloop:
  42.         fild    qword [ecx+eax-8]
  43.         fild    qword [ecx+eax]
  44.         fxch
  45.         fistp    qword [edx+eax-8]
  46.         fistp    qword [edx+eax]
  47.         add        eax,16
  48.         jnc        .xloop
  49.         jnz        .nobytes
  50. .doodd:
  51.         fild    qword [ecx-8]
  52.         fistp    qword [edx-8]
  53. .nobytes:
  54.         ret
  55.  
  56.     global    _VDFastMemcpyPartialMMX
  57. _VDFastMemcpyPartialMMX:
  58.         push    edi
  59.         push    esi
  60.  
  61.         mov        edi, [esp+4+8]
  62.         mov        esi, [esp+8+8]
  63.         mov        ecx, [esp+12+8]
  64.         mov        edx, ecx
  65.         shr        ecx, 2
  66.         and        edx, 3
  67.         rep        movsd
  68.         mov        ecx, edx
  69.         rep        movsb
  70.         pop        esi
  71.         pop        edi
  72.         ret
  73.  
  74.     global    _VDFastMemcpyPartialMMX2
  75. _VDFastMemcpyPartialMMX2:
  76.         push    ebp
  77.         push    edi
  78.         push    esi
  79.         push    ebx
  80.  
  81.         mov        ebx, [esp+4+16]
  82.         mov        edx, [esp+8+16]
  83.         mov        eax, [esp+12+16]
  84.         neg        eax
  85.         add        eax, 63
  86.         jbe        .skipblastloop
  87. .blastloop:
  88.         movq    mm0, [edx]
  89.         movq    mm1, [edx+8]
  90.         movq    mm2, [edx+16]
  91.         movq    mm3, [edx+24]
  92.         movq    mm4, [edx+32]
  93.         movq    mm5, [edx+40]
  94.         movq    mm6, [edx+48]
  95.         movq    mm7, [edx+56]
  96.         movntq    [ebx], mm0
  97.         movntq    [ebx+8], mm1
  98.         movntq    [ebx+16], mm2
  99.         movntq    [ebx+24], mm3
  100.         movntq    [ebx+32], mm4
  101.         movntq    [ebx+40], mm5
  102.         movntq    [ebx+48], mm6
  103.         movntq    [ebx+56], mm7
  104.         add        ebx, 64
  105.         add        edx, 64
  106.         add        eax, 64
  107.         jnc        .blastloop
  108. .skipblastloop:
  109.         sub        eax, 63-7
  110.         jns        .noextras
  111. .quadloop:
  112.         movq    mm0, [edx]
  113.         movntq    [ebx], mm0
  114.         add        edx, 8
  115.         add        ebx, 8
  116.         add        eax, 8
  117.         jnc        .quadloop
  118. .noextras:
  119.         sub        eax, 7
  120.         jz        .nooddballs
  121.         mov        ecx, eax
  122.         neg        ecx
  123.         mov        esi, edx
  124.         mov        edi, ebx
  125.         rep        movsb
  126. .nooddballs:
  127.         pop        ebx
  128.         pop        esi
  129.         pop        edi
  130.         pop        ebp
  131.         ret
  132.  
  133.  
  134.         end
  135.  
  136.