A question about Assambler code..

Hi, I'm just browsing through some code and find sometimes

_asm

nop

_endasm

So basically the prodram does nothing at this point, am i right? Is there some reason why someone would do that (its not Arduino code)? And is there a possible way to do such a thing in Arduino? My first idea was using delay(1) - but i think delay(1) would take longer than nop...

A no-operation command is inserted into a program for many different reasons, but usually none of them apply to assembler NOP in a C program.

It can be used as a way to ensure the next instruction is at a convenient address. It can be used as a very small delay, typically one clock cycle or instruction cycle. It can be used as a free byte that can be replaced with a breakpoint statement (e.g., 8086 INT 3 is a single-byte instruction) or other instruction while in the debugger. It can be used just as a sort of visual bookmark, something that shows up in a disassembly or debugger.

The only situation that I can think of that really benefits a C program would be to thwart the compiler's ability to reorganize and optimize a routine, such as to force a loop to be unrolled. Most compilers have options that can be used to control this, rather than resort to non-portable hacks like inline assembler.

ok, thanks for the info :0)