[fpc-devel] asm offset question
    ABorka 
    fpc-devel at aborka.com
       
    Sun Nov  9 05:46:01 CET 2008
    
    
  
Thanks. It seems that
mov al, dl
as well as
xor al, dl
gives error too. I created a bug report 
http://bugs.freepascal.org/view.php?id=12595
Daniël Mantione wrote:
> 
> 
> 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
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
    
    
More information about the fpc-devel
mailing list