[fpc-devel] asm offset question

Daniël Mantione daniel.mantione at freepascal.org
Sat Nov 8 11:33:45 CET 2008



Op Sat, 8 Nov 2008, schreef ABorka:

> Hi,
>
> I'm converting a Delphi program to FPC/lazarus and I did hit a snag with an 
> asm code part (win32, latest fpc and lazarus svn trunk is used).
> I know it is probably simple to fix, but I cannot seem to be able to figure 
> it out:
>
> function something(s :String; i: Integer):String;
> var tmp:Array[0..32768]of byte;
> begin
> .
> .
> {$ASMMODE intel}
>    asm
>      pushad
>      mov edi, offset tmp
>      add edi, ebp
> .
> .
>      popad
>    end;
> end;
>
> The compiler gives "Error: Cannot use local variable or parameters here" at 
> line "mov edi, offset tmp" .
> How can I get the offset of a local variable into a register?

This seems like an incompatibility you might want to report. However, you 
can replace the mov & add by:

lea edi,tmp

... whould should be accepted by FPC.

Daniël


More information about the fpc-devel mailing list