struct / union in initializer, RFE #901.
[sdcc.git] / sdcc-extra / emu / rrz80 / cpu / z80optab.c
blob911b700908a5522235b961f05460efed9da4c8fa
1 /*
2 * Copyright (C) 1996-1998 Szeredi Miklos
3 * Email: mszeredi@inf.bme.hu
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. See the file COPYING.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "z80_def.h"
22 #include "z80optab.h"
23 #include <stdio.h>
25 #ifdef PROCP
26 #define NEXTTAB(tab) \
27 { \
28 register byte nextop; \
29 nextop = *PCP; \
30 PC++; \
31 return (*z80c_op_tab_ ## tab [nextop])(z80p); \
33 #else
34 #define NEXTTAB(tab) \
35 { \
36 register byte nextop; \
37 nextop = *PCP; \
38 PC++; \
39 (*z80c_op_tab_ ## tab [nextop])(); \
41 #endif
44 OPDEF(special_cb, 0xCB)
46 RR++;
47 DANM(cbaddr) = HL;
48 NEXTTAB(cb);
51 OPDEF(special_dd, 0xDD)
53 RR++;
54 DANM(tc) -= 4;
55 NEXTTAB(dd);
59 OPDEF(special_ed, 0xED)
61 RR++;
62 NEXTTAB(ed);
65 OPDEF(special_fd, 0xFD)
67 RR++;
68 DANM(tc) -= 4;
69 NEXTTAB(fd);
72 OPDEF(special_xx, 0xDD 0xFD)
74 RR--;
75 PC--;
76 ENDOP();
79 OPDEF(special_dd_cb, 0xCB)
81 DANM(tc) -= 4;
82 IXDGET(IX, DANM(cbaddr));
83 #ifdef DEBUG_Z80
84 if((*PCP & 0x07) != 6)
85 printf("DD_CB unimplemented!\n");
86 #endif
87 NEXTTAB(cb);
90 OPDEF(special_fd_cb, 0xCB)
92 DANM(tc) -= 4;
93 IXDGET(IY, DANM(cbaddr));
94 #ifdef DEBUG_Z80
95 if((*PCP & 0x07) != 6)
96 printf("FD_CB unimplemented!\n");
97 #endif
98 NEXTTAB(cb);
101 op_f z80c_op_tab[] = {
102 z80op_nop,
103 z80op_ld_bc_nn,
104 z80op_ld_ibc_a,
105 z80op_inc_bc,
106 z80op_inc_b,
107 z80op_dec_b,
108 z80op_ld_b_n,
109 z80op_rlca,
110 z80op_ex_af_afb,
111 z80op_add_hl_bc,
112 z80op_ld_a_ibc,
113 z80op_dec_bc,
114 z80op_inc_c,
115 z80op_dec_c,
116 z80op_ld_c_n,
117 z80op_rrca,
119 z80op_djnz_e,
120 z80op_ld_de_nn,
121 z80op_ld_ide_a,
122 z80op_inc_de,
123 z80op_inc_d,
124 z80op_dec_d,
125 z80op_ld_d_n,
126 z80op_rla,
127 z80op_jr_e,
128 z80op_add_hl_de,
129 z80op_ld_a_ide,
130 z80op_dec_de,
131 z80op_inc_e,
132 z80op_dec_e,
133 z80op_ld_e_n,
134 z80op_rra,
136 z80op_jr_nz_e,
137 z80op_ld_hl_nn,
138 z80op_ld_inn_hl,
139 z80op_inc_hl,
140 z80op_inc_h,
141 z80op_dec_h,
142 z80op_ld_h_n,
143 z80op_daa,
144 z80op_jr_z_e,
145 z80op_add_hl_hl,
146 z80op_ld_hl_inn,
147 z80op_dec_hl,
148 z80op_inc_l,
149 z80op_dec_l,
150 z80op_ld_l_n,
151 z80op_cpl,
153 z80op_jr_nc_e,
154 z80op_ld_sp_nn,
155 z80op_ld_inn_a,
156 z80op_inc_sp,
157 z80op_inc_ihl,
158 z80op_dec_ihl,
159 z80op_ld_ihl_n,
160 z80op_scf,
161 z80op_jr_c_e,
162 z80op_add_hl_sp,
163 z80op_ld_a_inn,
164 z80op_dec_sp,
165 z80op_inc_a,
166 z80op_dec_a,
167 z80op_ld_a_n,
168 z80op_ccf,
170 z80op_nop,
171 z80op_ld_b_c,
172 z80op_ld_b_d,
173 z80op_ld_b_e,
174 z80op_ld_b_h,
175 z80op_ld_b_l,
176 z80op_ld_b_ihl,
177 z80op_ld_b_a,
178 z80op_ld_c_b,
179 z80op_nop,
180 z80op_ld_c_d,
181 z80op_ld_c_e,
182 z80op_ld_c_h,
183 z80op_ld_c_l,
184 z80op_ld_c_ihl,
185 z80op_ld_c_a,
187 z80op_ld_d_b,
188 z80op_ld_d_c,
189 z80op_nop,
190 z80op_ld_d_e,
191 z80op_ld_d_h,
192 z80op_ld_d_l,
193 z80op_ld_d_ihl,
194 z80op_ld_d_a,
195 z80op_ld_e_b,
196 z80op_ld_e_c,
197 z80op_ld_e_d,
198 z80op_nop,
199 z80op_ld_e_h,
200 z80op_ld_e_l,
201 z80op_ld_e_ihl,
202 z80op_ld_e_a,
204 z80op_ld_h_b,
205 z80op_ld_h_c,
206 z80op_ld_h_d,
207 z80op_ld_h_e,
208 z80op_nop,
209 z80op_ld_h_l,
210 z80op_ld_h_ihl,
211 z80op_ld_h_a,
212 z80op_ld_l_b,
213 z80op_ld_l_c,
214 z80op_ld_l_d,
215 z80op_ld_l_e,
216 z80op_ld_l_h,
217 z80op_nop,
218 z80op_ld_l_ihl,
219 z80op_ld_l_a,
221 z80op_ld_ihl_b,
222 z80op_ld_ihl_c,
223 z80op_ld_ihl_d,
224 z80op_ld_ihl_e,
225 z80op_ld_ihl_h,
226 z80op_ld_ihl_l,
227 z80op_halt,
228 z80op_ld_ihl_a,
229 z80op_ld_a_b,
230 z80op_ld_a_c,
231 z80op_ld_a_d,
232 z80op_ld_a_e,
233 z80op_ld_a_h,
234 z80op_ld_a_l,
235 z80op_ld_a_ihl,
236 z80op_nop,
238 z80op_add_a_b,
239 z80op_add_a_c,
240 z80op_add_a_d,
241 z80op_add_a_e,
242 z80op_add_a_h,
243 z80op_add_a_l,
244 z80op_add_a_ihl,
245 z80op_add_a_a,
246 z80op_adc_a_b,
247 z80op_adc_a_c,
248 z80op_adc_a_d,
249 z80op_adc_a_e,
250 z80op_adc_a_h,
251 z80op_adc_a_l,
252 z80op_adc_a_ihl,
253 z80op_adc_a_a,
255 z80op_sub_b,
256 z80op_sub_c,
257 z80op_sub_d,
258 z80op_sub_e,
259 z80op_sub_h,
260 z80op_sub_l,
261 z80op_sub_ihl,
262 z80op_sub_a,
263 z80op_sbc_a_b,
264 z80op_sbc_a_c,
265 z80op_sbc_a_d,
266 z80op_sbc_a_e,
267 z80op_sbc_a_h,
268 z80op_sbc_a_l,
269 z80op_sbc_a_ihl,
270 z80op_sbc_a_a,
272 z80op_and_b,
273 z80op_and_c,
274 z80op_and_d,
275 z80op_and_e,
276 z80op_and_h,
277 z80op_and_l,
278 z80op_and_ihl,
279 z80op_and_a,
280 z80op_xor_b,
281 z80op_xor_c,
282 z80op_xor_d,
283 z80op_xor_e,
284 z80op_xor_h,
285 z80op_xor_l,
286 z80op_xor_ihl,
287 z80op_xor_a,
289 z80op_or_b,
290 z80op_or_c,
291 z80op_or_d,
292 z80op_or_e,
293 z80op_or_h,
294 z80op_or_l,
295 z80op_or_ihl,
296 z80op_or_a,
297 z80op_cp_b,
298 z80op_cp_c,
299 z80op_cp_d,
300 z80op_cp_e,
301 z80op_cp_h,
302 z80op_cp_l,
303 z80op_cp_ihl,
304 z80op_cp_a,
306 z80op_ret_nz,
307 z80op_pop_bc,
308 z80op_jp_nz_nn,
309 z80op_jp_nn,
310 z80op_call_nz_nn,
311 z80op_push_bc,
312 z80op_add_a_n,
313 z80op_rst_00,
314 z80op_ret_z,
315 z80op_ret,
316 z80op_jp_z_nn,
317 z80op_special_cb,
318 z80op_call_z_nn,
319 z80op_call_nn,
320 z80op_adc_a_n,
321 z80op_rst_08,
323 z80op_ret_nc,
324 z80op_pop_de,
325 z80op_jp_nc_nn,
326 z80op_out_in_a,
327 z80op_call_nc_nn,
328 z80op_push_de,
329 z80op_sub_n,
330 z80op_rst_10,
331 z80op_ret_c,
332 z80op_exx,
333 z80op_jp_c_nn,
334 z80op_in_a_in,
335 z80op_call_c_nn,
336 z80op_special_dd,
337 z80op_sbc_a_n,
338 z80op_rst_18,
340 z80op_ret_po,
341 z80op_pop_hl,
342 z80op_jp_po_nn,
343 z80op_ex_isp_hl,
344 z80op_call_po_nn,
345 z80op_push_hl,
346 z80op_and_n,
347 z80op_rst_20,
348 z80op_ret_pe,
349 z80op_jp_hl,
350 z80op_jp_pe_nn,
351 z80op_ex_de_hl,
352 z80op_call_pe_nn,
353 z80op_special_ed,
354 z80op_xor_n,
355 z80op_rst_28,
357 z80op_ret_p,
358 z80op_pop_af,
359 z80op_jp_p_nn,
360 z80op_di,
361 z80op_call_p_nn,
362 z80op_push_af,
363 z80op_or_n,
364 z80op_rst_30,
365 z80op_ret_m,
366 z80op_ld_sp_hl,
367 z80op_jp_m_nn,
368 z80op_ei,
369 z80op_call_m_nn,
370 z80op_special_fd,
371 z80op_cp_n,
372 z80op_rst_38
376 op_f z80c_op_tab_ed[] = {
377 z80op_ill_ed,
378 z80op_ill_ed,
379 z80op_ill_ed,
380 z80op_ill_ed,
381 z80op_ill_ed,
382 z80op_ill_ed,
383 z80op_ill_ed,
384 z80op_ill_ed,
385 z80op_ill_ed,
386 z80op_ill_ed,
387 z80op_ill_ed,
388 z80op_ill_ed,
389 z80op_ill_ed,
390 z80op_ill_ed,
391 z80op_ill_ed,
392 z80op_ill_ed,
394 z80op_ill_ed,
395 z80op_ill_ed,
396 z80op_ill_ed,
397 z80op_ill_ed,
398 z80op_ill_ed,
399 z80op_ill_ed,
400 z80op_ill_ed,
401 z80op_ill_ed,
402 z80op_ill_ed,
403 z80op_ill_ed,
404 z80op_ill_ed,
405 z80op_ill_ed,
406 z80op_ill_ed,
407 z80op_ill_ed,
408 z80op_ill_ed,
409 z80op_ill_ed,
411 z80op_ill_ed,
412 z80op_ill_ed,
413 z80op_ill_ed,
414 z80op_ill_ed,
415 z80op_ill_ed,
416 z80op_ill_ed,
417 z80op_ill_ed,
418 z80op_ill_ed,
419 z80op_ill_ed,
420 z80op_ill_ed,
421 z80op_ill_ed,
422 z80op_ill_ed,
423 z80op_ill_ed,
424 z80op_ill_ed,
425 z80op_ill_ed,
426 z80op_ill_ed,
428 z80op_ill_ed,
429 z80op_ill_ed,
430 z80op_ill_ed,
431 z80op_ill_ed,
432 z80op_ill_ed,
433 z80op_ill_ed,
434 z80op_ill_ed,
435 z80op_ill_ed,
436 z80op_ill_ed,
437 z80op_ill_ed,
438 z80op_ill_ed,
439 z80op_ill_ed,
440 z80op_ill_ed,
441 z80op_ill_ed,
442 z80op_ill_ed,
443 z80op_ill_ed,
445 z80op_in_b_ic,
446 z80op_out_ic_b,
447 z80op_sbc_hl_bc,
448 z80op_ld_inn_bc,
449 z80op_neg,
450 z80op_retn,
451 z80op_im_0,
452 z80op_ld_i_a,
453 z80op_in_c_ic,
454 z80op_out_ic_c,
455 z80op_adc_hl_bc,
456 z80op_ld_bc_inn,
457 z80op_neg,
458 z80op_reti,
459 z80op_im_0,
460 z80op_ld_r_a,
462 z80op_in_d_ic,
463 z80op_out_ic_d,
464 z80op_sbc_hl_de,
465 z80op_ld_inn_de,
466 z80op_neg,
467 z80op_retn,
468 z80op_im_1,
469 z80op_ld_a_i,
470 z80op_in_e_ic,
471 z80op_out_ic_e,
472 z80op_adc_hl_de,
473 z80op_ld_de_inn,
474 z80op_neg,
475 z80op_retn,
476 z80op_im_2,
477 z80op_ld_a_r,
479 z80op_in_h_ic,
480 z80op_out_ic_h,
481 z80op_sbc_hl_hl,
482 z80op_ld_inn_hl_ed,
483 z80op_neg,
484 z80op_retn,
485 z80op_im_0,
486 z80op_rrd,
487 z80op_in_l_ic,
488 z80op_out_ic_l,
489 z80op_adc_hl_hl,
490 z80op_ld_hl_inn_ed,
491 z80op_neg,
492 z80op_retn,
493 z80op_im_0,
494 z80op_rld,
496 z80op_in_f_ic,
497 z80op_out_ic_0,
498 z80op_sbc_hl_sp,
499 z80op_ld_inn_sp,
500 z80op_neg,
501 z80op_retn,
502 z80op_im_1,
503 z80op_ill_ed,
504 z80op_in_a_ic,
505 z80op_out_ic_a,
506 z80op_adc_hl_sp,
507 z80op_ld_sp_inn,
508 z80op_neg,
509 z80op_retn,
510 z80op_im_2,
511 z80op_ill_ed,
513 z80op_ill_ed,
514 z80op_ill_ed,
515 z80op_ill_ed,
516 z80op_ill_ed,
517 z80op_ill_ed,
518 z80op_ill_ed,
519 z80op_ill_ed,
520 z80op_ill_ed,
521 z80op_ill_ed,
522 z80op_ill_ed,
523 z80op_ill_ed,
524 z80op_ill_ed,
525 z80op_ill_ed,
526 z80op_ill_ed,
527 z80op_ill_ed,
528 z80op_ill_ed,
530 z80op_ill_ed,
531 z80op_ill_ed,
532 z80op_ill_ed,
533 z80op_ill_ed,
534 z80op_ill_ed,
535 z80op_ill_ed,
536 z80op_ill_ed,
537 z80op_ill_ed,
538 z80op_ill_ed,
539 z80op_ill_ed,
540 z80op_ill_ed,
541 z80op_ill_ed,
542 z80op_ill_ed,
543 z80op_ill_ed,
544 z80op_ill_ed,
545 z80op_ill_ed,
547 z80op_ldi,
548 z80op_cpi,
549 z80op_ini,
550 z80op_outi,
551 z80op_ill_ed,
552 z80op_ill_ed,
553 z80op_ill_ed,
554 z80op_ill_ed,
555 z80op_ldd,
556 z80op_cpd,
557 z80op_ind,
558 z80op_outd,
559 z80op_ill_ed,
560 z80op_ill_ed,
561 z80op_ill_ed,
562 z80op_ill_ed,
564 z80op_ldir,
565 z80op_cpir,
566 z80op_inir,
567 z80op_otir,
568 z80op_ill_ed,
569 z80op_ill_ed,
570 z80op_ill_ed,
571 z80op_ill_ed,
572 z80op_lddr,
573 z80op_cpdr,
574 z80op_indr,
575 z80op_otdr,
576 z80op_ill_ed,
577 z80op_ill_ed,
578 z80op_ill_ed,
579 z80op_ill_ed,
581 z80op_ill_ed,
582 z80op_ill_ed,
583 z80op_ill_ed,
584 z80op_ill_ed,
585 z80op_ill_ed,
586 z80op_ill_ed,
587 z80op_ill_ed,
588 z80op_ill_ed,
589 z80op_ill_ed,
590 z80op_ill_ed,
591 z80op_ill_ed,
592 z80op_ill_ed,
593 z80op_ill_ed,
594 z80op_ill_ed,
595 z80op_ill_ed,
596 z80op_ill_ed,
598 z80op_ill_ed,
599 z80op_ill_ed,
600 z80op_ill_ed,
601 z80op_ill_ed,
602 z80op_ill_ed,
603 z80op_ill_ed,
604 z80op_ill_ed,
605 z80op_ill_ed,
606 z80op_ill_ed,
607 z80op_ill_ed,
608 z80op_ill_ed,
609 z80op_ill_ed,
610 z80op_ill_ed,
611 z80op_ill_ed,
612 z80op_ill_ed,
613 z80op_ill_ed,
615 z80op_ill_ed,
616 z80op_ill_ed,
617 z80op_ill_ed,
618 z80op_ill_ed,
619 z80op_ill_ed,
620 z80op_ill_ed,
621 z80op_ill_ed,
622 z80op_ill_ed,
623 z80op_ill_ed,
624 z80op_ill_ed,
625 z80op_ill_ed,
626 z80op_ill_ed,
627 z80op_ill_ed,
628 z80op_ill_ed,
629 z80op_ill_ed,
630 z80op_ill_ed,
632 z80op_ill_ed,
633 z80op_ill_ed,
634 z80op_ill_ed,
635 z80op_ill_ed,
636 z80op_ill_ed,
637 z80op_ill_ed,
638 z80op_ill_ed,
639 z80op_ill_ed,
640 z80op_ill_ed,
641 z80op_ill_ed,
642 z80op_ill_ed,
643 z80op_ill_ed,
644 z80op_ill_ed,
645 z80op_ill_ed,
646 z80op_ill_ed,
647 z80op_ill_ed
650 op_f z80c_op_tab_dd[] = {
651 z80op_nop,
652 z80op_ld_bc_nn,
653 z80op_ld_ibc_a,
654 z80op_inc_bc,
655 z80op_inc_b,
656 z80op_dec_b,
657 z80op_ld_b_n,
658 z80op_rlca,
659 z80op_ex_af_afb,
660 z80op_add_ix_bc,
661 z80op_ld_a_ibc,
662 z80op_dec_bc,
663 z80op_inc_c,
664 z80op_dec_c,
665 z80op_ld_c_n,
666 z80op_rrca,
668 z80op_djnz_e,
669 z80op_ld_de_nn,
670 z80op_ld_ide_a,
671 z80op_inc_de,
672 z80op_inc_d,
673 z80op_dec_d,
674 z80op_ld_d_n,
675 z80op_rla,
676 z80op_jr_e,
677 z80op_add_ix_de,
678 z80op_ld_a_ide,
679 z80op_dec_de,
680 z80op_inc_e,
681 z80op_dec_e,
682 z80op_ld_e_n,
683 z80op_rra,
685 z80op_jr_nz_e,
686 z80op_ld_ix_nn,
687 z80op_ld_inn_ix,
688 z80op_inc_ix,
689 z80op_inc_ixh,
690 z80op_dec_ixh,
691 z80op_ld_ixh_n,
692 z80op_daa,
693 z80op_jr_z_e,
694 z80op_add_ix_ix,
695 z80op_ld_ix_inn,
696 z80op_dec_ix,
697 z80op_inc_ixl,
698 z80op_dec_ixl,
699 z80op_ld_ixl_n,
700 z80op_cpl,
702 z80op_jr_nc_e,
703 z80op_ld_sp_nn,
704 z80op_ld_inn_a,
705 z80op_inc_sp,
706 z80op_inc_iixd,
707 z80op_dec_iixd,
708 z80op_ld_iixd_n,
709 z80op_scf,
710 z80op_jr_c_e,
711 z80op_add_ix_sp,
712 z80op_ld_a_inn,
713 z80op_dec_sp,
714 z80op_inc_a,
715 z80op_dec_a,
716 z80op_ld_a_n,
717 z80op_ccf,
719 z80op_nop,
720 z80op_ld_b_c,
721 z80op_ld_b_d,
722 z80op_ld_b_e,
723 z80op_ld_b_ixh,
724 z80op_ld_b_ixl,
725 z80op_ld_b_iixd,
726 z80op_ld_b_a,
727 z80op_ld_c_b,
728 z80op_nop,
729 z80op_ld_c_d,
730 z80op_ld_c_e,
731 z80op_ld_c_ixh,
732 z80op_ld_c_ixl,
733 z80op_ld_c_iixd,
734 z80op_ld_c_a,
736 z80op_ld_d_b,
737 z80op_ld_d_c,
738 z80op_nop,
739 z80op_ld_d_e,
740 z80op_ld_d_ixh,
741 z80op_ld_d_ixl,
742 z80op_ld_d_iixd,
743 z80op_ld_d_a,
744 z80op_ld_e_b,
745 z80op_ld_e_c,
746 z80op_ld_e_d,
747 z80op_nop,
748 z80op_ld_e_ixh,
749 z80op_ld_e_ixl,
750 z80op_ld_e_iixd,
751 z80op_ld_e_a,
753 z80op_ld_ixh_b,
754 z80op_ld_ixh_c,
755 z80op_ld_ixh_d,
756 z80op_ld_ixh_e,
757 z80op_nop,
758 z80op_ld_ixh_ixl,
759 z80op_ld_h_iixd,
760 z80op_ld_ixh_a,
761 z80op_ld_ixl_b,
762 z80op_ld_ixl_c,
763 z80op_ld_ixl_d,
764 z80op_ld_ixl_e,
765 z80op_ld_ixl_ixh,
766 z80op_nop,
767 z80op_ld_l_iixd,
768 z80op_ld_ixl_a,
770 z80op_ld_iixd_b,
771 z80op_ld_iixd_c,
772 z80op_ld_iixd_d,
773 z80op_ld_iixd_e,
774 z80op_ld_iixd_h,
775 z80op_ld_iixd_l,
776 z80op_halt,
777 z80op_ld_iixd_a,
778 z80op_ld_a_b,
779 z80op_ld_a_c,
780 z80op_ld_a_d,
781 z80op_ld_a_e,
782 z80op_ld_a_ixh,
783 z80op_ld_a_ixl,
784 z80op_ld_a_iixd,
785 z80op_nop,
787 z80op_add_a_b,
788 z80op_add_a_c,
789 z80op_add_a_d,
790 z80op_add_a_e,
791 z80op_add_a_ixh,
792 z80op_add_a_ixl,
793 z80op_add_a_iixd,
794 z80op_add_a_a,
795 z80op_adc_a_b,
796 z80op_adc_a_c,
797 z80op_adc_a_d,
798 z80op_adc_a_e,
799 z80op_adc_a_ixh,
800 z80op_adc_a_ixl,
801 z80op_adc_a_iixd,
802 z80op_adc_a_a,
804 z80op_sub_b,
805 z80op_sub_c,
806 z80op_sub_d,
807 z80op_sub_e,
808 z80op_sub_ixh,
809 z80op_sub_ixl,
810 z80op_sub_iixd,
811 z80op_sub_a,
812 z80op_sbc_a_b,
813 z80op_sbc_a_c,
814 z80op_sbc_a_d,
815 z80op_sbc_a_e,
816 z80op_sbc_a_ixh,
817 z80op_sbc_a_ixl,
818 z80op_sbc_a_iixd,
819 z80op_sbc_a_a,
821 z80op_and_b,
822 z80op_and_c,
823 z80op_and_d,
824 z80op_and_e,
825 z80op_and_ixh,
826 z80op_and_ixl,
827 z80op_and_iixd,
828 z80op_and_a,
829 z80op_xor_b,
830 z80op_xor_c,
831 z80op_xor_d,
832 z80op_xor_e,
833 z80op_xor_ixh,
834 z80op_xor_ixl,
835 z80op_xor_iixd,
836 z80op_xor_a,
838 z80op_or_b,
839 z80op_or_c,
840 z80op_or_d,
841 z80op_or_e,
842 z80op_or_ixh,
843 z80op_or_ixl,
844 z80op_or_iixd,
845 z80op_or_a,
846 z80op_cp_b,
847 z80op_cp_c,
848 z80op_cp_d,
849 z80op_cp_e,
850 z80op_cp_ixh,
851 z80op_cp_ixl,
852 z80op_cp_iixd,
853 z80op_cp_a,
855 z80op_ret_nz,
856 z80op_pop_bc,
857 z80op_jp_nz_nn,
858 z80op_jp_nn,
859 z80op_call_nz_nn,
860 z80op_push_bc,
861 z80op_add_a_n,
862 z80op_rst_00,
863 z80op_ret_z,
864 z80op_ret,
865 z80op_jp_z_nn,
866 z80op_special_dd_cb,
867 z80op_call_z_nn,
868 z80op_call_nn,
869 z80op_adc_a_n,
870 z80op_rst_08,
872 z80op_ret_nc,
873 z80op_pop_de,
874 z80op_jp_nc_nn,
875 z80op_out_in_a,
876 z80op_call_nc_nn,
877 z80op_push_de,
878 z80op_sub_n,
879 z80op_rst_10,
880 z80op_ret_c,
881 z80op_exx,
882 z80op_jp_c_nn,
883 z80op_in_a_in,
884 z80op_call_c_nn,
885 z80op_special_xx,
886 z80op_sbc_a_n,
887 z80op_rst_18,
889 z80op_ret_po,
890 z80op_pop_ix,
891 z80op_jp_po_nn,
892 z80op_ex_isp_ix,
893 z80op_call_po_nn,
894 z80op_push_ix,
895 z80op_and_n,
896 z80op_rst_20,
897 z80op_ret_pe,
898 z80op_jp_ix,
899 z80op_jp_pe_nn,
900 z80op_ex_de_hl,
901 z80op_call_pe_nn,
902 z80op_special_ed,
903 z80op_xor_n,
904 z80op_rst_28,
906 z80op_ret_p,
907 z80op_pop_af,
908 z80op_jp_p_nn,
909 z80op_di,
910 z80op_call_p_nn,
911 z80op_push_af,
912 z80op_or_n,
913 z80op_rst_30,
914 z80op_ret_m,
915 z80op_ld_sp_ix,
916 z80op_jp_m_nn,
917 z80op_ei,
918 z80op_call_m_nn,
919 z80op_special_xx,
920 z80op_cp_n,
921 z80op_rst_38
925 op_f z80c_op_tab_fd[] = {
926 z80op_nop,
927 z80op_ld_bc_nn,
928 z80op_ld_ibc_a,
929 z80op_inc_bc,
930 z80op_inc_b,
931 z80op_dec_b,
932 z80op_ld_b_n,
933 z80op_rlca,
934 z80op_ex_af_afb,
935 z80op_add_iy_bc,
936 z80op_ld_a_ibc,
937 z80op_dec_bc,
938 z80op_inc_c,
939 z80op_dec_c,
940 z80op_ld_c_n,
941 z80op_rrca,
943 z80op_djnz_e,
944 z80op_ld_de_nn,
945 z80op_ld_ide_a,
946 z80op_inc_de,
947 z80op_inc_d,
948 z80op_dec_d,
949 z80op_ld_d_n,
950 z80op_rla,
951 z80op_jr_e,
952 z80op_add_iy_de,
953 z80op_ld_a_ide,
954 z80op_dec_de,
955 z80op_inc_e,
956 z80op_dec_e,
957 z80op_ld_e_n,
958 z80op_rra,
960 z80op_jr_nz_e,
961 z80op_ld_iy_nn,
962 z80op_ld_inn_iy,
963 z80op_inc_iy,
964 z80op_inc_iyh,
965 z80op_dec_iyh,
966 z80op_ld_iyh_n,
967 z80op_daa,
968 z80op_jr_z_e,
969 z80op_add_iy_iy,
970 z80op_ld_iy_inn,
971 z80op_dec_iy,
972 z80op_inc_iyl,
973 z80op_dec_iyl,
974 z80op_ld_iyl_n,
975 z80op_cpl,
977 z80op_jr_nc_e,
978 z80op_ld_sp_nn,
979 z80op_ld_inn_a,
980 z80op_inc_sp,
981 z80op_inc_iiyd,
982 z80op_dec_iiyd,
983 z80op_ld_iiyd_n,
984 z80op_scf,
985 z80op_jr_c_e,
986 z80op_add_iy_sp,
987 z80op_ld_a_inn,
988 z80op_dec_sp,
989 z80op_inc_a,
990 z80op_dec_a,
991 z80op_ld_a_n,
992 z80op_ccf,
994 z80op_nop,
995 z80op_ld_b_c,
996 z80op_ld_b_d,
997 z80op_ld_b_e,
998 z80op_ld_b_iyh,
999 z80op_ld_b_iyl,
1000 z80op_ld_b_iiyd,
1001 z80op_ld_b_a,
1002 z80op_ld_c_b,
1003 z80op_nop,
1004 z80op_ld_c_d,
1005 z80op_ld_c_e,
1006 z80op_ld_c_iyh,
1007 z80op_ld_c_iyl,
1008 z80op_ld_c_iiyd,
1009 z80op_ld_c_a,
1011 z80op_ld_d_b,
1012 z80op_ld_d_c,
1013 z80op_nop,
1014 z80op_ld_d_e,
1015 z80op_ld_d_iyh,
1016 z80op_ld_d_iyl,
1017 z80op_ld_d_iiyd,
1018 z80op_ld_d_a,
1019 z80op_ld_e_b,
1020 z80op_ld_e_c,
1021 z80op_ld_e_d,
1022 z80op_nop,
1023 z80op_ld_e_iyh,
1024 z80op_ld_e_iyl,
1025 z80op_ld_e_iiyd,
1026 z80op_ld_e_a,
1028 z80op_ld_iyh_b,
1029 z80op_ld_iyh_c,
1030 z80op_ld_iyh_d,
1031 z80op_ld_iyh_e,
1032 z80op_nop,
1033 z80op_ld_iyh_iyl,
1034 z80op_ld_h_iiyd,
1035 z80op_ld_iyh_a,
1036 z80op_ld_iyl_b,
1037 z80op_ld_iyl_c,
1038 z80op_ld_iyl_d,
1039 z80op_ld_iyl_e,
1040 z80op_ld_iyl_iyh,
1041 z80op_nop,
1042 z80op_ld_l_iiyd,
1043 z80op_ld_iyl_a,
1045 z80op_ld_iiyd_b,
1046 z80op_ld_iiyd_c,
1047 z80op_ld_iiyd_d,
1048 z80op_ld_iiyd_e,
1049 z80op_ld_iiyd_h,
1050 z80op_ld_iiyd_l,
1051 z80op_halt,
1052 z80op_ld_iiyd_a,
1053 z80op_ld_a_b,
1054 z80op_ld_a_c,
1055 z80op_ld_a_d,
1056 z80op_ld_a_e,
1057 z80op_ld_a_iyh,
1058 z80op_ld_a_iyl,
1059 z80op_ld_a_iiyd,
1060 z80op_nop,
1062 z80op_add_a_b,
1063 z80op_add_a_c,
1064 z80op_add_a_d,
1065 z80op_add_a_e,
1066 z80op_add_a_iyh,
1067 z80op_add_a_iyl,
1068 z80op_add_a_iiyd,
1069 z80op_add_a_a,
1070 z80op_adc_a_b,
1071 z80op_adc_a_c,
1072 z80op_adc_a_d,
1073 z80op_adc_a_e,
1074 z80op_adc_a_iyh,
1075 z80op_adc_a_iyl,
1076 z80op_adc_a_iiyd,
1077 z80op_adc_a_a,
1079 z80op_sub_b,
1080 z80op_sub_c,
1081 z80op_sub_d,
1082 z80op_sub_e,
1083 z80op_sub_iyh,
1084 z80op_sub_iyl,
1085 z80op_sub_iiyd,
1086 z80op_sub_a,
1087 z80op_sbc_a_b,
1088 z80op_sbc_a_c,
1089 z80op_sbc_a_d,
1090 z80op_sbc_a_e,
1091 z80op_sbc_a_iyh,
1092 z80op_sbc_a_iyl,
1093 z80op_sbc_a_iiyd,
1094 z80op_sbc_a_a,
1096 z80op_and_b,
1097 z80op_and_c,
1098 z80op_and_d,
1099 z80op_and_e,
1100 z80op_and_iyh,
1101 z80op_and_iyl,
1102 z80op_and_iiyd,
1103 z80op_and_a,
1104 z80op_xor_b,
1105 z80op_xor_c,
1106 z80op_xor_d,
1107 z80op_xor_e,
1108 z80op_xor_iyh,
1109 z80op_xor_iyl,
1110 z80op_xor_iiyd,
1111 z80op_xor_a,
1113 z80op_or_b,
1114 z80op_or_c,
1115 z80op_or_d,
1116 z80op_or_e,
1117 z80op_or_iyh,
1118 z80op_or_iyl,
1119 z80op_or_iiyd,
1120 z80op_or_a,
1121 z80op_cp_b,
1122 z80op_cp_c,
1123 z80op_cp_d,
1124 z80op_cp_e,
1125 z80op_cp_iyh,
1126 z80op_cp_iyl,
1127 z80op_cp_iiyd,
1128 z80op_cp_a,
1130 z80op_ret_nz,
1131 z80op_pop_bc,
1132 z80op_jp_nz_nn,
1133 z80op_jp_nn,
1134 z80op_call_nz_nn,
1135 z80op_push_bc,
1136 z80op_add_a_n,
1137 z80op_rst_00,
1138 z80op_ret_z,
1139 z80op_ret,
1140 z80op_jp_z_nn,
1141 z80op_special_fd_cb,
1142 z80op_call_z_nn,
1143 z80op_call_nn,
1144 z80op_adc_a_n,
1145 z80op_rst_08,
1147 z80op_ret_nc,
1148 z80op_pop_de,
1149 z80op_jp_nc_nn,
1150 z80op_out_in_a,
1151 z80op_call_nc_nn,
1152 z80op_push_de,
1153 z80op_sub_n,
1154 z80op_rst_10,
1155 z80op_ret_c,
1156 z80op_exx,
1157 z80op_jp_c_nn,
1158 z80op_in_a_in,
1159 z80op_call_c_nn,
1160 z80op_special_xx,
1161 z80op_sbc_a_n,
1162 z80op_rst_18,
1164 z80op_ret_po,
1165 z80op_pop_iy,
1166 z80op_jp_po_nn,
1167 z80op_ex_isp_iy,
1168 z80op_call_po_nn,
1169 z80op_push_iy,
1170 z80op_and_n,
1171 z80op_rst_20,
1172 z80op_ret_pe,
1173 z80op_jp_iy,
1174 z80op_jp_pe_nn,
1175 z80op_ex_de_hl,
1176 z80op_call_pe_nn,
1177 z80op_special_ed,
1178 z80op_xor_n,
1179 z80op_rst_28,
1181 z80op_ret_p,
1182 z80op_pop_af,
1183 z80op_jp_p_nn,
1184 z80op_di,
1185 z80op_call_p_nn,
1186 z80op_push_af,
1187 z80op_or_n,
1188 z80op_rst_30,
1189 z80op_ret_m,
1190 z80op_ld_sp_iy,
1191 z80op_jp_m_nn,
1192 z80op_ei,
1193 z80op_call_m_nn,
1194 z80op_special_xx,
1195 z80op_cp_n,
1196 z80op_rst_38
1199 op_f z80c_op_tab_cb[] = {
1200 z80op_rlc_b,
1201 z80op_rlc_c,
1202 z80op_rlc_d,
1203 z80op_rlc_e,
1204 z80op_rlc_h,
1205 z80op_rlc_l,
1206 z80op_rlc_ihl,
1207 z80op_rlc_a,
1208 z80op_rrc_b,
1209 z80op_rrc_c,
1210 z80op_rrc_d,
1211 z80op_rrc_e,
1212 z80op_rrc_h,
1213 z80op_rrc_l,
1214 z80op_rrc_ihl,
1215 z80op_rrc_a,
1217 z80op_rl_b,
1218 z80op_rl_c,
1219 z80op_rl_d,
1220 z80op_rl_e,
1221 z80op_rl_h,
1222 z80op_rl_l,
1223 z80op_rl_ihl,
1224 z80op_rl_a,
1225 z80op_rr_b,
1226 z80op_rr_c,
1227 z80op_rr_d,
1228 z80op_rr_e,
1229 z80op_rr_h,
1230 z80op_rr_l,
1231 z80op_rr_ihl,
1232 z80op_rr_a,
1234 z80op_sla_b,
1235 z80op_sla_c,
1236 z80op_sla_d,
1237 z80op_sla_e,
1238 z80op_sla_h,
1239 z80op_sla_l,
1240 z80op_sla_ihl,
1241 z80op_sla_a,
1242 z80op_sra_b,
1243 z80op_sra_c,
1244 z80op_sra_d,
1245 z80op_sra_e,
1246 z80op_sra_h,
1247 z80op_sra_l,
1248 z80op_sra_ihl,
1249 z80op_sra_a,
1251 z80op_sll_b,
1252 z80op_sll_c,
1253 z80op_sll_d,
1254 z80op_sll_e,
1255 z80op_sll_h,
1256 z80op_sll_l,
1257 z80op_sll_ihl,
1258 z80op_sll_a,
1259 z80op_srl_b,
1260 z80op_srl_c,
1261 z80op_srl_d,
1262 z80op_srl_e,
1263 z80op_srl_h,
1264 z80op_srl_l,
1265 z80op_srl_ihl,
1266 z80op_srl_a,
1268 z80op_bit_0_b,
1269 z80op_bit_0_c,
1270 z80op_bit_0_d,
1271 z80op_bit_0_e,
1272 z80op_bit_0_h,
1273 z80op_bit_0_l,
1274 z80op_bit_0_ihl,
1275 z80op_bit_0_a,
1276 z80op_bit_1_b,
1277 z80op_bit_1_c,
1278 z80op_bit_1_d,
1279 z80op_bit_1_e,
1280 z80op_bit_1_h,
1281 z80op_bit_1_l,
1282 z80op_bit_1_ihl,
1283 z80op_bit_1_a,
1285 z80op_bit_2_b,
1286 z80op_bit_2_c,
1287 z80op_bit_2_d,
1288 z80op_bit_2_e,
1289 z80op_bit_2_h,
1290 z80op_bit_2_l,
1291 z80op_bit_2_ihl,
1292 z80op_bit_2_a,
1293 z80op_bit_3_b,
1294 z80op_bit_3_c,
1295 z80op_bit_3_d,
1296 z80op_bit_3_e,
1297 z80op_bit_3_h,
1298 z80op_bit_3_l,
1299 z80op_bit_3_ihl,
1300 z80op_bit_3_a,
1302 z80op_bit_4_b,
1303 z80op_bit_4_c,
1304 z80op_bit_4_d,
1305 z80op_bit_4_e,
1306 z80op_bit_4_h,
1307 z80op_bit_4_l,
1308 z80op_bit_4_ihl,
1309 z80op_bit_4_a,
1310 z80op_bit_5_b,
1311 z80op_bit_5_c,
1312 z80op_bit_5_d,
1313 z80op_bit_5_e,
1314 z80op_bit_5_h,
1315 z80op_bit_5_l,
1316 z80op_bit_5_ihl,
1317 z80op_bit_5_a,
1319 z80op_bit_6_b,
1320 z80op_bit_6_c,
1321 z80op_bit_6_d,
1322 z80op_bit_6_e,
1323 z80op_bit_6_h,
1324 z80op_bit_6_l,
1325 z80op_bit_6_ihl,
1326 z80op_bit_6_a,
1327 z80op_bit_7_b,
1328 z80op_bit_7_c,
1329 z80op_bit_7_d,
1330 z80op_bit_7_e,
1331 z80op_bit_7_h,
1332 z80op_bit_7_l,
1333 z80op_bit_7_ihl,
1334 z80op_bit_7_a,
1336 z80op_res_0_b,
1337 z80op_res_0_c,
1338 z80op_res_0_d,
1339 z80op_res_0_e,
1340 z80op_res_0_h,
1341 z80op_res_0_l,
1342 z80op_res_0_ihl,
1343 z80op_res_0_a,
1344 z80op_res_1_b,
1345 z80op_res_1_c,
1346 z80op_res_1_d,
1347 z80op_res_1_e,
1348 z80op_res_1_h,
1349 z80op_res_1_l,
1350 z80op_res_1_ihl,
1351 z80op_res_1_a,
1353 z80op_res_2_b,
1354 z80op_res_2_c,
1355 z80op_res_2_d,
1356 z80op_res_2_e,
1357 z80op_res_2_h,
1358 z80op_res_2_l,
1359 z80op_res_2_ihl,
1360 z80op_res_2_a,
1361 z80op_res_3_b,
1362 z80op_res_3_c,
1363 z80op_res_3_d,
1364 z80op_res_3_e,
1365 z80op_res_3_h,
1366 z80op_res_3_l,
1367 z80op_res_3_ihl,
1368 z80op_res_3_a,
1370 z80op_res_4_b,
1371 z80op_res_4_c,
1372 z80op_res_4_d,
1373 z80op_res_4_e,
1374 z80op_res_4_h,
1375 z80op_res_4_l,
1376 z80op_res_4_ihl,
1377 z80op_res_4_a,
1378 z80op_res_5_b,
1379 z80op_res_5_c,
1380 z80op_res_5_d,
1381 z80op_res_5_e,
1382 z80op_res_5_h,
1383 z80op_res_5_l,
1384 z80op_res_5_ihl,
1385 z80op_res_5_a,
1387 z80op_res_6_b,
1388 z80op_res_6_c,
1389 z80op_res_6_d,
1390 z80op_res_6_e,
1391 z80op_res_6_h,
1392 z80op_res_6_l,
1393 z80op_res_6_ihl,
1394 z80op_res_6_a,
1395 z80op_res_7_b,
1396 z80op_res_7_c,
1397 z80op_res_7_d,
1398 z80op_res_7_e,
1399 z80op_res_7_h,
1400 z80op_res_7_l,
1401 z80op_res_7_ihl,
1402 z80op_res_7_a,
1404 z80op_set_0_b,
1405 z80op_set_0_c,
1406 z80op_set_0_d,
1407 z80op_set_0_e,
1408 z80op_set_0_h,
1409 z80op_set_0_l,
1410 z80op_set_0_ihl,
1411 z80op_set_0_a,
1412 z80op_set_1_b,
1413 z80op_set_1_c,
1414 z80op_set_1_d,
1415 z80op_set_1_e,
1416 z80op_set_1_h,
1417 z80op_set_1_l,
1418 z80op_set_1_ihl,
1419 z80op_set_1_a,
1421 z80op_set_2_b,
1422 z80op_set_2_c,
1423 z80op_set_2_d,
1424 z80op_set_2_e,
1425 z80op_set_2_h,
1426 z80op_set_2_l,
1427 z80op_set_2_ihl,
1428 z80op_set_2_a,
1429 z80op_set_3_b,
1430 z80op_set_3_c,
1431 z80op_set_3_d,
1432 z80op_set_3_e,
1433 z80op_set_3_h,
1434 z80op_set_3_l,
1435 z80op_set_3_ihl,
1436 z80op_set_3_a,
1438 z80op_set_4_b,
1439 z80op_set_4_c,
1440 z80op_set_4_d,
1441 z80op_set_4_e,
1442 z80op_set_4_h,
1443 z80op_set_4_l,
1444 z80op_set_4_ihl,
1445 z80op_set_4_a,
1446 z80op_set_5_b,
1447 z80op_set_5_c,
1448 z80op_set_5_d,
1449 z80op_set_5_e,
1450 z80op_set_5_h,
1451 z80op_set_5_l,
1452 z80op_set_5_ihl,
1453 z80op_set_5_a,
1455 z80op_set_6_b,
1456 z80op_set_6_c,
1457 z80op_set_6_d,
1458 z80op_set_6_e,
1459 z80op_set_6_h,
1460 z80op_set_6_l,
1461 z80op_set_6_ihl,
1462 z80op_set_6_a,
1463 z80op_set_7_b,
1464 z80op_set_7_c,
1465 z80op_set_7_d,
1466 z80op_set_7_e,
1467 z80op_set_7_h,
1468 z80op_set_7_l,
1469 z80op_set_7_ihl,
1470 z80op_set_7_a