Guest User

Untitled

a guest
Feb 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.09 KB | None | 0 0
  1. #include "instructions.h"
  2.  
  3. const t_instruction g_instructions[] = {
  4. /* 3.3.1 - 8 Bits Loads */
  5.  
  6. /* 1. LD nn, n */
  7. /* Description: Put value nn into n */
  8. /* Use with: */
  9. /* nn = B,C,D,E,H,L,BC,DE,HL,SP */
  10. /* n = 8 bit immediate value */
  11. {0x06, "LD B, n", &unimplemented_instruction, 8, 2},
  12. {0x0e, "LD C, n", &unimplemented_instruction, 8, 2},
  13. {0x16, "LD D, n", &unimplemented_instruction, 8, 2},
  14. {0x1e, "LD E, n", &unimplemented_instruction, 8, 2},
  15. {0x26, "LD H, n", &unimplemented_instruction, 8, 2},
  16. {0x2e, "LD L, n", &unimplemented_instruction, 8, 2},
  17.  
  18. /* 2. LD r1, r2 */
  19. /* Description: Put value r2 into r1 */
  20. /* Use with: */
  21. /* r1, r2 = A,B,C,D,E,H,L,(HL) */
  22. {0x7f, "LD A, A", &unimplemented_instruction, 4, 1},
  23. {0x78, "LD A, B", &unimplemented_instruction, 4, 1},
  24. {0x79, "LD A, C", &unimplemented_instruction, 4, 1},
  25. {0x7a, "LD A, D", &unimplemented_instruction, 4, 1},
  26. {0x7b, "LD A, E", &unimplemented_instruction, 4, 1},
  27. {0x7c, "LD A, H", &unimplemented_instruction, 4, 1},
  28. {0x7d, "LD A, L", &unimplemented_instruction, 4, 1},
  29. {0x7e, "LD A, (HL)", &unimplemented_instruction, 8, 1},
  30. {0x40, "LD B, B", &unimplemented_instruction, 4, 1},
  31. {0x41, "LD B, C", &unimplemented_instruction, 4, 1},
  32. {0x42, "LD B, D", &unimplemented_instruction, 4, 1},
  33. {0x43, "LD B, E", &unimplemented_instruction, 4, 1},
  34. {0x44, "LD B, H", &unimplemented_instruction, 4, 1},
  35. {0x45, "LD B, L", &unimplemented_instruction, 4, 1},
  36. {0x46, "LD B, (HL)", &unimplemented_instruction, 8, 1},
  37. {0x48, "LD C, B", &unimplemented_instruction, 4, 1},
  38. {0x49, "LD C, C", &unimplemented_instruction, 4, 1},
  39. {0x4a, "LD C, D", &unimplemented_instruction, 4, 1},
  40. {0x4b, "LD C, E", &unimplemented_instruction, 4, 1},
  41. {0x4c, "LD C, H", &unimplemented_instruction, 4, 1},
  42. {0x4d, "LD C, L", &unimplemented_instruction, 4, 1},
  43. {0x4e, "LD C, (HL)", &unimplemented_instruction, 8, 1},
  44. {0x50, "LD D, B", &unimplemented_instruction, 4, 1},
  45. {0x51, "LD D, C", &unimplemented_instruction, 4, 1},
  46. {0x52, "LD D, D", &unimplemented_instruction, 4, 1},
  47. {0x53, "LD D, E", &unimplemented_instruction, 4, 1},
  48. {0x54, "LD D, H", &unimplemented_instruction, 4, 1},
  49. {0x55, "LD D, L", &unimplemented_instruction, 4, 1},
  50. {0x56, "LD D, (HL)", &unimplemented_instruction, 8, 1},
  51. {0x58, "LD E, B", &unimplemented_instruction, 4, 1},
  52. {0x59, "LD E, C", &unimplemented_instruction, 4, 1},
  53. {0x5a, "LD E, D", &unimplemented_instruction, 4, 1},
  54. {0x5b, "LD E, E", &unimplemented_instruction, 4, 1},
  55. {0x5c, "LD E, H", &unimplemented_instruction, 4, 1},
  56. {0x5d, "LD E, L", &unimplemented_instruction, 4, 1},
  57. {0x5e, "LD E, (HL)", &unimplemented_instruction, 8, 1},
  58. {0x60, "LD H, B", &unimplemented_instruction, 4, 1},
  59. {0x61, "LD H, C", &unimplemented_instruction, 4, 1},
  60. {0x62, "LD H, D", &unimplemented_instruction, 4, 1},
  61. {0x63, "LD H, E", &unimplemented_instruction, 4, 1},
  62. {0x64, "LD H, H", &unimplemented_instruction, 4, 1},
  63. {0x65, "LD H, L", &unimplemented_instruction, 4, 1},
  64. {0x66, "LD H, (HL)", &unimplemented_instruction, 8, 1},
  65. {0x68, "LD L, B", &unimplemented_instruction, 4, 1},
  66. {0x69, "LD L, C", &unimplemented_instruction, 4, 1},
  67. {0x6a, "LD L, D", &unimplemented_instruction, 4, 1},
  68. {0x6b, "LD L, E", &unimplemented_instruction, 4, 1},
  69. {0x6c, "LD L, H", &unimplemented_instruction, 4, 1},
  70. {0x6d, "LD L, L", &unimplemented_instruction, 4, 1},
  71. {0x6e, "LD L, (HL)", &unimplemented_instruction, 8, 1},
  72. {0x70, "LD (HL), B", &unimplemented_instruction, 8, 1},
  73. {0x71, "LD (HL), C", &unimplemented_instruction, 8, 1},
  74. {0x72, "LD (HL), D", &unimplemented_instruction, 8, 1},
  75. {0x73, "LD (HL), E", &unimplemented_instruction, 8, 1},
  76. {0x74, "LD (HL), H", &unimplemented_instruction, 8, 1},
  77. {0x75, "LD (HL), L", &unimplemented_instruction, 8, 1},
  78. {0x36, "LD (HL), n", &unimplemented_instruction, 12, 3},
  79.  
  80. /* 3. LD A, n */
  81. /* Description: Put value n into A */
  82. /* Use with: */
  83. /* n = A,B,C,D,E,H,L,(BC),(DE),(HL),(nn),# */
  84. /* nn = two byte immediate value. (LS byte first.) */
  85. {0x0a, "LD A, (BC)", &unimplemented_instruction, 8, 1},
  86. {0x1a, "LD A, (DE)", &unimplemented_instruction, 8, 1},
  87. {0xfa, "LD A, (nn)", &unimplemented_instruction, 16, 1},
  88. {0x3e, "LD A, #", &unimplemented_instruction, 8, 1},
  89.  
  90. /* 4. LD n, A */
  91. /* Description: Put value A into n */
  92. /* Use with: */
  93. /* n = A,B,C,D,E,H,L,(BC),(DE),(HL),(nn) */
  94. /* nn = two byte immediate value. (LS byte first.) */
  95. {0x47, "LD B, A", &unimplemented_instruction, 4, 1},
  96. {0x4f, "LD C, A", &unimplemented_instruction, 4, 1},
  97. {0x57, "LD D, A", &unimplemented_instruction, 4, 1},
  98. {0x5f, "LD E, A", &unimplemented_instruction, 4, 1},
  99. {0x67, "LD H, A", &unimplemented_instruction, 4, 1},
  100. {0x6f, "LD L, A", &unimplemented_instruction, 4, 1},
  101. {0x02, "LD (BC), A", &unimplemented_instruction, 8, 1},
  102. {0x12, "LD (DE), A", &unimplemented_instruction, 8, 1},
  103. {0x77, "LD (HL), A", &unimplemented_instruction, 8, 1},
  104. {0xea, "LD (nn), A", &unimplemented_instruction, 16, 1},
  105.  
  106. /* 5. LD A, (C) */
  107. {0xf2, "LD A, (C)", &unimplemented_instruction, 8, 1},
  108.  
  109. /* 6. LD (C), A */
  110. {0xe2, "LD ($FF00+C), A", &unimplemented_instruction, 8, 1},
  111.  
  112. /* 7. LD A, (HLD) */
  113. /* Description: Same as: LDD A, (HL) */
  114.  
  115. /* 8. LD A, (HL-) */
  116. /* Description: Same as: LDD A, (HL) */
  117.  
  118. /* 9. LDD A, (HL) */
  119. /* Description: Put value at address HL into A. Decrement HL */
  120. /* Same as: LD A, (HL) - DEC HL */
  121. {0x3a, "LDD A, (HL)", &unimplemented_instruction, 8, 1},
  122.  
  123. /* 10. LD (HLD), A */
  124. /* Description: Same as: LDD (HL), A */
  125.  
  126. /* 11. LD (HL-), A */
  127. /* Description: Same as: LDD (HL), A */
  128.  
  129. /* 12. LDD (HL), A */
  130. /* Description: Put A into memory address HL. Decrement HL */
  131. /* Same as: LD (HL), A - DEC HL */
  132. {0x32, "LDD (HL), A", &unimplemented_instruction, 8, 1},
  133.  
  134.  
  135. /* 13. LD A, (HLI) */
  136. /* Description: Same as: LDI A, (HL) */
  137.  
  138. /* 14. LD A, (HL+) */
  139. /* Description: Same as: LDI A, (HL) */
  140.  
  141. /* 15. LDI A, (HL) */
  142. /* Description: Put value at address HL into A. Increment HL */
  143. /* Same as: LD A, (HL) - INC HL */
  144. {0x2a, "LDI A, (HL)", &unimplemented_instruction, 8, 1},
  145.  
  146. /* 16. LD (HLI), A */
  147. /* Description: Same as: LDD (HL), A */
  148.  
  149. /* 17. LD (HL+), A */
  150. /* Description: Same as: LDD (HL), A */
  151.  
  152. /* 18. LDI (HL), A */
  153. /* Description: Put A into memory address HL. Increment HL */
  154. /* Same as: LD (HL), A - INC HL */
  155. {0x22, "LDI (HL), A", &unimplemented_instruction, 8, 1},
  156.  
  157. /* 19. LDH (n), A */
  158. /* Description: Put A into memory address $FF00+n */
  159. /* Use with: n = one byte immediate value. */
  160. {0xe0, "LD ($FF00+n), A", &unimplemented_instruction, 12, 2},
  161.  
  162. /* 20. LDH A, (n) */
  163. /* Description: Put memory address $FF00+n into A */
  164. /* Use with: n = one byte immediate value */
  165. {0xf0, "LD A, ($FF00+n)", &unimplemented_instruction, 12, 1},
  166.  
  167. /* 3.3.2 - 16 Bits Loads */
  168.  
  169. /* 1. LD n, nn */
  170. /* Description: Put valie nn into n */
  171. /* Use With: */
  172. /* n = BC, DE, HL, SP */
  173. /* nn = 16 bit immediate value */
  174. {0x01, "LD BC, nn", &i_ld16_bc_nn, 12, 3},
  175. {0x11, "LD DE, nn", &unimplemented_instruction, 12, 3},
  176. {0x21, "LD HL, nn", &i_ld16_hl_nn, 12, 3},
  177. {0x31, "LD SP, nn", &unimplemented_instruction, 12, 3},
  178.  
  179. /* 2. LD SP, HL */
  180. /* Description: Put HL into Stack Pointer (SP) */
  181. {0xf9, "LD SP, HL", &unimplemented_instruction, 8, 1},
  182.  
  183. /* 3. LD HL, SP+n */
  184. /* Description: Same as: LDHL SP, n */
  185.  
  186. /* 4. LDHL SP, n */
  187. /* Description: */
  188. /* Put SP + n effective address into HL */
  189. /* Use with: */
  190. /* n = one byte signed immediate value */
  191. /* Flags affected */
  192. /* Z - Reset. */
  193. /* N - Reset. */
  194. /* H - Set or reset according to operation. */
  195. /* C - Set or reset according to operation. */
  196. {0xf8, "LDHL SP, n", &unimplemented_instruction, 12, 1},
  197.  
  198. /* 5. LD (nn), SP */
  199. /* Description: */
  200. /* Put Stack Pointer (SP) at address n. */
  201. /* Use with: */
  202. /* nn = two byte immediate address. */
  203. {0x08, "LD (nn) SP", &unimplemented_instruction, 20, 1},
  204.  
  205. /* 6. PUSH nn */
  206. /* Description: */
  207. /* Push register pair nn onto stack. */
  208. /* Decrement Stack Pointer (SP) twice. */
  209. /* Use with: */
  210. /* nn = AF, BC, DE, HL */
  211. {0xf5, "PUSH AF", &unimplemented_instruction, 16, 1},
  212. {0xc5, "PUSH BC", &unimplemented_instruction, 16, 1},
  213. {0xd5, "PUSH DE", &unimplemented_instruction, 16, 1},
  214. {0xe5, "PUSH HL", &unimplemented_instruction, 16, 1},
  215.  
  216. /* 7. POP nn */
  217. /* Description: */
  218. /* Pop two bytes off stack into register pair nn. */
  219. /* Increment Stack Pointer (SP) twice. */
  220. /* Use with: */
  221. /* nn = AF, BC, DE, HL */
  222. {0xf1, "POP AF", &unimplemented_instruction, 12, 1},
  223. {0xc1, "POP BC", &unimplemented_instruction, 12, 1},
  224. {0xd1, "POP DE", &unimplemented_instruction, 12, 1},
  225. {0xe1, "POP HL", &unimplemented_instruction, 12, 1},
  226.  
  227. /* 3.3.3 - 8 Bit ALU */
  228.  
  229. /* 1.ADD A, n */
  230. /* Description: */
  231. /* Add n to A. */
  232. /* Use with: */
  233. /* n = A, B, C, D, E, H, L, (HL), #. */
  234. /* Flags affected: */
  235. /* Z - Set if result is zero */
  236. /* N - Reset */
  237. /* H - Set if carry from bit 3 */
  238. /* C - Set if carry from bit 7 */
  239. {0x87, "ADD A, A", &unimplemented_instruction, 4, 1},
  240. {0x80, "ADD A, B", &unimplemented_instruction, 4, 1},
  241. {0x81, "ADD A, C", &unimplemented_instruction, 4, 1},
  242. {0x82, "ADD A, D", &unimplemented_instruction, 4, 1},
  243. {0x83, "ADD A, E", &unimplemented_instruction, 4, 1},
  244. {0x84, "ADD A, H", &unimplemented_instruction, 4, 1},
  245. {0x85, "ADD A, L", &unimplemented_instruction, 4, 1},
  246. {0x86, "ADD A, (HL)", &unimplemented_instruction, 8, 1},
  247. {0xc6, "ADD A, #", &unimplemented_instruction, 8, 2},
  248.  
  249. /* 2.ADC A, n */
  250. /* Description: */
  251. /* Add n + Carry flag to A. */
  252. /* Use with: */
  253. /* n = A, B, C, D, E, H, L, (HL), #. */
  254. /* Flags affected: */
  255. /* Z - Set if result is zero */
  256. /* N - Reset */
  257. /* H - Set if carry from bit 3 */
  258. /* C - Set if carry from bit 7 */
  259. {0x8f, "ADC A, A", &unimplemented_instruction, 4, 1},
  260. {0x88, "ADC A, B", &unimplemented_instruction, 4, 1},
  261. {0x89, "ADC A, C", &unimplemented_instruction, 4, 1},
  262. {0x8a, "ADC A, D", &unimplemented_instruction, 4, 1},
  263. {0x8b, "ADC A, E", &unimplemented_instruction, 4, 1},
  264. {0x8c, "ADC A, H", &unimplemented_instruction, 4, 1},
  265. {0x8d, "ADC A, L", &unimplemented_instruction, 4, 1},
  266. {0x8e, "ADC A, (HL)", &unimplemented_instruction, 8, 1},
  267. {0xce, "ADC A, #", &unimplemented_instruction, 8, 1},
  268.  
  269. /* SUB n */
  270. /* Description: */
  271. /* Substract n from A */
  272. /* Use with: */
  273. /* n = A, B, C, D, E, H, L, (HL), # */
  274. /* Flags affected: */
  275. /* Z - Set if result is zero. */
  276. /* N - Set. */
  277. /* H - Set if no borrow from bit 4. */
  278. /* C - Set if no borrow. */
  279. {0x97, "SUB A", &unimplemented_instruction, 4, 1},
  280. {0x90, "SUB B", &unimplemented_instruction, 4, 1},
  281. {0x91, "SUB C", &unimplemented_instruction, 4, 1},
  282. {0x92, "SUB D", &unimplemented_instruction, 4, 1},
  283. {0x93, "SUB E", &unimplemented_instruction, 4, 1},
  284. {0x94, "SUB H", &unimplemented_instruction, 4, 1},
  285. {0x95, "SUB L", &unimplemented_instruction, 4, 1},
  286. {0x96, "SUB (HL)", &unimplemented_instruction, 8, 1},
  287. {0xd6, "SUB #", &unimplemented_instruction, 8, 2},
  288.  
  289. /* 4. SBC A, n */
  290. /* Description: */
  291. /* Substract n + Carry flag from A. */
  292. /* Use with: */
  293. /* n = A, B, C, D, E, H, L, (HL), # */
  294. /* Use with: */
  295. /* Z - Set if result is zero. */
  296. /* N - Set. */
  297. /* H - Set if no borrow from bit 4. */
  298. /* C - Set if no borrow. */
  299. {0x9f, "SUB A, A", &unimplemented_instruction, 4, 1},
  300. {0x98, "SUB A, B", &unimplemented_instruction, 4, 1},
  301. {0x99, "SUB A, C", &unimplemented_instruction, 4, 1},
  302. {0x9a, "SUB A, D", &unimplemented_instruction, 4, 1},
  303. {0x9b, "SUB A, E", &unimplemented_instruction, 4, 1},
  304. {0x9c, "SUB A, H", &unimplemented_instruction, 4, 1},
  305. {0x9d, "SUB A, L", &unimplemented_instruction, 4, 1},
  306. {0x9e, "SUB A, (HL)", &unimplemented_instruction, 8, 1},
  307. /* {0x??, "SUB A, #", &unimplemented_instruction, ??, 2}, */
  308.  
  309. /* 5. AND n */
  310. /* Description: */
  311. /* Logically AND n with A, result in A. */
  312. /* Use with: */
  313. /* n = A, B, C, D, E, H, L, (HL), # */
  314. /* Flags affected: */
  315. /* Z - Set if result is zero. */
  316. /* N - Reset. */
  317. /* H - Set. */
  318. /* C - Reset. */
  319. {0xa7, "AND A", &unimplemented_instruction, 4, 1},
  320. {0xa0, "AND B", &unimplemented_instruction, 4, 1},
  321. {0xa1, "AND C", &unimplemented_instruction, 4, 1},
  322. {0xa2, "AND D", &unimplemented_instruction, 4, 1},
  323. {0xa3, "AND E", &unimplemented_instruction, 4, 1},
  324. {0xa4, "AND H", &unimplemented_instruction, 4, 1},
  325. {0xa5, "AND L", &unimplemented_instruction, 4, 1},
  326. {0xa6, "AND (HL)", &unimplemented_instruction, 8, 1},
  327. {0xe6, "AND #", &unimplemented_instruction, 8, 2},
  328.  
  329. /* 6. OR n */
  330. /* Description: */
  331. /* Logically OR n with A, result in A. */
  332. /* Use with: */
  333. /* n = A, B, C, D, E, H, L, (HL), # */
  334. /* Flags affected: */
  335. /* Z - Set if result is zero. */
  336. /* N - Reset. */
  337. /* H - Reset. */
  338. /* C - Reset. */
  339. {0xb7, "OR A", &unimplemented_instruction, 4, 1},
  340. {0xb0, "OR B", &unimplemented_instruction, 4, 1},
  341. {0xb1, "OR C", &unimplemented_instruction, 4, 1},
  342. {0xb2, "OR D", &unimplemented_instruction, 4, 1},
  343. {0xb3, "OR E", &unimplemented_instruction, 4, 1},
  344. {0xb4, "OR H", &unimplemented_instruction, 4, 1},
  345. {0xb5, "OR L", &unimplemented_instruction, 4, 1},
  346. {0xb6, "OR (HL)", &unimplemented_instruction, 8, 1},
  347. {0xf6, "OR #", &unimplemented_instruction, 8, 2},
  348.  
  349. /* 7. XOR n */
  350. /* Description: */
  351. /* Logically exclusive OR n with A, result in A. */
  352. /* Use with: */
  353. /* n = A, B, C, D, E, H, L, (HL), # */
  354. /* Flags affected: */
  355. /* Z - Set if result is zero. */
  356. /* N - Reset. */
  357. /* H - Reset. */
  358. /* C - Reset. */
  359. {0xaf, "XOR A", &i_xor_a, 4, 1},
  360. {0xa8, "XOR B", &unimplemented_instruction, 4, 1},
  361. {0xa9, "XOR C", &unimplemented_instruction, 4, 1},
  362. {0xaa, "XOR D", &unimplemented_instruction, 4, 1},
  363. {0xab, "XOR E", &unimplemented_instruction, 4, 1},
  364. {0xac, "XOR H", &unimplemented_instruction, 4, 1},
  365. {0xad, "XOR L", &unimplemented_instruction, 4, 1},
  366. {0xae, "XOR (HL)", &unimplemented_instruction, 8, 1},
  367. {0xee, "XOR #", &unimplemented_instruction, 8, 2},
  368.  
  369.  
  370. /* 8. CP n */
  371. /* Description: */
  372. /* Compare A with n. This is basically an A - n substraction instruction but the results are thrown away */
  373. /* Use with: */
  374. /* n = A, B, C, D, E, H, L, (HL), # */
  375. /* Flags affected: */
  376. /* Z - Set if result is zero. (Set if A = n.) */
  377. /* N - Set. */
  378. /* H - Set if no borrow from bit 4. */
  379. /* C - Set for no borrow. (Set if A < n.) */
  380. {0xbf, "OP A", &unimplemented_instruction, 4, 1},
  381. {0xb8, "OP B", &unimplemented_instruction, 4, 1},
  382. {0xb9, "OP C", &unimplemented_instruction, 4, 1},
  383. {0xba, "OP D", &unimplemented_instruction, 4, 1},
  384. {0xbb, "OP E", &unimplemented_instruction, 4, 1},
  385. {0xbc, "OP H", &unimplemented_instruction, 4, 1},
  386. {0xbd, "OP L", &unimplemented_instruction, 4, 1},
  387. {0xbe, "OP (HL)", &unimplemented_instruction, 8, 1},
  388. {0xfe, "OP #", &unimplemented_instruction, 8, 2},
  389.  
  390. /* 9. INC n */
  391. /* Description: */
  392. /* Increment register n */
  393. /* Use with: */
  394. /* n = A, B, C, D, E, H, L, (HL), # */
  395. /* Flags affected: */
  396. /* Z - Set if result is zero. */
  397. /* N - Reset. */
  398. /* H - Set if carry from bit 3. */
  399. /* C - Not affected */
  400. {0x3c, "INC A", &unimplemented_instruction, 4, 1},
  401. {0x04, "INC B", &unimplemented_instruction, 4, 1},
  402. {0x0c, "INC C", &unimplemented_instruction, 4, 1},
  403. {0x14, "INC D", &unimplemented_instruction, 4, 1},
  404. {0x1c, "INC E", &unimplemented_instruction, 4, 1},
  405. {0x24, "INC H", &unimplemented_instruction, 4, 1},
  406. {0x2c, "INC L", &unimplemented_instruction, 4, 1},
  407. {0x34, "INC (HL)", &unimplemented_instruction, 8, 1},
  408.  
  409. /* 10. DEC n */
  410. /* Description: */
  411. /* Decrement register n */
  412. /* Use with: */
  413. /* n = A, B, C, D, E, H, L, (HL), # */
  414. /* Flags affected: */
  415. /* Z - Set if result is zero. */
  416. /* N - Set. */
  417. /* H - Set if no borrow from bit 4. */
  418. /* C - Not affected */
  419. {0x3d, "DEC A", &unimplemented_instruction, 4, 1},
  420. {0x05, "DEC B", &unimplemented_instruction, 4, 1},
  421. {0x0d, "DEC C", &unimplemented_instruction, 4, 1},
  422. {0x15, "DEC D", &unimplemented_instruction, 4, 1},
  423. {0x1d, "DEC E", &unimplemented_instruction, 4, 1},
  424. {0x25, "DEC H", &unimplemented_instruction, 4, 1},
  425. {0x2d, "DEC L", &unimplemented_instruction, 4, 1},
  426. {0x35, "DEC (HL)", &unimplemented_instruction, 12, 1},
  427.  
  428. /* 3.3.4 - 16 Bit Arithmetic */
  429.  
  430. /* 1. ADD HL, n */
  431. /* Description: */
  432. /* Add n to HL. */
  433. /* Use with: */
  434. /* n = BC, DE, HL, SP */
  435. /* Flags affected: */
  436. /* Z - Not affected. */
  437. /* N - Reset. */
  438. /* H - Set if carry from bit 11. */
  439. /* C - Set if carry from bit 15. */
  440. {0x09, "ADD HL, BC", &unimplemented_instruction, 8, 1},
  441. {0x19, "ADD HL, DE", &unimplemented_instruction, 8, 1},
  442. {0x29, "ADD HL, HL", &unimplemented_instruction, 8, 1},
  443. {0x39, "ADD HL, CP", &unimplemented_instruction, 8, 1},
  444.  
  445.  
  446. /* 2. ADD SP, n */
  447. /* Description: */
  448. /* Add n to Stack Pointer (SP). */
  449. /* Use with: */
  450. /* n = one byte signed immediate value (#). */
  451. /* Flags affected: */
  452. /* Z - Reset. */
  453. /* N - Reset. */
  454. /* H - Set or reset according to operation. */
  455. /* C - Set or reset according to operation. */
  456. {0xe8, "ADD CP, #", &unimplemented_instruction, 16, 2},
  457.  
  458. /* 3. INC nn */
  459. /* Description: */
  460. /* Increment register nn. */
  461. /* Use with: */
  462. /* nn = BC, DE, HL, SP. */
  463. /* Flags affected: */
  464. /* None. */
  465. {0x03, "INC BC", &unimplemented_instruction, 8, 1},
  466. {0x13, "INC DE", &unimplemented_instruction, 8, 1},
  467. {0x23, "INC HL", &unimplemented_instruction, 8, 1},
  468. {0x33, "INC SP", &unimplemented_instruction, 8, 1},
  469.  
  470. /* 3. DEC nn */
  471. /* Description: */
  472. /* Decrement register nn. */
  473. /* Use with: */
  474. /* nn = BC, DE, HL, SP. */
  475. /* Flags affected: */
  476. /* None. */
  477. {0x0b, "DEC BC", &unimplemented_instruction, 8, 1},
  478. {0x1b, "DEC DE", &unimplemented_instruction, 8, 1},
  479. {0x2b, "DEC HL", &unimplemented_instruction, 8, 1},
  480. {0x3b, "DEC SP", &unimplemented_instruction, 8, 1},
  481.  
  482. /* 3.3.5 Miscellaneous */
  483.  
  484. /* 1. SWAP n */
  485. /* Description: */
  486. /* Swap upper & lower nibles of n. */
  487. /* Use with: */
  488. /* n = A, B, C, D, E, H, L, (HL). */
  489. /* Flags affected: */
  490. /* Z - Set if result is zero. */
  491. /* N - Reset. */
  492. /* H - Reset. */
  493. /* C - Reset. */
  494.  
  495. /* TODO: ???? */
  496.  
  497. /* 2. DAA */
  498. /* Description: */
  499. /* Decimal adjust register A. */
  500. /* This instruction adjusts register A so that the */
  501. /* correct representation of Binary Coded Deciman (BCD) is obtained. */
  502. /* Flags affected: */
  503. /* Z - Set if register A is zero. */
  504. /* N - Not affected. */
  505. /* H - Reset. */
  506. /* C - Set or reset according to operation. */
  507. {0x27, "DDA", &unimplemented_instruction, 4, 1},
  508.  
  509. /* 3. CPL */
  510. /* Description: */
  511. /* Complement A register. (Flip all bits.) */
  512. /* Flags affected: */
  513. /* Z - Not affected. */
  514. /* N - Set. */
  515. /* H - Set. */
  516. /* C - Not affected. */
  517. {0x2f, "CPL", &unimplemented_instruction, 4, 1},
  518.  
  519. /* 4. CCF */
  520. /* Description: */
  521. /* Complement carry flag. */
  522. /* If C flag is set, then reset it. */
  523. /* If C flag is reset, then set it. */
  524. /* Flags affected: */
  525. /* Z - Not affected. */
  526. /* N - Reset. */
  527. /* H - Reset. */
  528. /* C - Complemented */
  529. {0x3f, "CCF", &unimplemented_instruction, 4, 1},
  530.  
  531. /* 5. SCF */
  532. /* Description: */
  533. /* Set carry flag. */
  534. /* Flags affected: */
  535. /* Z - Not affected. */
  536. /* N - Reset. */
  537. /* H - Reset. */
  538. /* C - Set */
  539.  
  540. /* 6. NOP */
  541. /* Description: */
  542. /* No operation. */
  543. {0x00, "NOP", &i_nop, 4, 1},
  544.  
  545. /* 7. HALT */
  546. /* Description: */
  547. /* Power down PU until an interrupt occurs. */
  548. /* Use this when ever possible to reduce energy consumption. */
  549. {0x76, "HALT", &unimplemented_instruction, 4, 1},
  550.  
  551. /* 8. STOP */
  552. /* Description: */
  553. /* Halt CPU & LCD display until button pressed. */
  554.  
  555. /* TODO: ???? */
  556.  
  557. /* 9. DI */
  558. /* Description: */
  559. /* This instruction disables interrupts but not immediately. */
  560. /* Interrupts are disabled after instruction after DI is executed. */
  561. {0xf3, "DI", &unimplemented_instruction, 4, 1},
  562.  
  563. /* 10. EI */
  564. /* Description: */
  565. /* Enable interrupts. */
  566. /* This instruction enables interrupts but not immediately. */
  567. /* Interrupts are enabled after instruction after EI is executed. */
  568. {0xfb, "EI", &unimplemented_instruction, 4, 1},
  569.  
  570. /* 3.3.6 Rotates & Shifts */
  571.  
  572. /* 1. RLCA */
  573. /* Description: */
  574. /* Rotate A left. Old bit 7 Carry flag. */
  575. /* Flags affected: */
  576. /* Z - Set if result is zero. */
  577. /* N - Reset. */
  578. /* H - Reset. */
  579. /* C - Contains old bit 7 data. */
  580. {0x07, "RLCA", &unimplemented_instruction, 4, 1},
  581.  
  582. /* 2. RLA */
  583. /* Description: */
  584. /* Rotate A left through Carry flag. */
  585. /* Flags affected: */
  586. /* Z - Set if result is zero. */
  587. /* N - Reset. */
  588. /* H - Reset. */
  589. /* C - Contains old bit 7 data. */
  590. {0x17, "RLA", &unimplemented_instruction, 4, 1},
  591.  
  592. /* 3. RRCA */
  593. /* Description: */
  594. /* Rotate A right. Old bit 0 to Carry flag. */
  595. /* Flags affected: */
  596. /* Z - Set if result is zero. */
  597. /* N - Reset. */
  598. /* H - Reset. */
  599. /* C - Contains old bit 0 data. */
  600. {0x0f, "RRCA", &unimplemented_instruction, 4, 1},
  601.  
  602. /* 4. RRA */
  603. /* Description: */
  604. /* Rotate A right through Carry flag. */
  605. /* Flags affected: */
  606. /* Z - Set if result is zero. */
  607. /* N - Reset. */
  608. /* H - Reset. */
  609. /* C - Contains old bit 0 data. */
  610. {0x1f, "RRA", &unimplemented_instruction, 4, 1},
  611.  
  612. /* 5. RLC n */
  613. /* Description: */
  614. /* Rotate n left. Old bit 7 to Carry flag. */
  615. /* Use with: */
  616. /* n = A,B,C,D,E,H,L,(HL) */
  617. /* Flags affected: */
  618. /* Z - Set if result is zero. */
  619. /* N - Reset. */
  620. /* H - Reset. */
  621. /* C - Contains old bit 7 data. */
  622.  
  623. /* TODO: ???? */
  624. /* TODO: ???? */
  625. /* TODO: ???? */
  626. /* TODO: ???? */
  627. /* TODO: ???? */
  628. /* TODO: ???? */
  629. /* TODO: ???? */
  630. /* TODO: ???? */
  631.  
  632. /* 6. RL n */
  633. /* Description: */
  634. /* Rotate n left through Carry flag. */
  635. /* Use with: */
  636. /* n = A,B,C,D,E,H,L,(HL) */
  637. /* Flags affected: */
  638. /* Z - Set if result is zero. */
  639. /* N - Reset. */
  640. /* H - Reset. */
  641. /* C - Contains old bit 7 data. */
  642.  
  643. /* TODO: ???? */
  644. /* TODO: ???? */
  645. /* TODO: ???? */
  646. /* TODO: ???? */
  647. /* TODO: ???? */
  648. /* TODO: ???? */
  649. /* TODO: ???? */
  650. /* TODO: ???? */
  651.  
  652. /* 7. RRC n */
  653. /* Description: */
  654. /* Rotate n right. Old bit 0 to Carry flag. */
  655. /* Use with: */
  656. /* n = A,B,C,D,E,H,L,(HL) */
  657. /* Flags affected: */
  658. /* Z - Set if result is zero. */
  659. /* N - Reset. */
  660. /* H - Reset. */
  661. /* C - Contains old bit 0 data. */
  662.  
  663. /* TODO: ???? */
  664. /* TODO: ???? */
  665. /* TODO: ???? */
  666. /* TODO: ???? */
  667. /* TODO: ???? */
  668. /* TODO: ???? */
  669. /* TODO: ???? */
  670. /* TODO: ???? */
  671.  
  672. /* 8. RRC n */
  673. /* Description: */
  674. /* Rotate n right through Carry flag. */
  675. /* Use with: */
  676. /* n = A,B,C,D,E,H,L,(HL) */
  677. /* Flags affected: */
  678. /* Z - Set if result is zero. */
  679. /* N - Reset. */
  680. /* H - Reset. */
  681. /* C - Contains old bit 0 data. */
  682.  
  683. /* TODO: ???? */
  684. /* TODO: ???? */
  685. /* TODO: ???? */
  686. /* TODO: ???? */
  687. /* TODO: ???? */
  688. /* TODO: ???? */
  689. /* TODO: ???? */
  690. /* TODO: ???? */
  691.  
  692. /* 9. SLA n */
  693. /* Description: */
  694. /* Shift n left into Carry. LSB of n set to 0. */
  695. /* Use with: */
  696. /* n = A,B,C,D,E,H,L,(HL) */
  697. /* Flags affected: */
  698. /* Z - Set if result is zero. */
  699. /* N - Reset. */
  700. /* H - Reset. */
  701. /* C - Contains old bit 7 data. */
  702.  
  703. /* TODO: ???? */
  704. /* TODO: ???? */
  705. /* TODO: ???? */
  706. /* TODO: ???? */
  707. /* TODO: ???? */
  708. /* TODO: ???? */
  709. /* TODO: ???? */
  710. /* TODO: ???? */
  711.  
  712. /* 10. SRA n */
  713. /* Description: */
  714. /* Shift n right into Carry. MSB doesn't change. */
  715. /* Use with: */
  716. /* n = A,B,C,D,E,H,L,(HL) */
  717. /* Flags affected: */
  718. /* Z - Set if result is zero. */
  719. /* N - Reset. */
  720. /* H - Reset. */
  721. /* C - Contains old bit 0 data. */
  722.  
  723. /* TODO: ???? */
  724. /* TODO: ???? */
  725. /* TODO: ???? */
  726. /* TODO: ???? */
  727. /* TODO: ???? */
  728. /* TODO: ???? */
  729. /* TODO: ???? */
  730. /* TODO: ???? */
  731.  
  732. /* 11. SRL n */
  733. /* Description: */
  734. /* Shift n right into Carry. MSB set to 0. */
  735. /* Use with: */
  736. /* n = A,B,C,D,E,H,L,(HL) */
  737. /* Flags affected: */
  738. /* Z - Set if result is zero. */
  739. /* N - Reset. */
  740. /* H - Reset. */
  741. /* C - Contains old bit 0 data. */
  742.  
  743. /* TODO: ???? */
  744. /* TODO: ???? */
  745. /* TODO: ???? */
  746. /* TODO: ???? */
  747. /* TODO: ???? */
  748. /* TODO: ???? */
  749. /* TODO: ???? */
  750. /* TODO: ???? */
  751.  
  752. /* 3.3.7 - Bit Opcodes*/
  753.  
  754. /* 1. BIT b, r */
  755. /* Description: */
  756. /* Test bit b in register r. */
  757. /* Use with: */
  758. /* b = 0 - 7, r = A, B, C, D, E, H, L, (HL) */
  759. /* Flags affected: */
  760. /* Z - Set if bit b of register r is 0. */
  761. /* N - Reset. */
  762. /* H - Set. */
  763. /* C - Not affected. */
  764.  
  765. /* TODO: ???? */
  766. /* TODO: ???? */
  767. /* TODO: ???? */
  768. /* TODO: ???? */
  769. /* TODO: ???? */
  770. /* TODO: ???? */
  771. /* TODO: ???? */
  772. /* TODO: ???? */
  773.  
  774. /* 2. SET b, r */
  775. /* Description: */
  776. /* Set bit b in register r. */
  777. /* Use with: */
  778. /* b = 0 - 7, r = A, B, C, D, E, H, L, (HL) */
  779.  
  780. /* TODO: ???? */
  781. /* TODO: ???? */
  782. /* TODO: ???? */
  783. /* TODO: ???? */
  784. /* TODO: ???? */
  785. /* TODO: ???? */
  786. /* TODO: ???? */
  787. /* TODO: ???? */
  788.  
  789. /* 3. RES b, r */
  790. /* Description: */
  791. /* Reset bit b in register r. */
  792. /* Use with: */
  793. /* b = 0 - 7, r = A, B, C, D, E, H, L, (HL) */
  794.  
  795. /* TODO: ???? */
  796. /* TODO: ???? */
  797. /* TODO: ???? */
  798. /* TODO: ???? */
  799. /* TODO: ???? */
  800. /* TODO: ???? */
  801. /* TODO: ???? */
  802. /* TODO: ???? */
  803.  
  804. /* 3.3.8 - Jumps */
  805.  
  806. /* 1. JP nn */
  807. /* Description: */
  808. /* Jump to address nn. */
  809. /* Use with: */
  810. /* nn = two byte immediate value. (LS byte first) */
  811. {0xc3, "", &i_jp_nn, 12, 3},
  812.  
  813.  
  814. /* 2. JP cc, nn */
  815. /* Description: */
  816. /* Jump to address n if following condition is true. */
  817. /* cc = NZ, Jump if Z flag is reset. */
  818. /* cc = Z, Jump if Z flag is set. */
  819. /* cc = NC, Jump if C flag is reset. */
  820. /* cc = C, Jump if C flag is set. */
  821. /* Use with: */
  822. /* nn = two byte immediate value. (LS byte first) */
  823. {0xc2, "JP NZ, nn", &unimplemented_instruction, 12, 3},
  824. {0xca, "JP Z, nn", &unimplemented_instruction, 12, 3},
  825. {0xd2, "JP NC, nn", &unimplemented_instruction, 12, 3},
  826. {0xda, "JP C, nn", &unimplemented_instruction, 12, 3},
  827.  
  828. /* 3. JP (HL) */
  829. /* Description: */
  830. /* Jump to address contained in HL. */
  831. {0xe9, "JP (HL)", &unimplemented_instruction, 4, 1},
  832.  
  833. /* 4. JP n */
  834. /* Description: */
  835. /* Add n to current address and jump to it. */
  836. /* Use with: */
  837. /* n = one byte signed immediate value */
  838. {0x18, "JP n", &unimplemented_instruction, 8, 2},
  839.  
  840. /* 5. JR cc, n */
  841. /* Description: */
  842. /* If following condition is true then add n to current address and jump to it. */
  843. /* cc = NZ, Jump if Z flag is reset. */
  844. /* cc = Z, Jump if Z flag is set. */
  845. /* cc = NC, Jump if C flag is reset. */
  846. /* cc = C, Jump if C flag is set. */
  847. /* Use with: */
  848. /* n = one byte signed immediate value. */
  849. {0x20, "JR NZ, #", &unimplemented_instruction, 8, 2},
  850. {0x28, "JR Z, #", &unimplemented_instruction, 8, 2},
  851. {0x30, "JR NC, #", &unimplemented_instruction, 8, 2},
  852. {0x38, "JR C, #", &unimplemented_instruction, 8, 2},
  853.  
  854. /* 3.3.9 - Calls */
  855.  
  856.  
  857. /* 1. CALL nn */
  858. /* Description: */
  859. /* Push address of next instruction onto stack and then jump to address nn. */
  860. /* Use with: */
  861. /* nn = two byte immediate value. (LS byte first). */
  862. {0xcd, "CALL nn", &unimplemented_instruction, 12, 3},
  863.  
  864.  
  865. /* 2. CALL cc, nn */
  866. /* Description: */
  867. /* Call address n if following condition is true: */
  868. /* cc = NZ, Call if Z flag is reset */
  869. /* cc = Z, Call if Z flag is set */
  870. /* cc = NC, Call if C flag is reset */
  871. /* cc = C, Call if C flag is set */
  872. /* Use with: */
  873. /* nn = two byte immediate value. (LS byte first). */
  874. {0xc4, "CALL NZ, nn", &unimplemented_instruction, 12, 3},
  875. {0xcc, "CALL Z, nn", &unimplemented_instruction, 12, 3},
  876. {0xd4, "CALL NC, nn", &unimplemented_instruction, 12, 3},
  877. {0xdc, "CALL C, nn", &unimplemented_instruction, 12, 3},
  878.  
  879.  
  880. /* 3.3.10 - Restarts */
  881.  
  882. /* 1. RST n */
  883. /* Description: */
  884. /* Push present address onto stack. */
  885. /* Jump to address $0000 + n. */
  886. /* Use with: */
  887. /* n = $00, $08, $10, $18, $20, $28, $30, $38 */
  888. {0xc7, "RST 00H", &unimplemented_instruction, 32, 1},
  889. {0xcf, "RST 08H", &unimplemented_instruction, 32, 1},
  890. {0xd7, "RST 10H", &unimplemented_instruction, 32, 1},
  891. {0xdf, "RST 18H", &unimplemented_instruction, 32, 1},
  892. {0xe7, "RST 20H", &unimplemented_instruction, 32, 1},
  893. {0xef, "RST 28H", &unimplemented_instruction, 32, 1},
  894. {0xf7, "RST 30H", &unimplemented_instruction, 32, 1},
  895. {0xff, "RST 38H", &i_rst_38, 32, 1},
  896.  
  897. /* 3.3.11 - Returns */
  898.  
  899. /* 1. RET */
  900. /* Description: */
  901. /* Pop two bytes from stack & jump to that address. */
  902. {0xc9, "RET", &unimplemented_instruction, 8, 1},
  903.  
  904. /* 2. RET cc */
  905. /* Description: */
  906. /* Return if following condition is true. */
  907. /* Use with: */
  908. /* cc = NZ, Return if Z flag is reset. */
  909. /* cc = Z, Return if Z flag is set. */
  910. /* cc = NC, Return if C flag is reset. */
  911. /* cc = C, Return if C flag is set. */
  912. {0xc0, "RET NZ", &unimplemented_instruction, 8, 1},
  913. {0xcb, "RET Z", &unimplemented_instruction, 8, 1},
  914. {0xd0, "RET NC", &unimplemented_instruction, 8, 1},
  915. {0xd8, "RET C", &unimplemented_instruction, 8, 1},
  916.  
  917. /* 3. RETI */
  918. /* Description: */
  919. /* Pop two bytes from stack & jump to that address then enable interrupts. */
  920. {0xd9, "RETI", &unimplemented_instruction, 8, 1},
  921.  
  922. {0x10, "", &unimplemented_instruction, 0, 1},
  923. {0xc8, "", &unimplemented_instruction, 0, 1},
  924. {0xd3, "", &unimplemented_instruction, 0, 1},
  925. {0xdb, "", &unimplemented_instruction, 0, 1},
  926. {0xdd, "", &unimplemented_instruction, 0, 1},
  927. {0xde, "", &unimplemented_instruction, 0, 1},
  928. {0xe3, "", &unimplemented_instruction, 0, 1},
  929. {0xe4, "", &unimplemented_instruction, 0, 1},
  930. {0xeb, "", &unimplemented_instruction, 0, 1},
  931. {0xec, "", &unimplemented_instruction, 0, 1},
  932. {0xed, "", &unimplemented_instruction, 0, 1},
  933. {0xf4, "", &unimplemented_instruction, 0, 1},
  934. {0xfc, "", &unimplemented_instruction, 0, 1},
  935. {0xfd, "", &unimplemented_instruction, 0, 1},
  936. };
Add Comment
Please, Sign In to add comment