3 static char _z80_defaultRules[] =
6 #include "peeph-z80.rul"
9 static char _gbz80_defaultRules[] =
12 #include "peeph-gbz80.rul"
21 static char *_keywords[] = { NULL };
23 extern PORT gbz80_port;
28 static void _z80_init(void)
30 z80_opts.sub = SUB_Z80;
31 asm_addTree(&_asxxxx_z80);
34 static void _gbz80_init(void)
36 z80_opts.sub = SUB_GBZ80;
39 static int regParmFlg = 0; /* determine if we can register a parameter */
41 static void _reset_regparm()
46 static int _reg_parm(link *l)
48 /* for this processor it is simple
49 can pass only the first parameter in a register */
58 static int _process_pragma(const char *sz)
60 printf("Got pragma \"%s\"\n", sz);
64 static bool _parseOptions(int *pargc, char **argv, int *i)
66 if (argv[*i][0] == '-') {
67 if (argv[*i][1] == 'b' && IS_GB) {
68 int bank = atoi(argv[*i] + 3);
70 switch (argv[*i][2]) {
73 sprintf(buffer, "_CODE_%u", bank);
74 gbz80_port.mem.code_name = gc_strdup(buffer);
78 sprintf(buffer, "_DATA_%u", bank);
79 gbz80_port.mem.data_name = gc_strdup(buffer);
83 else if (!strncmp(argv[*i], "--asm=", 6)) {
84 if (!strcmp(argv[*i], "--asm=rgbds")) {
85 asm_addTree(&_rgbds_gb);
86 _G.fsetAsmType = TRUE;
89 else if (!strcmp(argv[*i], "--asm=asxxxx")) {
90 asm_addTree(&_asxxxx_gb);
91 _G.fsetAsmType = TRUE;
99 static void _finaliseOptions(void)
101 port->mem.default_local_map = data;
102 port->mem.default_globl_map = data;
103 if (!_G.fsetAsmType && IS_GB)
104 asm_addTree(&_asxxxx_gb);
107 static void _setDefaultOptions(void)
109 options.genericPtr = 1; /* default on */
111 options.stackAuto = 1;
112 options.mainreturn = 1;
113 options.noregparms = 1;
115 /* first the options part */
116 options.intlong_rent = 1;
118 optimize.global_cse = 1;
123 optimize.loopInvariant = 1;
124 optimize.loopInduction = 0;
127 static const char *_getRegName(struct regs *reg)
135 /** $1 is always the basename.
136 $2 is always the output file.
138 $l is the list of extra options that should be there somewhere...
139 MUST be terminated with a NULL.
141 static const char *_z80_linkCmd[] = {
142 "link-z80", "-nf", "$1", NULL
145 static const char *_z80_asmCmd[] = {
146 "as-z80", "-plosgff", "$1.o", "$1.asm", NULL
149 /** $1 is always the basename.
150 $2 is always the output file.
152 $l is the list of extra options that should be there somewhere...
153 MUST be terminated with a NULL.
155 static const char *_gbz80_linkCmd[] = {
156 "link-gbz80", "-nf", "$1", NULL
159 static const char *_gbz80_asmCmd[] = {
160 "as-gbz80", "-plosgff", "$1.o", "$1.asm", NULL
166 "Zilog Z80", /* Target name */
172 "-plosgff", /* Options with debug */
173 "-plosgff", /* Options without debug */
182 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
183 1, 1, 2, 4, 2, 2, 2, 1, 4, 4
204 /* Z80 has no native mul/div commands */
215 0, /* no assembler preamble */
216 0, /* no local IVT generation code */
224 "Gameboy Z80-like", /* Target name */
230 "-plosgff", /* Options with debug */
231 "-plosgff", /* Options without debug */
240 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
241 1, 1, 2, 4, 2, 2, 2, 1, 4, 4
262 /* gbZ80 has no native mul/div commands */
273 0, /* no assembler preamble */
274 0, /* no local IVT generation code */