Use 'ao-dbg' instead of 's51' to communicate with TeleMetrum
[fw/sdcc] / src / izt / tlcs900h.c
1 /** @file izt/tlcs900h.c
2     tlcs900h specific general functions.
3 */
4 #include "izt.h"
5
6 static REG _tlcs900h_regs[] =
7 {
8   {1, REG_ID_C, "c", 0,
9    {REG_ID_BC, REG_ID_NONE, REG_ID_NONE}},
10   {1, REG_ID_B, "b", 0,
11    {REG_ID_BC, REG_ID_NONE, REG_ID_NONE}},
12   {1, REG_ID_E, "e", 0,
13    {REG_ID_DE, REG_ID_NONE, REG_ID_NONE}},
14   {1, REG_ID_D, "d", 0,
15    {REG_ID_DE, REG_ID_NONE, REG_ID_NONE}},
16   {2, REG_ID_BC, "bc", 0,
17    {REG_ID_C, REG_ID_B, REG_ID_NONE}},
18   {2, REG_ID_DE, "de", 0,
19    {REG_ID_E, REG_ID_D, REG_ID_NONE}},
20   {4, REG_ID_XBC, "xbc", 0,
21    {REG_ID_C, REG_ID_B, REG_ID_BC}},
22   {4, REG_ID_XDE, "xde", 0,
23    {REG_ID_E, REG_ID_D, REG_ID_DE}},
24   {0, REG_ID_NONE, "??", 0,
25    {REG_ID_NONE, REG_ID_NONE, REG_ID_NONE}}
26 };
27
28 static IZT_PORT _tlcs900h_port =
29 {
30   _tlcs900h_regs
31 };
32
33 static char _defaultRules[] =
34 {
35     //#include "peeph.rul"
36     ""
37 };
38
39 static char *_tlcs900h_keywords[] =
40 {
41   NULL
42 };
43
44 void tlcs900h_assignRegisters (eBBlock ** ebbs, int count);
45
46 static void
47 _tlcs900h_init (void)
48 {
49   asm_addTree (&asm_asxxxx_mapping);
50   izt_init (&_tlcs900h_port);
51 }
52
53 static void
54 _tlcs900h_reset_regparm ()
55 {
56 }
57
58 static int
59 _tlcs900h_regparm (sym_link * l)
60 {
61   // PENDING: No register parameters.
62   return 0;
63 }
64
65 static bool
66 _tlcs900h_parseOptions (int *pargc, char **argv, int *i)
67 {
68   /* TODO: allow port-specific command line options to specify
69    * segment names here.
70    */
71   return FALSE;
72 }
73
74 static void
75 _tlcs900h_finaliseOptions (void)
76 {
77   // No options
78 }
79
80 static void
81 _tlcs900h_setDefaultOptions (void)
82 {
83   // No options
84 }
85
86 static const char *
87 _tlcs900h_getRegName (struct regs *reg)
88 {
89   if (reg)
90     return reg->name;
91   wassert (0);
92   return "err";
93 }
94
95 static void
96 _tlcs900h_genAssemblerPreamble (FILE * of)
97 {
98   // PENDING
99 }
100
101 /* Generate interrupt vector table. */
102 static int
103 _tlcs900h_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
104 {
105   // PENDING
106   return 0;
107 }
108
109 /** $1 is always the basename.
110     $2 is always the output file.
111     $3 varies
112     $l is the list of extra options that should be there somewhere...
113     MUST be terminated with a NULL.
114 */
115 // PENDING
116 static const char *_linkCmd[] =
117 {
118   "aslink", "-nf", "$1", NULL
119 };
120
121 // PENDING
122 static const char *_asmCmd[] =
123 {
124   "gpasm", NULL, NULL, NULL
125 };
126
127 void
128 tlcs900h_assignRegisters (eBBlock ** ebbs, int count)
129 {
130 }
131
132 /* Globals */
133 PORT tlcs900h_port =
134 {
135   TARGET_ID_TLCS900H,
136   "tlcs900h",
137   "Toshiba TLCS-900H",          /* Target name */
138   NULL,
139   {
140     glue,
141     TRUE,                       /* Emit glue around main */
142     MODEL_SMALL,
143     MODEL_SMALL
144   },
145   {
146     _asmCmd,
147     NULL,
148     NULL,
149     NULL,
150     0,
151     NULL,
152     NULL                        /* no do_assemble function */
153   },
154   {
155     _linkCmd,
156     NULL,
157     NULL,
158     ".o"
159   },
160   {
161     _defaultRules
162   },
163   {
164         /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
165     1, 2, 2, 4, 2, 2, 2, 1, 4, 4
166   },
167   /* tags for generic pointers */
168   { 0x00, 0x40, 0x60, 0x80 },           /* far, near, xstack, code */
169   {
170     "XSEG    (XDATA)",
171     "STACK   (DATA)",
172     "CSEG    (CODE)",
173     "DSEG    (DATA)",
174     "ISEG    (DATA)",
175     "XSEG    (XDATA)",
176     "BSEG    (BIT)",
177     "RSEG    (DATA)",
178     "GSINIT  (CODE)",
179     "OSEG    (OVR,DATA)",
180     "GSFINAL (CODE)",
181     "HOME        (CODE)",
182     NULL, // xidata
183     NULL, // xinit
184     NULL,
185     NULL,
186     1
187   },
188   {
189     +1, 1, 4, 1, 1, 0
190   },
191     /* tlcs900h has an 16 bit mul */
192   {
193     2, -1
194   },
195   "_",
196   _tlcs900h_init,
197   _tlcs900h_parseOptions,
198   NULL,
199   _tlcs900h_finaliseOptions,
200   _tlcs900h_setDefaultOptions,
201   tlcs900h_assignRegisters,
202   _tlcs900h_getRegName,
203   _tlcs900h_keywords,
204   _tlcs900h_genAssemblerPreamble,
205   NULL,                         /* no genAssemblerEnd */
206   _tlcs900h_genIVT,
207   0, // _tlcs900h_genXINIT
208   _tlcs900h_reset_regparm,
209   _tlcs900h_regparm,
210   NULL,
211   NULL,
212   NULL,
213   FALSE,
214   0,                            /* leave lt */
215   0,                            /* leave gt */
216   1,                            /* transform <= to ! > */
217   1,                            /* transform >= to ! < */
218   1,                            /* transform != to !(a == b) */
219   0,                            /* leave == */
220   FALSE,                        /* No array initializer support. */     
221   0,                            /* no CSE cost estimation yet */
222   NULL,                         /* no builtin functions */
223   GPOINTER,                     /* treat unqualified pointers as "generic" pointers */
224   1,                            /* reset labelKey to 1 */
225   1,                            /* globals & local static allowed */
226   PORT_MAGIC
227 };