Lets say we have a procedure like the below in Delphi

Posted on 2006-02-18 14:14:33 by XCHG
Why do you need this?
The best way is just to use function parameters in asm block as they are.
Anyway I don't think that the use of parameters by the means of esp in HLL is safe...
I might be wrong, cause I don't know Delphi, so I guess If Assembler directive allows you to make pure asm function and according to the stdcall convention char1 might be at esp+4,char2 at esp+8 and so on.
But you have 4 char parameters so compiler can pack 4 bytes into 1 dword.
Posted on 2006-02-18 19:21:51 by k3Eahn
Here are some example on how delphi treats functions with special keywords like register

Posted on 2006-02-18 21:41:43 by XCHG
Well Delphi uses by default its own calling convention named register - that's right.
This convention is similar to fastcall convention, cause register function accepts first 3 parameters in registers
namely eax(first),edx(second),ecx(third). The rest of the parameters are passed to sucha function by the means
of the stack according to pascal calling convention.

Here is the example of how to use parameters in asm procedure in Delphi:

procedure _Sum(a,b,c,d,e:cardinal);
asm
add eax,edx;{eax=a+b}
add ecx,;{ecx=c+e}
add eax,ecx
add eax,;{eax=eax+d}
end;
Posted on 2006-02-19 06:34:52 by k3Eahn
Hey cool thats what i was looking for. thanks, cheers.
Posted on 2006-03-03 04:21:07 by XCHG