[ucsim] Version 0.8.5
[sdcc.git] / sdcc / sim / ucsim / src / sims / f8.src / decode.h
blobe1e7bf453f9fa5ca5644e74d24232aeb73a9b0b2
1 /*
2 * Simulator of microcontrollers (decode.h)
4 * Copyright (C) 2022 Drotos Daniel, Talker Bt.
5 *
6 * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
8 */
10 /* This file is part of microcontroller simulator: ucsim.
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING. If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 02111-1307, USA. */
26 /*@1@*/
28 #ifndef F8_DECODE_HEADER
29 #define F8_DECODE_HEADER
31 #define PREF 0x9c
32 #define PREF_MASK 0xfc
33 #define PREF_SHIFT 0
35 // Opcodes of prefixes
36 #define PREF_SWAPOP 0x9c
37 #define PREF_ALT1 0x9d
38 #define PREF_ALT2 0x9e
39 #define PREF_ALT3 0x9f
40 #define PREF_ALT4 0x94
41 #define PREF_ALT5 0xd8
43 // data moves
44 #define LD8_A_I instruction_80
45 #define LD8_A_M instruction_81
46 #define LD8_A_NSP instruction_82
47 #define LD8_A_NNZ instruction_83
48 #define LD8_A_Y instruction_84
49 #define LD8_A_NY instruction_85
50 #define LD8_A_XH instruction_86
51 #define LD8_A_YL instruction_87
52 #define LD8_A_YH instruction_88
53 #define LD8_A_ZL instruction_89
54 #define LD8_A_ZH instruction_8a
55 #define LD8_M_A instruction_8b
56 #define LD8_NSP_A instruction_8c
57 #define LD8_NNZ_A instruction_8d
58 #define LD8_Y_A instruction_8e
59 #define LD8_NY_A instruction_8f
61 #define LDW_A_I instruction_c0
62 #define LDW_A_M instruction_c1
63 #define LDW_A_NSP instruction_c2
64 #define LDW_A_NNZ instruction_c3
65 #define LDW_A_NY instruction_c4
66 #define LDW_A_Y instruction_c5
67 #define LDW_A_X instruction_c6
68 #define LDW_A_D instruction_c7
69 #define LDW_M_A instruction_c8
70 #define LDW_NSP_A instruction_c9
71 #define LDW_NNZ_A instruction_ca
72 #define LDW_X_A instruction_cb
73 #define LDW_Z_A instruction_cc
74 #define LDW_AM_X instruction_cd
75 #define LDW_NAM_X instruction_ce
76 #define LDW_DSP_A instruction_74
78 #define LDI_Z_Y instruction_ed
79 #define LDWI_Z_Y instruction_cf
81 #define PUSH_M instruction_60
82 #define PUSH_NSP instruction_61
83 #define PUSH_A instruction_62
84 #define PUSH_NY instruction_63
85 #define PUSH_I instruction_90
87 #define PUSHW_M instruction_b0
88 #define PUSHW_NSP instruction_b1
89 #define PUSHW_NNZ instruction_b2
90 #define PUSHW_A instruction_b3
91 #define PUSHW_I instruction_e8
93 #define POP_A instruction_99
94 #define POPW_A instruction_e9
96 #define XCH_A_NSP instruction_91
97 #define XCH_A_Y instruction_92
98 #define XCH_A_A instruction_93
99 #define XCHW_Y_Z instruction_f4
100 #define XCHW_Z_NSP instruction_f5
102 #define CAX instruction_9b
103 #define CAXW instruction_f9
105 #define CLR_M instruction_58
106 #define CLR_NSP instruction_59
107 #define CLR_A instruction_5a
108 #define CLR_NY instruction_5b
109 #define CLRW_M instruction_a0
110 #define CLRW_NSP instruction_a1
111 #define CLRW_NNZ instruction_a2
112 #define CLRW_A instruction_a3
114 #define XCHB_0 instruction_68
115 #define XCHB_1 instruction_69
116 #define XCHB_2 instruction_6a
117 #define XCHB_3 instruction_6b
118 #define XCHB_4 instruction_6c
119 #define XCHB_5 instruction_6d
120 #define XCHB_6 instruction_6e
121 #define XCHB_7 instruction_6f
123 #define INC_M instruction_50
124 #define INC_NSP instruction_51
125 #define INC_A instruction_52
126 #define INC_NY instruction_53
127 #define DEC_M instruction_54
128 #define DEC_NSP instruction_55
129 #define DEC_A instruction_56
130 #define DEC_NY instruction_57
131 #define TST_M instruction_5c
132 #define TST_NSP instruction_5d
133 #define TST_A instruction_5e
134 #define TST_NY instruction_5f
136 // arithmetic instructions
137 #define ADD_I instruction_10
138 #define ADD_M instruction_11
139 #define ADD_NSP instruction_12
140 #define ADD_NNZ instruction_13
141 #define ADD_ZL instruction_14
142 #define ADD_XH instruction_15
143 #define ADD_YL instruction_16
144 #define ADD_YH instruction_17
146 #define ADC_I instruction_18
147 #define ADC_M instruction_19
148 #define ADC_NSP instruction_1a
149 #define ADC_NNZ instruction_1b
150 #define ADC_ZL instruction_1c
151 #define ADC_XH instruction_1d
152 #define ADC_YL instruction_1e
153 #define ADC_YH instruction_1f
155 #define SUB_M instruction_01
156 #define SUB_NSP instruction_02
157 #define SUB_NNZ instruction_03
158 #define SUB_ZL instruction_04
159 #define SUB_XH instruction_05
160 #define SUB_YL instruction_06
161 #define SUB_YH instruction_07
163 #define SBC_M instruction_09
164 #define SBC_NSP instruction_0a
165 #define SBC_NNZ instruction_0b
166 #define SBC_ZL instruction_0c
167 #define SBC_XH instruction_0d
168 #define SBC_YL instruction_0e
169 #define SBC_YH instruction_0f
171 #define CP_I instruction_20
172 #define CP_M instruction_21
173 #define CP_NSP instruction_22
174 #define CP_NNZ instruction_23
175 #define CP_ZL instruction_24
176 #define CP_XH instruction_25
177 #define CP_YL instruction_26
178 #define CP_YH instruction_27
180 #define OR_I instruction_28
181 #define OR_M instruction_29
182 #define OR_NSP instruction_2a
183 #define OR_NNZ instruction_2b
184 #define OR_ZL instruction_2c
185 #define OR_XH instruction_2d
186 #define OR_YL instruction_2e
187 #define OR_YH instruction_2f
189 #define AND_I instruction_30
190 #define AND_M instruction_31
191 #define AND_NSP instruction_32
192 #define AND_NNZ instruction_33
193 #define AND_ZL instruction_34
194 #define AND_XH instruction_35
195 #define AND_YL instruction_36
196 #define AND_YH instruction_37
198 #define XOR_I instruction_38
199 #define XOR_M instruction_39
200 #define XOR_NSP instruction_3a
201 #define XOR_NNZ instruction_3b
202 #define XOR_ZL instruction_3c
203 #define XOR_XH instruction_3d
204 #define XOR_YL instruction_3e
205 #define XOR_YH instruction_3f
207 #define SUBW_M instruction_71
208 #define SUBW_NSP instruction_72
209 #define SUBW_X instruction_73
210 #define SBCW_M instruction_75
211 #define SBCW_NSP instruction_76
212 #define SBCW_X instruction_77
214 #define ADDW_I instruction_78
215 #define ADDW_M instruction_79
216 #define ADDW_NSP instruction_7a
217 #define ADDW_X instruction_7b
218 #define ADCW_I instruction_7c
219 #define ADCW_M instruction_7d
220 #define ADCW_NSP instruction_7e
221 #define ADCW_X instruction_7f
223 #define ORW_I instruction_f0
224 #define ORW_M instruction_f1
225 #define ORW_NSP instruction_f2
226 #define ORW_X instruction_f3
228 #define XORW_I instruction_fc
229 #define XORW_M instruction_fd
230 #define XORW_NSP instruction_fe
231 #define XORW_X instruction_ff
233 #define SRL_M instruction_40
234 #define SRL_NSP instruction_41
235 #define SRL_A instruction_42
236 #define SRL_NY instruction_43
237 #define SLL_M instruction_44
238 #define SLL_NSP instruction_45
239 #define SLL_A instruction_46
240 #define SLL_NY instruction_47
241 #define RRC_M instruction_48
242 #define RRC_NSP instruction_49
243 #define RRC_A instruction_4a
244 #define RRC_NY instruction_4b
245 #define RLC_M instruction_4c
246 #define RLC_NSP instruction_4d
247 #define RLC_A instruction_4e
248 #define RLC_NY instruction_4f
250 #define INCW_M instruction_a4
251 #define INCW_NSP instruction_a5
252 #define INCW_NNZ instruction_a6
253 #define INCW_A instruction_a7
254 #define ADCW1_M instruction_a8
255 #define ADCW1_NSP instruction_a9
256 #define ADCW1_NNZ instruction_aa
257 #define ADCW1_A instruction_ab
258 #define SBCW1_M instruction_ac
259 #define SBCW1_NSP instruction_ad
260 #define SBCW1_NNZ instruction_ae
261 #define SBCW1_A instruction_af
262 #define TSTW1_M instruction_b4
263 #define TSTW1_NSP instruction_b5
264 #define TSTW1_NNZ instruction_b6
265 #define TSTW1_A instruction_b7
267 #define ROT instruction_95
268 #define SRA instruction_96
269 #define DAA instruction_97
270 #define BOOL_A instruction_98
271 #define MSK instruction_b8
272 #define MAD_M instruction_bc
273 #define MAD_NSP instruction_bd
274 #define MAD_NNZ instruction_be
275 #define MAD_Z instruction_bf
276 #define XCH_F_NSP instruction_ec
278 #define MUL instruction_b9
279 #define NEGW instruction_fa
280 #define BOOLW instruction_fb
281 #define SRLW instruction_e0
282 #define SLLW instruction_e1
283 #define RRCW instruction_e2
284 #define RLCW_A instruction_e3
285 #define RRCW_NSP instruction_e6
286 #define RLCW_NSP instruction_e7
287 #define SRAW instruction_e4
288 #define ADDW_SP_D instruction_ea
289 #define ADDW_A_D instruction_eb
290 #define LDW_A_SP instruction_70
291 #define CPW instruction_f8
292 #define INCNW instruction_f6
293 #define DECW_NSP instruction_f7
294 #define SLLW_A_XL instruction_e5
295 #define SEX instruction_ee
296 #define ZEX instruction_ef
298 // branches
299 #define JP_I instruction_64
300 #define JP_A instruction_65
301 #define CALL_I instruction_66
302 #define CALL_A instruction_67
303 #define RET instruction_ba
304 #define RETI instruction_bb
306 #define JR instruction_d0
307 #define DNJNZ instruction_d1
308 #define JRZ instruction_d2
309 #define JRNZ instruction_d3
310 #define JRC instruction_d4
311 #define JRNC instruction_d5
312 #define JRN instruction_d6
313 #define JRNN instruction_d7
314 #define JRNO instruction_d9
315 #define JRSGE instruction_da
316 #define JRSLT instruction_db
317 #define JRSLE instruction_dd
318 #define JRLE instruction_df
320 // other instructions
321 #define NOP instruction_08
322 #define TRAP instruction_00
323 #define THRD instruction_9a
325 #endif
327 /* End of f8.src/decode.h */