struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / sdas / asrab / rabpst.c
blob1d7da49f6f251d07a8649de628b2c79cc31da276
1 /* rabpst.c */
3 /*
4 * Copyright (C) 1989-2009 Alan R. Baldwin
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * Alan R. Baldwin
21 * 721 Berkeley St.
22 * Kent, Ohio 44240
24 * ported to the Rabbit2000 by
25 * Ulrich Raich and Razaq Ijoduola
26 * PS Division
27 * CERN
28 * CH-1211 Geneva-23
29 * email: Ulrich dot Raich at cern dot ch
33 * Extensions: P. Felber
35 * Altered by Leland Morrison to support rabbit 2000
36 * and rabbit 4000 instruction sets (2011)
39 #include "asxxxx.h"
40 #include "rab.h"
43 * Mnemonic Structure
45 struct mne mne[] = {
47 /* machine */
49 /* system */
51 { NULL, "CON", S_ATYP, 0, A_CON },
52 { NULL, "OVR", S_ATYP, 0, A_OVR },
53 { NULL, "REL", S_ATYP, 0, A_REL },
54 { NULL, "ABS", S_ATYP, 0, A_ABS },
55 { NULL, "NOPAG", S_ATYP, 0, A_NOPAG },
56 { NULL, "PAG", S_ATYP, 0, A_PAG },
58 { NULL, ".page", S_PAGE, 0, 0 },
59 { NULL, ".title", S_HEADER, 0, O_TITLE },
60 { NULL, ".sbttl", S_HEADER, 0, O_SBTTL },
61 { NULL, ".module", S_MODUL, 0, 0 },
62 { NULL, ".include", S_INCL, 0, I_CODE },
63 { NULL, ".incbin", S_INCL, 0, I_BNRY },
64 { NULL, ".area", S_AREA, 0, 0 },
65 { NULL, ".org", S_ORG, 0, 0 },
66 { NULL, ".radix", S_RADIX, 0, 0 },
67 { NULL, ".globl", S_GLOBL, 0, 0 },
68 { NULL, ".local", S_LOCAL, 0, 0 },
69 { NULL, ".if", S_CONDITIONAL, 0, O_IF },
70 { NULL, ".iff", S_CONDITIONAL, 0, O_IFF },
71 { NULL, ".ift", S_CONDITIONAL, 0, O_IFT },
72 { NULL, ".iftf", S_CONDITIONAL, 0, O_IFTF },
73 { NULL, ".ifdef", S_CONDITIONAL, 0, O_IFDEF },
74 { NULL, ".ifndef", S_CONDITIONAL, 0, O_IFNDEF},
75 { NULL, ".ifgt", S_CONDITIONAL, 0, O_IFGT },
76 { NULL, ".iflt", S_CONDITIONAL, 0, O_IFLT },
77 { NULL, ".ifge", S_CONDITIONAL, 0, O_IFGE },
78 { NULL, ".ifle", S_CONDITIONAL, 0, O_IFLE },
79 { NULL, ".ifeq", S_CONDITIONAL, 0, O_IFEQ },
80 { NULL, ".ifne", S_CONDITIONAL, 0, O_IFNE },
81 { NULL, ".ifb", S_CONDITIONAL, 0, O_IFB },
82 { NULL, ".ifnb", S_CONDITIONAL, 0, O_IFNB },
83 { NULL, ".ifidn", S_CONDITIONAL, 0, O_IFIDN },
84 { NULL, ".ifdif", S_CONDITIONAL, 0, O_IFDIF },
85 { NULL, ".iif", S_CONDITIONAL, 0, O_IIF },
86 { NULL, ".iiff", S_CONDITIONAL, 0, O_IIFF },
87 { NULL, ".iift", S_CONDITIONAL, 0, O_IIFT },
88 { NULL, ".iiftf", S_CONDITIONAL, 0, O_IIFTF },
89 { NULL, ".iifdef", S_CONDITIONAL, 0, O_IIFDEF},
90 { NULL, ".iifndef", S_CONDITIONAL, 0, O_IIFNDEF},
91 { NULL, ".iifgt", S_CONDITIONAL, 0, O_IIFGT },
92 { NULL, ".iiflt", S_CONDITIONAL, 0, O_IIFLT },
93 { NULL, ".iifge", S_CONDITIONAL, 0, O_IIFGE },
94 { NULL, ".iifle", S_CONDITIONAL, 0, O_IIFLE },
95 { NULL, ".iifeq", S_CONDITIONAL, 0, O_IIFEQ },
96 { NULL, ".iifne", S_CONDITIONAL, 0, O_IIFNE },
97 { NULL, ".iifb", S_CONDITIONAL, 0, O_IIFB },
98 { NULL, ".iifnb", S_CONDITIONAL, 0, O_IIFNB },
99 { NULL, ".iifidn", S_CONDITIONAL, 0, O_IIFIDN},
100 { NULL, ".iifdif", S_CONDITIONAL, 0, O_IIFDIF},
101 { NULL, ".else", S_CONDITIONAL, 0, O_ELSE },
102 { NULL, ".endif", S_CONDITIONAL, 0, O_ENDIF },
103 { NULL, ".list", S_LISTING, 0, O_LIST },
104 { NULL, ".nlist", S_LISTING, 0, O_NLIST },
105 { NULL, ".equ", S_EQU, 0, O_EQU },
106 { NULL, ".gblequ", S_EQU, 0, O_GBLEQU},
107 { NULL, ".lclequ", S_EQU, 0, O_LCLEQU},
108 { NULL, ".byte", S_DATA, 0, O_1BYTE },
109 { NULL, ".db", S_DATA, 0, O_1BYTE },
110 { NULL, ".fcb", S_DATA, 0, O_1BYTE },
111 { NULL, ".word", S_DATA, 0, O_2BYTE },
112 { NULL, ".dw", S_DATA, 0, O_2BYTE },
113 { NULL, ".fdb", S_DATA, 0, O_2BYTE },
114 /* { NULL, ".3byte", S_DATA, 0, O_3BYTE }, */
115 /* { NULL, ".triple", S_DATA, 0, O_3BYTE }, */
116 /* { NULL, ".4byte", S_DATA, 0, O_4BYTE }, */
117 /* { NULL, ".quad", S_DATA, 0, O_4BYTE }, */
118 { NULL, ".df", S_FLOAT, 0, 0 },
119 { NULL, ".blkb", S_BLK, 0, O_1BYTE },
120 { NULL, ".ds", S_BLK, 0, O_1BYTE },
121 { NULL, ".rmb", S_BLK, 0, O_1BYTE },
122 { NULL, ".rs", S_BLK, 0, O_1BYTE },
123 { NULL, ".blkw", S_BLK, 0, O_2BYTE },
124 /* { NULL, ".blk3", S_BLK, 0, O_3BYTE }, */
125 /* { NULL, ".blk4", S_BLK, 0, O_4BYTE }, */
126 { NULL, ".ascii", S_ASCIX, 0, O_ASCII },
127 { NULL, ".ascis", S_ASCIX, 0, O_ASCIS },
128 { NULL, ".asciz", S_ASCIX, 0, O_ASCIZ },
129 { NULL, ".str", S_ASCIX, 0, O_ASCII },
130 { NULL, ".strs", S_ASCIX, 0, O_ASCIS },
131 { NULL, ".strz", S_ASCIX, 0, O_ASCIZ },
132 { NULL, ".fcc", S_ASCIX, 0, O_ASCII },
133 { NULL, ".define", S_DEFINE, 0, O_DEF },
134 { NULL, ".undefine", S_DEFINE, 0, O_UNDEF },
135 { NULL, ".even", S_BOUNDARY, 0, O_EVEN },
136 { NULL, ".odd", S_BOUNDARY, 0, O_ODD },
137 { NULL, ".bndry", S_BOUNDARY, 0, O_BNDRY },
138 { NULL, ".msg" , S_MSG, 0, 0 },
139 { NULL, ".assume", S_ERROR, 0, O_ASSUME},
140 { NULL, ".error", S_ERROR, 0, O_ERROR },
141 /* sdas specific */
142 { NULL, ".optsdcc", S_OPTSDCC, 0, 0 },
143 /* end sdas specific */
145 /* Macro Processor */
147 { NULL, ".macro", S_MACRO, 0, O_MACRO },
148 { NULL, ".endm", S_MACRO, 0, O_ENDM },
149 { NULL, ".mexit", S_MACRO, 0, O_MEXIT },
151 { NULL, ".narg", S_MACRO, 0, O_NARG },
152 { NULL, ".nchr", S_MACRO, 0, O_NCHR },
153 { NULL, ".ntyp", S_MACRO, 0, O_NTYP },
155 { NULL, ".irp", S_MACRO, 0, O_IRP },
156 { NULL, ".irpc", S_MACRO, 0, O_IRPC },
157 { NULL, ".rept", S_MACRO, 0, O_REPT },
159 { NULL, ".nval", S_MACRO, 0, O_NVAL },
161 { NULL, ".mdelete", S_MACRO, 0, O_MDEL },
163 /* Machines */
165 { NULL, ".r4k", S_CPU, 0, X_R4K },
166 { NULL, ".r3k", S_CPU, 0, X_R2K },
167 { NULL, ".r2k", S_CPU, 0, X_R2K },
168 { NULL, ".hd64", S_CPU, 0, X_HD64 },
169 { NULL, ".z180", S_CPU, 0, X_HD64 },
170 { NULL, ".z80", S_CPU, 0, X_Z80 },
172 /* rabbit (warning: derived from "z80 / hd64180") */
174 { NULL, "ld", S_LD, 0, 0x40 },
176 { NULL, "call", S_CALL, 0, 0xC4 },
177 { NULL, "jp", S_JP, 0, 0xC2 },
178 { NULL, "jr", S_JR, 0, 0x18 },
179 { NULL, "djnz", S_DJNZ, 0, 0x10 },
180 { NULL, "ret", S_RET, 0, 0xC0 },
182 { NULL, "bit", S_BIT, 0, 0x40 },
183 { NULL, "res", S_BIT, 0, 0x80 },
184 { NULL, "set", S_BIT, 0, 0xC0 },
186 { NULL, "inc", S_INC, 0, 0x04 },
187 { NULL, "dec", S_DEC, 0, 0x05 },
189 { NULL, "add", S_ADD, 0, 0x80 },
190 { NULL, "adc", S_ADC, 0, 0x88 },
191 { NULL, "sbc", S_SBC, 0, 0x98 },
193 { NULL, "and", S_AND, 0, 0xA0 },
194 { NULL, "or", S_AND, 0, 0xB0 },
195 { NULL, "sub", S_SUB, 0, 0x90 },
196 { NULL, "xor", S_AND, 0, 0xA8 },
197 { NULL, "cp", S_AND, 0, 0xB8 },
199 { NULL, "ex", S_EX, 0, 0xE3 },
201 { NULL, "push", S_PUSH, 0, 0xC5 },
202 { NULL, "pop", S_PUSH, 0, 0xC1 },
204 /* { NULL, "in", S_IN, 0, 0xDB }, */
205 /* { NULL, "out", S_OUT, 0, 0xD3 }, */
207 { NULL, "ioi", S_IN, 0, 0xD3 },
208 { NULL, "ioe", S_OUT, 0, 0xDB },
210 { NULL, "rl", S_RL, 0, 0x10 },
211 { NULL, "rlc", S_RL, 0, 0x00 },
212 { NULL, "rr", S_RL, 0, 0x18 },
213 { NULL, "rrc", S_RL, 0, 0x08 },
214 { NULL, "sla", S_RL, 0, 0x20 },
215 { NULL, "sra", S_RL, 0, 0x28 },
216 { NULL, "srl", S_RL, 0, 0x38 },
218 { NULL, "rst", S_RST, 0, 0xC7 },
220 /* { NULL, "im", S_IM, 0, 0xED }, */
222 { NULL, "ccf", S_INH1, 0, 0x3F },
223 { NULL, "cpl", S_INH1, 0, 0x2F },
224 /* { NULL, "daa", S_INH1, 0, 0x27 }, */
225 /* { NULL, "di", S_INH1, 0, 0xF3 }, */
226 /* { NULL, "ei", S_INH1, 0, 0xFB }, */
227 { NULL, "ipset", S_IM, 0, 0xED },
228 { NULL, "ipset0", S_INH2, 0, 0x46 },
229 { NULL, "ipset1", S_INH2, 0, 0x56 },
230 { NULL, "ipset2", S_INH2, 0, 0x4E },
231 { NULL, "ipset3", S_INH2, 0, 0x5E },
232 { NULL, "ipres", S_INH2, 0, 0x5D },
233 { NULL, "exx", S_INH1, 0, 0xD9 },
234 { NULL, "nop", S_INH1, 0, 0x00 },
236 /* { NULL, "halt", S_INH1, 0, 0x76 }, */
237 { NULL, "altd", S_INH1, 0, 0x76 },
239 { NULL, "rla", S_INH1, 0, 0x17 },
240 { NULL, "rlca", S_INH1, 0, 0x07 },
241 { NULL, "rra", S_INH1, 0, 0x1F },
242 { NULL, "rrca", S_INH1, 0, 0x0F },
243 { NULL, "scf", S_INH1, 0, 0x37 },
245 /* { NULL, "cpd", S_INH2, 0, 0xA9 }, */
246 /* { NULL, "cpdr", S_INH2, 0, 0xB9 }, */
247 /* { NULL, "cpi", S_INH2, 0, 0xA1 }, */
248 /* { NULL, "cpir", S_INH2, 0, 0xB1 }, */
249 /* { NULL, "ind", S_INH2, 0, 0xAA }, */
250 /* { NULL, "indr", S_INH2, 0, 0xBA }, */
251 /* { NULL, "ini", S_INH2, 0, 0xA2 }, */
252 /* { NULL, "inir", S_INH2, 0, 0xB2 }, */
253 { NULL, "ldd", S_INH2, 0, 0xA8 },
254 { NULL, "lddr", S_INH2, 0, 0xB8 },
255 { NULL, "ldi", S_INH2, 0, 0xA0 },
256 { NULL, "ldir", S_INH2, 0, 0xB0 },
257 { NULL, "neg", S_NEG, 0, 0x44 },
258 /* { NULL, "outd", S_INH2, 0, 0xAB }, */
259 /* { NULL, "otdr", S_INH2, 0, 0xBB }, */
260 /* { NULL, "outi", S_INH2, 0, 0xA3 }, */
261 /* { NULL, "otir", S_INH2, 0, 0xB3 }, */
262 { NULL, "reti", S_INH2, 0, 0x4D },
263 /* { NULL, "retn", S_INH2, 0, 0x45 }, */
264 { NULL, "lret", S_INH2, 0, 0x45 },
265 /* { NULL, "rld", S_INH2, 0, 0x6F }, */
266 /* { NULL, "rrd", S_INH2, S_EOL, 0x67 } */
268 { NULL, "mul", S_INH1, 0, 0xF7 },
270 { NULL, "idet", R3K_INH1, 0, 0x5B },
271 { NULL, "lddsr", R3K_INH2, 0, 0x98 },
272 { NULL, "ldisr", R3K_INH2, 0, 0x90 },
273 { NULL, "lsddr", R3K_INH2, 0, 0xD8 },
274 { NULL, "lsdr", R3K_INH2, 0, 0xF8 },
275 { NULL, "lsidr", R3K_INH2, 0, 0xD0 },
276 { NULL, "lsir", R3K_INH2, 0, 0xF0 },
277 { NULL, "rdmode", R3K_INH2, 0, 0x7F },
278 { NULL, "setusr", R3K_INH2, 0, 0x6F },
279 { NULL, "sures", R3K_INH2, 0, 0x7D },
280 { NULL, "uma", R3K_INH2, 0, 0xC0 },
281 { NULL, "ums", R3K_INH2, 0, 0xC8 },
283 { NULL, "jre", X_JRE, 0, 0xA3 },
284 { NULL, "clr", X_CLR, 0, 0xBF },
285 { NULL, "ljp", X_LJP, 0, 0xC7 },
286 { NULL, "lcall", X_LCALL, 0, 0xCF },
287 { NULL, "lret", S_INH2, 0, 0x45 },
288 { NULL, "bool", X_BOOL, 0, 0xCC },
289 { NULL, "ldp", X_LDP, 0, 0x64 },
290 { NULL, "syscall", R4K_INH2, 0, 0x75 },
291 { NULL, "sysret", R4K_INH2, 0, 0x83 },
292 { NULL, "mulu", X_R4K_MULU, S_EOL, 0xA7 }