StrCopy64 By Wonder Mage For MASM uses mmx registers to copy data.
Very easy alog. for beginers in win32asm who want to use mmx regs.
StrCopy64 proc OutBuffer1:DWORD,InBuffer1:DWORD
local iPos1:DWORD
local iLen1:DWORD
;USING .MMX---------------------------------------------------
;-------------------------------------------------------------
;This functions copies data bits upto 64 bits per copy!-------
;By Wonder Mage-----------------------------------------------
;A beginners guide example routine to copy data by using mmx--
;Date:06-07-02-(MM/DD/YYYY)-----------------------------------
invoke lstrlenA,InBuffer1
test eax,eax
jle @@ReturnLenError
mov iLen1,eax
mov iPos1,0

@@Z1:
mov ecx,iPos1
cmp ecx,iLen1
jge @@Z2
mov ecx,iLen1
sub ecx,iPos1
cmp ecx,9
jle @@Z1UseByte
@@Z1UseMMX1: ; Using mmx now
pxor MM0,MM0
mov ecx,iPos1
mov eax,InBuffer1
mov ebx,OutBuffer1
movq MM0,qword ptr ;-----------------MM0 MMX Register
movq qword ptr ,MM0
add iPos1,8
jmp @@Z1
@@Z1UseByte: ; Time for byte processessing!
xor eax,eax
mov ecx,iPos1
mov edx,InBuffer1
mov ebx,OutBuffer1
mov al,byte ptr
mov byte ptr ,al
inc iPos1
jmp @@Z1
@@Z2:
emms ;Very bad instruction time consuming if processessed in a loop!
mov ecx,iPos1
; inc ecx
mov edx,OutBuffer1
mov byte ptr ,0 ;Zero Fill MUST!
mov eax,iPos1
ret
@@ReturnLenError:
xor eax,eax
ret
StrCopy64 endp:cool:
Posted on 2002-06-07 08:30:29 by Wonder Mage