12.5.5 For 8-bit code, #asm and #endasm cause red bangs in the Editor window
The #asm
and #endasm
statements are
valid constructs for declaring in-line assembly code within an MPLAB XC8 C program. But
in the IDE Editor, the C preparser does not see these as valid directives and will
display a red bang next to these statements. However, this code will still work.
If you want to eliminate the red bangs in the Editor, you can use the
asm()
statement. This is the preferred method of using in-line
assembly for all MPLAB XC C compilers.
Example:
// Inline Code that causes error
#asm
movlw 0x20;
nop;
nop;
#endasm
// Workaround for inline assembly - that will not cause error
// (Multi line asm code)
asm("\
movlw 0x20;\
nop;\
nop;");
// Workaround for inline assembly - that will not cause Error
// (Single line asm code)
asm("movlw 0x20; nop; nop");