A variable or constant defined in an ANSI-C source file is accessible in an assembly source file.
The variable or constant is defined in the ANSI-C source file using the standard ANSI-C syntax, as listed in the following listing:
unsigned int CData; /* Definition of a variable */ unsigned const int CConst; /* Definition of a constant */
An external declaration for the variable or constant must be inserted into the assembly source file, as listed in the following listing:
This can also be done in a separate file, included in the assembly source file.
XREF CData; External declaration of a variable XREF CConst; External declaration of a constant
The variables or constants can then be accessed in the usual way, using their names, as listed in the following listing:
LDA CConst .... LDA CData ....