Date: Fri, 18 Oct 1996 16:31:15 +0000 From: Bill Currie Subject: Re: Some Inline ASM questions To: khcm6sh AT dmu DOT ac DOT uk Cc: djgpp AT delorie DOT com Message-id: <3267B0D3.2632@blackmagic.tait.co.nz> Organization: Tait Electronics NZ MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit References: <326651D4 DOT 7250 AT dmu DOT ac DOT uk> Simon Hammett wrote: > some_routine() > { > asm (" > > movl _Y_coord, %eax > imul $HREZ, %eax > > "); > }change to: some_routine() { asm (" movl _Y_coord, %%eax imul $%0, %%eax " : :"i"(HREZ)); } > int some_function ( int x, int y ); > { > asm (" > > movl X(%sp), %eax > imul Y(%sp), %eax > movl %eax, RESULT( %sp ) > > "); > }chage to: int some_function ( int x, int y ); { int result; asm (" imul %2, %%eax " :"=a"(result) :"a"(x),"g"(y) ); } Basically, extended inline asm makes life much easier. (type 'info gcc "c ex" ex' to get more info) Hope this helps Bill