1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
|
/*
* Simulator of microcontrollers (ez80.cc)
*
* Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
*
* To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
*
*/
/* This file is part of microcontroller simulator: ucsim.
UCSIM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
UCSIM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with UCSIM; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/*@1@*/
#include <stdint.h>
#include "z80mac.h"
#include "ez80cl.h"
struct dis_entry disass_ez80_ed[]=
{
// ED
{ 0x000f, 0x00ff, ' ', 1, "LD (HL),BC" },
{ 0x001f, 0x00ff, ' ', 1, "LD (HL),DE" },
{ 0x002f, 0x00ff, ' ', 1, "LD (HL),HL" },
{ 0x0037, 0x00ff, ' ', 1, "LD IX,(HL)" },
{ 0x0031, 0x00ff, ' ', 1, "LD IY,(HL)" },
{ 0x0007, 0x00ff, ' ', 1, "LD BC,(HL)" },
{ 0x0017, 0x00ff, ' ', 1, "LD DE,(HL)" },
{ 0x0027, 0x00ff, ' ', 1, "LD HL,(HL)" },
// ED
{ 0x0032, 0x00ff, ' ', 2, "LEA IX,IX+%d" },
{ 0x0055, 0x00ff, ' ', 2, "LEA IY,IX+%d" },
{ 0x0054, 0x00ff, ' ', 2, "LEA IX,IY+%d" },
{ 0x0033, 0x00ff, ' ', 2, "LEA IY,IY+%d" },
{ 0x0002, 0x00ff, ' ', 2, "LEA BC,IX+%d" },
{ 0x0012, 0x00ff, ' ', 2, "LEA DE,IX+%d" },
{ 0x0022, 0x00ff, ' ', 2, "LEA HL,IX+%d" },
{ 0x0003, 0x00ff, ' ', 2, "LEA BC,IY+%d" },
{ 0x0013, 0x00ff, ' ', 2, "LEA DE,IY+%d" },
{ 0x0023, 0x00ff, ' ', 2, "LEA HL,IY+%d" },
// ED
{ 0x0065, 0x00ff, ' ', 2, "PEA IX+%d" },
{ 0x0066, 0x00ff, ' ', 2, "PEA IY+%d" },
{ 0, 0, 0, 0, NULL }
};
struct dis_entry disass_ez80_dd[]=
{
// DD
{ 0x003f, 0x00ff, ' ', 2, "LD (IX+%d),IX" },
{ 0x003E, 0x00ff, ' ', 2, "LD (IX+%d),IY" },
{ 0x0037, 0x00ff, ' ', 2, "LD IX,(IX+%d)" },
{ 0x0031, 0x00ff, ' ', 2, "LD IY,(IX+%d)" },
{ 0x000f, 0x00ff, ' ', 2, "LD (IX+%d),BC" },
{ 0x001f, 0x00ff, ' ', 2, "LD (IX+%d),DE" },
{ 0x002f, 0x00ff, ' ', 2, "LD (IX+%d),HL" },
{ 0x0007, 0x00ff, ' ', 2, "LD BC,(IX+%d)" },
{ 0x0017, 0x00ff, ' ', 2, "LD DE,(IX+%d)" },
{ 0x0027, 0x00ff, ' ', 2, "LD HL,(IX+%d)" },
// DD
{ 0x0064, 0x00ff, ' ', 1, "LD IXH,IXH" },
{ 0x0065, 0x00ff, ' ', 1, "LD IXH,IXL" },
{ 0x006c, 0x00ff, ' ', 1, "LD IXL,IXH" },
{ 0x006d, 0x00ff, ' ', 1, "LD IXL,IXL" },
{ 0x0026, 0x00ff, ' ', 2, "LD IXH,%d" },
{ 0x002e, 0x00ff, ' ', 2, "LD IXL,%d" },
// DD
{ 0x0067, 0x00ff, ' ', 1, "LD IXH,A" },
{ 0x0060, 0x00ff, ' ', 1, "LD IXH,B" },
{ 0x0061, 0x00ff, ' ', 1, "LD IXH,C" },
{ 0x0062, 0x00ff, ' ', 1, "LD IXH,D" },
{ 0x0063, 0x00ff, ' ', 1, "LD IXH,E" },
{ 0x006f, 0x00ff, ' ', 1, "LD IXL,A" },
{ 0x0068, 0x00ff, ' ', 1, "LD IXL,B" },
{ 0x0069, 0x00ff, ' ', 1, "LD IXL,C" },
{ 0x006a, 0x00ff, ' ', 1, "LD IXL,D" },
{ 0x006b, 0x00ff, ' ', 1, "LD IXL,E" },
{ 0x007c, 0x00ff, ' ', 1, "LD A,IXH" },
{ 0x007d, 0x00ff, ' ', 1, "LD A,IXL" },
{ 0x0044, 0x00ff, ' ', 1, "LD B,IXH" },
{ 0x0045, 0x00ff, ' ', 1, "LD B,IXL" },
{ 0x004c, 0x00ff, ' ', 1, "LD C,IXH" },
{ 0x004d, 0x00ff, ' ', 1, "LD C,IXL" },
{ 0x0054, 0x00ff, ' ', 1, "LD D,IXH" },
{ 0x0055, 0x00ff, ' ', 1, "LD D,IXL" },
{ 0x005c, 0x00ff, ' ', 1, "LD E,IXH" },
{ 0x005d, 0x00ff, ' ', 1, "LD E,IXL" },
// DD
{ 0x0084, 0x00ff, ' ', 1, "ADD A,IXH" },
{ 0x0085, 0x00ff, ' ', 1, "ADD A,IXL" },
{ 0x008c, 0x00ff, ' ', 1, "ADC A,IXH" },
{ 0x008d, 0x00ff, ' ', 1, "ADC A,IXL" },
// DD
{ 0x0094, 0x00ff, ' ', 1, "SUB A,IXH" },
{ 0x0095, 0x00ff, ' ', 1, "SUB A,IXL" },
{ 0x009c, 0x00ff, ' ', 1, "SBC A,IXH" },
{ 0x009d, 0x00ff, ' ', 1, "SBC A,IXL" },
{ 0x00bc, 0x00ff, ' ', 1, "CP A,IXH" },
{ 0x00bd, 0x00ff, ' ', 1, "CP A,IXL" },
// DD
{ 0x0025, 0x00ff, ' ', 1, "DEC IXH" },
{ 0x002d, 0x00ff, ' ', 1, "DEC IXL" },
{ 0x0024, 0x00ff, ' ', 1, "INC IXH" },
{ 0x002c, 0x00ff, ' ', 1, "INC IXL" },
// DD
{ 0x00a4, 0x00ff, ' ', 1, "AND A,IXH" },
{ 0x00a5, 0x00ff, ' ', 1, "AND A,IXL" },
{ 0x00b4, 0x00ff, ' ', 1, "OR A,IXH" },
{ 0x00b5, 0x00ff, ' ', 1, "OR A,IXL" },
{ 0x00ac, 0x00ff, ' ', 1, "XOR A,IXH" },
{ 0x00ad, 0x00ff, ' ', 1, "XOR A,IXL" },
{ 0, 0, 0, 0, NULL }
};
struct dis_entry disass_ez80_fd[]=
{
// FD
{ 0x003e, 0x00ff, ' ', 2, "LD (IY+%d),IX" },
{ 0x003f, 0x00ff, ' ', 2, "LD (IY+%d),IY" },
{ 0x0031, 0x00ff, ' ', 2, "LD IX,(IY+%d)" },
{ 0x003f, 0x00ff, ' ', 2, "LD IY,(IY+%d)" },
{ 0x000f, 0x00ff, ' ', 2, "LD (IY+%d),BC" },
{ 0x001f, 0x00ff, ' ', 2, "LD (IY+%d),DE" },
{ 0x002f, 0x00ff, ' ', 2, "LD (IY+%d),HL" },
{ 0x0007, 0x00ff, ' ', 2, "LD BC,(IY+%d)" },
{ 0x0017, 0x00ff, ' ', 2, "LD DE,(IY+%d)" },
{ 0x0027, 0x00ff, ' ', 2, "LD HL,(IY+%d)" },
// FD
{ 0x0064, 0x00ff, ' ', 1, "LD IYH,IYH" },
{ 0x0065, 0x00ff, ' ', 1, "LD IYH,IYL" },
{ 0x006c, 0x00ff, ' ', 1, "LD IYL,IYH" },
{ 0x006d, 0x00ff, ' ', 1, "LD IYL,IYL" },
{ 0x0026, 0x00ff, ' ', 2, "LD IYH,%d" },
{ 0x002e, 0x00ff, ' ', 2, "LD IYL,%d" },
// FD
{ 0x0067, 0x00ff, ' ', 1, "LD IYH,A" },
{ 0x0060, 0x00ff, ' ', 1, "LD IYH,B" },
{ 0x0061, 0x00ff, ' ', 1, "LD IYH,C" },
{ 0x0062, 0x00ff, ' ', 1, "LD IYH,D" },
{ 0x0063, 0x00ff, ' ', 1, "LD IYH,E" },
{ 0x006f, 0x00ff, ' ', 1, "LD IYL,A" },
{ 0x0068, 0x00ff, ' ', 1, "LD IYL,B" },
{ 0x0069, 0x00ff, ' ', 1, "LD IYL,C" },
{ 0x006a, 0x00ff, ' ', 1, "LD IYL,D" },
{ 0x006b, 0x00ff, ' ', 1, "LD IYL,E" },
{ 0x007c, 0x00ff, ' ', 1, "LD A,IYH" },
{ 0x007d, 0x00ff, ' ', 1, "LD A,IYL" },
{ 0x0044, 0x00ff, ' ', 1, "LD B,IYH" },
{ 0x0045, 0x00ff, ' ', 1, "LD B,IYL" },
{ 0x004c, 0x00ff, ' ', 1, "LD C,IYH" },
{ 0x004d, 0x00ff, ' ', 1, "LD C,IYL" },
{ 0x0054, 0x00ff, ' ', 1, "LD D,IYH" },
{ 0x0055, 0x00ff, ' ', 1, "LD D,IYL" },
{ 0x005c, 0x00ff, ' ', 1, "LD E,IYH" },
{ 0x005d, 0x00ff, ' ', 1, "LD E,IYL" },
// FD
{ 0x0094, 0x00ff, ' ', 1, "SUB A,IYH" },
{ 0x0095, 0x00ff, ' ', 1, "SUB A,IYL" },
{ 0x009c, 0x00ff, ' ', 1, "SBC A,IYH" },
{ 0x009d, 0x00ff, ' ', 1, "SBC A,IYL" },
{ 0x00bc, 0x00ff, ' ', 1, "CP A,IYH" },
{ 0x00bd, 0x00ff, ' ', 1, "CP A,IYL" },
// FD
{ 0x0025, 0x00ff, ' ', 1, "DEC IYH" },
{ 0x002d, 0x00ff, ' ', 1, "DEC IYL" },
{ 0x0024, 0x00ff, ' ', 1, "INC IYH" },
{ 0x002c, 0x00ff, ' ', 1, "INC IYL" },
// FD
{ 0x00a4, 0x00ff, ' ', 1, "AND A,IYH" },
{ 0x00a5, 0x00ff, ' ', 1, "AND A,IYL" },
{ 0x00b4, 0x00ff, ' ', 1, "OR A,IYH" },
{ 0x00b5, 0x00ff, ' ', 1, "OR A,IYL" },
{ 0x00ac, 0x00ff, ' ', 1, "XOR A,IYH" },
{ 0x00ad, 0x00ff, ' ', 1, "XOR A,IYL" },
{ 0, 0, 0, 0, NULL }
};
cl_ez80::cl_ez80(struct cpu_entry *Itype, class cl_sim *asim):
cl_z80(Itype, asim)
{
}
int
cl_ez80::init(void)
{
return cl_z80::init();
}
char *
cl_ez80::id_string(void)
{
return ((char*)"EZ80");
}
const char *
cl_ez80::get_disasm_info(t_addr addr,
int *ret_len,
int *ret_branch,
int *immed_offset,
struct dis_entry **dentry)
{
const char *b = NULL;
uint code;
t_addr addr_org= addr;
int start_addr = addr;
int i;
int len= 0;
int immed_n = 0;
struct dis_entry *dis_e= NULL;
code= rom->get(addr++);
switch (code)
{
case 0xed:
code= rom->get(addr++);
i= 0;
while ((code & disass_ez80_ed[i].mask) != disass_ez80_ed[i].code &&
disass_ez80_ed[i].mnemonic)
i++;
dis_e= &disass_ez80_ed[i];
b= dis_e->mnemonic;
if (b == NULL)
return cl_z80::get_disasm_info(addr_org, ret_len, ret_branch, immed_offset, dentry);
len+= dis_e->length+1;
switch (code)
{
case 0x32: case 0x55:
case 0x54: case 0x33:
case 0x02: case 0x12: case 0x22:
case 0x03: case 0x13: case 0x23:
immed_n= 2;
break;
}
break;
case 0xdd:
code= rom->get(addr++);
i= 0;
while ((code & disass_ez80_dd[i].mask) != disass_ez80_dd[i].code &&
disass_ez80_dd[i].mnemonic)
i++;
dis_e= &disass_ez80_dd[i];
b= dis_e->mnemonic;
if (b == NULL)
return cl_z80::get_disasm_info(addr_org, ret_len, ret_branch, immed_offset, dentry);
len+= dis_e->length+1;
switch (code)
{
case 0x3f: case 0x3e:
case 0x37: case 0x31:
case 0x0f: case 0x1f: case 0x2f:
case 0x07: case 0x17: case 0x27:
case 0x26: case 0x2e:
immed_n= 2;
break;
}
break;
case 0xfd:
code= rom->get(addr++);
i= 0;
while ((code & disass_ez80_fd[i].mask) != disass_ez80_fd[i].code &&
disass_ez80_fd[i].mnemonic)
i++;
dis_e= &disass_ez80_fd[i];
b= dis_e->mnemonic;
if (b == NULL)
return cl_z80::get_disasm_info(addr_org, ret_len, ret_branch, immed_offset, dentry);
len+= dis_e->length+1;
switch (code)
{
case 0x3e: case 0x3f:
case 0x31: case 0x37:
case 0x0f: case 0x1f: case 0x2f:
case 0x07: case 0x17: case 0x27:
case 0x26: case 0x2e:
immed_n= 2;
break;
}
break;
default:
return cl_z80::get_disasm_info(addr_org, ret_len, ret_branch, immed_offset, dentry);
}
if (ret_branch)
*ret_branch = dis_e->branch;
if (immed_offset) {
if (immed_n > 0)
*immed_offset = immed_n;
else *immed_offset = (addr - start_addr);
}
if (len == 0)
len = 1;
if (ret_len)
*ret_len = len;
if (dentry)
*dentry= dis_e;
return b;
}
int
cl_ez80::inst_ed_ez80(t_mem code)
{
int8_t d;
switch (code)
{
// ED
case 0x0f: // LD (HL),BC
store2(regs.HL, regs.BC);
return resGO;
case 0x1f: // LD (HL),DE
store2(regs.HL, regs.DE);
return resGO;
case 0x2f: // LD (HL),HL
store2(regs.HL, regs.HL);
return resGO;
case 0x37: // LD IX,(HL)
regs.IX= get2(regs.HL);
return resGO;
case 0x31: // LD IY,(HL)
regs.IY= get2(regs.HL);
return resGO;
case 0x07: // LD BC,(HL)
regs.BC= get2(regs.HL);
return resGO;
case 0x17: // LD DE,(HL)
regs.DE= get2(regs.HL);
return resGO;
case 0x27: // LD HL,(HL)
regs.HL= get2(regs.HL);
return resGO;
// ED
case 0x32: // LEA IX,IX+d
d= fetch1();
regs.IX= regs.IX + d;
return resGO;
case 0x55: // LEA IY,IX+d
d= fetch1();
regs.IY= regs.IX + d;
return resGO;
case 0x54: // LEA IX,IY+d
d= fetch1();
regs.IX= regs.IY + d;
return resGO;
case 0x33: // LEA IY,IY+d
d= fetch1();
regs.IY= regs.IY + d;
return resGO;
// ED
case 0x02: // LEA BC,IX+d
d= fetch1();
regs.BC= regs.IX + d;
return resGO;
case 0x12: // LEA DE,IX+d
d= fetch1();
regs.DE= regs.IX + d;
return resGO;
case 0x22: // LEA HL,IX+d
d= fetch1();
regs.HL= regs.IX + d;
return resGO;
// ED
case 0x03: // LEA BC,IY+d
d= fetch1();
regs.BC= regs.IY + d;
return resGO;
case 0x13: // LEA DE,IY+d
d= fetch1();
regs.DE= regs.IY + d;
return resGO;
case 0x23: // LEA HL,IY+d
d= fetch1();
regs.HL= regs.IY + d;
return resGO;
// ED
case 0x65: // PEA IX+d
d= fetch1();
push2(regs.IX + d);
vc.wr+= 2;
return resGO;
case 0x66: // PEA IY+d
d= fetch1();
push2(regs.IY + d);
vc.wr+= 2;
return resGO;
default: // fall back to original Z80
return inst_ed_(code);
}
}
int
cl_ez80::inst_ed(t_mem prefix)
{
t_mem code;
if (fetch(&code))
return (resBREAKPOINT);
return inst_ed_ez80(code);
}
int
cl_ez80::inst_dd_spec(t_mem code)
{
int8_t d;
switch (code)
{
// DD
case 0x3f: // LD (IX+d),IX
d= fetch1();
store2(regs.IX+d, regs.IX);
return resGO;
case 0x3e: // LD (IX+d),IY
d= fetch1();
store2(regs.IX+d, regs.IY);
return resGO;
// DD
case 0x37: // LD IX,(IX+d)
d= fetch1();
regs.IX= get2(regs.IX+d);
return resGO;
case 0x31: // LD IY,(IX+d)
d= fetch1();
regs.IY= get2(regs.IX+d);
return resGO;
// DD
case 0x0f: // LD (IX+d),BC
d= fetch1();
store2(regs.IX+d, regs.BC);
return resGO;
case 0x1f: // LD (IX+d),DE
d= fetch1();
store2(regs.IX+d, regs.DE);
return resGO;
case 0x2f: // LD (IX+d),HL
d= fetch1();
store2(regs.IX+d, regs.HL);
return resGO;
// DD
case 0x07: // LD BC,(IX+d)
d= fetch1();
regs.BC= get2(regs.IX+d);
return resGO;
case 0x17: // LD DE,(IX+d)
d= fetch1();
regs.DE= get2(regs.IX+d);
return resGO;
case 0x27: // LD HL,(IX+d)
d= fetch1();
regs.HL= get2(regs.IX+d);
return resGO;
// DD
case 0x64: // LD IXH,IXH
return resGO;
case 0x65: // LD IXH,IXL
regs.ix.h= regs.ix.l;
return resGO;
case 0x6c: // LD IXL,IXH
regs.ix.l= regs.ix.h;
return resGO;
case 0x6d: // LD IXL,IXL
return resGO;
// DD
case 0x26: // LD IXH,n
d= fetch1();
regs.ix.h= d;
return resGO;
case 0x2e: // LD IXL,n
d= fetch1();
regs.ix.l= d;
return resGO;
// DD
case 0x67: // LD,IXH,A
regs.ix.h= regs.raf.A;
return resGO;
case 0x60: // LD,IXH,B
regs.ix.h= regs.bc.h;
return resGO;
case 0x61: // LD,IXH,C
regs.ix.h= regs.bc.l;
return resGO;
case 0x62: // LD,IXH,D
regs.ix.h= regs.de.h;
return resGO;
case 0x63: // LD,IXH,E
regs.ix.h= regs.de.l;
return resGO;
// DD
case 0x6f: // LD,IXL,A
regs.ix.l= regs.raf.A;
return resGO;
case 0x68: // LD,IXL,B
regs.ix.l= regs.bc.h;
return resGO;
case 0x69: // LD,IXL,C
regs.ix.l= regs.bc.l;
return resGO;
case 0x6a: // LD,IXL,D
regs.ix.l= regs.de.h;
return resGO;
case 0x6b: // LD,IXL,E
regs.ix.l= regs.de.l;
return resGO;
// DD
case 0x7c: // LD A,IXH
regs.raf.A= regs.ix.h;
return resGO;
case 0x7d: // LD A,IXL
regs.raf.A= regs.ix.l;
return resGO;
case 0x44: // LD B,IXH
regs.bc.h= regs.ix.h;
return resGO;
case 0x45: // LD B,IXL
regs.bc.h= regs.ix.l;
return resGO;
case 0x4c: // LD C,IXH
regs.bc.l= regs.ix.h;
return resGO;
case 0x4d: // LD C,IXL
regs.bc.l= regs.ix.l;
return resGO;
case 0x54: // LD D,IXH
regs.de.h= regs.ix.h;
return resGO;
case 0x55: // LD D,IXL
regs.de.h= regs.ix.l;
return resGO;
case 0x5c: // LD E,IXH
regs.de.l= regs.ix.h;
return resGO;
case 0x5d: // LD E,IXL
regs.de.l= regs.ix.l;
return resGO;
// DD
case 0x84: // ADD A,IXH
add_A_bytereg(regs.ix.h);
return resGO;
case 0x85: // ADD A,IXL
add_A_bytereg(regs.ix.l);
return resGO;
case 0x8c: // ADC A,IXH
adc_A_bytereg(regs.ix.h);
return resGO;
case 0x8d: // ADC A,IXL
adc_A_bytereg(regs.ix.l);
return resGO;
// DD
case 0x94: // SUB A,IXH
sub_A_bytereg(regs.ix.h);
return resGO;
case 0x95: // SUB A,IXL
sub_A_bytereg(regs.ix.l);
return resGO;
case 0x9c: // SBC A,IXH
sbc_A_bytereg(regs.ix.h);
return resGO;
case 0x9d: // SBC A,IXL
sbc_A_bytereg(regs.ix.l);
return resGO;
case 0xbc: // SUB A,IXH
cp_bytereg(regs.ix.h);
return resGO;
case 0xbd: // SUB A,IXL
cp_bytereg(regs.ix.l);
return resGO;
// DD
case 0x25: // DEC IXH
dec(regs.ix.h);
return resGO;
case 0x2d: // DEC IXL
dec(regs.ix.l);
return resGO;
case 0x24: // INC IXH
inc(regs.ix.h);
return resGO;
case 0x2c: // INC IXL
inc(regs.ix.l);
return resGO;
// DD
case 0xa4: // AND A,IXH
and_A_bytereg(regs.ix.h);
return resGO;
case 0xa5: // AND A,IXL
and_A_bytereg(regs.ix.l);
return resGO;
case 0xb4: // OR A,IXH
or_A_bytereg(regs.ix.h);
return resGO;
case 0xb5: // OR A,IXL
or_A_bytereg(regs.ix.l);
return resGO;
case 0xac: // XOR A,IXH
xor_A_bytereg(regs.ix.h);
return resGO;
case 0xad: // XOR A,IXL
xor_A_bytereg(regs.ix.l);
return resGO;
}
return -1;
}
int
cl_ez80::inst_fd_spec(t_mem code)
{
int8_t d;
switch (code)
{
// FD
case 0x3e: // LD (IY+d),IX
d= fetch1();
store2(regs.IY+d, regs.IX);
return resGO;
case 0x3f: // LD (IY+d),IY
d= fetch1();
store2(regs.IY+d, regs.IY);
return resGO;
// FD
case 0x31: // LD IX,(IY+d)
d= fetch1();
regs.IX= get2(regs.IY+d);
return resGO;
case 0x37: // LD IY,(IY+d)
d= fetch1();
regs.IY= get2(regs.IY+d);
return resGO;
// FD
case 0x0f: // LD (IY+d),BC
d= fetch1();
store2(regs.IY+d, regs.BC);
return resGO;
case 0x1f: // LD (IY+d),DE
d= fetch1();
store2(regs.IY+d, regs.DE);
return resGO;
case 0x2f: // LD (IY+d),HL
d= fetch1();
store2(regs.IY+d, regs.HL);
return resGO;
// FD
case 0x07: // LD BC,(IY+d)
d= fetch1();
regs.BC= get2(regs.IY+d);
return resGO;
case 0x17: // LD DE,(IY+d)
d= fetch1();
regs.DE= get2(regs.IY+d);
return resGO;
case 0x27: // LD HL,(IY+d)
d= fetch1();
regs.HL= get2(regs.IY+d);
return resGO;
// FD
case 0x64: // LD IYH,IYH
return resGO;
case 0x65: // LD IYH,IYL
regs.iy.h= regs.iy.l;
return resGO;
case 0x6c: // LD IYL,IYH
regs.iy.l= regs.iy.h;
return resGO;
case 0x6d: // LD IYL,IYL
return resGO;
// FD
case 0x26: // LD IYH,n
d= fetch1();
regs.iy.h= d;
return resGO;
case 0x2e: // LD IYL,n
d= fetch1();
regs.iy.l= d;
return resGO;
// FD
case 0x67: // LD,IYH,A
regs.iy.h= regs.raf.A;
return resGO;
case 0x60: // LD,IYH,B
regs.iy.h= regs.bc.h;
return resGO;
case 0x61: // LD,IYH,C
regs.iy.h= regs.bc.l;
return resGO;
case 0x62: // LD,IYH,D
regs.iy.h= regs.de.h;
return resGO;
case 0x63: // LD,IYH,E
regs.iy.h= regs.de.l;
return resGO;
// FD
case 0x6f: // LD,IYL,A
regs.iy.l= regs.raf.A;
return resGO;
case 0x68: // LD,IYL,B
regs.iy.l= regs.bc.h;
return resGO;
case 0x69: // LD,IYL,C
regs.iy.l= regs.bc.l;
return resGO;
case 0x6a: // LD,IYL,D
regs.iy.l= regs.de.h;
return resGO;
case 0x6b: // LD,IYL,E
regs.iy.l= regs.de.l;
return resGO;
// FD
case 0x7c: // LD A,IYH
regs.raf.A= regs.iy.h;
return resGO;
case 0x7d: // LD A,IYL
regs.raf.A= regs.iy.l;
return resGO;
case 0x44: // LD B,IYH
regs.bc.h= regs.iy.h;
return resGO;
case 0x45: // LD B,IYL
regs.bc.h= regs.iy.l;
return resGO;
case 0x4c: // LD C,IYH
regs.bc.l= regs.iy.h;
return resGO;
case 0x4d: // LD C,IYL
regs.bc.l= regs.iy.l;
return resGO;
case 0x54: // LD D,IYH
regs.de.h= regs.iy.h;
return resGO;
case 0x55: // LD D,IYL
regs.de.h= regs.iy.l;
return resGO;
case 0x5c: // LD E,IYH
regs.de.l= regs.iy.h;
return resGO;
case 0x5d: // LD E,IYL
regs.de.l= regs.iy.l;
return resGO;
// FD
case 0x84: // ADD A,IYH
add_A_bytereg(regs.iy.h);
return resGO;
case 0x85: // ADD A,IYL
add_A_bytereg(regs.iy.l);
return resGO;
case 0x8c: // ADC A,IYH
adc_A_bytereg(regs.iy.h);
return resGO;
case 0x8d: // ADC A,IYL
adc_A_bytereg(regs.iy.l);
return resGO;
// FD
case 0x94: // SUB A,IYH
sub_A_bytereg(regs.iy.h);
return resGO;
case 0x95: // SUB A,IYL
sub_A_bytereg(regs.iy.l);
return resGO;
case 0x9c: // SBC A,IYH
sbc_A_bytereg(regs.iy.h);
return resGO;
case 0x9d: // SBC A,IYL
sbc_A_bytereg(regs.iy.l);
return resGO;
case 0xbc: // SUB A,IYH
cp_bytereg(regs.iy.h);
return resGO;
case 0xbd: // SUB A,IYL
cp_bytereg(regs.iy.l);
return resGO;
// FD
case 0x25: // DEC IYH
dec(regs.iy.h);
return resGO;
case 0x2d: // DEC IYL
dec(regs.iy.l);
return resGO;
case 0x24: // INC IYH
inc(regs.iy.h);
return resGO;
case 0x2c: // INC IYL
inc(regs.iy.l);
return resGO;
// DD
case 0xa4: // AND A,IYH
and_A_bytereg(regs.iy.h);
return resGO;
case 0xa5: // AND A,IYL
and_A_bytereg(regs.iy.l);
return resGO;
case 0xb4: // OR A,IYH
or_A_bytereg(regs.iy.h);
return resGO;
case 0xb5: // OR A,IYL
or_A_bytereg(regs.iy.l);
return resGO;
case 0xac: // XOR A,IYH
xor_A_bytereg(regs.iy.h);
return resGO;
case 0xad: // XOR A,IYL
xor_A_bytereg(regs.iy.l);
return resGO;
}
return -1;
}
/* End of z80.src/ez80.cc */
|