Consider that we have a C function that consists entirely of in-line assembly code, of the form -
; // Assembly code here
The question then arises about the inclusion of a final RTS instruction, or not. I have seen examples of both. My best guess is that if the function is called from C there should not be RTS. But if the function is called by other in-line code (JSR func1), the final RTS should be included. If this is the case, this would seem to make the calling of the function within both C and in-line assembly mutually excusive.
Can anyone clarify the situation for me? One example is in the start08.c file generated by CW. The loadByte() function does include RTS.
Another couple of questions also arise -
- Whether to use asm or _asm for a block of in-line code - what is the difference between the two forms?
- What is the correct way to make a comment within in-line assembly code, since the semi-colon has different meanings for C and assembler?
Message Edited by bigmac on 2006-09-15 04:39 PM
Message Edited by CrasyCat on 2007-04-13 02:16 PM