Inline Assembly Overview

To specify assembly-language interpretation for a block of code in your file, use the asm keyword and standard DSP56800E instruction mnemonics.

Note: To make sure that the C compiler recognizes the asm keyword, you must clear the ANSI Keywords Only checkbox of the Language panel . Differences in calling conventions mean that you cannot re-use DSP56800 assembly code in the DSP56800E compiler.

The following listing shows how to use the asm keyword with braces, to specify that an entire function is in assembly language.

Listing: Function-level syntax
asm <function header> { 
   <assembly instructions>
} 

The function header can be any valid C function header; the local declarations are any valid C local declarations.

The following listing shows how to use the asm keyword with braces, to specify that a block of statements or a single statement is in assembly language.

Listing: Statement-level syntax
asm { inline assembly statement


  inline assembly statement 
    ... 

} 
asm {inline assembly statement} 

The inline assembly statement is any valid assembly-language statement.

The following listing shows how to use the asm keyword with parentheses, to specify that a single statement is in assembly language. Note that a semicolon must follow the close parenthesis.

Listing: Alternate single-statement syntax
asm (inline assembly statement); 
Note: If you apply the asm keyword to one statement or a block of statements within a function, you must not define local variables within any of the inline-assembly statements.