Subversion Repositories pentevo

Rev

Rev 796 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. #include "defs.h"
  2. #include "tables.h"
  3. #include "op_system.h"
  4. #include "op_noprefix.h"
  5. #include "daa_tabs.h"
  6. #include <stdio.h>
  7. /*  not prefixed opcodes */
  8.  
  9. //#ifdef Z80_COMMON
  10. Z80OPCODE op_00(Z80 *cpu) { // nop
  11.     (void)cpu;
  12.  
  13.    /* note: don't inc t: 4 cycles already wasted in m1_cycle() */
  14. }
  15. //#endif
  16. //#ifndef Z80_COMMON
  17. Z80OPCODE op_01(Z80 *cpu) { // ld bc,nnnn
  18.    cpu->c = cpu->MemIf->xm(cpu->pc++);
  19.    cpu->b = cpu->MemIf->xm(cpu->pc++);
  20.    cpu->t += 6;
  21. }
  22. Z80OPCODE op_02(Z80 *cpu) { // ld (bc),a | M:2 T:7 (4, 3)
  23. //   wm(cpu->bc, cpu->a);
  24.    cpu->memh = cpu->a;
  25.    cpu->meml = u8(cpu->bc + 1);
  26.    cpu->t += 3;
  27.    cpu->MemIf->wm(cpu->bc, cpu->a); //Alone Coder
  28. }
  29. //#endif
  30. //#ifdef Z80_COMMON
  31. Z80OPCODE op_03(Z80 *cpu) { // inc bc
  32.    cpu->bc++;
  33.    cpu->t += 2;
  34. }
  35. Z80OPCODE op_04(Z80 *cpu) { // inc b
  36.    inc8(cpu, cpu->b);
  37. }
  38. Z80OPCODE op_05(Z80 *cpu) { // dec b
  39.    dec8(cpu, cpu->b);
  40. }
  41. //#endif
  42. //#ifndef Z80_COMMON
  43. Z80OPCODE op_06(Z80 *cpu) { // ld b,nn
  44.    cpu->b = cpu->MemIf->xm(cpu->pc++);
  45.    cpu->t += 3;
  46. }
  47. //#endif
  48. //#ifdef Z80_COMMON
  49. Z80OPCODE op_07(Z80 *cpu) { // rlca
  50.    cpu->f = rlcaf[cpu->a] | (cpu->f & (SF | ZF | PV));
  51.    cpu->a = rol[cpu->a];
  52. }
  53. Z80OPCODE op_08(Z80 *cpu) { // ex af,af'
  54.    unsigned tmp = cpu->af;
  55.    cpu->af = cpu->alt.af;
  56.    cpu->alt.af = tmp;
  57. }
  58. static Z80OPCODE op_09(Z80 *cpu) { // add hl,bc
  59.    cpu->memptr = cpu->hl+1;
  60.    cpu->f = (cpu->f & ~(NF | CF | F5 | F3 | HF));
  61.    cpu->f |= (((cpu->hl & 0x0FFF) + (cpu->bc & 0x0FFF)) >> 8) & 0x10; /* HF */
  62.    cpu->hl = (cpu->hl & 0xFFFF) + (cpu->bc & 0xFFFF);
  63.    if (cpu->hl & 0x10000) cpu->f |= CF;
  64.    cpu->f |= (cpu->h & (F5 | F3));
  65.    cpu->t += 7;
  66. }
  67. //#endif
  68. //#ifndef Z80_COMMON
  69. Z80OPCODE op_0A(Z80 *cpu) { // ld a,(bc)
  70.    cpu->memptr = cpu->bc+1;
  71.    cpu->a = cpu->MemIf->rm(cpu->bc);
  72.    cpu->t += 3;
  73. }
  74. //#endif
  75. //#ifdef Z80_COMMON
  76. Z80OPCODE op_0B(Z80 *cpu) { // dec bc
  77.    cpu->bc--;
  78.    cpu->t += 2;
  79. }
  80. Z80OPCODE op_0C(Z80 *cpu) { // inc c
  81.    inc8(cpu, cpu->c);
  82. }
  83. Z80OPCODE op_0D(Z80 *cpu) { // dec c
  84.    dec8(cpu, cpu->c);
  85. }
  86. //#endif
  87. //#ifndef Z80_COMMON
  88. Z80OPCODE op_0E(Z80 *cpu) { // ld c,nn
  89.    cpu->c = cpu->MemIf->xm(cpu->pc++);
  90.    cpu->t += 3;
  91. }
  92. //#endif
  93. //#ifdef Z80_COMMON
  94. Z80OPCODE op_0F(Z80 *cpu) { // rrca
  95.    cpu->f = rrcaf[cpu->a] | (cpu->f & (SF | ZF | PV));
  96.    cpu->a = ror[cpu->a];
  97. }
  98. //#endif
  99. //#ifndef Z80_COMMON
  100. Z80OPCODE op_10(Z80 *cpu) { // djnz rr
  101.     if(--cpu->b)
  102.     {
  103.         signed char offs = (char)cpu->MemIf->xm(cpu->pc);
  104.         cpu->last_branch = u16(cpu->pc - 1);
  105.         cpu->memptr = cpu->pc += unsigned(offs + 1);
  106.         cpu->t += 9;
  107.     }
  108.     else
  109.     {
  110.         cpu->pc++;
  111.         cpu->t += 4;
  112.     }
  113. }
  114. Z80OPCODE op_11(Z80 *cpu) { // ld de,nnnn
  115.    cpu->e = cpu->MemIf->xm(cpu->pc++);
  116.    cpu->d = cpu->MemIf->xm(cpu->pc++);
  117.    cpu->t += 6;
  118. }
  119. Z80OPCODE op_12(Z80 *cpu) { // ld (de),a | M:2 T:7 (4, 3)
  120. //   wm(cpu->de, cpu->a);
  121.    cpu->memh = cpu->a;
  122.    cpu->meml = u8(cpu->de + 1);
  123.    cpu->t += 3;
  124.    cpu->MemIf->wm(cpu->de, cpu->a); //Alone Coder
  125. }
  126. //#endif
  127. //#ifdef Z80_COMMON
  128. Z80OPCODE op_13(Z80 *cpu) { // inc de
  129.    cpu->de++;
  130.    cpu->t += 2;
  131. }
  132. Z80OPCODE op_14(Z80 *cpu) { // inc d
  133.    inc8(cpu, cpu->d);
  134. }
  135. Z80OPCODE op_15(Z80 *cpu) { // dec d
  136.    dec8(cpu, cpu->d);
  137. }
  138. //#endif
  139. //#ifndef Z80_COMMON
  140. Z80OPCODE op_16(Z80 *cpu) { // ld d,nn
  141.    cpu->d = cpu->MemIf->xm(cpu->pc++);
  142.    cpu->t += 3;
  143. }
  144. //#endif
  145. //#ifdef Z80_COMMON
  146. Z80OPCODE op_17(Z80 *cpu) { // rla
  147.    unsigned char new_a = u8((cpu->a << 1) + (cpu->f & 1));
  148.    cpu->f = rlcaf[cpu->a] | (cpu->f & (SF | ZF | PV)); // use same table with rlca
  149.    cpu->a = new_a;
  150. }
  151. //#endif
  152. //#ifndef Z80_COMMON
  153. Z80OPCODE op_18(Z80 *cpu) { // jr rr
  154.    signed char offs = (char)cpu->MemIf->xm(cpu->pc);
  155.    cpu->last_branch = u16(cpu->pc-1);
  156.    cpu->pc += unsigned(offs+1);
  157.    cpu->memptr = cpu->pc;
  158.    cpu->t += 8;
  159. }
  160. //#endif
  161. //#ifdef Z80_COMMON
  162. static Z80OPCODE op_19(Z80 *cpu) { // add hl,de
  163.    cpu->memptr = cpu->hl+1;
  164.    cpu->f = (cpu->f & ~(NF | CF | F5 | F3 | HF));
  165.    cpu->f |= (((cpu->hl & 0x0FFF) + (cpu->de & 0x0FFF)) >> 8) & 0x10; /* HF */
  166.    cpu->hl = (cpu->hl & 0xFFFF) + (cpu->de & 0xFFFF);
  167.    if (cpu->hl & 0x10000) cpu->f |= CF;
  168.    cpu->f |= (cpu->h & (F5 | F3));
  169.    cpu->t += 7;
  170. }
  171. //#endif
  172. //#ifndef Z80_COMMON
  173. Z80OPCODE op_1A(Z80 *cpu) { // ld a,(de)
  174.    cpu->memptr = cpu->de+1;
  175.    cpu->a = cpu->MemIf->rm(cpu->de);
  176.    cpu->t += 3;
  177. }
  178. //#endif
  179. //#ifdef Z80_COMMON
  180. Z80OPCODE op_1B(Z80 *cpu) { // dec de
  181.    cpu->de--;
  182.    cpu->t += 2;
  183. }
  184. Z80OPCODE op_1C(Z80 *cpu) { // inc e
  185.    inc8(cpu, cpu->e);
  186. }
  187. Z80OPCODE op_1D(Z80 *cpu) { // dec e
  188.    dec8(cpu, cpu->e);
  189. }
  190. //#endif
  191. //#ifndef Z80_COMMON
  192. Z80OPCODE op_1E(Z80 *cpu) { // ld e,nn
  193.    cpu->e = cpu->MemIf->xm(cpu->pc++);
  194.    cpu->t += 3;
  195. }
  196. //#endif
  197. //#ifdef Z80_COMMON
  198. Z80OPCODE op_1F(Z80 *cpu) { // rra
  199.    unsigned char new_a = u8((cpu->a >> 1) + (cpu->f << 7));
  200.    cpu->f = rrcaf[cpu->a] | (cpu->f & (SF | ZF | PV)); // use same table with rrca
  201.    cpu->a = new_a;
  202. }
  203. //#endif
  204. //#ifndef Z80_COMMON
  205. Z80OPCODE op_20(Z80 *cpu) { // jr nz, rr
  206.     if(!(cpu->f & ZF))
  207.     {
  208.         signed char offs = (char)cpu->MemIf->xm(cpu->pc);
  209.         cpu->last_branch = u16(cpu->pc - 1);
  210.         cpu->memptr = cpu->pc += unsigned(offs + 1);
  211.         cpu->t += 8;
  212.     }
  213.     else
  214.     {
  215.         cpu->pc++;
  216.         cpu->t += 3;
  217.     }
  218. }
  219. static Z80OPCODE op_21(Z80 *cpu) { // ld hl,nnnn
  220.    cpu->l = cpu->MemIf->xm(cpu->pc++);
  221.    cpu->h = cpu->MemIf->xm(cpu->pc++);
  222.    cpu->t += 6;
  223. }
  224. Z80OPCODE op_22(Z80 *cpu) { // ld (nnnn),hl | M:5 T:16 (4, 3, 3, 3, 3)
  225.    unsigned adr = cpu->MemIf->xm(cpu->pc++);
  226.    adr += cpu->MemIf->xm(cpu->pc++)*0x100;
  227.    cpu->memptr = adr+1;
  228. //   wm(adr, cpu->l);
  229. //   wm(adr+1, cpu->h);
  230. //   cpu->t += 12;
  231.    cpu->t += 9;
  232.    cpu->MemIf->wm(adr, cpu->l);
  233.    cpu->t += 3;
  234.    cpu->MemIf->wm(adr+1, cpu->h);
  235.  //Alone Coder
  236. }
  237. //#endif
  238. //#ifdef Z80_COMMON
  239. static Z80OPCODE op_23(Z80 *cpu) { // inc hl
  240.    cpu->hl++;
  241.    cpu->t += 2;
  242. }
  243. static Z80OPCODE op_24(Z80 *cpu) { // inc h
  244.    inc8(cpu, cpu->h);
  245. }
  246. static Z80OPCODE op_25(Z80 *cpu) { // dec h
  247.    dec8(cpu, cpu->h);
  248. }
  249. //#endif
  250. //#ifndef Z80_COMMON
  251. static Z80OPCODE op_26(Z80 *cpu) { // ld h,nn
  252.    cpu->h = cpu->MemIf->xm(cpu->pc++);
  253.    cpu->t += 3;
  254. }
  255. //#endif
  256. //#ifdef Z80_COMMON
  257. Z80OPCODE op_27(Z80 *cpu) { // daa
  258.    cpu->af = *(const unsigned short*)
  259.       (daatab+(cpu->a+0x100*((cpu->f & 3) + ((cpu->f >> 2) & 4)))*2);
  260. }
  261. //#endif
  262. //#ifndef Z80_COMMON
  263. Z80OPCODE op_28(Z80 *cpu) { // jr z,rr
  264.     if((cpu->f & ZF))
  265.     {
  266.         signed char offs = (char)cpu->MemIf->xm(cpu->pc);
  267.         cpu->last_branch = u16(cpu->pc - 1);
  268.         cpu->memptr = cpu->pc += unsigned(offs + 1);
  269.         cpu->t += 8;
  270.     }
  271.     else
  272.     {
  273.         cpu->pc++;
  274.         cpu->t += 3;
  275.     }
  276. }
  277. //#endif
  278. //#ifdef Z80_COMMON
  279. static Z80OPCODE op_29(Z80 *cpu) { // add hl,hl
  280.    cpu->memptr = cpu->hl+1;
  281.    cpu->f = (cpu->f & ~(NF | CF | F5 | F3 | HF));
  282.    cpu->f |= ((cpu->hl >> 7) & 0x10); /* HF */
  283.    cpu->hl = (cpu->hl & 0xFFFF)*2;
  284.    if (cpu->hl & 0x10000) cpu->f |= CF;
  285.    cpu->f |= (cpu->h & (F5 | F3));
  286.    cpu->t += 7;
  287. }
  288. //#endif
  289. //#ifndef Z80_COMMON
  290. Z80OPCODE op_2A(Z80 *cpu) { // ld hl,(nnnn)
  291.    unsigned adr = cpu->MemIf->xm(cpu->pc++);
  292.    adr += cpu->MemIf->xm(cpu->pc++)*0x100;
  293.    cpu->memptr = adr+1;
  294.    cpu->l = cpu->MemIf->rm(adr);
  295.    cpu->h = cpu->MemIf->rm(adr+1);
  296.    cpu->t += 12;
  297. }
  298. //#endif
  299. //#ifdef Z80_COMMON
  300. static Z80OPCODE op_2B(Z80 *cpu) { // dec hl
  301.    cpu->hl--;
  302.    cpu->t += 2;
  303. }
  304. static Z80OPCODE op_2C(Z80 *cpu) { // inc l
  305.    inc8(cpu, cpu->l);
  306. }
  307. static Z80OPCODE op_2D(Z80 *cpu) { // dec l
  308.    dec8(cpu, cpu->l);
  309. }
  310. //#endif
  311. //#ifndef Z80_COMMON
  312. static Z80OPCODE op_2E(Z80 *cpu) { // ld l,nn
  313.    cpu->l = cpu->MemIf->xm(cpu->pc++);
  314.    cpu->t += 3;
  315. }
  316. //#endif
  317. //#ifdef Z80_COMMON
  318. Z80OPCODE op_2F(Z80 *cpu) { // cpl
  319.    cpu->a ^= 0xFF;
  320.    cpu->f = (cpu->f & ~(F3|F5)) | NF | HF | (cpu->a & (F3|F5));
  321. }
  322. //#endif
  323. //#ifndef Z80_COMMON
  324. Z80OPCODE op_30(Z80 *cpu) { // jr nc, rr
  325.     if(!(cpu->f & CF))
  326.     {
  327.         signed char offs = (char)cpu->MemIf->xm(cpu->pc);
  328.         cpu->last_branch = u16(cpu->pc - 1);
  329.         cpu->memptr = cpu->pc += unsigned(offs + 1);
  330.         cpu->t += 8;
  331.     }
  332.     else
  333.     {
  334.         cpu->pc++;
  335.         cpu->t += 3;
  336.     }
  337. }
  338. Z80OPCODE op_31(Z80 *cpu) { // ld sp,nnnn
  339.    cpu->spl = cpu->MemIf->xm(cpu->pc++);
  340.    cpu->sph = cpu->MemIf->xm(cpu->pc++);
  341.    cpu->t += 6;
  342. }
  343. Z80OPCODE op_32(Z80 *cpu) { // ld (nnnn),a | M:4 T:13 (4, 3, 3, 3)
  344.    unsigned adr = cpu->MemIf->xm(cpu->pc++);
  345.    adr += cpu->MemIf->xm(cpu->pc++)*0x100;
  346.    cpu->memptr = unsigned(((adr+1) & 0xFF) | u8(cpu->a << 8));
  347. //   wm(adr, cpu->a);
  348.    cpu->memh = cpu->a;
  349.    cpu->t += 9;
  350.    cpu->MemIf->wm(adr, cpu->a); //Alone Coder
  351. }
  352. //#endif
  353. //#ifdef Z80_COMMON
  354. Z80OPCODE op_33(Z80 *cpu) { // inc sp
  355.    cpu->sp++;
  356.    cpu->t += 2;
  357. }
  358. //#endif
  359. //#ifndef Z80_COMMON
  360. static Z80OPCODE op_34(Z80 *cpu) { // inc (hl) | M:3 T:11 (4, 4, 3)
  361.    unsigned char hl = cpu->MemIf->rm(cpu->hl);
  362.    inc8(cpu, hl);
  363. //   wm(cpu->hl, hl);
  364.    cpu->t += 7;
  365.    cpu->MemIf->wm(cpu->hl, hl); //Alone Coder
  366. }
  367. static Z80OPCODE op_35(Z80 *cpu) { // dec (hl) | M:3 T:11 (4, 4, 3)
  368.    unsigned char hl = cpu->MemIf->rm(cpu->hl);
  369.    dec8(cpu, hl);
  370. //   wm(cpu->hl, hl);
  371.    cpu->t += 7;
  372.    cpu->MemIf->wm(cpu->hl, hl); //Alone Coder
  373. }
  374. static Z80OPCODE op_36(Z80 *cpu) { // ld (hl),nn | M:3 T:10 (4, 3, 3)
  375. //   wm(cpu->hl, rm(cpu->pc++));
  376.    cpu->t += 6;
  377.    cpu->MemIf->wm(cpu->hl, cpu->MemIf->xm(cpu->pc++)); //Alone Coder
  378. }
  379. //#endif
  380. //#ifdef Z80_COMMON
  381. Z80OPCODE op_37(Z80 *cpu) { // scf
  382.    cpu->f = (cpu->f & ~(HF|NF|F3|F5)) | (cpu->a & (F3|F5)) | CF;
  383. }
  384. //#endif
  385. //#ifndef Z80_COMMON
  386. Z80OPCODE op_38(Z80 *cpu) { // jr c,rr
  387.     if((cpu->f & CF))
  388.     {
  389.         signed char offs = (char)cpu->MemIf->xm(cpu->pc);
  390.         cpu->last_branch = u16(cpu->pc - 1);
  391.         cpu->memptr = cpu->pc += unsigned(offs + 1);
  392.         cpu->t += 8;
  393.     }
  394.     else
  395.     {
  396.         cpu->pc++;
  397.         cpu->t += 3;
  398.     }
  399. }
  400. //#endif
  401. //#ifdef Z80_COMMON
  402. static Z80OPCODE op_39(Z80 *cpu) { // add hl,sp
  403.    cpu->memptr = cpu->hl+1;
  404.    cpu->f = (cpu->f & ~(NF | CF | F5 | F3 | HF));
  405.    cpu->f |= (((cpu->hl & 0x0FFF) + (cpu->sp & 0x0FFF)) >> 8) & 0x10; /* HF */
  406.    cpu->hl = (cpu->hl & 0xFFFF) + (cpu->sp & 0xFFFF);
  407.    if (cpu->hl & 0x10000) cpu->f |= CF;
  408.    cpu->f |= (cpu->h & (F5 | F3));
  409.    cpu->t += 7;
  410. }
  411. //#endif
  412. //#ifndef Z80_COMMON
  413. Z80OPCODE op_3A(Z80 *cpu) { // ld a,(nnnn)
  414.    unsigned adr = cpu->MemIf->xm(cpu->pc++);
  415.    adr += cpu->MemIf->xm(cpu->pc++)*0x100;
  416.    cpu->memptr = adr+1;
  417.    cpu->a = cpu->MemIf->rm(adr);
  418.    cpu->t += 9;
  419. }
  420. //#endif
  421. //#ifdef Z80_COMMON
  422. Z80OPCODE op_3B(Z80 *cpu) { // dec sp
  423.    cpu->sp--;
  424.    cpu->t += 2;
  425. }
  426. Z80OPCODE op_3C(Z80 *cpu) { // inc a
  427.    inc8(cpu, cpu->a);
  428. }
  429. Z80OPCODE op_3D(Z80 *cpu) { // dec a
  430.    dec8(cpu, cpu->a);
  431. }
  432. //#endif
  433. //#ifndef Z80_COMMON
  434. Z80OPCODE op_3E(Z80 *cpu) { // ld a,nn
  435.    cpu->a = cpu->MemIf->xm(cpu->pc++);
  436.    cpu->t += 3;
  437. }
  438. //#endif
  439. //#ifdef Z80_COMMON
  440. Z80OPCODE op_3F(Z80 *cpu) { // ccf
  441.    cpu->f = ((cpu->f & ~(NF|HF)) | ((cpu->f << 4) & HF) | (cpu->a & (F3|F5))) ^ CF;
  442. }
  443. //#endif
  444.  
  445. //#ifdef Z80_COMMON
  446. Z80OPCODE op_41(Z80 *cpu) { // ld b,c
  447.    cpu->b = cpu->c;
  448. }
  449. Z80OPCODE op_42(Z80 *cpu) { // ld b,d
  450.    cpu->b = cpu->d;
  451. }
  452. Z80OPCODE op_43(Z80 *cpu) { // ld b,e
  453.    cpu->b = cpu->e;
  454. }
  455. static Z80OPCODE op_44(Z80 *cpu) { // ld b,h
  456.    cpu->b = cpu->h;
  457. }
  458. static Z80OPCODE op_45(Z80 *cpu) { // ld b,l
  459.    cpu->b = cpu->l;
  460. }
  461. //#endif
  462. //#ifndef Z80_COMMON
  463. static Z80OPCODE op_46(Z80 *cpu) { // ld b,(hl)
  464.    cpu->b = cpu->MemIf->rm(cpu->hl);
  465.    cpu->t += 3;
  466. }
  467. //#endif
  468. //#ifdef Z80_COMMON
  469. Z80OPCODE op_47(Z80 *cpu) { // ld b,a
  470.    cpu->b = cpu->a;
  471. }
  472. Z80OPCODE op_48(Z80 *cpu) { // ld c,b
  473.    cpu->c = cpu->b;
  474. }
  475. Z80OPCODE op_4A(Z80 *cpu) { // ld c,d
  476.    cpu->c = cpu->d;
  477. }
  478. Z80OPCODE op_4B(Z80 *cpu) { // ld c,e
  479.    cpu->c = cpu->e;
  480. }
  481. static Z80OPCODE op_4C(Z80 *cpu) { // ld c,h
  482.    cpu->c = cpu->h;
  483. }
  484. static Z80OPCODE op_4D(Z80 *cpu) { // ld c,l
  485.    cpu->c = cpu->l;
  486. }
  487. //#endif
  488. //#ifndef Z80_COMMON
  489. static Z80OPCODE op_4E(Z80 *cpu) { // ld c,(hl)
  490.    cpu->c = cpu->MemIf->rm(cpu->hl);
  491.    cpu->t += 3;
  492. }
  493. //#endif
  494. //#ifdef Z80_COMMON
  495. Z80OPCODE op_4F(Z80 *cpu) { // ld c,a
  496.    cpu->c = cpu->a;
  497. }
  498. Z80OPCODE op_50(Z80 *cpu) { // ld d,b
  499.    cpu->d = cpu->b;
  500. }
  501. Z80OPCODE op_51(Z80 *cpu) { // ld d,c
  502.    cpu->d = cpu->c;
  503. }
  504. Z80OPCODE op_53(Z80 *cpu) { // ld d,e
  505.    cpu->d = cpu->e;
  506. }
  507. static Z80OPCODE op_54(Z80 *cpu) { // ld d,h
  508.    cpu->d = cpu->h;
  509. }
  510. static Z80OPCODE op_55(Z80 *cpu) { // ld d,l
  511.    cpu->d = cpu->l;
  512. }
  513. //#endif
  514. //#ifndef Z80_COMMON
  515. static Z80OPCODE op_56(Z80 *cpu) { // ld d,(hl)
  516.    cpu->d = cpu->MemIf->rm(cpu->hl);
  517.    cpu->t += 3;
  518. }
  519. //#endif
  520. //#ifdef Z80_COMMON
  521. Z80OPCODE op_57(Z80 *cpu) { // ld d,a
  522.    cpu->d = cpu->a;
  523. }
  524. Z80OPCODE op_58(Z80 *cpu) { // ld e,b
  525.    cpu->e = cpu->b;
  526. }
  527. Z80OPCODE op_59(Z80 *cpu) { // ld e,c
  528.    cpu->e = cpu->c;
  529. }
  530. Z80OPCODE op_5A(Z80 *cpu) { // ld e,d
  531.    cpu->e = cpu->d;
  532. }
  533. static Z80OPCODE op_5C(Z80 *cpu) { // ld e,h
  534.    cpu->e = cpu->h;
  535. }
  536. static Z80OPCODE op_5D(Z80 *cpu) { // ld e,l
  537.    cpu->e = cpu->l;
  538. }
  539. //#endif
  540. //#ifndef Z80_COMMON
  541. static Z80OPCODE op_5E(Z80 *cpu) { // ld e,(hl)
  542.    cpu->e = cpu->MemIf->rm(cpu->hl);
  543.    cpu->t += 3;
  544. }
  545. //#endif
  546. //#ifdef Z80_COMMON
  547. Z80OPCODE op_5F(Z80 *cpu) { // ld e,a
  548.    cpu->e = cpu->a;
  549. }
  550. static Z80OPCODE op_60(Z80 *cpu) { // ld h,b
  551.    cpu->h = cpu->b;
  552. }
  553. static Z80OPCODE op_61(Z80 *cpu) { // ld h,c
  554.    cpu->h = cpu->c;
  555. }
  556. static Z80OPCODE op_62(Z80 *cpu) { // ld h,d
  557.    cpu->h = cpu->d;
  558. }
  559. static Z80OPCODE op_63(Z80 *cpu) { // ld h,e
  560.    cpu->h = cpu->e;
  561. }
  562. static Z80OPCODE op_65(Z80 *cpu) { // ld h,l
  563.    cpu->h = cpu->l;
  564. }
  565. //#endif
  566. //#ifndef Z80_COMMON
  567. static Z80OPCODE op_66(Z80 *cpu) { // ld h,(hl)
  568.    cpu->h = cpu->MemIf->rm(cpu->hl);
  569.    cpu->t += 3;
  570. }
  571. //#endif
  572. //#ifdef Z80_COMMON
  573. static Z80OPCODE op_67(Z80 *cpu) { // ld h,a
  574.    cpu->h = cpu->a;
  575. }
  576. static Z80OPCODE op_68(Z80 *cpu) { // ld l,b
  577.    cpu->l = cpu->b;
  578. }
  579. static Z80OPCODE op_69(Z80 *cpu) { // ld l,c
  580.    cpu->l = cpu->c;
  581. }
  582. static Z80OPCODE op_6A(Z80 *cpu) { // ld l,d
  583.    cpu->l = cpu->d;
  584. }
  585. static Z80OPCODE op_6B(Z80 *cpu) { // ld l,e
  586.    cpu->l = cpu->e;
  587. }
  588. static Z80OPCODE op_6C(Z80 *cpu) { // ld l,h
  589.    cpu->l = cpu->h;
  590. }
  591. //#endif
  592. //#ifndef Z80_COMMON
  593. static Z80OPCODE op_6E(Z80 *cpu) { // ld l,(hl)
  594.    cpu->l = cpu->MemIf->rm(cpu->hl);
  595.    cpu->t += 3;
  596. }
  597. //#endif
  598. //#ifdef Z80_COMMON
  599. static Z80OPCODE op_6F(Z80 *cpu) { // ld l,a
  600.    cpu->l = cpu->a;
  601. }
  602. //#endif
  603. //#ifndef Z80_COMMON
  604. static Z80OPCODE op_70(Z80 *cpu) { // ld (hl),b | M:2 T:7 (4, 3)
  605. //   wm(cpu->hl, cpu->b);
  606.    cpu->t += 3;
  607.    cpu->MemIf->wm(cpu->hl, cpu->b); //Alone Coder
  608. }
  609. static Z80OPCODE op_71(Z80 *cpu) { // ld (hl),c | M:2 T:7 (4, 3)
  610. //   wm(cpu->hl, cpu->c);
  611.    cpu->t += 3;
  612.    cpu->MemIf->wm(cpu->hl, cpu->c); //Alone Coder
  613. }
  614. static Z80OPCODE op_72(Z80 *cpu) { // ld (hl),d | M:2 T:7 (4, 3)
  615. //   wm(cpu->hl, cpu->d);
  616.    cpu->t += 3;
  617.    cpu->MemIf->wm(cpu->hl, cpu->d); //Alone Coder
  618. }
  619. static Z80OPCODE op_73(Z80 *cpu) { // ld (hl),e | M:2 T:7 (4, 3)
  620. //   wm(cpu->hl, cpu->e);
  621.    cpu->t += 3;
  622.    cpu->MemIf->wm(cpu->hl, cpu->e); //Alone Coder
  623. }
  624. static Z80OPCODE op_74(Z80 *cpu) { // ld (hl),h | M:2 T:7 (4, 3)
  625. //   wm(cpu->hl, cpu->h);
  626.    cpu->t += 3;
  627.    cpu->MemIf->wm(cpu->hl, cpu->h); //Alone Coder
  628. }
  629. static Z80OPCODE op_75(Z80 *cpu) { // ld (hl),l | M:2 T:7 (4, 3)
  630. //   wm(cpu->hl, cpu->l);
  631.    cpu->t += 3;
  632.    cpu->MemIf->wm(cpu->hl, cpu->l); //Alone Coder
  633. }
  634. //#endif
  635. //#ifdef Z80_COMMON
  636. Z80OPCODE op_76(Z80 *cpu) { // halt
  637.    if(!cpu->halted)
  638.        cpu->haltpos = cpu->t;
  639.  
  640.    cpu->pc--;
  641.    cpu->halted = 1;
  642. }
  643. //#endif
  644. //#ifndef Z80_COMMON
  645. static Z80OPCODE op_77(Z80 *cpu) { // ld (hl),a | M:2 T:7 (4, 3)
  646. //   wm(cpu->hl, cpu->a);
  647.    cpu->t += 3;
  648.    cpu->MemIf->wm(cpu->hl, cpu->a); //Alone Coder
  649. }
  650. //#endif
  651. //#ifdef Z80_COMMON
  652. Z80OPCODE op_78(Z80 *cpu) { // ld a,b
  653.    cpu->a = cpu->b;
  654. }
  655. Z80OPCODE op_79(Z80 *cpu) { // ld a,c
  656.    cpu->a = cpu->c;
  657. }
  658. Z80OPCODE op_7A(Z80 *cpu) { // ld a,d
  659.    cpu->a = cpu->d;
  660. }
  661. Z80OPCODE op_7B(Z80 *cpu) { // ld a,e
  662.    cpu->a = cpu->e;
  663. }
  664. static Z80OPCODE op_7C(Z80 *cpu) { // ld a,h
  665.    cpu->a = cpu->h;
  666. }
  667. static Z80OPCODE op_7D(Z80 *cpu) { // ld a,l
  668.    cpu->a = cpu->l;
  669. }
  670. //#endif
  671. //#ifndef Z80_COMMON
  672. static Z80OPCODE op_7E(Z80 *cpu) { // ld a,(hl)
  673.    cpu->a = cpu->MemIf->rm(cpu->hl);
  674.    cpu->t += 3;
  675. }
  676. //#endif
  677. //#ifdef Z80_COMMON
  678. Z80OPCODE op_80(Z80 *cpu) { // add a,b
  679.    add8(cpu, cpu->b);
  680. }
  681. Z80OPCODE op_81(Z80 *cpu) { // add a,c
  682.    add8(cpu, cpu->c);
  683. }
  684. Z80OPCODE op_82(Z80 *cpu) { // add a,d
  685.    add8(cpu, cpu->d);
  686. }
  687. Z80OPCODE op_83(Z80 *cpu) { // add a,e
  688.    add8(cpu, cpu->e);
  689. }
  690. static Z80OPCODE op_84(Z80 *cpu) { // add a,h
  691.    add8(cpu, cpu->h);
  692. }
  693. static Z80OPCODE op_85(Z80 *cpu) { // add a,l
  694.    add8(cpu, cpu->l);
  695. }
  696. //#endif
  697. //#ifndef Z80_COMMON
  698. static Z80OPCODE op_86(Z80 *cpu) { // add a,(hl)
  699.    add8(cpu, cpu->MemIf->rm(cpu->hl));
  700.    cpu->t += 3;
  701. }
  702. //#endif
  703. //#ifdef Z80_COMMON
  704. Z80OPCODE op_87(Z80 *cpu) { // add a,a
  705.    add8(cpu, cpu->a);
  706. }
  707. Z80OPCODE op_88(Z80 *cpu) { // adc a,b
  708.    adc8(cpu, cpu->b);
  709. }
  710. Z80OPCODE op_89(Z80 *cpu) { // adc a,c
  711.    adc8(cpu, cpu->c);
  712. }
  713. Z80OPCODE op_8A(Z80 *cpu) { // adc a,d
  714.    adc8(cpu, cpu->d);
  715. }
  716. Z80OPCODE op_8B(Z80 *cpu) { // adc a,e
  717.    adc8(cpu, cpu->e);
  718. }
  719. static Z80OPCODE op_8C(Z80 *cpu) { // adc a,h
  720.    adc8(cpu, cpu->h);
  721. }
  722. static Z80OPCODE op_8D(Z80 *cpu) { // adc a,l
  723.    adc8(cpu, cpu->l);
  724. }
  725. //#endif
  726. //#ifndef Z80_COMMON
  727. static Z80OPCODE op_8E(Z80 *cpu) { // adc a,(hl)
  728.    adc8(cpu, cpu->MemIf->rm(cpu->hl));
  729.    cpu->t += 3;
  730. }
  731. //#endif
  732. //#ifdef Z80_COMMON
  733. Z80OPCODE op_8F(Z80 *cpu) { // adc a,a
  734.    adc8(cpu, cpu->a);
  735. }
  736. Z80OPCODE op_90(Z80 *cpu) { // sub b
  737.    sub8(cpu, cpu->b);
  738. }
  739. Z80OPCODE op_91(Z80 *cpu) { // sub c
  740.    sub8(cpu, cpu->c);
  741. }
  742. Z80OPCODE op_92(Z80 *cpu) { // sub d
  743.    sub8(cpu, cpu->d);
  744. }
  745. Z80OPCODE op_93(Z80 *cpu) { // sub e
  746.    sub8(cpu, cpu->e);
  747. }
  748. static Z80OPCODE op_94(Z80 *cpu) { // sub h
  749.    sub8(cpu, cpu->h);
  750. }
  751. static Z80OPCODE op_95(Z80 *cpu) { // sub l
  752.    sub8(cpu, cpu->l);
  753. }
  754. //#endif
  755. //#ifndef Z80_COMMON
  756. static Z80OPCODE op_96(Z80 *cpu) { // sub (hl)
  757.    sub8(cpu, cpu->MemIf->rm(cpu->hl));
  758.    cpu->t += 3;
  759. }
  760. //#endif
  761. //#ifdef Z80_COMMON
  762. Z80OPCODE op_97(Z80 *cpu) { // sub a
  763.    cpu->af = ZF | NF;
  764. }
  765. Z80OPCODE op_98(Z80 *cpu) { // sbc a,b
  766.    sbc8(cpu, cpu->b);
  767. }
  768. Z80OPCODE op_99(Z80 *cpu) { // sbc a,c
  769.    sbc8(cpu, cpu->c);
  770. }
  771. Z80OPCODE op_9A(Z80 *cpu) { // sbc a,d
  772.    sbc8(cpu, cpu->d);
  773. }
  774. Z80OPCODE op_9B(Z80 *cpu) { // sbc a,e
  775.    sbc8(cpu, cpu->e);
  776. }
  777. static Z80OPCODE op_9C(Z80 *cpu) { // sbc a,h
  778.    sbc8(cpu, cpu->h);
  779. }
  780. static Z80OPCODE op_9D(Z80 *cpu) { // sbc a,l
  781.    sbc8(cpu, cpu->l);
  782. }
  783. //#endif
  784. //#ifndef Z80_COMMON
  785. static Z80OPCODE op_9E(Z80 *cpu) { // sbc a,(hl)
  786.    sbc8(cpu, cpu->MemIf->rm(cpu->hl));
  787.    cpu->t += 3;
  788. }
  789. //#endif
  790. //#ifdef Z80_COMMON
  791. Z80OPCODE op_9F(Z80 *cpu) { // sbc a,a
  792.    sbc8(cpu, cpu->a);
  793. }
  794. Z80OPCODE op_A0(Z80 *cpu) { // and b
  795.    and8(cpu, cpu->b);
  796. }
  797. Z80OPCODE op_A1(Z80 *cpu) { // and c
  798.    and8(cpu, cpu->c);
  799. }
  800. Z80OPCODE op_A2(Z80 *cpu) { // and d
  801.    and8(cpu, cpu->d);
  802. }
  803. Z80OPCODE op_A3(Z80 *cpu) { // and e
  804.    and8(cpu, cpu->e);
  805. }
  806. static Z80OPCODE op_A4(Z80 *cpu) { // and h
  807.    and8(cpu, cpu->h);
  808. }
  809. static Z80OPCODE op_A5(Z80 *cpu) { // and l
  810.    and8(cpu, cpu->l);
  811. }
  812. //#endif
  813. //#ifndef Z80_COMMON
  814. static Z80OPCODE op_A6(Z80 *cpu) { // and (hl)
  815.    and8(cpu, cpu->MemIf->rm(cpu->hl));
  816.    cpu->t += 3;
  817. }
  818. //#endif
  819. //#ifdef Z80_COMMON
  820. Z80OPCODE op_A7(Z80 *cpu) { // and a
  821.    and8(cpu, cpu->a); // already optimized by compiler
  822. }
  823. Z80OPCODE op_A8(Z80 *cpu) { // xor b
  824.    xor8(cpu, cpu->b);
  825. }
  826. Z80OPCODE op_A9(Z80 *cpu) { // xor c
  827.    xor8(cpu, cpu->c);
  828. }
  829. Z80OPCODE op_AA(Z80 *cpu) { // xor d
  830.    xor8(cpu, cpu->d);
  831. }
  832. Z80OPCODE op_AB(Z80 *cpu) { // xor e
  833.    xor8(cpu, cpu->e);
  834. }
  835. static Z80OPCODE op_AC(Z80 *cpu) { // xor h
  836.    xor8(cpu, cpu->h);
  837. }
  838. static Z80OPCODE op_AD(Z80 *cpu) { // xor l
  839.    xor8(cpu, cpu->l);
  840. }
  841. //#endif
  842. //#ifndef Z80_COMMON
  843. static Z80OPCODE op_AE(Z80 *cpu) { // xor (hl)
  844.    xor8(cpu, cpu->MemIf->rm(cpu->hl));
  845.    cpu->t += 3;
  846. }
  847. //#endif
  848. //#ifdef Z80_COMMON
  849. Z80OPCODE op_AF(Z80 *cpu) { // xor a
  850.    cpu->af = ZF | PV;
  851. }
  852. Z80OPCODE op_B0(Z80 *cpu) { // or b
  853.    or8(cpu, cpu->b);
  854. }
  855. Z80OPCODE op_B1(Z80 *cpu) { // or c
  856.    or8(cpu, cpu->c);
  857. }
  858. Z80OPCODE op_B2(Z80 *cpu) { // or d
  859.    or8(cpu, cpu->d);
  860. }
  861. Z80OPCODE op_B3(Z80 *cpu) { // or e
  862.    or8(cpu, cpu->e);
  863. }
  864. static Z80OPCODE op_B4(Z80 *cpu) { // or h
  865.    or8(cpu, cpu->h);
  866. }
  867. static Z80OPCODE op_B5(Z80 *cpu) { // or l
  868.    or8(cpu, cpu->l);
  869. }
  870. //#endif
  871. //#ifndef Z80_COMMON
  872. static Z80OPCODE op_B6(Z80 *cpu) { // or (hl)
  873.    or8(cpu, cpu->MemIf->rm(cpu->hl));
  874.    cpu->t += 3;
  875. }
  876. //#endif
  877. //#ifdef Z80_COMMON
  878. Z80OPCODE op_B7(Z80 *cpu) { // or a
  879.    or8(cpu, cpu->a);  // already optimized by compiler
  880. }
  881. Z80OPCODE op_B8(Z80 *cpu) { // cp b
  882.    cp8(cpu, cpu->b);
  883. }
  884. Z80OPCODE op_B9(Z80 *cpu) { // cp c
  885.    cp8(cpu, cpu->c);
  886. }
  887. Z80OPCODE op_BA(Z80 *cpu) { // cp d
  888.    cp8(cpu, cpu->d);
  889. }
  890. Z80OPCODE op_BB(Z80 *cpu) { // cp e
  891.    cp8(cpu, cpu->e);
  892. }
  893. static Z80OPCODE op_BC(Z80 *cpu) { // cp h
  894.    cp8(cpu, cpu->h);
  895. }
  896. static Z80OPCODE op_BD(Z80 *cpu) { // cp l
  897.    cp8(cpu, cpu->l);
  898. }
  899. //#endif
  900. //#ifndef Z80_COMMON
  901. static Z80OPCODE op_BE(Z80 *cpu) { // cp (hl)
  902.    cp8(cpu, cpu->MemIf->rm(cpu->hl));
  903.    cpu->t += 3;
  904. }
  905. //#endif
  906. //#ifdef Z80_COMMON
  907. Z80OPCODE op_BF(Z80 *cpu) { // cp a
  908.    cp8(cpu, cpu->a); // can't optimize: F3,F5 depends on A
  909. }
  910. //#endif
  911. //#ifndef Z80_COMMON
  912. Z80OPCODE op_C0(Z80 *cpu) { // ret nz
  913.    if (!(cpu->f & ZF)) {
  914.       unsigned addr = cpu->MemIf->rm(cpu->sp++);
  915.       addr += 0x100*cpu->MemIf->rm(cpu->sp++);
  916.       cpu->last_branch = u16(cpu->pc-1);
  917.       cpu->pc = addr;
  918.       cpu->memptr = addr;
  919.       cpu->t += 7;
  920.    } else cpu->t += 1;
  921. }
  922. Z80OPCODE op_C1(Z80 *cpu) { // pop bc
  923.    cpu->c = cpu->MemIf->rm(cpu->sp++);
  924.    cpu->b = cpu->MemIf->rm(cpu->sp++);
  925.    cpu->t += 6;
  926. }
  927. Z80OPCODE op_C2(Z80 *cpu) { // jp nz,nnnn
  928.    cpu->t += 6;
  929.    unsigned addr = cpu->MemIf->xm(cpu->pc);
  930.    addr += 0x100*cpu->MemIf->xm(cpu->pc+1);
  931.    cpu->memptr = addr;
  932.    if (!(cpu->f & ZF)) {
  933.       cpu->last_branch = u16(cpu->pc-1);
  934.       cpu->pc = addr;
  935.    } else cpu->pc += 2;
  936. }
  937. Z80OPCODE op_C3(Z80 *cpu) { // jp nnnn
  938.    cpu->last_branch = u16(cpu->pc-1);
  939.    unsigned lo = cpu->MemIf->xm(cpu->pc++);
  940.    cpu->pc = lo + 0x100*cpu->MemIf->xm(cpu->pc);
  941.    cpu->memptr = cpu->pc;
  942.    cpu->t += 6;
  943. }
  944. Z80OPCODE op_C4(Z80 *cpu) { // call nz,nnnn | cc==true M:5 T:17 (4, 3, 4, 3, 3) | cc==false M:3 T:10 (4, 3, 3)
  945.    cpu->pc += 2;
  946.    unsigned addr = cpu->MemIf->xm(cpu->pc-2);
  947.    addr += 0x100*cpu->MemIf->xm(cpu->pc-1);
  948.    cpu->memptr = addr;
  949.    if (!(cpu->f & ZF)) {
  950.       cpu->MemIf->wm(--cpu->sp, cpu->pch);
  951.       cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  952.       cpu->last_branch = u16(cpu->pc-1);
  953.       cpu->pc = addr;
  954.       cpu->t += 13;
  955.    } else cpu->t += 6;
  956. }
  957. Z80OPCODE op_C5(Z80 *cpu) { // push bc | M:3 T:11 (5, 3, 3)
  958. //   wm(--cpu->sp, cpu->b);
  959. //   wm(--cpu->sp, cpu->c);
  960.    cpu->t += 7;
  961.    cpu->MemIf->wm(--cpu->sp, cpu->b);
  962.    cpu->MemIf->wm(--cpu->sp, cpu->c);
  963.  //Alone Coder
  964. }
  965. Z80OPCODE op_C6(Z80 *cpu) { // add a,nn
  966.    add8(cpu, cpu->MemIf->xm(cpu->pc++));
  967.    cpu->t += 3;
  968. }
  969. Z80OPCODE op_C7(Z80 *cpu) { // rst 00 | M:3 T:11 (5, 3, 3)
  970.    cpu->MemIf->wm(--cpu->sp, cpu->pch);
  971.    cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  972.    cpu->last_branch = u16(cpu->pc-1);
  973.    cpu->pc = 0x00;
  974.    cpu->memptr = 0x00;
  975.    cpu->t += 7;
  976. }
  977. Z80OPCODE op_C8(Z80 *cpu) { // ret z
  978.    if (cpu->f & ZF) {
  979.       unsigned addr = cpu->MemIf->rm(cpu->sp++);
  980.       addr += 0x100*cpu->MemIf->rm(cpu->sp++);
  981.       cpu->last_branch = u16(cpu->pc-1);
  982.       cpu->pc = addr;
  983.       cpu->memptr = addr;
  984.       cpu->t += 7;
  985.    } else cpu->t += 1;
  986. }
  987. Z80OPCODE op_C9(Z80 *cpu) { // ret
  988.    unsigned addr = cpu->MemIf->rm(cpu->sp++);
  989.    addr += 0x100*cpu->MemIf->rm(cpu->sp++);
  990.    cpu->last_branch = u16(cpu->pc-1);
  991.    cpu->pc = addr;
  992.    cpu->memptr = addr;
  993.    cpu->t += 6;
  994. }
  995. Z80OPCODE op_CA(Z80 *cpu) { // jp z,nnnn
  996.    cpu->t += 6;
  997.    unsigned addr = cpu->MemIf->xm(cpu->pc);
  998.    addr += 0x100*cpu->MemIf->xm(cpu->pc+1);
  999.    cpu->memptr = addr;
  1000.    if (cpu->f & ZF) {
  1001.       cpu->last_branch = u16(cpu->pc-1);
  1002.       cpu->pc = addr;
  1003.    } else cpu->pc += 2;
  1004. }
  1005. Z80OPCODE op_CC(Z80 *cpu) { // call z,nnnn | cc==true M:5 T:17 (4, 3, 4, 3, 3) | cc==false M:3 T:10 (4, 3, 3)
  1006.    cpu->pc += 2;
  1007.    unsigned addr = cpu->MemIf->xm(cpu->pc-2);
  1008.    addr += 0x100*cpu->MemIf->xm(cpu->pc-1);
  1009.    cpu->memptr = addr;
  1010.    if (cpu->f & ZF) {
  1011.       cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1012.       cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1013.       cpu->last_branch = u16(cpu->pc-1);
  1014.       cpu->pc = addr;
  1015.       cpu->t += 13;
  1016.    } else cpu->t += 6;
  1017. }
  1018. Z80OPCODE op_CD(Z80 *cpu) { // call | M:5 T:17 (4, 3, 4, 3, 3)
  1019.    cpu->last_branch = u16(cpu->pc-1);
  1020.    unsigned addr = cpu->MemIf->xm(cpu->pc++);
  1021.    addr += 0x100*cpu->MemIf->xm(cpu->pc++);
  1022.    cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1023.    cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1024.    cpu->pc = addr;
  1025.    cpu->memptr = addr;
  1026.    cpu->t += 13;
  1027. }
  1028. Z80OPCODE op_CE(Z80 *cpu) { // adc a,nn
  1029.    adc8(cpu, cpu->MemIf->xm(cpu->pc++));
  1030.    cpu->t += 3;
  1031. }
  1032. Z80OPCODE op_CF(Z80 *cpu) { // rst 08 | M:3 T:11 (5, 3, 3)
  1033.    cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1034.    cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1035.    cpu->last_branch = u16(cpu->pc-1);
  1036.    cpu->pc = 0x08;
  1037.    cpu->memptr = 0x08;
  1038.    cpu->memh = 0;
  1039.    cpu->t += 7;
  1040. }
  1041. Z80OPCODE op_D0(Z80 *cpu) { // ret nc
  1042.    if (!(cpu->f & CF)) {
  1043.       unsigned addr = cpu->MemIf->rm(cpu->sp++);
  1044.       addr += 0x100*cpu->MemIf->rm(cpu->sp++);
  1045.       cpu->last_branch = u16(cpu->pc-1);
  1046.       cpu->pc = addr;
  1047.       cpu->memptr = addr;
  1048.       cpu->t += 7;
  1049.    } else cpu->t += 1;
  1050. }
  1051. Z80OPCODE op_D1(Z80 *cpu) { // pop de
  1052.    cpu->e = cpu->MemIf->rm(cpu->sp++);
  1053.    cpu->d = cpu->MemIf->rm(cpu->sp++);
  1054.    cpu->t += 6;
  1055. }
  1056. Z80OPCODE op_D2(Z80 *cpu) { // jp nc,nnnn
  1057.    cpu->t += 6;
  1058.    unsigned addr = cpu->MemIf->xm(cpu->pc);
  1059.    addr += 0x100*cpu->MemIf->xm(cpu->pc+1);
  1060.    cpu->memptr = addr;
  1061.    if (!(cpu->f & CF)) {
  1062.       cpu->last_branch = u16(cpu->pc-1);
  1063.       cpu->pc = addr;
  1064.    } else cpu->pc += 2;
  1065. }
  1066. Z80OPCODE op_D3(Z80 *cpu) { // out (nn),a | M:3 T:11 (4, 3, 4)
  1067.    unsigned port = cpu->MemIf->xm(cpu->pc++);
  1068.    cpu->t += 7;
  1069.    cpu->memptr = ((port+1) & 0xFF) + unsigned(cpu->a << 8);
  1070.    cpu->out(port + unsigned(cpu->a << 8), cpu->a);
  1071. }
  1072. Z80OPCODE op_D4(Z80 *cpu) { // call nc,nnnn | cc==true M:5 T:17 (4, 3, 4, 3, 3) | cc==false M:3 T:10 (4, 3, 3)
  1073.    cpu->pc += 2;
  1074.    unsigned addr = cpu->MemIf->xm(cpu->pc-2);
  1075.    addr += 0x100*cpu->MemIf->xm(cpu->pc-1);
  1076.    cpu->memptr = addr;
  1077.    if (!(cpu->f & CF)) {
  1078.       cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1079.       cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1080.       cpu->last_branch = u16(cpu->pc-1);
  1081.       cpu->pc = addr;
  1082.       cpu->t += 13;
  1083.    } else cpu->t += 6;
  1084. }
  1085. Z80OPCODE op_D5(Z80 *cpu) { // push de | M:3 T:11 (5, 3, 3)
  1086. //   wm(--cpu->sp, cpu->d);
  1087. //   wm(--cpu->sp, cpu->e);
  1088.    cpu->t += 7;
  1089.    cpu->MemIf->wm(--cpu->sp, cpu->d);
  1090.    cpu->MemIf->wm(--cpu->sp, cpu->e);
  1091.  //Alone Coder
  1092. }
  1093. Z80OPCODE op_D6(Z80 *cpu) { // sub nn
  1094.    sub8(cpu, cpu->MemIf->xm(cpu->pc++));
  1095.    cpu->t += 3;
  1096. }
  1097. Z80OPCODE op_D7(Z80 *cpu) { // rst 10 | M:3 T:11 (5, 3, 3)
  1098.    cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1099.    cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1100.    cpu->last_branch = u16(cpu->pc-1);
  1101.    cpu->pc = 0x10;
  1102.    cpu->memptr = 0x10;
  1103.    cpu->t += 7;
  1104. }
  1105. Z80OPCODE op_D8(Z80 *cpu) { // ret c
  1106.    if (cpu->f & CF) {
  1107.       unsigned addr = cpu->MemIf->rm(cpu->sp++);
  1108.       addr += 0x100*cpu->MemIf->rm(cpu->sp++);
  1109.       cpu->last_branch = u16(cpu->pc-1);
  1110.       cpu->pc = addr;
  1111.       cpu->memptr = addr;
  1112.       cpu->t += 7;
  1113.    } else cpu->t += 1;
  1114. }
  1115. //#endif
  1116. //#ifdef Z80_COMMON
  1117. Z80OPCODE op_D9(Z80 *cpu) { // exx
  1118.    unsigned tmp = cpu->bc; cpu->bc = cpu->alt.bc; cpu->alt.bc = tmp;
  1119.    tmp = cpu->de; cpu->de = cpu->alt.de; cpu->alt.de = tmp;
  1120.    tmp = cpu->hl; cpu->hl = cpu->alt.hl; cpu->alt.hl = tmp;
  1121. }
  1122. //#endif
  1123. //#ifndef Z80_COMMON
  1124. Z80OPCODE op_DA(Z80 *cpu) { // jp c,nnnn
  1125.    cpu->t += 6;
  1126.    unsigned addr = cpu->MemIf->xm(cpu->pc);
  1127.    addr += 0x100*cpu->MemIf->xm(cpu->pc+1);
  1128.    cpu->memptr = addr;
  1129.    if (cpu->f & CF) {
  1130.       cpu->last_branch = u16(cpu->pc-1);
  1131.       cpu->pc = addr;
  1132.    } else cpu->pc += 2;
  1133. }
  1134. Z80OPCODE op_DB(Z80 *cpu) { // in a,(nn)
  1135.    unsigned port = cpu->MemIf->xm(cpu->pc++) + unsigned(cpu->a << 8);
  1136.    cpu->memptr = port + 1;
  1137.    cpu->t += 7;
  1138.    cpu->a = cpu->in(port);
  1139. }
  1140. Z80OPCODE op_DC(Z80 *cpu) { // call c,nnnn | cc==true M:5 T:17 (4, 3, 4, 3, 3) | cc==false M:3 T:10 (4, 3, 3)
  1141.    cpu->pc += 2;
  1142.    unsigned addr = cpu->MemIf->xm(cpu->pc-2);
  1143.    addr += 0x100*cpu->MemIf->xm(cpu->pc-1);
  1144.    cpu->memptr = addr;
  1145.    if (cpu->f & CF) {
  1146.       cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1147.       cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1148.       cpu->last_branch = u16(cpu->pc-1);
  1149.       cpu->pc = addr;
  1150.       cpu->t += 13;
  1151.    } else cpu->t += 6;
  1152. }
  1153. Z80OPCODE op_DE(Z80 *cpu) { // sbc a,nn
  1154.    sbc8(cpu, cpu->MemIf->xm(cpu->pc++));
  1155.    cpu->t += 3;
  1156. }
  1157. Z80OPCODE op_DF(Z80 *cpu) { // rst 18 | M:3 T:11 (5, 3, 3)
  1158.    cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1159.    cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1160.    cpu->last_branch = u16(cpu->pc-1);
  1161.    cpu->pc = 0x18;
  1162.    cpu->memptr = 0x18;
  1163.    cpu->t += 7;
  1164. }
  1165. Z80OPCODE op_E0(Z80 *cpu) { // ret po
  1166.    if (!(cpu->f & PV)) {
  1167.       unsigned addr = cpu->MemIf->rm(cpu->sp++);
  1168.       addr += 0x100*cpu->MemIf->rm(cpu->sp++);
  1169.       cpu->pc = addr;
  1170.       cpu->memptr = addr;
  1171.       cpu->t += 7;
  1172.    } else cpu->t += 1;
  1173. }
  1174. static Z80OPCODE op_E1(Z80 *cpu) { // pop hl
  1175.    cpu->l = cpu->MemIf->rm(cpu->sp++);
  1176.    cpu->h = cpu->MemIf->rm(cpu->sp++);
  1177.    cpu->t += 6;
  1178. }
  1179. Z80OPCODE op_E2(Z80 *cpu) { // jp po,nnnn
  1180.    cpu->t += 6;
  1181.    unsigned addr = cpu->MemIf->xm(cpu->pc);
  1182.    addr += 0x100*cpu->MemIf->xm(cpu->pc+1);
  1183.    cpu->memptr = addr;
  1184.    if (!(cpu->f & PV)) {
  1185.       cpu->last_branch = u16(cpu->pc-1);
  1186.       cpu->pc = addr;
  1187.    } else cpu->pc += 2;
  1188. }
  1189. static Z80OPCODE op_E3(Z80 *cpu) { // ex (sp),hl | M:5 T:19 (4, 3, 4, 3, 5)
  1190.    unsigned tmp = cpu->MemIf->rm(cpu->sp) + 0x100*cpu->MemIf->rm(cpu->sp + 1);
  1191.    cpu->MemIf->wm(cpu->sp, cpu->l);
  1192.    cpu->MemIf->wm(cpu->sp+1, cpu->h);
  1193.    cpu->memptr = tmp;
  1194.    cpu->hl = tmp;
  1195.    cpu->t += 15;
  1196. }
  1197. Z80OPCODE op_E4(Z80 *cpu) { // call po,nnnn | cc==true M:5 T:17 (4, 3, 4, 3, 3) | cc==false M:3 T:10 (4, 3, 3)
  1198.    cpu->pc += 2;
  1199.    unsigned addr = cpu->MemIf->xm(cpu->pc-2);
  1200.    addr += 0x100*cpu->MemIf->xm(cpu->pc-1);
  1201.    cpu->memptr = addr;
  1202.    if (!(cpu->f & PV)) {
  1203.       cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1204.       cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1205.       cpu->last_branch = u16(cpu->pc-1);
  1206.       cpu->pc = addr;
  1207.       cpu->t += 13;
  1208.    } else cpu->t += 6;
  1209. }
  1210. static Z80OPCODE op_E5(Z80 *cpu) { // push hl | M:3 T:11 (5, 3, 3)
  1211. //   wm(--cpu->sp, cpu->h);
  1212. //   wm(--cpu->sp, cpu->l);
  1213.    cpu->t += 7;
  1214.    cpu->MemIf->wm(--cpu->sp, cpu->h);
  1215.    cpu->MemIf->wm(--cpu->sp, cpu->l);
  1216.  //Alone Coder
  1217. }
  1218. Z80OPCODE op_E6(Z80 *cpu) { // and nn
  1219.    and8(cpu, cpu->MemIf->xm(cpu->pc++));
  1220.    cpu->t += 3;
  1221. }
  1222. Z80OPCODE op_E7(Z80 *cpu) { // rst 20 | M:3 T:11 (5, 3, 3)
  1223.    cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1224.    cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1225.    cpu->last_branch = u16(cpu->pc-1);
  1226.    cpu->pc = 0x20;
  1227.    cpu->memptr = 0x20;
  1228.    cpu->t += 7;
  1229. }
  1230. Z80OPCODE op_E8(Z80 *cpu) { // ret pe
  1231.    if (cpu->f & PV) {
  1232.       unsigned addr = cpu->MemIf->rm(cpu->sp++);
  1233.       addr += 0x100*cpu->MemIf->rm(cpu->sp++);
  1234.       cpu->last_branch = u16(cpu->pc-1);
  1235.       cpu->pc = addr;
  1236.       cpu->memptr = addr;
  1237.       cpu->t += 7;
  1238.    } else cpu->t += 1;
  1239. }
  1240. //#endif
  1241. //#ifdef Z80_COMMON
  1242. static Z80OPCODE op_E9(Z80 *cpu) { // jp (hl)
  1243.    cpu->last_branch = u16(cpu->pc-1);
  1244.    cpu->pc = cpu->hl;
  1245. }
  1246. //#endif
  1247. //#ifndef Z80_COMMON
  1248. Z80OPCODE op_EA(Z80 *cpu) { // jp pe,nnnn
  1249.    cpu->t += 6;
  1250.    unsigned addr = cpu->MemIf->xm(cpu->pc);
  1251.    addr += 0x100*cpu->MemIf->xm(cpu->pc+1);
  1252.    cpu->memptr = addr;
  1253.    if (cpu->f & PV) {
  1254.       cpu->last_branch = u16(cpu->pc-1);
  1255.       cpu->pc = addr;
  1256.    } else cpu->pc += 2;
  1257. }
  1258. //#endif
  1259. //#ifdef Z80_COMMON
  1260. Z80OPCODE op_EB(Z80 *cpu) { // ex de,hl
  1261.    unsigned tmp = cpu->de;
  1262.    cpu->de = cpu->hl;
  1263.    cpu->hl = tmp;
  1264. }
  1265. //#endif
  1266. //#ifndef Z80_COMMON
  1267. Z80OPCODE op_EC(Z80 *cpu) { // call pe,nnnn | cc==true M:5 T:17 (4, 3, 4, 3, 3) | cc==false M:3 T:10 (4, 3, 3)
  1268.    cpu->pc += 2;
  1269.    unsigned addr = cpu->MemIf->xm(cpu->pc-2);
  1270.    addr += 0x100*cpu->MemIf->xm(cpu->pc-1);
  1271.    cpu->memptr = addr;
  1272.    if (cpu->f & PV) {
  1273.       cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1274.       cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1275.       cpu->last_branch = u16(cpu->pc-1);
  1276.       cpu->pc = addr;
  1277.       cpu->t += 13;
  1278.    } else cpu->t += 6;
  1279. }
  1280. Z80OPCODE op_EE(Z80 *cpu) { // xor nn
  1281.    xor8(cpu, cpu->MemIf->xm(cpu->pc++));
  1282.    cpu->t += 3;
  1283. }
  1284. Z80OPCODE op_EF(Z80 *cpu) { // rst 28 | M:3 T:11 (5, 3, 3)
  1285.    cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1286.    cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1287.    cpu->last_branch = u16(cpu->pc-1);
  1288.    cpu->pc = 0x28;
  1289.    cpu->memptr = 0x28;
  1290.    cpu->t += 7;
  1291. }
  1292. Z80OPCODE op_F0(Z80 *cpu) { // ret p
  1293.    if (!(cpu->f & SF)) {
  1294.       unsigned addr = cpu->MemIf->rm(cpu->sp++);
  1295.       addr += 0x100*cpu->MemIf->rm(cpu->sp++);
  1296.       cpu->last_branch = u16(cpu->pc-1);
  1297.       cpu->pc = addr;
  1298.       cpu->memptr = addr;
  1299.       cpu->t += 7;
  1300.    } else cpu->t += 1;
  1301. }
  1302. Z80OPCODE op_F1(Z80 *cpu) { // pop af
  1303.    cpu->f = cpu->MemIf->rm(cpu->sp++);
  1304.    cpu->a = cpu->MemIf->rm(cpu->sp++);
  1305.    cpu->t += 6;
  1306. }
  1307. Z80OPCODE op_F2(Z80 *cpu) { // jp p,nnnn
  1308.    cpu->t += 6;
  1309.    unsigned addr = cpu->MemIf->xm(cpu->pc);
  1310.    addr += 0x100*cpu->MemIf->xm(cpu->pc+1);
  1311.    cpu->memptr = addr;
  1312.    if (!(cpu->f & SF)) {
  1313.       cpu->last_branch = u16(cpu->pc-1);
  1314.       cpu->pc = addr;
  1315.    } else cpu->pc += 2;
  1316. }
  1317. //#endif
  1318. //#ifdef Z80_COMMON
  1319. Z80OPCODE op_F3(Z80 *cpu) { // di
  1320.    cpu->iff1 = cpu->iff2 = 0;
  1321. }
  1322. //#endif
  1323. //#ifndef Z80_COMMON
  1324. Z80OPCODE op_F4(Z80 *cpu) { // call p,nnnn | cc==true M:5 T:17 (4, 3, 4, 3, 3) | cc==false M:3 T:10 (4, 3, 3)
  1325.    cpu->pc += 2;
  1326.    unsigned addr = cpu->MemIf->xm(cpu->pc-2);
  1327.    addr += 0x100*cpu->MemIf->xm(cpu->pc-1);
  1328.    cpu->memptr = addr;
  1329.    if (!(cpu->f & SF)) {
  1330.       cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1331.       cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1332.       cpu->last_branch = u16(cpu->pc-1);
  1333.       cpu->pc = addr;
  1334.       cpu->t += 13;
  1335.    } else cpu->t += 6;
  1336. }
  1337. Z80OPCODE op_F5(Z80 *cpu) { // push af | M:3 T:11 (5, 3, 3)
  1338. //   wm(--cpu->sp, cpu->a);
  1339. //   wm(--cpu->sp, cpu->f);
  1340.    cpu->t += 7;
  1341.    cpu->MemIf->wm(--cpu->sp, cpu->a);
  1342.    cpu->MemIf->wm(--cpu->sp, cpu->f);
  1343.  //Alone Coder
  1344. }
  1345. Z80OPCODE op_F6(Z80 *cpu) { // or nn
  1346.    or8(cpu, cpu->MemIf->xm(cpu->pc++));
  1347.    cpu->t += 3;
  1348. }
  1349. Z80OPCODE op_F7(Z80 *cpu) { // rst 30 | M:3 T:11 (5, 3, 3)
  1350.    cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1351.    cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1352.    cpu->last_branch = u16(cpu->pc-1);
  1353.    cpu->pc = 0x30;
  1354.    cpu->memptr = 0x30;
  1355.    cpu->t += 7;
  1356. }
  1357. Z80OPCODE op_F8(Z80 *cpu) { // ret m
  1358.    if (cpu->f & SF) {
  1359.       unsigned addr = cpu->MemIf->rm(cpu->sp++);
  1360.       addr += 0x100*cpu->MemIf->rm(cpu->sp++);
  1361.       cpu->last_branch = u16(cpu->pc-1);
  1362.       cpu->pc = addr;
  1363.       cpu->memptr = addr;
  1364.       cpu->t += 7;
  1365.    } else cpu->t += 1;
  1366. }
  1367. //#endif
  1368. //#ifdef Z80_COMMON
  1369. static Z80OPCODE op_F9(Z80 *cpu) { // ld sp,hl
  1370.    cpu->sp = cpu->hl;
  1371.    cpu->t += 2;
  1372. }
  1373. //#endif
  1374. //#ifndef Z80_COMMON
  1375. Z80OPCODE op_FA(Z80 *cpu) { // jp m,nnnn
  1376.    cpu->t += 6;
  1377.    unsigned addr = cpu->MemIf->xm(cpu->pc);
  1378.    addr += 0x100*cpu->MemIf->xm(cpu->pc+1);
  1379.    cpu->memptr = addr;
  1380.    if (cpu->f & SF) {
  1381.       cpu->last_branch = u16(cpu->pc-1);
  1382.       cpu->pc = addr;
  1383.    } else cpu->pc += 2;
  1384. }
  1385. //#endif
  1386. //#ifdef Z80_COMMON
  1387. Z80OPCODE op_FB(Z80 *cpu) { // ei
  1388.    cpu->iff1 = cpu->iff2 = 1;
  1389.    cpu->eipos = cpu->t;
  1390. }
  1391. //#endif
  1392. //#ifndef Z80_COMMON
  1393. Z80OPCODE op_FC(Z80 *cpu) { // call m,nnnn | cc==true M:5 T:17 (4, 3, 4, 3, 3) | cc==false M:3 T:10 (4, 3, 3)
  1394.    cpu->pc += 2;
  1395.    unsigned addr = cpu->MemIf->xm(cpu->pc-2);
  1396.    addr += 0x100*cpu->MemIf->xm(cpu->pc-1);
  1397.    cpu->memptr = addr;
  1398.    if (cpu->f & SF) {
  1399.       cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1400.       cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1401.       cpu->last_branch = u16(cpu->pc-1);
  1402.       cpu->pc = addr;
  1403.       cpu->t += 13;
  1404.    } else cpu->t += 6;
  1405. }
  1406. Z80OPCODE op_FE(Z80 *cpu) { // cp nn
  1407.    cp8(cpu, cpu->MemIf->xm(cpu->pc++));
  1408.    cpu->t += 3;
  1409. }
  1410. Z80OPCODE op_FF(Z80 *cpu) { // rst 38 | M:3 T:11 (5, 3, 3)
  1411.    cpu->MemIf->wm(--cpu->sp, cpu->pch);
  1412.    cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  1413.    cpu->last_branch = u16(cpu->pc-1);
  1414.    cpu->pc = 0x38;
  1415.    cpu->memptr = 0x38;
  1416.    cpu->t += 7;
  1417. }
  1418.  
  1419. Z80OPCODE op_CB(Z80 *cpu);
  1420. Z80OPCODE op_ED(Z80 *cpu);
  1421. Z80OPCODE op_DD(Z80 *cpu);
  1422. Z80OPCODE op_FD(Z80 *cpu);
  1423.  
  1424. STEPFUNC const normal_opcode[0x100] = {
  1425.  
  1426.    op_00, op_01, op_02, op_03, op_04, op_05, op_06, op_07,
  1427.    op_08, op_09, op_0A, op_0B, op_0C, op_0D, op_0E, op_0F,
  1428.    op_10, op_11, op_12, op_13, op_14, op_15, op_16, op_17,
  1429.    op_18, op_19, op_1A, op_1B, op_1C, op_1D, op_1E, op_1F,
  1430.    op_20, op_21, op_22, op_23, op_24, op_25, op_26, op_27,
  1431.    op_28, op_29, op_2A, op_2B, op_2C, op_2D, op_2E, op_2F,
  1432.    op_30, op_31, op_32, op_33, op_34, op_35, op_36, op_37,
  1433.    op_38, op_39, op_3A, op_3B, op_3C, op_3D, op_3E, op_3F,
  1434.  
  1435.    op_40, op_41, op_42, op_43, op_44, op_45, op_46, op_47,
  1436.    op_48, op_49, op_4A, op_4B, op_4C, op_4D, op_4E, op_4F,
  1437.    op_50, op_51, op_52, op_53, op_54, op_55, op_56, op_57,
  1438.    op_58, op_59, op_5A, op_5B, op_5C, op_5D, op_5E, op_5F,
  1439.    op_60, op_61, op_62, op_63, op_64, op_65, op_66, op_67,
  1440.    op_68, op_69, op_6A, op_6B, op_6C, op_6D, op_6E, op_6F,
  1441.    op_70, op_71, op_72, op_73, op_74, op_75, op_76, op_77,
  1442.    op_78, op_79, op_7A, op_7B, op_7C, op_7D, op_7E, op_7F,
  1443.  
  1444.    op_80, op_81, op_82, op_83, op_84, op_85, op_86, op_87,
  1445.    op_88, op_89, op_8A, op_8B, op_8C, op_8D, op_8E, op_8F,
  1446.    op_90, op_91, op_92, op_93, op_94, op_95, op_96, op_97,
  1447.    op_98, op_99, op_9A, op_9B, op_9C, op_9D, op_9E, op_9F,
  1448.    op_A0, op_A1, op_A2, op_A3, op_A4, op_A5, op_A6, op_A7,
  1449.    op_A8, op_A9, op_AA, op_AB, op_AC, op_AD, op_AE, op_AF,
  1450.    op_B0, op_B1, op_B2, op_B3, op_B4, op_B5, op_B6, op_B7,
  1451.    op_B8, op_B9, op_BA, op_BB, op_BC, op_BD, op_BE, op_BF,
  1452.  
  1453.    op_C0, op_C1, op_C2, op_C3, op_C4, op_C5, op_C6, op_C7,
  1454.    op_C8, op_C9, op_CA, op_CB, op_CC, op_CD, op_CE, op_CF,
  1455.    op_D0, op_D1, op_D2, op_D3, op_D4, op_D5, op_D6, op_D7,
  1456.    op_D8, op_D9, op_DA, op_DB, op_DC, op_DD, op_DE, op_DF,
  1457.    op_E0, op_E1, op_E2, op_E3, op_E4, op_E5, op_E6, op_E7,
  1458.    op_E8, op_E9, op_EA, op_EB, op_EC, op_ED, op_EE, op_EF,
  1459.    op_F0, op_F1, op_F2, op_F3, op_F4, op_F5, op_F6, op_F7,
  1460.    op_F8, op_F9, op_FA, op_FB, op_FC, op_FD, op_FE, op_FF,
  1461.  
  1462. };
  1463. //#endif
  1464.