2 pic14 specific general functions.
4 Note that mlh prepended _pic14_ 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 *_pic14_keywords[] =
46 void pic14_assignRegisters (eBBlock ** ebbs, int count);
48 static int regParmFlg = 0; /* determine if we can register a parameter */
53 asm_addTree (&asm_asxxxx_mapping);
57 _pic14_reset_regparm ()
63 _pic14_regparm (sym_link * l)
65 /* for this processor it is simple
66 can pass only the first parameter in a register */
75 _pic14_parseOptions (int *pargc, char **argv, int *i)
77 /* TODO: allow port-specific command line options to specify
84 _pic14_finaliseOptions (void)
87 /* Hack-o-matic: if we are using the flat24 model,
88 * adjust pointer sizes.
90 if (options.model == MODEL_FLAT24)
93 fprintf (stderr, "*** WARNING: you should use the '-mds390' option "
94 "for DS80C390 support. This code generator is "
95 "badly out of date and probably broken.\n");
97 port->s.fptr_size = 3;
98 port->s.gptr_size = 4;
99 port->stack.isr_overhead++; /* Will save dpx on ISR entry. */
101 port->stack.call_overhead++; /* This acounts for the extra byte
102 * of return addres on the stack.
103 * but is ugly. There must be a
107 fReturn = fReturn390;
111 if (options.model == MODEL_LARGE)
113 port->mem.default_local_map = xdata;
114 port->mem.default_globl_map = xdata;
118 port->mem.default_local_map = data;
119 port->mem.default_globl_map = data;
122 if (options.stack10bit)
124 if (options.model != MODEL_FLAT24)
127 "*** warning: 10 bit stack mode is only supported in flat24 model.\n");
128 fprintf (stderr, "\t10 bit stack mode disabled.\n");
129 options.stack10bit = 0;
133 /* Fixup the memory map for the stack; it is now in
134 * far space and requires a FPOINTER to access it.
137 istack->ptrType = FPOINTER;
144 _pic14_setDefaultOptions (void)
149 _pic14_getRegName (struct regs *reg)
157 _pic14_genAssemblerPreamble (FILE * of)
159 fprintf (of, "\tlist\tp=16c84\n");
160 fprintf (of, "\t__config _wdt_off\n");
161 fprintf (of, "\ninclude \"p16c84.inc\"\n");
164 /* Generate interrupt vector table. */
166 _pic14_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
170 if (options.model != MODEL_FLAT24)
172 /* Let the default code handle it. */
176 fprintf (of, "\t;ajmp\t__sdcc_gsinit_startup\n");
178 /* now for the other interrupts */
179 for (i = 0; i < maxInterrupts; i++)
183 fprintf (of, "\t;ljmp\t%s\n\t.ds\t4\n", interrupts[i]->rname);
187 fprintf (of, "\t;reti\n\t.ds\t7\n");
194 /** $1 is always the basename.
195 $2 is always the output file.
197 $l is the list of extra options that should be there somewhere...
198 MUST be terminated with a NULL.
200 static const char *_linkCmd[] =
202 "aslink", "-nf", "$1", NULL
205 static const char *_asmCmd[] =
207 "gpasm", NULL, NULL, NULL
216 "MCU pic", /* Target name */
218 TRUE, /* Emit glue around main */
219 MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
226 //"-plosgffc", /* Options with debug */
227 //"-plosgff", /* Options without debug */
239 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
240 1, 1, 2, 4, 1, 2, 1, 1, 4, 4
241 /* TSD - I changed the size of gptr from 3 to 1. However, it should be
242 2 so that we can accomodate the PIC's with 4 register banks (like the
266 /* pic14 has an 8 bit mul */
273 _pic14_finaliseOptions,
274 _pic14_setDefaultOptions,
275 pic14_assignRegisters,
278 _pic14_genAssemblerPreamble,
280 _pic14_reset_regparm,
286 1, /* transform <= to ! > */
287 1, /* transform >= to ! < */
288 1, /* transform != to !(a == b) */