Keywords: sdccman

## 3.11.4 Use of Labels within Inline Assembler

SDCC allows the use of in-line assembler with a few restrictions regarding labels. All labels defined within inline assembler code have to be of the form nnnnn$ where nnnnn is a number less than 100 (which implies a limit of utmost 100 inline assembler labels per function).3.6

> __asm
> mov b,#10
> 00001$:
> djnz b,00001$
> __endasm ;

Inline assembler code cannot reference any C-labels, however it can reference labels defined by the inline assembler, e.g.:

> foo() {
> /* some c code */
> __asm
> ; some assembler code
> ljmp 0003$
> __endasm;
> /* some more c code */
> clabel: /* inline assembler cannot reference this label */ 3.7
> __asm
> 0003$: ;label (can be referenced by inline assembler only)
> __endasm ;
> /* some more c code */
> }

In other words inline assembly code can access labels defined in inline assembly within the scope of the function. The same goes the other way, i.e. labels defines in inline assembly can not be accessed by C statements.