Inline Assembly?

anyone know of if inline assembler is possible with the Arduino IDE?

asm()
{

}

and if so?... anyone come across any interesting tutorials for it?.. this is purely curiosity... (yes, i know all the downfalls from inline, not portable etc, just curiosity)

  • Cheers.

cjdelphi:
anyone know of if inline assembler is possible with the Arduino IDE?

Yes.

and if so?... anyone come across any interesting tutorials for it?

Sadly, no.

This is the best documentation I have found...
http://www.nongnu.org/avr-libc/user-manual/inline_asm.html

The Tiny Core is riddled with inline assembly...
http://code.google.com/p/arduino-tiny/source/browse/trunk/hardware/tiny/cores/tiny/TinyDebugSerial.h#75

The "Inline Assembler Cookbook," noted above, is indeed a pithy reference. But, I couldn't get it to work until I read this:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=105855.

That's perfect cheers :slight_smile:

I generally fiddle about with the C and then check the generated assembly, if theres anything glaringly inefficient I rework the C - its portable, readable, maintainable etc etc etc.

If you don't use it already, you can use objdump to see the assembly generated from your C -

If anything it shows you that assembly is a bit repetitive - load from register (LDS), do something, store back in register (STS) and repeat.

Duane B