vcアセンブリstrcpy memcpyを実現


void *__memcpy(void *src, void *dest, int n)
{
	__asm
	{ 
		mov eax, 0
		mov esi, dword ptr[src]
		mov edi, dword ptr[dest]
		cmp esi, 0
		jz next
		cmp edi, 0
		jz next
		mov ecx, n
		rep movsb
		mov eax, dword ptr[dest]
next:
		//NEXT
	}
}
char *__strcpy(const char *src, char *dest)
{
	__asm
	{
		cld
		or ecx, 0xffffffff
		mov edi, dword ptr[src]
		cmp edi, 0
		jz _ret
		repnz scasb /*  edi    */
		not ecx     /*      , -1,      */
		sub ecx, 1
		mov esi, dword ptr[src]
		mov edi, dword ptr[dest]
		cmp edi, 0
		jz _ret
		rep movsb	
		mov eax, dword ptr[dest]
_ret:
	}
}