Re: [fpc-pascal] var parameter

2010-04-30 Thread cobines
2010/4/30 spir ☣ : > Hello, > > I wrote a little simulation prog to try and understand better the semantics > of var parameters (see below code and output). > > It seems they behave like if passed via pointers, but also locally _operated_ > via pointers. Meaning there is in ChangeVar no real loca

[fpc-pascal] var parameter

2010-04-30 Thread spir ☣
Hello, I wrote a little simulation prog to try and understand better the semantics of var parameters (see below code and output). It seems they behave like if passed via pointers, but also locally _operated_ via pointers. Meaning there is in ChangeVar no real local variable n (on the stack). B

Re: [fpc-pascal]Var parameter passing to asm procedure

2004-08-06 Thread Tomas Hajny
On Thu, 05 Aug 2004 16:56:28 +0200, Florian Klaempfl wrote > Ivan Stamenkovic wrote: > > > Hi, > > > > I have a problem when trying to pass some variable parameters to a > > procedure writen using integrated assembler. I have reduced the > > problem to the following code: > > > > program Increme

Re: [fpc-pascal]Var parameter passing to asm procedure

2004-08-06 Thread Tomas Hajny
On Fri, 6 Aug 2004 11:18:01 +0200 (CEST), Marco van de Voort wrote > > Ok, then this can be this way: > > > > procedure increment(var x: dword); assembler; > > asm > > mov eax, x > > inc [eax] > > end; > > > > Is this correct? If the compiler uses registers, the first line is > > transl

Re: [fpc-pascal]Var parameter passing to asm procedure

2004-08-06 Thread Marco van de Voort
> Ok, then this can be this way: > > procedure increment(var x: dword); assembler; > asm > mov eax, x > inc [eax] > end; > > Is this correct? If the compiler uses registers, the first line is > translated to a 'mov eax, eax', otherwise it is something like 'mov eax, > [esp-4]'. Afaik

Re: [fpc-pascal]Var parameter passing to asm procedure

2004-08-06 Thread Florian Klaempfl
Ivan Stamenkovic wrote: Hi, I have a problem when trying to pass some variable parameters to a procedure writen using integrated assembler. I have reduced the problem to the following code: program IncrementDemo; {$R+} {$asmmode intel} var a: dword; procedure increment(var x: dword); assembler;

Re: [fpc-pascal]Var parameter passing to asm procedure

2004-08-05 Thread Nelson M. Sicuro
Ok, then this can be this way: procedure increment(var x: dword); assembler; asm mov eax, x inc [eax] end; Is this correct? If the compiler uses registers, the first line is translated to a 'mov eax, eax', otherwise it is something like 'mov eax, [esp-4]'. Regards, Nelson The asm block c

Re: [fpc-pascal]Var parameter passing to asm procedure

2004-08-05 Thread Marco van de Voort
> The asm block can be this way: > > procedure increment(var x: dword); assembler; > asm >inc [eax] > end; > > You don't need to worry about segment registers, but don't mess with them! > I assume that the parameter x is passed on the eax register as Delphi does. > Please correct me if I'm wr

Re: [fpc-pascal]Var parameter passing to asm procedure

2004-08-05 Thread Nelson M. Sicuro
The asm block can be this way: procedure increment(var x: dword); assembler; asm inc [eax] end; You don't need to worry about segment registers, but don't mess with them! I assume that the parameter x is passed on the eax register as Delphi does. Please correct me if I'm wrong... Hi, I have a pro

[fpc-pascal]Var parameter passing to asm procedure

2004-08-05 Thread Ivan Stamenkovic
Hi, I have a problem when trying to pass some variable parameters to a procedure writen using integrated assembler. I have reduced the problem to the following code: program IncrementDemo; {$R+} {$asmmode intel} var a: dword; procedure increment(var x: dword); assembler; asm push ds