new files of 0.5.2
[fw/sdcc] / sim / ucsim / s51.src / sim51.cc
1 /*
2  * Simulator of microcontrollers (sim51.cc)
3  *
4  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
5  * 
6  * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
7  *
8  */
9
10 /* This file is part of microcontroller simulator: ucsim.
11
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING.  If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 02111-1307, USA. */
26 /*@1@*/
27
28 #include "ddconfig.h"
29
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <ctype.h>
33 #include <errno.h>
34 #include "i_string.h"
35
36 #include "globals.h"
37 #include "utils.h"
38 #include "cmdutil.h"
39
40 #include "sim51cl.h"
41 //#include "cmd51cl.h"
42 #include "uc51cl.h"
43 #include "uc52cl.h"
44 #include "uc51rcl.h"
45 #include "uc89c51rcl.h"
46 #include "uc251cl.h"
47 #include "uc390cl.h"
48 #include "glob.h"
49
50
51 cl_sim51::cl_sim51(class cl_app *the_app):
52   cl_sim(the_app)
53 {}
54
55
56 class cl_uc *
57 cl_sim51::mk_controller(void)
58 {
59   int i;
60
61   i= 0;
62   if (app->args->get_sarg('t', 0) == NULL)
63     app->args->add(new cl_prg_arg('t', 0, "C51"));
64   while ((cpus_51[i].type_str != NULL) &&
65          (strcmp(app->args->get_sarg('t', 0), cpus_51[i].type_str) != 0))
66     i++;
67   if (cpus_51[i].type_str == NULL)
68     {
69       fprintf(stderr, "Unknown processor type. "
70               "Use -H option to see known types.\n");
71       return(NULL);
72     }
73   switch (cpus_51[i].type)
74     {
75     case CPU_51: case CPU_31:
76       return(new t_uc51(cpus_51[i].type, cpus_51[i].technology, this));
77     case CPU_52: case CPU_32:
78       return(new t_uc52(cpus_51[i].type, cpus_51[i].technology, this));
79     case CPU_51R:
80       return(new t_uc51r(cpus_51[i].type, cpus_51[i].technology, this));
81     case CPU_89C51R:
82       return(new t_uc89c51r(cpus_51[i].type, cpus_51[i].technology, this));
83     case CPU_251:
84       return(new t_uc251(cpus_51[i].type, cpus_51[i].technology, this));
85     case CPU_DS390: case CPU_DS390F:
86       return(new t_uc390(cpus_51[i].type, cpus_51[i].technology, this));
87     }
88   return(NULL);
89 }
90
91
92 /* End of s51.src/sim51.cc */