* asranlib/asranlib.c, link/lkar.h, link/lkar.c:
[fw/sdcc] / as / z80 / z80.h
1 /* z80.h
2
3    Copyright (C) 1989-1995 Alan R. Baldwin
4    721 Berkeley St., Kent, Ohio 44240
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3, or (at your option) any
9 later version.
10
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.
15
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/>. */
18
19 /*
20  * Extensions: P. Felber
21  */
22
23 /*)BUILD
24         $(PROGRAM) =    ASZ80
25         $(INCLUDE) = {
26                 ASM.H
27                 Z80.H
28         }
29         $(FILES) = {
30                 Z80EXT.C
31                 Z80MCH.C
32                 Z80ADR.C
33                 Z80PST.C
34                 ASMAIN.C
35                 ASLEX.C
36                 ASSYM.C
37                 ASSUBR.C
38                 ASEXPR.C
39                 ASDATA.C
40                 ASLIST.C
41                 ASOUT.C
42         }
43         $(STACK) = 2000
44 */
45
46 /*
47  * Indirect Addressing delimeters
48  */
49 #define LFIND   '('
50 #define RTIND   ')'
51
52 /*
53  * Registers
54  */
55 #define B       0
56 #define C       1
57 #define D       2
58 #define E       3
59 #define H       4
60 #define L       5
61 #define A       7
62
63 #define I       0107
64 #define R       0117
65
66 #define BC      0
67 #define DE      1
68 #define HL      2
69 #define SP      3
70 #define AF      4
71 #ifndef GAMEBOY
72 #define IX      5
73 #define IY      6
74 #else /* GAMEBOY */
75 #define HLD     5
76 #define HLI     6
77 #endif /* GAMEBOY */
78
79 /*
80  * Conditional definitions
81  */
82 #define NZ      0
83 #define Z       1
84 #define NC      2
85 #define CS      3
86 #ifndef GAMEBOY
87 #define PO      4
88 #define PE      5
89 #define P       6
90 #define M       7
91 #endif /* GAMEBOY */
92
93 /*
94  * Symbol types
95  */
96 #define S_IMMED 30
97 #define S_R8    31
98 #define S_R8X   32
99 #define S_R16   33
100 #define S_R16X  34
101 #define S_CND   35
102 #define S_FLAG  36
103
104 /*
105  * Indexing modes
106  */
107 #define S_INDB  40
108 #define S_IDC   41
109 #define S_INDR  50
110 #define S_IDBC  50
111 #define S_IDDE  51
112 #define S_IDHL  52
113 #define S_IDSP  53
114 #ifndef GAMEBOY
115 #define S_IDIX  55
116 #define S_IDIY  56
117 #else /* GAMEBOY */
118 #define S_IDHLD 55
119 #define S_IDHLI 56
120 #endif /* GAMEBOY */
121 #define S_INDM  57
122
123 /*
124  * Instruction types
125  */
126 #define S_LD    60
127 #define S_CALL  61
128 #define S_JP    62
129 #define S_JR    63
130 #define S_RET   64
131 #define S_BIT   65
132 #define S_INC   66
133 #define S_DEC   67
134 #define S_ADD   68
135 #define S_ADC   69
136 #define S_AND   70
137 #ifndef GAMEBOY
138 #define S_EX    71
139 #endif /* GAMEBOY */
140 #define S_PUSH  72
141 #ifndef GAMEBOY
142 #define S_IN    73
143 #define S_OUT   74
144 #endif /* GAMEBOY */
145 #define S_RL    75
146 #define S_RST   76
147 #define S_IM    77
148 #define S_INH1  78
149 #ifndef GAMEBOY
150 #define S_INH2  79
151 #define S_DJNZ  80
152 #endif /* GAMEBOY */
153 #define S_SUB   81
154 #define S_SBC   82
155 #ifdef GAMEBOY
156 #define S_STOP  83
157 #define S_LDH   84
158 #define S_LDA   85
159 #define S_LDHL  86
160 #endif /* GAMEBOY */
161
162 /*
163  * HD64180 Instructions
164  */
165 #define X_HD64  90
166 #define X_INH2  91
167 #define X_IN    92
168 #define X_OUT   93
169 #define X_MLT   94
170 #define X_TST   95
171 #define X_TSTIO 96
172
173 struct adsym
174 {
175         char    a_str[4];       /* addressing string */
176         int     a_val;          /* addressing mode value */
177 };
178
179 extern  struct  adsym   R8[];
180 extern  struct  adsym   R8X[];
181 extern  struct  adsym   R16[];
182 extern  struct  adsym   R16X[];
183 extern  struct  adsym   CND[];
184
185         /* machine dependent functions */
186
187         /* z80adr.c */
188 extern  int             addr();
189 extern  int             admode();
190 extern  int             any();
191 extern  int             srch();
192
193         /* z80mch.c */
194 extern  int             comma();
195 extern  int             genop();
196 extern  int             gixiy();
197 extern  VOID            minit();
198 extern  VOID            machine(struct mne *mp) ;