Assembler in C

William A. Gatliff bgat@billgatliff.com
Mon Nov 25 07:51:00 GMT 2002


Daniel:


The gcc syntax is along the lines of:

   __asm__("sbi PORTB, 0x07");

You could also do this:

   __asm__("sbi PORTB, 0x07;"
           "sbi PORTC, 0x07;");

See the GNU compiler manual, the section called "extended asm", for
more information on operand constraints that let you do really cool
stuff with inline assembly code.

You could also put your asm code in a .S file.

The example you provide for AnyFunction() won't work with gcc.  The
syntax just doesn't work like that.  If you're trying to do that much
in assembly, it probably belongs in a .S file anyway--- with a few
lines of inline assembly code to glue it to the C environment (again,
using operand constraints).


b.g.
-- 
Bill Gatliff
Do you do embedded GNU?  I do!
See http://billgatliff.com for details.

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list