psx emulator
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.

86 lines
1.4 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. #ifndef PSXC_INSN_H_
  2. #define PSXC_INSN_H_
  3. #include <stdint.h>
  4. #include "cpu.h"
  5. typedef enum {
  6. SPECIAL = 0x00,
  7. BCONDZ = 0x01,
  8. J = 0x02,
  9. JAL = 0x03,
  10. BEQ = 0x04,
  11. BNE = 0x05,
  12. BLEZ = 0x06,
  13. BGTZ = 0x07,
  14. ADDI = 0x08,
  15. ADDIU = 0x09,
  16. SLTI = 0x0a,
  17. SLTIU = 0x0b,
  18. ANDI = 0x0c,
  19. ORI = 0x0d,
  20. XORI = 0x0e,
  21. LUI = 0x0f,
  22. COP0 = 0x10,
  23. COP1 = 0x11,
  24. COP2 = 0x12,
  25. COP3 = 0x13,
  26. LB = 0x20,
  27. LH = 0x21,
  28. LWL = 0x22,
  29. LW = 0x23,
  30. LBU = 0x24,
  31. LHU = 0x25,
  32. LWR = 0x26,
  33. SB = 0x28,
  34. SH = 0x29,
  35. SWL = 0x2a,
  36. SW = 0x2b,
  37. SWR = 0x2e,
  38. LWC0 = 0x30,
  39. LWC1 = 0x31,
  40. LWC2 = 0x32,
  41. LWC3 = 0x33,
  42. SWC0 = 0x38,
  43. SWC1 = 0x39,
  44. SWC2 = 0x3a,
  45. SWC3 = 0x3b,
  46. } op_primary_t;
  47. typedef enum {
  48. SLL = 0x00,
  49. SRL = 0x02,
  50. SRA = 0x03,
  51. SLLV = 0x04,
  52. SRLV = 0x06,
  53. SRAV = 0x07,
  54. JR = 0x08,
  55. JALR = 0x09,
  56. SYSCALL = 0x0c,
  57. BREAK = 0x0d,
  58. MFHI = 0x10,
  59. MTHI = 0x11,
  60. MFLO = 0x12,
  61. MTLO = 0x13,
  62. MULT = 0x18,
  63. MULTU = 0x19,
  64. DIV = 0x1a,
  65. DIVU = 0x1b,
  66. ADD = 0x20,
  67. ADDU = 0x21,
  68. SUB = 0x22,
  69. SUBU = 0x23,
  70. AND = 0x24,
  71. OR = 0x25,
  72. XOR = 0x26,
  73. NOR = 0x27,
  74. SLT = 0x2a,
  75. SLTU = 0x2b,
  76. } op_secondary_t;
  77. typedef void (*cpu_insn_handler)(cpu_t *, uint32_t);
  78. void insn_execute(cpu_t *cpu, uint32_t insn);
  79. #endif