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.

88 lines
1.2 KiB

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