Statements

All internal assembly statements must follow this syntax:

  [LocalLabel:] (instruction | directive) [operands];  

Other rules for statements are:

The following listings are valid examples of inline assembly code:

Listing: Function-Level Sample
long int b;
struct mystruct {

  long int a;

} ;

static asm long f(void)     // Legal asm qualifier

{

  move.l   struct(mystruct.a)(A0),D0 // Accessing a struct.

  add.l    b,D0   // Using a global variable, put return value

                  // in D0.

  rts             // Return from the function:

                  // result = mystruct.a + b 

} 
Listing: Statement-Level Sample
long square(short a)
{

   asm {

     move.w  a,d0    // fetch function argument `a'

     mulu.w  d0,d0   // multiply

     return          // return from function (result is in D0)

   }

}
Note: Regardless of its settings, the compiler never optimizes assembly-language functions. However, to maintain integrity of all registers, the compiler notes which registers inline assembly uses.