Subsections

3.11.1 Inline Assembler Code Formats

SDCC supports two formats for inline assembler code definition:

3.11.1.1 Old __asm ... __endasm; Format

Most of inline assembler code examples in this manual use the old inline assembler code format, but the new format could be used equivalently.

Example:

__asm
    ; This is a comment 
    label: 
        nop 
__endasm;
Note: As of SDCC 4.2.9, assembler comments occurring in this type of inline assembler block are affected by macro expansion.

3.11.1.2 New __asm__ (''inline_assembler_code'') Format

The __asm__ inline assembler code format was introduced in SDCC version 3.2.0. Its main advantage is that it is compatible with all standard compliant C preprocessors.

Example:

__asm__ (”; This is a comment\nlabel:\n\tnop”);
Or for better readability:
__asm__ (

”; This is a comment\n”

”label:\n”

”    nop”

);