Hello
Just my 10 cents here.
When a function is implemented as an inline assembly function (contains only inline assembly instructions), you do not have to explicitly generate the RTS or whatever exit code is requested.
The compiler will care about that for you.
Only case where you may have to add exit code yourself is if for any reason you want to exit the function some other places.
Anyway in that case also I would recommend to use the standard function exit code and branch to a label at the end of the function.
Main advantage of letting the compiler manage function exit code is that compiler knows how the function is invoked and will adjust exit code accordingly.
Exit code may be different depending if function is invoked using a JSR or directly inlined in the calling function.
Just let the compiler manage this all
.
loadByte is preceded by the pragmas
#pragma NO_ENTRY
#pragma NO_EXIT
#pragma NO_FRAME
These pragmas explicitly tells the compiler to generate no entry or exit code. In that particular case the programmer decided to keep whole control over function entry and exit code.
I would not use that as a standard.
Around your other questions,
asm and _asm have identical behavior. Only difference I know is asm is not accepted if you build with option "Strict ANSI" (-Ansi) activated. _asm will be accepted in strict ANSI mode as well.
Comment in inline assembler can be specified in either ANSI C, C++ or assembly syntax.
So you can use:
; ...
// ...
/* ... */
; and // are valid till the end of the line, whereas /* */ strictly enclosed the text in comment. Anything after */ will not be considered as comment.
I hope that helps.
CrasyCat