+
+ /* initial comments */
+ initialComments (asmFile);
+
+ /* print module name */
+ tfprintf (asmFile, "\t!module\n", moduleName);
+ tfprintf (asmFile, "\t!fileprelude\n");
+
+ /* Let the port generate any global directives, etc. */
+ if (port->genAssemblerPreamble)
+ {
+ port->genAssemblerPreamble (asmFile);
+ }
+
+ /* print the global variables in this module */
+ printPublics (asmFile);
+ if (port->assembler.externGlobal)
+ printExterns (asmFile);
+
+ /* copy the sfr segment */
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; special function registers\n");
+ fprintf (asmFile, "%s", iComments2);
+ copyFile (asmFile, sfr->oFile);
+
+ /* copy the sbit segment */
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; special function bits \n");
+ fprintf (asmFile, "%s", iComments2);
+ copyFile (asmFile, sfrbit->oFile);
+
+ /* copy the data segment */
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; internal ram data\n");
+ fprintf (asmFile, "%s", iComments2);
+ copyFile (asmFile, data->oFile);
+
+
+ /* create the overlay segments */
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; overlayable items in internal ram \n");
+ fprintf (asmFile, "%s", iComments2);
+ copyFile (asmFile, ovrFile);
+
+ /* create the stack segment MOF */
+ if (mainf && IFFUNC_HASBODY(mainf->type))
+ {
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; Stack segment in internal ram \n");
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "\t.area\tSSEG\t(DATA)\n"
+ "__start__stack:\n\t.ds\t1\n\n");
+ }
+
+ /* create the idata segment */
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; indirectly addressable internal ram data\n");
+ fprintf (asmFile, "%s", iComments2);
+ copyFile (asmFile, idata->oFile);
+
+ /* copy the bit segment */
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; bit data\n");
+ fprintf (asmFile, "%s", iComments2);
+ copyFile (asmFile, bit->oFile);
+
+ /* if external stack then reserve space of it */
+ if (mainf && IFFUNC_HASBODY(mainf->type) && options.useXstack)
+ {
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; external stack \n");
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "\t.area XSEG (XDATA)\n"); /* MOF */
+ fprintf (asmFile, "\t.ds 256\n");
+ }
+
+
+ /* copy xtern ram data */
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; external ram data\n");
+ fprintf (asmFile, "%s", iComments2);
+ copyFile (asmFile, xdata->oFile);
+
+ /* copy xternal initialized ram data */
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; external initialized ram data\n");
+ fprintf (asmFile, "%s", iComments2);
+ copyFile (asmFile, xidata->oFile);
+
+ /* copy the interrupt vector table */
+ if (mainf && IFFUNC_HASBODY(mainf->type))
+ {
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; interrupt vector \n");
+ fprintf (asmFile, "%s", iComments2);
+ copyFile (asmFile, vFile);