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.

61 lines
927 B

2 years ago
  1. #ifndef PSXC_INSN_H_
  2. #define PSXC_INSN_H_
  3. #include <stdint.h>
  4. typedef enum {
  5. SPECIAL = 0x00,
  6. BCONDZ = 0x01,
  7. J = 0x02,
  8. JAL = 0x03,
  9. BEQ = 0x04,
  10. BNE = 0x05,
  11. BLEZ = 0x06,
  12. BGTZ = 0x07,
  13. ADDI = 0x08,
  14. ADDIU = 0x09,
  15. SLTI = 0x0a,
  16. SLTIU = 0x0b,
  17. ANDI = 0x0c,
  18. ORI = 0x0d,
  19. XORI = 0x0e,
  20. LUI = 0x0f,
  21. COP0 = 0x10,
  22. COP1 = 0x11,
  23. COP2 = 0x12,
  24. COP3 = 0x13,
  25. LB = 0x20,
  26. LH = 0x21,
  27. LWL = 0x22,
  28. LW = 0x23,
  29. LBU = 0x24,
  30. LHU = 0x25,
  31. LWR = 0x26,
  32. SB = 0x28,
  33. SH = 0x29,
  34. SWL = 0x2a,
  35. SW = 0x2b,
  36. SWR = 0x2e,
  37. LWC0 = 0x30,
  38. LWC1 = 0x31,
  39. LWC2 = 0x32,
  40. LWC3 = 0x33,
  41. SWC0 = 0x38,
  42. SWC1 = 0x39,
  43. SWC2 = 0x3a,
  44. SWC3 = 0x3b,
  45. } op_primary_t;
  46. static inline op_primary_t extract_primary_op(uint32_t insn) {
  47. return (insn >> 26) & 0x3f;
  48. }
  49. typedef enum {
  50. SLL = 0x00,
  51. } op_secondary_t;
  52. static inline op_secondary_t extract_secondary_op(uint32_t insn) {
  53. return (insn >> 0) & 0x3f;
  54. }
  55. #endif