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.
12 static char _defaultRules[] =
17 /* list of key words used by msc51 */
18 static char *_mcs51_keywords[] = {
45 void mcs51_assignRegisters (eBBlock **ebbs, int count);
47 static bool _mcs51_parseOptions(int *pargc, char **argv, int *i)
49 /* TODO: allow port-specific command line options to specify
55 static void _mcs51_finaliseOptions(void)
57 /* Hack-o-matic: if we are using the flat24 model,
58 * adjust pointer sizes.
60 if (options.model == MODEL_FLAT24)
62 port->s.fptr_size = 3;
63 port->s.gptr_size = 4;
64 port->stack.isr_overhead++; /* Will save dpx on ISR entry. */
66 port->stack.call_overhead++; /* This acounts for the extra byte
67 * of return addres on the stack.
68 * but is ugly. There must be a
77 static void _mcs51_setDefaultOptions(void)
81 static const char *_mcs51_getRegName(struct regs *reg)
88 static void _mcs51_genAssemblerPreamble(FILE *of)
90 if (options.model == MODEL_FLAT24)
92 fputs(".flat24 on\t\t; 24 bit flat addressing\n", of);
93 fputs("dpx = 0x93\t\t; dpx register unknown to assembler\n", of);
98 /* Generate interrupt vector table. */
99 static int _mcs51_genIVT(FILE *of, symbol **interrupts, int maxInterrupts)
103 if (options.model != MODEL_FLAT24)
105 /* Let the default code handle it. */
109 fprintf (of, "\tajmp\t__sdcc_gsinit_startup\n");
111 /* now for the other interrupts */
112 for (i = 0; i < maxInterrupts; i++)
116 fprintf(of, "\tljmp\t%s\n\t.ds\t4\n", interrupts[i]->rname);
120 fprintf(of, "\treti\n\t.ds\t7\n");
127 /** $1 is always the basename.
128 $2 is always the output file.
130 $l is the list of extra options that should be there somewhere...
131 MUST be terminated with a NULL.
133 static const char *_linkCmd[] = {
134 "aslink", "-nf", "$1", NULL
137 static const char *_asmCmd[] = {
138 "asx8051", "-plosgffc", "$1.asm", NULL
144 "MCU 8051", /* Target name */
146 TRUE, /* Emit glue around main */
150 "-plosgffc", /* Options with debug */
151 "-plosgff", /* Options without debug */
160 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
161 1, 1, 2, 4, 1, 2, 3, 1, 4, 4
178 /* mcs51 has an 8 bit mul */
184 _mcs51_finaliseOptions,
185 _mcs51_setDefaultOptions,
186 mcs51_assignRegisters,
189 _mcs51_genAssemblerPreamble,