doc/sdccman.lyx: added section about debugging with ddd
[fw/sdcc] / src / hc08 / main.c
index aa2cbb0cf7cb1b65ed2cddeebba8899812ebba5a..2e1c7cd055b33236e98505adc1d827ee16e2cc88 100644 (file)
@@ -12,9 +12,8 @@
 
 void copyFile(FILE *dest, FILE *src);
 extern char * iComments2;
-extern FILE * dwarf2FilePtr;
 extern DEBUGFILE dwarf2DebugFile;
-extern int dwarf2FinalizeFile(void);
+extern int dwarf2FinalizeFile(FILE *);
 
 static char _defaultRules[] =
 {
@@ -52,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 */
 
@@ -63,7 +62,7 @@ _hc08_init (void)
 }
 
 static void
-_hc08_reset_regparm ()
+_hc08_reset_regparm (void)
 {
   regParmFlg = 0;
 }
@@ -140,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 */
 
@@ -166,9 +165,11 @@ _hc08_genAssemblerPreamble (FILE * of)
   mainExists->block=0;
 
   fprintf (of, "\t.area %s\n",port->mem.code_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",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);
@@ -198,7 +199,7 @@ _hc08_genAssemblerPreamble (FILE * of)
        fprintf (of, "\t.org\t0xfffe\n");
       fprintf (of, "\t.dw\t%s", "__sdcc_gs_init_startup\n\n");
         
-      fprintf (of, "\t.area GSINIT\n");
+      fprintf (of, "\t.area GSINIT0\n");
       fprintf (of, "__sdcc_gs_init_startup:\n");
       if (options.stack_loc)
         {
@@ -240,8 +241,7 @@ _hc08_genAssemblerEnd (FILE * of)
 {
   if (options.out_fmt == 2 && options.debug)
     {
-      dwarf2FinalizeFile();
-      copyFile(of, dwarf2FilePtr);
+      dwarf2FinalizeFile (of);
     }
 }
 
@@ -424,6 +424,7 @@ PORT hc08_port =
     "CSEG (CODE)",
     "DSEG",
     NULL, /* "ISEG" */
+    NULL, /* "PSEG" */
     "XSEG",
     "BSEG",
     "RSEG",
@@ -433,6 +434,7 @@ PORT hc08_port =
     "HOME (CODE)",
     "XISEG", // initialized xdata
     "XINIT", // a code copy of xiseg
+    "CONST   (CODE)", // const_name - const data (code or not)
     NULL,
     NULL,
     1
@@ -464,10 +466,19 @@ PORT hc08_port =
       1,                       /* offsetSP */
     },
   },
+  {
+    256,        /* maxCount */
+    2,          /* sizeofElement */
+    {8,16,32},  /* sizeofMatchJump[] */
+    {8,16,32},  /* sizeofRangeCompare[] */
+    5,          /* sizeofSubtract */
+    10,         /* sizeofDispatch */
+  },
   "_",
   _hc08_init,
   _hc08_parseOptions,
   _hc08_options,
+  NULL,
   _hc08_finaliseOptions,
   _hc08_setDefaultOptions,
   hc08_assignRegisters,