Inline Assembler Problems_(re)

Wed, 11 Jun 1997 23:42:16 +0800


>     Var
>        TheArray : Array[0..99] Of Integer; {32-bit}
>     Begin
>         Asm("
>             ... Code ...
>             movl  _Index, %esi                    (*you must double % if
you use Ext. Asm*)
>             movl  $_TheArray(,esi,4), %eax
>             ... Code ...
>         ");
>     End.

DOHHH! I am an idiot! In my code I had the two operands switched around! The
assembler was telling me that I was using an invalid 386 instruction. Is the
following really illegal?

   movl %eax,$_TheArray(,esi,4)

   
Now im doing it much nicer:

   Asm("... Code ...         "
       "movl %0(,%1,4),%%eax "
       "... Code ...         "
       : { No outputs }
       : "m" (TheArray), "r" (Index), 
       : "eax"); 

I LOVE the inline assembler, except for the 15 local label limit. I know I
can prefix locals with an 'L' except when the compiler inlines the code it
creates duplicate labels. Is there any way around that?

Thanks for your help
 ________________________
|  _)        | |             e-mail: bernie@icenet.com.au
|___)ernhard |_|schirren             ptschirrenb@cc.curtin.edu.au
                             www:    www.geocities.com/CollegePark/Quad/8070/


Bernhard Tschirren (bernie@icenet.com.au)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es