4. Header and Include Files

Include files used by and generated by Relogix

After the initial comment indicating that sample.c was generated by Relogix, we find two #include statements:

#include "rlx68k.h"
#include "sample.h"

The first of these includes headers for the Relogix support library, which contains definitions and a small number of support routines used as part of the translation (these are mainly for handling special cases such as 64-bit divides). In this simple example, these are not used.

The second #include statement is used to include the header file specific to the translation of this particular assembler source file, sample.h. In a real-world example, this would then be followed by a number of further #include statements, one for each assembler source file in your project.

As you can see, the include file sample.h contains the function prototypes which Relogix has produced for each of the public (exported) functions in the translated C source (in this case, we have only one function, movetok). The include file also contains the definitions for the data types which are needed for the parameters of the exported functions - in this case, the structure tok. We will look at this in more detail later in the tour.

Equates, variables, local prototypes and local types

The next part of the generated C source file comprises definitions and prototypes which are local to the file being translated. In more complex examples, global variable definitions might also be placed here. In this simple translation, we have just one equate defined, which arises directly from an assembler EQU directive:

#define ENDMARK              0x80000000