
Interfacing C with Assembly Language
6-22
6.4.2 Using Inline Assembly Language
Within a C program, you can use the
asm statement
to inject a single line of
assembly language into the assembly language file that the compiler creates.
A series of asm statements places sequential lines of assembly language into
the compiler output with no intervening code.
Note: Using the asm Statement
The asm statement lets you access features of the hardware that would be
otherwise inaccessible from C. When you use the asm statement, be careful
not to disrupt the C environment. The compiler does not check or analyze the
inserted instructions.
Inserting jumps or labels into C code may produce unpredictable results by
confusing the register-tracking algorithms that the code generator uses.
Do not change the value of a C variable. You can, however, safely read the
current value of any variable.
Do not use the asm statement to insert assembler directives that would
change the assembly environment.
The asm statement is also useful for inserting comments in the compiler out-
put. You can simply start the assembly code string with an asterisk (*) as shown
below:
asm(”**** this is an assembly language comment”);
Содержание TMS320C2x
Страница 8: ...viii...
Страница 69: ...2 47 C Compiler Description...
Страница 159: ...6 36...
Страница 226: ...8 6...
Страница 250: ...Index Index 14 Z z shell option 2 2 2 4 2 14 overriding with c option 4 5 overriding with n option 2 13...