17 Mixing C and Assembly Code
Note: The examples presented in this section may not compile or assemble
on all devices; however, they are illustrative of the concepts being presented.
This section describes how to use assembly language and C modules together. It gives examples of using C variables and functions in assembly code and examples of using assembly language variables and functions in C.
Items discussed are:
- 17.1 Mixing Assembly Language and C Variables and Functions – separate assembly language modules may be assembled then linked with compiled C modules.
- 17.2 Using Inline Assembly Language – assembly language instructions may be embedded directly into the C code. The inline assembler supports both simple (non-parameterized) assembly language statement, as well as extended (parameterized) statements (where C variables can be accessed as operands of an assembler instruction).
- 17.3 Predefined Assembly Macros – a list of predefined assembly-code macros to be used in C code is provided.