Snippet:Embed assembly in C

From Curuxa

If you are writing a program in C language but you need to implement a function or piece of code in assembly language, you can do it by writing your code between the __asm and __endasm; directives.

Real example

The following is an example that can also be found in the snippets about delays:

//Delay the program for 10 microseconds
void Delay10us(){
	__asm
		GOTO $+1
		GOTO $+1
		GOTO $+1
		GOTO $+1
		GOTO $+1
		GOTO $+1
		GOTO $+1
		GOTO $+1
		GOTO $+1
	__endasm;
}