18 Mixing C and Assembly Code

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:

  • Mixing Assembly Language and C Variables and Functions – separate assembly language modules may be assembled then linked with compiled C modules.
  • 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).
  • Predefined Assembly Macros – a list of predefined assembly-code macros to be used in C code is provided.