Here is a demo with the FASTCALL calling convention :
.386
.model flat
option casemap:none
.code
CopyString PROC FASTCALL USES ebx dest:DWORD,src:DWORD
; ecx -> destination
; edx -> source
mov eax,-1
@@:
add eax,1
movzx ebx,BYTE PTR [edx + eax]
mov BYTE PTR [ecx + eax],bl
test ebx,ebx
jnz @b
ret
CopyString ENDP
END
.386
.model flat,stdcall
option casemap:none
includelib "C:\PellesC\lib\win\kernel32.lib"
includelib msvcrt.lib
ExitProcess PROTO :DWORD
printf PROTO C :DWORD,:VARARG
CopyString PROTO FASTCALL dest:DWORD,src:DWORD
.data
src db 'This is a test string.',0
message db 'Destination buffer = %s',13,10,0
.data?
dest db 100 dup(?)
.code
start:
invoke CopyString,ADDR dest,ADDR src
invoke printf,ADDR message,ADDR dest
invoke ExitProcess,0
END start