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.
 
 

29 lines
559 B

#include "cpu.h"
static uint32_t translate_addr(uint32_t addr)
{
if (addr >= 0xA0000000)
{
addr = addr - 0xA0000000;
}
else if (addr >= 0x80000000)
{
addr = addr - 0x80000000;
}
return addr;
}
void cpu_write32(cpu_t *cpu, uint32_t addr, uint32_t x)
{
printf("WRITE: %08x to %08x\n", x, addr);
addr = translate_addr(addr);
cpu->main_ram[addr] = x;
}
uint32_t cpu_read32(cpu_t *cpu, uint32_t addr)
{
printf("READ: %08x\n", addr);
addr = translate_addr(addr);
return cpu->main_ram[addr];
}