#include "newalloc.h"
-#ifdef _BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
#define _ENDIAN(x) (3-x)
#else
#define _ENDIAN(x) (x)
/* it is type float */
fl.f = (float) floatFromVal(val);
-#ifdef _BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
return fl.c[3-offset];
#else
return fl.c[offset];
if (!IS_STATIC (sym->etype))
addSetHead (&publics, sym);
+#if 0
/* print extra debug info if required */
if (options.debug || sym->level == 0)
{
fprintf (code->oFile, "%s_%d_%d", sym->name, sym->level, sym->block);
}
+#endif
/* if it has an absolute address */
if (SPEC_ABSA (sym->etype))
return;
}
- fprintf (vFile, ";\t.area\t%s\n", CODE_NAME);
- fprintf (vFile, ";__interrupt_vect:\n");
+/*
+ * update started by Vangelis Rokas on 19-Jun-2003
+ * all fprintf() calls are prefixed with ';' so they seem
+ * as comments to the assembler. I (VR) removed them */
+
+// fprintf (vFile, "\t.area\t%s\n", CODE_NAME);
+ fprintf(vFile, "\tcode\t0x0000\n");
+ fprintf (vFile, "__interrupt_vect:\n");
if (!port->genIVT || !(port->genIVT (vFile, interrupts, maxInterrupts)))
if (IS_FUNC (sym->type))
continue;
+#if 0
/* print extra debug info if required */
if (options.debug || sym->level == 0)
{
(sym->localof ? sym->localof->name : "-null-"));
fprintf (afile, "%s_%d_%d", sym->name, sym->level, sym->block);
}
+#endif
/* if is has an absolute address then generate
an equate for this no need to allocate space */
/* print the global struct definitions */
if (options.debug)
- cdbStructBlock (0,cdbFile);
+ cdbStructBlock (0); //,cdbFile);
vFile = tempfile();
/* PENDING: this isnt the best place but it will do */
pic16emitOverlay(ovrFile);
- pic16_AnalyzepCode('*');
+ pic16_AnalyzepCode('*');
//#ifdef PCODE_DEBUG
//pic16_printCallTree(stderr);
pic16_InlinepCode();
- pic16_AnalyzepCode('*');
+ pic16_AnalyzepCode('*');
pic16_pcode_test();
/* now put it all together into the assembler file */
/* create the assembler file name */
- if (!options.c1mode) {
- if (noAssemble && fullDstFileName)
- {
- sprintf (buffer, fullDstFileName);
- }
- else
- {
- sprintf (buffer, dstFileName);
- strcat (buffer, ".asm");
- }
- }
- else {
- strcpy(buffer, options.out_name);
- }
+ if ((noAssemble || options.c1mode) && fullDstFileName)
+ {
+ sprintf (buffer, fullDstFileName);
+ }
+ else
+ {
+ sprintf (buffer, dstFileName);
+ strcat (buffer, ".asm");
+ }
if (!(asmFile = fopen (buffer, "w"))) {
werror (E_FILE_OPEN_ERR, buffer);
copyFile (asmFile, bit->oFile);
- fprintf (asmFile, "\tORG 0\n");
+/* the following is commented out. the CODE directive will be
+ used instead before code */
+
+// fprintf (asmFile, "\tORG 0\n");
/* copy the interrupt vector table */
if (mainf && IFFUNC_HASBODY(mainf->type)) {
fprintf (asmFile, ";\t.area %s\n", port->mem.static_name); /* MOF */
fprintf (asmFile, ";\t.area %s\n", port->mem.post_static_name);
fprintf (asmFile, ";\t.area %s\n", port->mem.static_name);
-
+
if (mainf && IFFUNC_HASBODY(mainf->type)) {
fprintf (asmFile,"__sdcc_gsinit_startup:\n");
+
+#if 0
+ /* 8051 legacy (?!) - VR 20-Jun-2003 */
/* if external stack is specified then the
higher order byte of the xdatalocation is
going into P2 and the lower order going into
fprintf(asmFile,";\tmov\t_spx,#0x%02x\n",
(unsigned int)options.xdata_loc & 0xff);
}
+#endif
}
* by the ugly shucking and jiving about 20 lines ago.
*/
fprintf(asmFile, ";\t.area %s\n", port->mem.post_static_name);
- fprintf (asmFile,";\tljmp\t__sdcc_program_startup\n");
+ fprintf (asmFile,"\tgoto\t__sdcc_program_startup\n");
}
/* copy over code */
//copyFile (stderr, code->oFile);
- pic16_copypCode(asmFile, 'I');
- pic16_copypCode(asmFile, statsg->dbName);
- pic16_copypCode(asmFile, 'X');
- pic16_copypCode(asmFile, 'M');
- pic16_copypCode(asmFile, code->dbName);
- pic16_copypCode(asmFile, 'P');
+// fprintf(asmFile, "; I code from now on!\n");
+ pic16_copypCode(asmFile, 'I');
+
+
+// fprintf(asmFile, "; dbName from now on!\n");
+ fprintf(asmFile, "__sdcc_program_startup:\n");
+ pic16_copypCode(asmFile, statsg->dbName);
+ fprintf(asmFile, "; X code from now on!\n");
+ pic16_copypCode(asmFile, 'X');
+ fprintf(asmFile, "; M code from now on!\n");
+ pic16_copypCode(asmFile, 'M');
+ pic16_copypCode(asmFile, code->dbName);
+ pic16_copypCode(asmFile, 'P');
- fprintf (asmFile,"\tend\n");
+ fprintf (asmFile,"\tend\n");
- fclose (asmFile);
+ fclose (asmFile);
- rm_tmpfiles();
+ rm_tmpfiles();
}