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.

26 lines
595 B

2 years ago
2 years ago
2 years ago
2 years ago
  1. #ifndef PSXC_H_
  2. #define PSXC_H_
  3. #include <stdint.h>
  4. #define REG_GP 28 // Global pointer
  5. #define REG_SP 29 // Stack pointer
  6. #define REG_FP 30 // Frame pointer
  7. #define MAIN_RAM_SIZE 0x200000 * 4
  8. #define SCRATCHPAD_BASE 0x1F800000
  9. #define SCRATCHPAD_END 0x1F8003FF
  10. #define SCRATCHPAD_SIZE (SCRATCHPAD_END - SCRATCHPAD_BASE + 1)
  11. typedef struct {
  12. uint32_t regs[32];
  13. uint32_t pc;
  14. uint8_t main_ram[MAIN_RAM_SIZE];
  15. uint32_t sratchpad_ram[SCRATCHPAD_SIZE];
  16. } cpu_t;
  17. void cpu_write32(cpu_t *cpu, uint32_t addr, uint32_t x);
  18. uint32_t cpu_read32(cpu_t *cpu, uint32_t addr);
  19. #endif