An emulator, assembler, and disassembler for the Sega Game Gear
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

769 lines
18 KiB

  1. /* Copyright (C) 2014-2016 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. Released under the terms of the MIT License. See LICENSE for details. */
  3. /*
  4. This file contains code to implement the Z80 instruction set. Since there
  5. are a lot of functions, it is kept separate from the main z80.c file. It is
  6. included in the middle of z80.c and should not be compiled separately.
  7. Most of this information can be found in the Z80 User Manual, Revision 06.
  8. Undocumented opcodes, flags, and some additional details come from:
  9. - http://clrhome.org/table/
  10. - http://www.z80.info/z80sflag.htm
  11. */
  12. /*
  13. Unimplemented opcode handler.
  14. */
  15. static uint8_t z80_inst_unimplemented(Z80 *z80, uint8_t opcode)
  16. {
  17. z80->except = true;
  18. z80->exc_code = Z80_EXC_UNIMPLEMENTED_OPCODE;
  19. z80->exc_data = opcode;
  20. return 4;
  21. }
  22. /*
  23. LD r, r' (0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x47, 0x48, 0x49, 0x4A, 0x4B,
  24. 0x4C, 0x4D, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x57, 0x58, 0x59,
  25. 0x5A, 0x5B, 0x5C, 0x5D, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x67,
  26. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6F, 0x78, 0x79, 0x7A, 0x7B, 0x7C,
  27. 0x7D, 0x7F):
  28. Load r' (8-bit register) into r (8-bit register).
  29. */
  30. static uint8_t z80_inst_ld_r_r(Z80 *z80, uint8_t opcode)
  31. {
  32. uint8_t *dst = extract_reg(z80, opcode),
  33. *src = extract_reg(z80, opcode << 3);
  34. *dst = *src;
  35. z80->regfile.pc++;
  36. return 4;
  37. }
  38. /*
  39. LD r, n (0x06, 0x0E, 0x16, 0x1E, 0x26, 0x2E, 0x3E):
  40. Load n (8-bit immediate) into r (8-bit register).
  41. */
  42. static uint8_t z80_inst_ld_r_n(Z80 *z80, uint8_t opcode)
  43. {
  44. uint8_t *reg = extract_reg(z80, opcode);
  45. *reg = mmu_read_byte(z80->mmu, ++z80->regfile.pc);
  46. z80->regfile.pc++;
  47. return 7;
  48. }
  49. /*
  50. LD r, (HL) (0x46, 0x4E, 0x56, 0x5E, 0x66, 0x6E, 0x7E):
  51. Load the contents of HL into r (8-bit register).
  52. */
  53. static uint8_t z80_inst_ld_r_hl(Z80 *z80, uint8_t opcode)
  54. {
  55. uint8_t *reg = extract_reg(z80, opcode);
  56. *reg = mmu_read_byte(z80->mmu, get_pair(z80, REG_HL));
  57. z80->regfile.pc++;
  58. return 7;
  59. }
  60. /*
  61. LD r, (IX+d)
  62. */
  63. // static uint8_t z80_inst_ld_r_ix(Z80 *z80, uint8_t opcode)
  64. /*
  65. LD r, (IY+d)
  66. */
  67. // static uint8_t z80_inst_ld_r_iy(Z80 *z80, uint8_t opcode)
  68. /*
  69. LD (HL), r
  70. */
  71. // static uint8_t z80_inst_ld_hl_r(Z80 *z80, uint8_t opcode)
  72. /*
  73. LD (IX+d), r
  74. */
  75. // static uint8_t z80_inst_ld_ix_r(Z80 *z80, uint8_t opcode)
  76. /*
  77. LD (IY+d), r
  78. */
  79. // static uint8_t z80_inst_ld_iy_r(Z80 *z80, uint8_t opcode)
  80. /*
  81. LD (HL), n
  82. */
  83. // static uint8_t z80_inst_ld_hl_n(Z80 *z80, uint8_t opcode)
  84. /*
  85. LD (IX+d), n
  86. */
  87. // static uint8_t z80_inst_ld_ix_n(Z80 *z80, uint8_t opcode)
  88. /*
  89. LD (IY+d), n
  90. */
  91. // static uint8_t z80_inst_ld_iy_n(Z80 *z80, uint8_t opcode)
  92. /*
  93. LD A, (BC)
  94. */
  95. // static uint8_t z80_inst_ld_a_bc(Z80 *z80, uint8_t opcode)
  96. /*
  97. LD A, (DE)
  98. */
  99. // static uint8_t z80_inst_ld_a_de(Z80 *z80, uint8_t opcode)
  100. /*
  101. LD A, (nn)
  102. */
  103. // static uint8_t z80_inst_ld_a_nn(Z80 *z80, uint8_t opcode)
  104. /*
  105. LD (BC), A
  106. */
  107. // static uint8_t z80_inst_ld_bc_a(Z80 *z80, uint8_t opcode)
  108. /*
  109. LD (DE), A
  110. */
  111. // static uint8_t z80_inst_ld_de_a(Z80 *z80, uint8_t opcode)
  112. /*
  113. LD (nn), A
  114. */
  115. // static uint8_t z80_inst_ld_nn_a(Z80 *z80, uint8_t opcode)
  116. /*
  117. LD A, I
  118. */
  119. // static uint8_t z80_inst_ld_a_i(Z80 *z80, uint8_t opcode)
  120. /*
  121. LD A, R
  122. */
  123. // static uint8_t z80_inst_ld_a_r(Z80 *z80, uint8_t opcode)
  124. /*
  125. LD I,A
  126. */
  127. // static uint8_t z80_inst_ld_i_a(Z80 *z80, uint8_t opcode)
  128. /*
  129. LD R, A
  130. */
  131. // static uint8_t z80_inst_ld_r_a(Z80 *z80, uint8_t opcode)
  132. /*
  133. LD dd, nn (0x01, 0x11, 0x21, 0x31):
  134. Load nn (16-bit immediate) into dd (16-bit register).
  135. */
  136. static uint8_t z80_inst_ld_dd_nn(Z80 *z80, uint8_t opcode)
  137. {
  138. uint8_t pair = extract_pair(opcode);
  139. set_pair(z80, pair, mmu_read_double(z80->mmu, ++z80->regfile.pc));
  140. z80->regfile.pc += 2;
  141. return 10;
  142. }
  143. // LD IX, nn
  144. // LD IY, nn
  145. // LD HL, (nn)
  146. // LD dd, (nn)
  147. // LD IX, (nn)
  148. // LD IY, (nn)
  149. // LD (nn), HL
  150. // LD (nn), dd
  151. // LD (nn), IX
  152. // LD (nn), IY
  153. // LD SP, HL
  154. // LD SP, IX
  155. // LD SP, IY
  156. // PUSH qq
  157. // PUSH IX
  158. // PUSH IY
  159. // POP qq
  160. // POP IX
  161. // POP IY
  162. // EX DE, HL
  163. // EX AF, AF′
  164. /*
  165. EXX (0xD9):
  166. Exchange the 16-bit registers with their shadows
  167. (BC <=> BC', DE <=> DE', HL <=> HL').
  168. */
  169. static uint8_t z80_inst_exx(Z80 *z80, uint8_t opcode)
  170. {
  171. (void) opcode;
  172. uint16_t bc = get_pair(z80, REG_BC),
  173. de = get_pair(z80, REG_DE),
  174. hl = get_pair(z80, REG_HL);
  175. set_pair(z80, REG_BC, get_pair(z80, REG_BC_));
  176. set_pair(z80, REG_DE, get_pair(z80, REG_DE_));
  177. set_pair(z80, REG_HL, get_pair(z80, REG_HL_));
  178. set_pair(z80, REG_BC_, bc);
  179. set_pair(z80, REG_DE_, de);
  180. set_pair(z80, REG_HL_, hl);
  181. z80->regfile.pc++;
  182. return 4;
  183. }
  184. // EX (SP), HL
  185. // EX (SP), IX
  186. // EX (SP), IY
  187. // LDI
  188. // LDIR
  189. // LDD
  190. // LDDR
  191. // CPI
  192. // CPIR
  193. // CPD
  194. // CPDR
  195. // ADD A, r
  196. // ADD A, n
  197. // ADD A, (HL)
  198. // ADD A, (IX + d)
  199. // ADD A, (IY + d)
  200. // ADC A, s
  201. // SUB s
  202. // SBC A, s
  203. // AND s
  204. // OR s
  205. // XOR s
  206. // CP s
  207. /*
  208. INC r (0x04, 0x0C, 0x14, 0x1C, 0x24, 0x2C, 0x3C):
  209. Increment r (8-bit register).
  210. */
  211. static uint8_t z80_inst_inc_r(Z80 *z80, uint8_t opcode)
  212. {
  213. uint8_t *reg = extract_reg(z80, opcode);
  214. bool halfcarry = !!(((*reg & 0x0F) + 1) & 0x10);
  215. (*reg)++;
  216. update_flags(z80, 0, 0, *reg == 0x80, !!(*reg & 0x08), halfcarry,
  217. !!(*reg & 0x20), *reg == 0, !!(*reg & 0x80), 0xFE);
  218. z80->regfile.pc++;
  219. return 4;
  220. }
  221. // INC (HL)
  222. // INC (IX+d)
  223. // INC (IY+d)
  224. // DEC m
  225. // DAA
  226. // CPL
  227. // NEG
  228. // CCF
  229. // SCF
  230. /*
  231. NOP (0x00):
  232. No operation is performed.
  233. */
  234. static uint8_t z80_inst_nop(Z80 *z80, uint8_t opcode)
  235. {
  236. (void) opcode;
  237. z80->regfile.pc++;
  238. return 4;
  239. }
  240. /*
  241. HALT (0x76):
  242. Suspend CPU operation: execute NOPs until an interrupt or reset.
  243. */
  244. static uint8_t z80_inst_halt(Z80 *z80, uint8_t opcode)
  245. {
  246. (void) z80;
  247. (void) opcode;
  248. return 4;
  249. }
  250. /*
  251. DI (0xF3):
  252. Disable maskable interrupts by resetting both flip-flops.
  253. */
  254. static uint8_t z80_inst_di(Z80 *z80, uint8_t opcode)
  255. {
  256. (void) opcode;
  257. z80->regfile.iff1 = false;
  258. z80->regfile.iff2 = false;
  259. z80->regfile.pc++;
  260. return 4;
  261. }
  262. /*
  263. EI (0xFB):
  264. Enable maskable interrupts by setting both flip-flops.
  265. */
  266. static uint8_t z80_inst_ei(Z80 *z80, uint8_t opcode)
  267. {
  268. (void) opcode;
  269. z80->regfile.iff1 = true;
  270. z80->regfile.iff2 = true;
  271. z80->regfile.pc++;
  272. return 4;
  273. }
  274. // IM 0
  275. // IM 1
  276. // IM 2
  277. // ADD HL, ss
  278. // ADC HL, ss
  279. // SBC HL, ss
  280. // ADD IX, pp
  281. // ADD IY, rr
  282. /*
  283. INC ss (0x03, 0x13, 0x23, 0x33):
  284. Increment ss (16-bit register).
  285. */
  286. static uint8_t z80_inst_inc_ss(Z80 *z80, uint8_t opcode)
  287. {
  288. uint8_t pair = extract_pair(opcode);
  289. set_pair(z80, pair, get_pair(z80, pair) + 1);
  290. z80->regfile.pc++;
  291. return 6;
  292. }
  293. // INC IX
  294. // INC IY
  295. // DEC ss
  296. // DEC IX
  297. // DEC IY
  298. // RLCA
  299. // RLA
  300. // RRCA
  301. // RRA
  302. // RLC r
  303. // RLC (HL)
  304. // RLC (IX+d)
  305. // RLC (IY+d)
  306. // RL m
  307. // RRC m
  308. // RR m
  309. // SLA m
  310. // SRA m
  311. // SRL m
  312. // RLD
  313. // RRD
  314. // BIT b, r
  315. // BIT b, (HL)
  316. // BIT b, (IX+d)
  317. // BIT b, (IY+d)
  318. // SET b, r
  319. // SET b, (HL)
  320. // SET b, (IX+d)
  321. // SET b, (IY+d)
  322. // RES b, m
  323. // JP nn
  324. // JP cc, nn
  325. // JR e
  326. // JR C, e
  327. // JR NC, e
  328. // JR Z, e
  329. // JR NZ, e
  330. // JP (HL)
  331. // JP (IX)
  332. // JP (IY)
  333. // DJNZ, e
  334. // CALL nn
  335. // CALL cc, nn
  336. // RET
  337. // RET cc
  338. // RETI
  339. // RETN
  340. // RST p
  341. // IN A, (n)
  342. // IN r (C)
  343. // INI
  344. // INIR
  345. // IND
  346. // INDR
  347. // OUT (n), A
  348. // OUT (C), r
  349. // OUTI
  350. // OTIR
  351. // OUTD
  352. // OTDR
  353. static uint8_t (*instruction_lookup_table[256])(Z80*, uint8_t) = {
  354. [0x00] = z80_inst_nop,
  355. [0x01] = z80_inst_ld_dd_nn,
  356. [0x02] = z80_inst_unimplemented, // TODO
  357. [0x03] = z80_inst_inc_ss,
  358. [0x04] = z80_inst_inc_r,
  359. [0x05] = z80_inst_unimplemented, // TODO
  360. [0x06] = z80_inst_ld_r_n,
  361. [0x07] = z80_inst_unimplemented, // TODO
  362. [0x08] = z80_inst_unimplemented, // TODO
  363. [0x09] = z80_inst_unimplemented, // TODO
  364. [0x0A] = z80_inst_unimplemented, // TODO
  365. [0x0B] = z80_inst_unimplemented, // TODO
  366. [0x0C] = z80_inst_inc_r,
  367. [0x0D] = z80_inst_unimplemented, // TODO
  368. [0x0E] = z80_inst_ld_r_n,
  369. [0x0F] = z80_inst_unimplemented, // TODO
  370. [0x10] = z80_inst_unimplemented, // TODO
  371. [0x11] = z80_inst_ld_dd_nn,
  372. [0x12] = z80_inst_unimplemented, // TODO
  373. [0x13] = z80_inst_inc_ss,
  374. [0x14] = z80_inst_inc_r,
  375. [0x15] = z80_inst_unimplemented, // TODO
  376. [0x16] = z80_inst_ld_r_n,
  377. [0x17] = z80_inst_unimplemented, // TODO
  378. [0x18] = z80_inst_unimplemented, // TODO
  379. [0x19] = z80_inst_unimplemented, // TODO
  380. [0x1A] = z80_inst_unimplemented, // TODO
  381. [0x1B] = z80_inst_unimplemented, // TODO
  382. [0x1C] = z80_inst_inc_r,
  383. [0x1D] = z80_inst_unimplemented, // TODO
  384. [0x1E] = z80_inst_ld_r_n,
  385. [0x1F] = z80_inst_unimplemented, // TODO
  386. [0x20] = z80_inst_unimplemented, // TODO
  387. [0x21] = z80_inst_ld_dd_nn,
  388. [0x22] = z80_inst_unimplemented, // TODO
  389. [0x23] = z80_inst_inc_ss,
  390. [0x24] = z80_inst_inc_r,
  391. [0x25] = z80_inst_unimplemented, // TODO
  392. [0x26] = z80_inst_ld_r_n,
  393. [0x27] = z80_inst_unimplemented, // TODO
  394. [0x28] = z80_inst_unimplemented, // TODO
  395. [0x29] = z80_inst_unimplemented, // TODO
  396. [0x2A] = z80_inst_unimplemented, // TODO
  397. [0x2B] = z80_inst_unimplemented, // TODO
  398. [0x2C] = z80_inst_inc_r,
  399. [0x2D] = z80_inst_unimplemented, // TODO
  400. [0x2E] = z80_inst_ld_r_n,
  401. [0x2F] = z80_inst_unimplemented, // TODO
  402. [0x30] = z80_inst_unimplemented, // TODO
  403. [0x31] = z80_inst_ld_dd_nn,
  404. [0x32] = z80_inst_unimplemented, // TODO
  405. [0x33] = z80_inst_inc_ss,
  406. [0x34] = z80_inst_unimplemented, // TODO
  407. [0x35] = z80_inst_unimplemented, // TODO
  408. [0x36] = z80_inst_unimplemented, // TODO
  409. [0x37] = z80_inst_unimplemented, // TODO
  410. [0x38] = z80_inst_unimplemented, // TODO
  411. [0x39] = z80_inst_unimplemented, // TODO
  412. [0x3A] = z80_inst_unimplemented, // TODO
  413. [0x3B] = z80_inst_unimplemented, // TODO
  414. [0x3C] = z80_inst_inc_r,
  415. [0x3D] = z80_inst_unimplemented, // TODO
  416. [0x3E] = z80_inst_ld_r_n,
  417. [0x3F] = z80_inst_unimplemented, // TODO
  418. [0x40] = z80_inst_ld_r_r,
  419. [0x41] = z80_inst_ld_r_r,
  420. [0x42] = z80_inst_ld_r_r,
  421. [0x43] = z80_inst_ld_r_r,
  422. [0x44] = z80_inst_ld_r_r,
  423. [0x45] = z80_inst_ld_r_r,
  424. [0x46] = z80_inst_ld_r_hl,
  425. [0x47] = z80_inst_ld_r_r,
  426. [0x48] = z80_inst_ld_r_r,
  427. [0x49] = z80_inst_ld_r_r,
  428. [0x4A] = z80_inst_ld_r_r,
  429. [0x4B] = z80_inst_ld_r_r,
  430. [0x4C] = z80_inst_ld_r_r,
  431. [0x4D] = z80_inst_ld_r_r,
  432. [0x4E] = z80_inst_ld_r_hl,
  433. [0x4F] = z80_inst_ld_r_r,
  434. [0x50] = z80_inst_ld_r_r,
  435. [0x51] = z80_inst_ld_r_r,
  436. [0x52] = z80_inst_ld_r_r,
  437. [0x53] = z80_inst_ld_r_r,
  438. [0x54] = z80_inst_ld_r_r,
  439. [0x55] = z80_inst_ld_r_r,
  440. [0x56] = z80_inst_ld_r_hl,
  441. [0x57] = z80_inst_ld_r_r,
  442. [0x58] = z80_inst_ld_r_r,
  443. [0x59] = z80_inst_ld_r_r,
  444. [0x5A] = z80_inst_ld_r_r,
  445. [0x5B] = z80_inst_ld_r_r,
  446. [0x5C] = z80_inst_ld_r_r,
  447. [0x5D] = z80_inst_ld_r_r,
  448. [0x5E] = z80_inst_ld_r_hl,
  449. [0x5F] = z80_inst_ld_r_r,
  450. [0x60] = z80_inst_ld_r_r,
  451. [0x61] = z80_inst_ld_r_r,
  452. [0x62] = z80_inst_ld_r_r,
  453. [0x63] = z80_inst_ld_r_r,
  454. [0x64] = z80_inst_ld_r_r,
  455. [0x65] = z80_inst_ld_r_r,
  456. [0x66] = z80_inst_ld_r_hl,
  457. [0x67] = z80_inst_ld_r_r,
  458. [0x68] = z80_inst_ld_r_r,
  459. [0x69] = z80_inst_ld_r_r,
  460. [0x6A] = z80_inst_ld_r_r,
  461. [0x6B] = z80_inst_ld_r_r,
  462. [0x6C] = z80_inst_ld_r_r,
  463. [0x6D] = z80_inst_ld_r_r,
  464. [0x6E] = z80_inst_ld_r_hl,
  465. [0x6F] = z80_inst_ld_r_r,
  466. [0x70] = z80_inst_unimplemented, // TODO
  467. [0x71] = z80_inst_unimplemented, // TODO
  468. [0x72] = z80_inst_unimplemented, // TODO
  469. [0x73] = z80_inst_unimplemented, // TODO
  470. [0x74] = z80_inst_unimplemented, // TODO
  471. [0x75] = z80_inst_unimplemented, // TODO
  472. [0x76] = z80_inst_halt,
  473. [0x77] = z80_inst_unimplemented, // TODO
  474. [0x78] = z80_inst_ld_r_r,
  475. [0x79] = z80_inst_ld_r_r,
  476. [0x7A] = z80_inst_ld_r_r,
  477. [0x7B] = z80_inst_ld_r_r,
  478. [0x7C] = z80_inst_ld_r_r,
  479. [0x7D] = z80_inst_ld_r_r,
  480. [0x7E] = z80_inst_ld_r_hl,
  481. [0x7F] = z80_inst_ld_r_r,
  482. [0x80] = z80_inst_unimplemented, // TODO
  483. [0x81] = z80_inst_unimplemented, // TODO
  484. [0x82] = z80_inst_unimplemented, // TODO
  485. [0x83] = z80_inst_unimplemented, // TODO
  486. [0x84] = z80_inst_unimplemented, // TODO
  487. [0x85] = z80_inst_unimplemented, // TODO
  488. [0x86] = z80_inst_unimplemented, // TODO
  489. [0x87] = z80_inst_unimplemented, // TODO
  490. [0x88] = z80_inst_unimplemented, // TODO
  491. [0x89] = z80_inst_unimplemented, // TODO
  492. [0x8A] = z80_inst_unimplemented, // TODO
  493. [0x8B] = z80_inst_unimplemented, // TODO
  494. [0x8C] = z80_inst_unimplemented, // TODO
  495. [0x8D] = z80_inst_unimplemented, // TODO
  496. [0x8E] = z80_inst_unimplemented, // TODO
  497. [0x8F] = z80_inst_unimplemented, // TODO
  498. [0x90] = z80_inst_unimplemented, // TODO
  499. [0x91] = z80_inst_unimplemented, // TODO
  500. [0x92] = z80_inst_unimplemented, // TODO
  501. [0x93] = z80_inst_unimplemented, // TODO
  502. [0x94] = z80_inst_unimplemented, // TODO
  503. [0x95] = z80_inst_unimplemented, // TODO
  504. [0x96] = z80_inst_unimplemented, // TODO
  505. [0x97] = z80_inst_unimplemented, // TODO
  506. [0x98] = z80_inst_unimplemented, // TODO
  507. [0x99] = z80_inst_unimplemented, // TODO
  508. [0x9A] = z80_inst_unimplemented, // TODO
  509. [0x9B] = z80_inst_unimplemented, // TODO
  510. [0x9C] = z80_inst_unimplemented, // TODO
  511. [0x9D] = z80_inst_unimplemented, // TODO
  512. [0x9E] = z80_inst_unimplemented, // TODO
  513. [0x9F] = z80_inst_unimplemented, // TODO
  514. [0xA0] = z80_inst_unimplemented, // TODO
  515. [0xA1] = z80_inst_unimplemented, // TODO
  516. [0xA2] = z80_inst_unimplemented, // TODO
  517. [0xA3] = z80_inst_unimplemented, // TODO
  518. [0xA4] = z80_inst_unimplemented, // TODO
  519. [0xA5] = z80_inst_unimplemented, // TODO
  520. [0xA6] = z80_inst_unimplemented, // TODO
  521. [0xA7] = z80_inst_unimplemented, // TODO
  522. [0xA8] = z80_inst_unimplemented, // TODO
  523. [0xA9] = z80_inst_unimplemented, // TODO
  524. [0xAA] = z80_inst_unimplemented, // TODO
  525. [0xAB] = z80_inst_unimplemented, // TODO
  526. [0xAC] = z80_inst_unimplemented, // TODO
  527. [0xAD] = z80_inst_unimplemented, // TODO
  528. [0xAE] = z80_inst_unimplemented, // TODO
  529. [0xAF] = z80_inst_unimplemented, // TODO
  530. [0xB0] = z80_inst_unimplemented, // TODO
  531. [0xB1] = z80_inst_unimplemented, // TODO
  532. [0xB2] = z80_inst_unimplemented, // TODO
  533. [0xB3] = z80_inst_unimplemented, // TODO
  534. [0xB4] = z80_inst_unimplemented, // TODO
  535. [0xB5] = z80_inst_unimplemented, // TODO
  536. [0xB6] = z80_inst_unimplemented, // TODO
  537. [0xB7] = z80_inst_unimplemented, // TODO
  538. [0xB8] = z80_inst_unimplemented, // TODO
  539. [0xB9] = z80_inst_unimplemented, // TODO
  540. [0xBA] = z80_inst_unimplemented, // TODO
  541. [0xBB] = z80_inst_unimplemented, // TODO
  542. [0xBC] = z80_inst_unimplemented, // TODO
  543. [0xBD] = z80_inst_unimplemented, // TODO
  544. [0xBE] = z80_inst_unimplemented, // TODO
  545. [0xBF] = z80_inst_unimplemented, // TODO
  546. [0xC0] = z80_inst_unimplemented, // TODO
  547. [0xC1] = z80_inst_unimplemented, // TODO
  548. [0xC2] = z80_inst_unimplemented, // TODO
  549. [0xC3] = z80_inst_unimplemented, // TODO
  550. [0xC4] = z80_inst_unimplemented, // TODO
  551. [0xC5] = z80_inst_unimplemented, // TODO
  552. [0xC6] = z80_inst_unimplemented, // TODO
  553. [0xC7] = z80_inst_unimplemented, // TODO
  554. [0xC8] = z80_inst_unimplemented, // TODO
  555. [0xC9] = z80_inst_unimplemented, // TODO
  556. [0xCA] = z80_inst_unimplemented, // TODO
  557. [0xCB] = z80_inst_unimplemented, // TODO
  558. [0xCC] = z80_inst_unimplemented, // TODO
  559. [0xCD] = z80_inst_unimplemented, // TODO
  560. [0xCE] = z80_inst_unimplemented, // TODO
  561. [0xCF] = z80_inst_unimplemented, // TODO
  562. [0xD0] = z80_inst_unimplemented, // TODO
  563. [0xD1] = z80_inst_unimplemented, // TODO
  564. [0xD2] = z80_inst_unimplemented, // TODO
  565. [0xD3] = z80_inst_unimplemented, // TODO
  566. [0xD4] = z80_inst_unimplemented, // TODO
  567. [0xD5] = z80_inst_unimplemented, // TODO
  568. [0xD6] = z80_inst_unimplemented, // TODO
  569. [0xD7] = z80_inst_unimplemented, // TODO
  570. [0xD8] = z80_inst_unimplemented, // TODO
  571. [0xD9] = z80_inst_exx,
  572. [0xDA] = z80_inst_unimplemented, // TODO
  573. [0xDB] = z80_inst_unimplemented, // TODO
  574. [0xDC] = z80_inst_unimplemented, // TODO
  575. [0xDD] = z80_inst_unimplemented, // TODO
  576. [0xDE] = z80_inst_unimplemented, // TODO
  577. [0xDF] = z80_inst_unimplemented, // TODO
  578. [0xE0] = z80_inst_unimplemented, // TODO
  579. [0xE1] = z80_inst_unimplemented, // TODO
  580. [0xE2] = z80_inst_unimplemented, // TODO
  581. [0xE3] = z80_inst_unimplemented, // TODO
  582. [0xE4] = z80_inst_unimplemented, // TODO
  583. [0xE5] = z80_inst_unimplemented, // TODO
  584. [0xE6] = z80_inst_unimplemented, // TODO
  585. [0xE7] = z80_inst_unimplemented, // TODO
  586. [0xE8] = z80_inst_unimplemented, // TODO
  587. [0xE9] = z80_inst_unimplemented, // TODO
  588. [0xEA] = z80_inst_unimplemented, // TODO
  589. [0xEB] = z80_inst_unimplemented, // TODO
  590. [0xEC] = z80_inst_unimplemented, // TODO
  591. [0xED] = z80_inst_unimplemented, // TODO
  592. [0xEE] = z80_inst_unimplemented, // TODO
  593. [0xEF] = z80_inst_unimplemented, // TODO
  594. [0xF0] = z80_inst_unimplemented, // TODO
  595. [0xF1] = z80_inst_unimplemented, // TODO
  596. [0xF2] = z80_inst_unimplemented, // TODO
  597. [0xF3] = z80_inst_di,
  598. [0xF4] = z80_inst_unimplemented, // TODO
  599. [0xF5] = z80_inst_unimplemented, // TODO
  600. [0xF6] = z80_inst_unimplemented, // TODO
  601. [0xF7] = z80_inst_unimplemented, // TODO
  602. [0xF8] = z80_inst_unimplemented, // TODO
  603. [0xF9] = z80_inst_unimplemented, // TODO
  604. [0xFA] = z80_inst_unimplemented, // TODO
  605. [0xFB] = z80_inst_ei,
  606. [0xFC] = z80_inst_unimplemented, // TODO
  607. [0xFD] = z80_inst_unimplemented, // TODO
  608. [0xFE] = z80_inst_unimplemented, // TODO
  609. [0xFF] = z80_inst_unimplemented // TODO
  610. };