2 mcs51 specific general functions.
4 Note that mlh prepended _mcs51_ on the static functions. Makes
5 it easier to set a breakpoint using the debugger.
11 static char _defaultRules[] =
16 /* list of key words used by msc51 */
17 static char *_mcs51_keywords[] = {
44 void mcs51_assignRegisters (eBBlock **ebbs, int count);
46 static bool _mcs51_parseOptions(int *pargc, char **argv, int *i)
48 /* TODO: allow port-specific command line options to specify
54 static void _mcs51_finaliseOptions(void)
56 /* Hack-o-matic: if we are using the flat24 model,
57 * adjust pointer sizes.
59 if (options.model == MODEL_FLAT24)
61 port->s.fptr_size = 3;
62 port->s.gptr_size = 4;
63 port->stack.isr_overhead++; /* Will save dpx on ISR entry. */
65 port->stack.call_overhead++; /* This acounts for the extra byte
66 * of return addres on the stack.
67 * but is ugly. There must be a
75 static void _mcs51_setDefaultOptions(void)
79 static const char *_mcs51_getRegName(struct regs *reg)
86 static void _mcs51_genAssemblerPreamble(FILE *of)
88 if (options.model == MODEL_FLAT24)
90 fputs(".flat24 on\t\t; 24 bit flat addressing\n", of);
91 fputs("dpx = 0x93\t\t; dpx register unknown to assembler\n", of);
96 /* Generate interrupt vector table. */
97 static int _mcs51_genIVT(FILE *of, symbol **interrupts, int maxInterrupts)
101 if (options.model != MODEL_FLAT24)
103 /* Let the default code handle it. */
107 fprintf (of, "\tajmp\t__sdcc_gsinit_startup\n");
109 /* now for the other interrupts */
110 for (i = 0; i < maxInterrupts; i++)
114 fprintf(of, "\tljmp\t%s\n\t.ds\t4\n", interrupts[i]->rname);
118 fprintf(of, "\treti\n\t.ds\t7\n");
125 /** $1 is always the basename.
126 $2 is always the output file.
128 $l is the list of extra options that should be there somewhere...
129 MUST be terminated with a NULL.
131 static const char *_linkCmd[] = {
132 "aslink", "-nf", "$1", NULL
135 static const char *_asmCmd[] = {
136 "asx8051", "-plosgffc", "$1.asm", NULL
142 "MCU 8051", /* Target name */
145 "-plosgffc", /* Options with debug */
146 "-plosgff", /* Options without debug */
155 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
156 1, 1, 2, 4, 1, 2, 3, 1, 4, 4
173 /* mcs51 has an 8 bit mul */
179 _mcs51_finaliseOptions,
180 _mcs51_setDefaultOptions,
181 mcs51_assignRegisters,
184 _mcs51_genAssemblerPreamble,