struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / sdas / asrab / rab.h
blobd4b2c902a512f293d22d649018bac392c0da9b08
1 /* rab.h */
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 /*)BUILD
40 $(PROGRAM) = ASRAB
41 $(INCLUDE) = {
42 ASXXXX.H
43 RAB.H
45 $(FILES) = {
46 RABMCH.C
47 RABADR.C
48 RABPST.C
49 ASMAIN.C
50 ASDBG.C
51 ASLEX.C
52 ASSYM.C
53 ASSUBR.C
54 ASEXPR.C
55 ASDATA.C
56 ASLIST.C
57 ASOUT.C
59 $(STACK) = 3000
63 * Indirect Addressing delimeters
65 #define LFIND '('
66 #define RTIND ')'
69 * Registers
71 #define B 0
72 #define C 1
73 #define D 2
74 #define E 3
75 #define H 4
76 #define L 5
77 #define A 7
79 #define BC 0
80 #define DE 1
81 #define HL 2
82 #define SP 3
83 #define AF 4
84 #define IX 5
85 #define IY 6
87 #define EIR 0x47
88 #define IIR 0x4f
89 #define IP 0x76
91 #define BCDE 1
92 #define JKHL 1
95 * Conditional definitions
97 #define NZ 0
98 #define Z 1
99 #define NC 2
100 #define CS 3
101 #define PO 4
102 #define PE 5
103 #define P 6
104 #define M 7
107 * Alternate set of conditional definitions for some rabbit 4000 instructions
109 #define CC_GT 0
110 #define CC_GTU 1
111 #define CC_LT 2
112 #define CC_V 3
113 #define CC_NZ 4
114 #define CC_Z 5
115 #define CC_NC 6
116 #define CC_C 7
119 * Symbol types
121 #define S_IMMED 30
122 #define S_R8 31
123 #define S_R8X 32
125 #define S_R16 34
126 #define S_R16_ALT 35
127 #define S_CND 36
128 #define S_FLAG 37
130 #define S_R32_BCDE 38
131 #define S_R32_JKHL 39
132 #define S_RXPC 40
134 #define S_R16AF 41
135 #define S_R16AF_ALT 42
138 * Indexing modes
140 #define S_INDB 40
141 #define S_IDC 41
142 #define S_INDR 50
143 #define S_IDBC 50
144 #define S_IDDE 51
145 #define S_IDHL 52
146 #define S_IDSP 53
147 #define S_IDIX 55
148 #define S_IDIY 56
149 #define S_INDM 57
150 #define S_IDHL_OFFSET 58
153 * Instruction types
155 #define S_LD 60
156 #define S_CALL 61
157 #define S_JP 62
158 #define S_JR 63
159 #define S_RET 64
160 #define S_BIT 65
161 #define S_INC 66
162 #define S_DEC 67
163 #define S_ADD 68
164 #define S_ADC 69
165 #define S_AND 70
166 #define S_EX 71
167 #define S_PUSH 72
168 #define S_IN 73
169 #define S_OUT 74
170 #define S_RL 75
171 #define S_RST 76
172 #define S_IM 77
173 #define S_INH1 78
174 #define S_INH2 81
175 #define S_DJNZ 84
176 #define S_SUB 85
177 #define S_SBC 86
178 #define S_NEG 83
179 #define S_CPU 88
182 * Processor Types (S_CPU)
184 #define X_R2K 0
185 #define X_HD64 1
186 #define X_Z80 2
187 #define X_R4K 3
190 * HD64180 Instructions
192 #define HD_INH2 90
193 #define HD_IN 91
194 #define HD_OUT 92
195 #define HD_MLT 93
196 #define HD_TST 94
197 #define HD_TSTIO 95
200 * Rabbit 2000 / Rabbit 4000 specific Instructions
202 #define X_LJP 97
203 #define X_LCALL 98
204 #define X_BOOL 99
205 #define X_LDP 100
206 #define X_R3K_MODE 101
207 #define R3K_INH1 102
208 #define R3K_INH2 103
210 #define X_R4K_MODE 105
211 /* the remaining instructions are only on Rabbit 4000: */
212 #define X_R4K_MULU 106
213 #define X_JRE 107
214 #define X_CLR 108
215 #define R4K_INH2 109
217 #define BCDE_PG 0xDD
218 #define JKHL_PG 0xFD
220 struct adsym
222 char a_str[8]; /* addressing string */
223 int a_val; /* addressing mode value */
226 /* register names are in rabadr.c: */
227 extern struct adsym R8[];
228 extern struct adsym R8X[];
229 extern struct adsym R8IP[];
230 extern struct adsym R16[];
231 extern struct adsym R16_ALT[];
232 extern struct adsym R16AF[];
233 extern struct adsym R16AF_ALT[];
235 extern struct adsym R32_JKHL[];
236 extern struct adsym R32_BCDE[];
237 extern struct adsym RXPC[];
239 extern struct adsym CND[];
240 extern struct adsym ALT_CND[];
242 /* machine dependent functions */
244 #ifdef OTHERSYSTEM
246 /* rabadr.c */
247 extern int addr(struct expr *esp);
248 extern int admode(struct adsym *sp);
249 extern int any(char c, char *str);
250 extern int srch(char *str);
253 /* rabmch.c */
254 extern int genop(int pop, int op, struct expr *esp, int f);
255 extern int gixiy(int v);
256 extern int mchpcr(struct expr *esp);
258 #else
260 /* rabadr.c */
261 extern int addr();
262 extern int admode();
263 extern int any();
264 extern int srch();
266 /* rabmch.c */
267 extern int genop();
268 extern int gixiy();
269 extern int mchpcr();
271 #endif