So are you proud of me? :-)
memcpy is designed to copy from a buffer to another buffer, for
a length of whatever. No overrun allowed. Destination to be
returned to caller. Parameter order is dest, source, length...
; stringa.asm - string assembler functions
;
; This program written by Paul Edwards, Fidonet 3:711/934
; Released to the public domain
.386p
.model flat
_DATA segment dword public use32 "DATA"
_DATA ends
_BSS segment dword public use32 "BSS"
_BSS ends
DGROUP group _DATA,_BSS
assume cs:_TEXT,ds:DGROUP
_TEXT segment "CODE"
public memcpy
memcpy proc
push ebp
mov ebp, esp
pushf
push edi
push esi
push ecx
mov edi, [ebp+8]
mov esi, [ebp+12]
mov ecx, [ebp+16]
cld
shr ecx, 2
rep movsd
mov ecx, [ebp+16]
and ecx, 00000003H
rep movsb
mov eax, [ebp+8]
pop ecx
pop esi
pop edi
popf
pop ebp
ret
memcpy endp
_TEXT ends
end
@EOT:
---
* Origin: X (3:711/934.9)
|