Interfacing Assembly and C
Anonymous
Not applicable
Mar 24, 2011
12:54 PM
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Mar 24, 2011
12:54 PM
How to use a variable that is defined in a .C file in a .asm file of the same project?
If a variable is declared in the .c file, no memory allocation is needed in the .asm file. Make sure to declare your variable outside of any functions so that it is global. Assembly is able to see all global variables, so we do not need to tell it about an “external” variable declaration. We must make sure that when we call it in the .asm file, we use with “_”.
For example. In a C file following global variable is declared:
int OperandTwo
To use it in assembly, just add an underscore and use the variable:
mov [ _OperandTwo],0x00
For more information on interfacing C and assembly functions, please refer to the application note, at the following link.
Translation - Japanese: アセンブリとCのインターフェース - Community Translated (JA)
Labels
Rate this article: