struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / sdas / asz80 / z80.h
blob5f45dd4415127fca140a343b622214ecf1b4ff38
1 /* z80.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
26 * Extensions: P. Felber
29 /*)BUILD
30 $(PROGRAM) = ASZ80
31 $(INCLUDE) = {
32 ASXXXX.H
33 Z80.H
35 $(FILES) = {
36 Z80MCH.C
37 Z80ADR.C
38 Z80PST.C
39 ASMAIN.C
40 ASDBG.C
41 ASLEX.C
42 ASSYM.C
43 ASSUBR.C
44 ASEXPR.C
45 ASDATA.C
46 ASLIST.C
47 ASOUT.C
49 $(STACK) = 3000
53 * Indirect Addressing delimeters
55 #define LFIND '('
56 #define RTIND ')'
59 * Registers
61 #define B 0
62 #define C 1
63 #define D 2
64 #define E 3
65 #define H 4
66 #define L 5
67 #define A 7
69 #define I 0107
70 #define R 0117
72 #define X 8 /* for ZXN pop x */
73 #define MB 9 /* for eZ80 */
75 #define BC 0
76 #define DE 1
77 #define HL 2
78 #define SP 3
79 #define AF 4
80 #define IX 5
81 #define IY 6
84 * Conditional definitions
86 #define NZ 0
87 #define Z 1
88 #define NC 2
89 #define CS 3
90 #define PO 4
91 #define PE 5
92 #define P 6
93 #define M 7
96 * Symbol types
98 #define S_IMMED 30
99 #define S_R8 31
100 #define S_R8X 32
101 #define S_R16 33
102 #define S_R16X 34
103 #define S_CND 35
104 #define S_FLAG 36
105 #define S_R8U1 37
106 #define S_R8U2 38
107 #define S_R8MB 39
110 * Indexing modes
112 #define S_INDB 40
113 #define S_IDC 41
114 #define S_INDR 50
115 #define S_IDBC 50
116 #define S_IDDE 51
117 #define S_IDHL 52
118 #define S_IDSP 53
119 #define S_IDIX 55
120 #define S_IDIY 56
121 #define S_INDM 57
124 * Undocumented instructions
127 #define X_UNDOCD 58
128 #define S_RL_UNDOCD 59
131 * Instruction types
133 #define S_LD 60
134 #define S_CALL 61
135 #define S_JP 62
136 #define S_JR 63
137 #define S_RET 64
138 #define S_BIT 65
139 #define S_INC 66
140 #define S_DEC 67
141 #define S_ADD 68
142 #define S_ADC 69
143 #define S_AND 70
144 #define S_EX 71
145 #define S_PUSH 72
146 #define S_IN 73
147 #define S_OUT 74
148 #define S_RL 75
149 #define S_RST 76
150 #define S_IM 77
151 #define S_INH1 78
152 #define S_INH2 79
153 #define S_DJNZ 80
154 #define S_SUB 81
155 #define S_SBC 82
158 * CPU Types
160 #define S_CPU 84
163 * HD64180 Instructions
165 #define X_INH2 90
166 #define X_IN 91
167 #define X_OUT 92
168 #define X_MLT 93
169 #define X_TST 94
170 #define X_TSTIO 95
173 * Processor Types (S_CPU)
175 #define X_Z80 0
176 #define X_HD64 1
177 #define X_ZXN 2
178 #define X_EZ80 3
179 #define X_R800 4
182 * Z80-ZX Next Instructions
184 #define X_ZXN_INH2 100
185 #define X_ZXN_MUL 101
186 #define X_ZXN_MIRROR 102
187 #define X_ZXN_NEXTREG 103
188 #define X_ZXN_CU_WAIT 104
189 #define X_ZXN_CU_MOVE 105
190 #define X_ZXN_CU_STOP 106
191 #define X_ZXN_CU_NOP 107
194 * eZ80 Instructions
196 #define X_EZ_ADL 110
197 #define X_EZ_INH2 111
198 #define X_EZ_LEA 112
199 #define X_EZ_PEA 113
202 * R800/Z280 Instructions
204 #define X_Z280_MULTU 120
205 #define X_Z280_MULTUW 121
208 * eZ80 specific addressing extensions (used in mne m_flag)
210 #define M_L 0x01
211 #define M_S 0x02
212 #define M_IL 0x04
213 #define M_IS 0x08
214 #define M_LIL (M_L | M_IL)
215 #define M_LIS (M_L | M_IS)
216 #define M_SIL (M_S | M_IL)
217 #define M_SIS (M_S | M_IS)
220 * Extended Addressing Modes
222 #define R_ADL 0x0000 /* 24-Bit Addressing Mode */
223 #define R_Z80 0x0100 /* 16-Bit Addressing Mode */
224 #define R_3BIT 0x0200 /* 3-Bit Addressing Mode */
226 struct adsym
228 char a_str[4]; /* addressing string */
229 int a_val; /* addressing mode value */
232 extern struct adsym R8[];
233 extern struct adsym R8X[];
234 extern struct adsym R8U1[];
235 extern struct adsym R8U2[];
237 extern struct adsym R16[];
238 extern struct adsym R16X[];
239 extern struct adsym R8MB[];
240 extern struct adsym RX[];
241 extern struct adsym CND[];
243 /* machine dependent functions */
245 #ifdef OTHERSYSTEM
247 /* z80adr.c */
248 extern int addr(struct expr *esp);
249 extern int admode(struct adsym *sp);
250 extern int srch(char *str);
252 /* z80mch.c */
253 extern int genop(int pop, int op, struct expr *esp, int f);
254 extern int gixiy(int v);
255 extern VOID glilsis(int sfx, struct expr *esp);
256 extern VOID machine(struct mne *mp);
257 extern int mchpcr(struct expr *esp);
258 extern VOID minit(void);
260 #else
262 /* z80adr.c */
263 extern int addr();
264 extern int admode();
265 extern int srch();
267 /* z80mch.c */
268 extern int genop();
269 extern int gixiy();
270 extern VOID glilsis();
271 extern VOID machine();
272 extern int mchpcr();
273 extern VOID minit();
275 #endif