add -mz80 support
authorkbongers <kbongers@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 9 Feb 2002 07:05:37 +0000 (07:05 +0000)
committerkbongers <kbongers@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 9 Feb 2002 07:05:37 +0000 (07:05 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1908 4a8a32a2-be11-0410-ad9d-d568d2c75423

debugger/mcs51/sdcdb.c
debugger/mcs51/simi.c

index a416625a8394a22197ce6db01e1aed2a76ab66ad..c40e3d8c8e45287e4ff06d93cac4a36bdd6857b8 100644 (file)
@@ -40,8 +40,9 @@ linkrec **linkrecs = NULL; /* all linkage editor records */
 context *currCtxt = NULL;
 short fullname = 0;
 char *ssdirl = SDCC_LIB_DIR ":" SDCC_LIB_DIR "/small" ;
-char *simArgs[8];
+char *simArgs[20];
 int nsimArgs = 0;
+char model_str[20];
 
 /* fake filename & lineno to make linker */
 char *filename=NULL;
@@ -86,7 +87,7 @@ struct cmdtab
     { "h"        ,  cmdHelp       , NULL },
 
     { "info"     ,  cmdInfo       ,
-      "info\n"
+      "info"
       "\t {break}\t list all break points\n"
       "\t {stack}\t information about call stack\n"
       "\t {frame}\t current frame information\n"
@@ -102,7 +103,7 @@ struct cmdtab
     },
     { "l"        ,  cmdListSrc    , NULL },
     { "show"     ,  cmdShow       ,
-      "show\n"
+      "show"
       "\t {copying}\t copying & distribution terms\n"
       "\t {warranty}\t warranty information\n"
     },
@@ -774,6 +775,20 @@ static void parseCmdLine (int argc, char **argv)
         continue ;
       }
 
+      /* model string */
+      if (strncmp(argv[i],"-m",2) == 0) {
+        strncpy(model_str, &argv[i][2], 15);
+        if (strcmp(model_str,"avr") == 0)
+          simArgs[0] = "savr";
+        else if (strcmp(model_str,"rrz80") == 0)
+          simArgs[0] = "rrz80";
+        else if (strcmp(model_str,"xa") == 0)
+          simArgs[0] = "sxa";
+        else if (strcmp(model_str,"z80") == 0)
+          simArgs[0] = "sz80";
+        continue ;
+      }
+
       fprintf(stderr,"unknown option %s --- ignored\n",
         argv[i]);
   } else {
@@ -800,7 +815,12 @@ static void parseCmdLine (int argc, char **argv)
 int main ( int argc, char **argv)
 {
     printVersionInfo();
+
+    simArgs[nsimArgs++] = "s51";
+    simArgs[nsimArgs++] = "-P";
+    simArgs[nsimArgs++] = "-r 9756";
     /* parse command line */
+
     parseCmdLine(argc,argv);
 
     commandLoop();
index 12430d1e625a5bbc4ad54d7c80854332f34f952d..168f02eb6e15e1fdd8496f7186e646818275c3c6 100644 (file)
@@ -88,6 +88,8 @@ void openSimulator (char **args, int nargs)
     struct sockaddr_in sin;     
     int retry = 0;
     int i ;
+
+#if 0
     char *simargs[32] = { "s51","-P","-r 9756", NULL };
     
     /* create the arguments */
@@ -95,6 +97,7 @@ void openSimulator (char **args, int nargs)
        simargs[i+3] = args[i];       
     }
     simargs[i+3]= NULL;
+#endif
 
     /* fork and start the simulator as a subprocess */
     if ((simPid = fork())) {
@@ -103,7 +106,8 @@ void openSimulator (char **args, int nargs)
     else {
        
        /* we are in the child process : start the simulator */
-       if (execvp("s51",simargs) < 0) {
+//     if (execvp("s51",simargs) < 0) {
+       if (execvp(args[0],args) < 0) {
            perror("cannot exec simulator");
            exit(1);
        }