I wrote a copy string procedure in masm32
coppystring proc uses esi edi ecx source:dword,dest:dword
mov esi, OFFSET source
mov edi, OFFSET dest
mov ecx, SIZEOF source
Lx:
mov al,[esi]
mov [edi],al
inc esi
inc edi
loop Lx
coppystring endp
This code gives me error
A2098 invalid operand for OFFSET
The expression following the OFFSET operator must be a memory expression or an immediate expression. But still I don't know how to fix my proc
You are getting those errors because the memory address of
source
anddest
are not known at compile time. You need to pass the address to the proc. Also, as commented, you cannot useSIZEOF
and should check for the null terminator or get the length another way.