#include "cpu.h" #include #include "log.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) { debug("Write [%08x] = %08x", addr, x); addr = translate_addr(addr); cpu->main_ram[addr] = x; } uint32_t cpu_read32(cpu_t *cpu, uint32_t addr) { debug("Read [%08x]", addr); addr = translate_addr(addr); return cpu->main_ram[addr]; }