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)
86 /* Hack-o-matic: if we are using the flat24 model,
87 * adjust pointer sizes.
89 if (options.model == MODEL_FLAT24)
92 fprintf (stderr, "*** WARNING: you should use the '-mds390' option "
93 "for DS80C390 support. This code generator is "
94 "badly out of date and probably broken.\n");
96 port->s.fptr_size = 3;
97 port->s.gptr_size = 4;
98 port->stack.isr_overhead++; /* Will save dpx on ISR entry. */
100 port->stack.call_overhead++; /* This acounts for the extra byte
101 * of return addres on the stack.
102 * but is ugly. There must be a
106 fReturn = fReturn390;
110 if (options.model == MODEL_LARGE)
112 port->mem.default_local_map = xdata;
113 port->mem.default_globl_map = xdata;
117 port->mem.default_local_map = data;
118 port->mem.default_globl_map = data;
121 if (options.stack10bit)
123 if (options.model != MODEL_FLAT24)
126 "*** warning: 10 bit stack mode is only supported in flat24 model.\n");
127 fprintf (stderr, "\t10 bit stack mode disabled.\n");
128 options.stack10bit = 0;
132 /* Fixup the memory map for the stack; it is now in
133 * far space and requires a FPOINTER to access it.
136 istack->ptrType = FPOINTER;
142 _pic14_setDefaultOptions (void)
147 _pic14_getRegName (struct regs *reg)
155 _pic14_genAssemblerPreamble (FILE * of)
157 fprintf (of, "\tlist\tp=16c84\n");
158 fprintf (of, "\t__config _wdt_off\n");
159 fprintf (of, "\ninclude \"p16c84.inc\"\n");
162 /* Generate interrupt vector table. */
164 _pic14_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
168 if (options.model != MODEL_FLAT24)
170 /* Let the default code handle it. */
174 fprintf (of, "\t;ajmp\t__sdcc_gsinit_startup\n");
176 /* now for the other interrupts */
177 for (i = 0; i < maxInterrupts; i++)
181 fprintf (of, "\t;ljmp\t%s\n\t.ds\t4\n", interrupts[i]->rname);
185 fprintf (of, "\t;reti\n\t.ds\t7\n");
192 /** $1 is always the basename.
193 $2 is always the output file.
195 $l is the list of extra options that should be there somewhere...
196 MUST be terminated with a NULL.
198 static const char *_linkCmd[] =
200 "aslink", "-nf", "$1", NULL
203 static const char *_asmCmd[] =
205 "gpasm", NULL, NULL, NULL
213 "MCU pic", /* Target name */
215 TRUE, /* Emit glue around main */
216 MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
223 //"-plosgffc", /* Options with debug */
224 //"-plosgff", /* Options without debug */
236 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
237 1, 1, 2, 4, 1, 2, 1, 1, 4, 4
238 /* TSD - I changed the size of gptr from 3 to 1. However, it should be
239 2 so that we can accomodate the PIC's with 4 register banks (like the
263 /* pic14 has an 8 bit mul */
270 _pic14_finaliseOptions,
271 _pic14_setDefaultOptions,
272 pic14_assignRegisters,
275 _pic14_genAssemblerPreamble,
277 _pic14_reset_regparm,
283 1, /* transform <= to ! > */
284 1, /* transform >= to ! < */
285 1, /* transform != to !(a == b) */