X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fhc08%2Fmain.c;h=da5fd14fcaf69c3c4a6b9e5bfa1d67ba2ab6a13d;hb=eae1bd2f705a2c61e143c539f8c4d1e9c2b4efe6;hp=f5efd8603fb2ee21956902fb88bbaada9ab1d038;hpb=06b95666e210afed625cfbe73489873b7b1bef82;p=fw%2Fsdcc diff --git a/src/hc08/main.c b/src/hc08/main.c index f5efd860..da5fd14f 100644 --- a/src/hc08/main.c +++ b/src/hc08/main.c @@ -8,9 +8,9 @@ #include "main.h" #include "ralloc.h" #include "gen.h" +#include "dbuf_string.h" #include "../SDCCutil.h" -void copyFile(FILE *dest, FILE *src); extern char * iComments2; extern DEBUGFILE dwarf2DebugFile; extern int dwarf2FinalizeFile(FILE *); @@ -51,7 +51,7 @@ static char *_hc08_keywords[] = }; -void hc08_assignRegisters (eBBlock ** ebbs, int count); +void hc08_assignRegisters (ebbIndex *); static int regParmFlg = 0; /* determine if we can register a parameter */ @@ -62,13 +62,13 @@ _hc08_init (void) } static void -_hc08_reset_regparm () +_hc08_reset_regparm (void) { regParmFlg = 0; } static int -_hc08_regparm (sym_link * l) +_hc08_regparm (sym_link * l, bool reentrant) { int size = getSize(l); @@ -139,7 +139,7 @@ _hc08_setDefaultOptions (void) { options.code_loc = 0x8000; options.data_loc = 0x80; - options.xdata_loc = 0x100; + options.xdata_loc = 0; /* 0 means immediately following data */ options.stack_loc = 0x7fff; options.out_fmt = 1; /* use motorola S19 output */ @@ -164,11 +164,13 @@ _hc08_genAssemblerPreamble (FILE * of) symbol *mainExists=newSymbol("main", 0); mainExists->block=0; - fprintf (of, "\t.area %s\n",port->mem.code_name); + fprintf (of, "\t.area %s\n",HOME_NAME); fprintf (of, "\t.area GSINIT0 (CODE)\n"); fprintf (of, "\t.area %s\n",port->mem.static_name); fprintf (of, "\t.area %s\n",port->mem.post_static_name); + fprintf (of, "\t.area %s\n",CODE_NAME); fprintf (of, "\t.area %s\n",port->mem.xinit_name); + fprintf (of, "\t.area %s\n",port->mem.const_name); fprintf (of, "\t.area %s\n",port->mem.data_name); fprintf (of, "\t.area %s\n",port->mem.overlay_name); fprintf (of, "\t.area %s\n",port->mem.bit_name); @@ -250,28 +252,28 @@ _hc08_genExtraAreas (FILE * asmFile, bool mainExists) fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; extended address mode data\n"); fprintf (asmFile, "%s", iComments2); - copyFile (asmFile, xdata->oFile); + dbuf_write_and_destroy (&xdata->oBuf, asmFile); } /* Generate interrupt vector table. */ static int -_hc08_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts) +_hc08_genIVT (struct dbuf_s * oBuf, symbol ** interrupts, int maxInterrupts) { int i; - fprintf (of, "\t.area\tCODEIVT (ABS)\n"); - fprintf (of, "\t.org\t0x%04x\n", + dbuf_printf (oBuf, "\t.area\tCODEIVT (ABS)\n"); + dbuf_printf (oBuf, "\t.org\t0x%04x\n", (0xfffe - (maxInterrupts * 2))); for (i=maxInterrupts;i>0;i--) { if (interrupts[i]) - fprintf (of, "\t.dw\t%s\n", interrupts[i]->rname); + dbuf_printf (oBuf, "\t.dw\t%s\n", interrupts[i]->rname); else - fprintf (of, "\t.dw\t0xffff\n"); + dbuf_printf (oBuf, "\t.dw\t0xffff\n"); } - fprintf (of, "\t.dw\t%s", "__sdcc_gs_init_startup\n"); + dbuf_printf (oBuf, "\t.dw\t%s", "__sdcc_gs_init_startup\n"); return TRUE; } @@ -417,12 +419,16 @@ PORT hc08_port = /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */ 1, 2, 2, 4, 2, 2, 2, 1, 4, 4 }, + /* tags for generic pointers */ + { 0x00, 0x40, 0x60, 0x80 }, /* far, near, xstack, code */ + { "XSEG", "STACK", "CSEG (CODE)", "DSEG", NULL, /* "ISEG" */ + NULL, /* "PSEG" */ "XSEG", "BSEG", "RSEG", @@ -432,6 +438,10 @@ PORT hc08_port = "HOME (CODE)", "XISEG", // initialized xdata "XINIT", // a code copy of xiseg + "CONST (CODE)", // const_name - const data (code or not) + "CABS (ABS,CODE)", // cabs_name - const absolute data (code or not) + "XABS (ABS)", // xabs_name - absolute xdata + "IABS (ABS)", // iabs_name - absolute data NULL, NULL, 1