bd43248b3b6f6da8b0974469965e2e02103951e8
[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     { 1, REG_ID_C,   "c",   0, { REG_ID_BC, REG_ID_NONE, REG_ID_NONE } },
8     { 1, REG_ID_B,   "b",   0, { REG_ID_BC, REG_ID_NONE, REG_ID_NONE } },
9     { 1, REG_ID_E,   "e",   0, { REG_ID_DE, REG_ID_NONE, REG_ID_NONE } },
10     { 1, REG_ID_D,   "d",   0, { REG_ID_DE, REG_ID_NONE, REG_ID_NONE } },
11     { 2, REG_ID_BC,  "bc",  0, { REG_ID_C, REG_ID_B, REG_ID_NONE } },
12     { 2, REG_ID_DE,  "de",  0, { REG_ID_E, REG_ID_D, REG_ID_NONE } },
13     { 4, REG_ID_XBC, "xbc", 0, { REG_ID_C, REG_ID_B, REG_ID_BC } },
14     { 4, REG_ID_XDE, "xde", 0, { REG_ID_E, REG_ID_D, REG_ID_DE } },
15     { 0, REG_ID_NONE,"??",  0, { REG_ID_NONE, REG_ID_NONE, REG_ID_NONE } }
16 };
17
18 static char _defaultRules[] =
19 {
20     //#include "peeph.rul"
21 };
22
23 /* list of key words used by msc51 */
24 static char *_tlcs900h_keywords[] =     {
25     NULL
26 };
27
28 void tlcs900h_assignRegisters (eBBlock **ebbs, int count);
29
30 static void _tlcs900h_init(void)
31 {
32     asm_addTree(&asm_asxxxx_mapping);
33 }
34
35 static void _tlcs900h_reset_regparm()
36 {
37 }
38
39 static int _tlcs900h_regparm( sym_link *l)
40 {
41     // PENDING: No register parameters.
42     return 0;
43 }
44
45 static bool _tlcs900h_parseOptions(int *pargc, char **argv, int *i)
46 {
47     /* TODO: allow port-specific command line options to specify
48      * segment names here.
49      */
50     return FALSE;
51 }
52
53 static void _tlcs900h_finaliseOptions(void)
54 {
55     // No options
56 }
57
58 static void _tlcs900h_setDefaultOptions(void)
59 {
60     // No options
61 }
62
63 static const char *_tlcs900h_getRegName(struct regs *reg)
64 {
65     if (reg)
66         return reg->name;
67     wassert(0);
68     return "err";
69 }
70
71 static void _tlcs900h_genAssemblerPreamble(FILE *of)
72 {
73     // PENDING
74 }
75
76 /* Generate interrupt vector table. */
77 static int _tlcs900h_genIVT(FILE *of, symbol **interrupts, int maxInterrupts)
78 {
79     // PENDING
80     return 0;
81 }
82
83 /** $1 is always the basename.
84     $2 is always the output file.
85     $3 varies
86     $l is the list of extra options that should be there somewhere...
87     MUST be terminated with a NULL.
88 */
89 // PENDING
90 static const char *_linkCmd[] = {
91     "aslink", "-nf", "$1", NULL
92 };
93
94 // PENDING
95 static const char *_asmCmd[] = {
96  "gpasm", NULL, NULL, NULL
97 };
98
99 void tlcs900h_assignRegisters (eBBlock **ebbs, int count)
100 {
101 }
102
103 /* Globals */
104 PORT tlcs900h_port = {
105     "tlcs900h",
106     "Toshiba TLCS-900H",        /* Target name */
107     {
108         TRUE,                   /* Emit glue around main */
109         MODEL_SMALL,
110         MODEL_SMALL
111     },
112     {   
113         _asmCmd,
114         NULL,
115         NULL,
116         0
117     },
118     {
119         _linkCmd,
120         NULL,
121         ".o"
122     },
123     {
124         _defaultRules
125     },
126     {
127         /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
128         1, 2, 2, 4, 2, 2, 2, 1, 4, 4
129     },
130     {
131         "XSEG    (XDATA)",
132         "STACK   (DATA)",
133         "CSEG    (CODE)",
134         "DSEG    (DATA)",
135         "ISEG    (DATA)",
136         "XSEG    (XDATA)",
137         "BSEG    (BIT)",
138         "RSEG    (DATA)",
139         "GSINIT  (CODE)",
140         "OSEG    (OVR,DATA)",
141         "GSFINAL (CODE)",
142         "HOME    (CODE)",
143         NULL,
144         NULL,
145         1
146     },
147     { 
148         +1, 1, 4, 1, 1, 0
149     },
150     /* tlcs900h has an 16 bit mul */
151     {
152         2, 0
153     },
154     "_",
155     _tlcs900h_init,
156     _tlcs900h_parseOptions,
157     _tlcs900h_finaliseOptions,
158     _tlcs900h_setDefaultOptions,
159     tlcs900h_assignRegisters,
160     _tlcs900h_getRegName ,
161     _tlcs900h_keywords,
162     _tlcs900h_genAssemblerPreamble,
163     _tlcs900h_genIVT ,
164     _tlcs900h_reset_regparm,
165     _tlcs900h_regparm,
166     NULL,
167     FALSE,
168     0,  /* leave lt */
169     0,  /* leave gt */
170     1,  /* transform <= to ! > */
171     1,  /* transform >= to ! < */
172     1,  /* transform != to !(a == b) */
173     0   /* leave == */
174 };