1 /* z80.h */ 2 3 /* 4 * Copyright (C) 1989-2009 Alan R. Baldwin 5 * 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. 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 * Alan R. Baldwin 21 * 721 Berkeley St. 22 * Kent, Ohio 44240 23 */ 24 25 /* 26 * Extensions: P. Felber 27 */ 28 29 /*)BUILD 30 $(PROGRAM) = ASZ80 31 $(INCLUDE) = { 32 ASXXXX.H 33 Z80.H 34 } 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 48 } 49 $(STACK) = 3000 50 */ 51 52 /* 53 * Indirect Addressing delimeters 54 */ 55 #define LFIND '(' 56 #define RTIND ')' 57 58 /* 59 * Registers 60 */ 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 68 69 #define I 0107 70 #define R 0117 71 72 #define X 8 /* for ZXN pop x */ 73 #define MB 9 /* for eZ80 */ 74 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 82 83 /* 84 * Conditional definitions 85 */ 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 94 95 /* 96 * Symbol types 97 */ 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 108 109 /* 110 * Indexing modes 111 */ 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 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 #define S_EX 71 138 #define S_PUSH 72 139 #define S_IN 73 140 #define S_OUT 74 141 #define S_RL 75 142 #define S_RST 76 143 #define S_IM 77 144 #define S_INH1 78 145 #define S_INH2 79 146 #define S_DJNZ 80 147 #define S_SUB 81 148 #define S_SBC 82 149 150 /* 151 * CPU Types 152 */ 153 #define S_CPU 83 154 155 #define S_RL_UNDOCD 85 156 #define X_UNDOCD 89 157 158 /* 159 * Processor Types (S_CPU) 160 */ 161 #define X_Z80 0 162 #define X_HD64 1 163 #define X_ZXN 2 164 #define X_EZ80 3 165 166 /* 167 * HD64180 Instructions 168 */ 169 #define X_INH2 90 170 #define X_IN 91 171 #define X_OUT 92 172 #define X_MLT 93 173 #define X_TST 94 174 #define X_TSTIO 95 175 176 /* 177 * Z80-ZX Next Instructions 178 */ 179 #define X_ZXN_INH2 100 180 #define X_ZXN_MUL 101 181 #define X_ZXN_MIRROR 102 182 #define X_ZXN_NEXTREG 103 183 #define X_ZXN_MMU 104 184 #define X_ZXN_CU_WAIT 105 185 #define X_ZXN_CU_MOVE 106 186 #define X_ZXN_CU_STOP 107 187 #define X_ZXN_CU_NOP 108 188 189 /* 190 * eZ80 Instructions 191 */ 192 #define X_EZ_ADL 110 193 #define X_EZ_INH2 111 194 #define X_EZ_LEA 112 195 #define X_EZ_PEA 113 196 197 /* 198 * eZ80 specific addressing extensions (used in mne m_flag) 199 */ 200 #define M_L 0x01 201 #define M_S 0x02 202 #define M_IL 0x04 203 #define M_IS 0x08 204 #define M_LIL (M_L | M_IL) 205 #define M_LIS (M_L | M_IS) 206 #define M_SIL (M_S | M_IL) 207 #define M_SIS (M_S | M_IS) 208 209 /* 210 * Extended Addressing Modes 211 */ 212 #define R_ADL 0x0000 /* 24-Bit Addressing Mode */ 213 #define R_Z80 0x0100 /* 16-Bit Addressing Mode */ 214 #define R_3BIT 0x0200 /* 3-Bit Addressing Mode */ 215 216 struct adsym 217 { 218 char a_str[4]; /* addressing string */ 219 int a_val; /* addressing mode value */ 220 }; 221 222 extern struct adsym R8[]; 223 extern struct adsym R8X[]; 224 extern struct adsym R8U1[]; 225 extern struct adsym R8U2[]; 226 227 extern struct adsym R16[]; 228 extern struct adsym R16X[]; 229 extern struct adsym R8MB[]; 230 extern struct adsym RX[]; 231 extern struct adsym CND[]; 232 233 /* machine dependent functions */ 234 235 #ifdef OTHERSYSTEM 236 237 /* z80adr.c */ 238 extern int addr(struct expr *esp); 239 extern int admode(struct adsym *sp); 240 extern int srch(char *str); 241 242 /* z80mch.c */ 243 extern int genop(int pop, int op, struct expr *esp, int f); 244 extern int gixiy(int v); 245 extern VOID glilsis(int sfx, struct expr *esp); 246 extern VOID machine(struct mne *mp); 247 extern int mchpcr(struct expr *esp); 248 extern VOID minit(void); 249 250 #else 251 252 /* z80adr.c */ 253 extern int addr(); 254 extern int admode(); 255 extern int srch(); 256 257 /* z80mch.c */ 258 extern int genop(); 259 extern int gixiy(); 260 extern VOID glilsis(); 261 extern VOID machine(); 262 extern int mchpcr(); 263 extern VOID minit(); 264 265 #endif 266