Assembler in C

William A. Gatliff
Mon Nov 25 07:51:00 GMT 2002


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).

Bill Gatliff
Do you do embedded GNU?  I do!
See for details.

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list