[DUG] Assembler

Paul Heinz paul at accredo.co.nz
Thu Sep 23 13:59:33 NZST 2010


Hi all 

> The following code appears in Grids.pas
> 
> { Jump to TSparsePointerArray.ForAll so that it looks like it 
> was called
>   from our caller, so that the BP trick works. }
> 
> function TSparseList.ForAll(ApplyFunction: Pointer {TSPAApply}):
> Integer; assembler;
> asm
>         MOV     EAX,[EAX].TSparseList.FList
>         JMP     TSparsePointerArray.ForAll
> end;
> 
> Does anyone know what the first line does?

It's using a BASM extension to calculate an offset per the
TSparseList.Flist member and deference and load EAX from there. So given
that EAX points to a TSparseList, afterwards EAX will point to the TList
instance via the FList member.

> More importantly, does anyone know how to convert the Intel 
> style assembler code to AT&T?

It's a non-trival change. The parameter order to instructions is often
different and the sizing is all explicit.

http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/gnu-assemble
r/i386-syntax.html

Cheers,
  Paul.



More information about the Delphi mailing list