]> git.gag.com Git - fw/sdcc/blobdiff - src/ds390/main.c
DS800C400 fun, improved ROM interface and tinibios
[fw/sdcc] / src / ds390 / main.c
index 2d5b4717ec14327b12a38ce2a5281817711130aa..285862e36830cc60ed71706f78da2e41ad98b220 100644 (file)
@@ -11,7 +11,7 @@
 #include "BuildCmd.h"
 #include "MySystem.h"
 #include "../SDCCutil.h"
-extern const char *preArgv[128];       /* pre-processor arguments  */
+#include "../SDCCglobl.h"
 static char _defaultRules[] =
 {
 #include "peeph.rul"
@@ -175,7 +175,7 @@ _ds390_finaliseOptions (void)
     istack->ptrType = FPOINTER;
 
     if (options.parms_in_bank1) {
-       addToList (preArgv, "-DSDCC_PARMS_IN_BANK1");
+       addSet(&preArgvSet, Safe_strdup("-DSDCC_PARMS_IN_BANK1"));
     }
   }  /* MODEL_FLAT24 */
 }
@@ -384,6 +384,7 @@ PORT ds390_port =
     NULL,
     1
   },
+  { NULL, NULL },
   {
     +1, 1, 4, 1, 1, 0
   },
@@ -416,7 +417,11 @@ PORT ds390_port =
   1,                           /* transform >= to ! < */
   1,                           /* transform != to !(a == b) */
   0,                           /* leave == */
+#if 0 // obsolete, and buggy for != xdata
   TRUE,                         /* we support array initializers. */
+#else
+  FALSE,                        /* No array initializer support. */
+#endif
   cseCostEstimation,
   __ds390_builtins,             /* table of builtin functions */
   GPOINTER,                    /* treat unqualified pointers as "generic" pointers */
@@ -669,6 +674,7 @@ PORT tininative_port =
     NULL,
     1
   },
+  { NULL, NULL },
   {
     +1, 1, 4, 1, 1, 0
   },
@@ -736,8 +742,8 @@ _ds400_finaliseOptions (void)
   }
 
   // hackhack: we're a superset of the 390.
-  addToList (preArgv, "-DSDCC_ds390");  
-  addToList (preArgv, "-D__ds390");    
+  addSet(&preArgvSet, Safe_strdup("-DSDCC_ds390"));
+  addSet(&preArgvSet, Safe_strdup("-D__ds390"));
     
   /* Hack-o-matic: if we are using the flat24 model,
    * adjust pointer sizes.
@@ -793,11 +799,36 @@ _ds400_finaliseOptions (void)
     istack->ptrType = FPOINTER;
 
     if (options.parms_in_bank1) {
-       addToList (preArgv, "-DSDCC_PARMS_IN_BANK1");
+       addSet(&preArgvSet, Safe_strdup("-DSDCC_PARMS_IN_BANK1"));
     }
+     
+    // the DS400 rom calling interface uses register bank 3.
+    RegBankUsed[3] = 1;
+      
   }  /* MODEL_FLAT24 */
 }
 
+extern char * iComments2;
+
+static void _ds400_generateRomDataArea(FILE *fp, bool isMain)
+{
+    /* Only do this for the file containing main() */
+    if (isMain)
+    {
+       fprintf(fp, "%s", iComments2);
+       fprintf(fp, "; the direct data area used by the DS80c400 ROM code.\n");
+       fprintf(fp, "%s", iComments2);
+       fprintf(fp, ".area ROMSEG (ABS,CON,DATA)\n\n");
+       fprintf(fp, ".ds 24 ; 24 bytes of directs used starting at 0x68\n\n");
+    }
+}
+
+static void _ds400_linkRomDataArea(FILE *fp)
+{
+    fprintf(fp, "-b ROMSEG = 0x0068\n");
+}
+
+
 PORT ds400_port =
 {
   TARGET_ID_DS400,
@@ -850,6 +881,7 @@ PORT ds400_port =
     NULL,
     1
   },
+  { _ds400_generateRomDataArea, _ds400_linkRomDataArea },
   {
     +1, 1, 4, 1, 1, 0
   },