diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/mem_map.h | 3 | ||||
-rw-r--r-- | src/core/mem_map_funcs.cpp | 20 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/core/mem_map.h b/src/core/mem_map.h index ab96e210f..087e8d3bc 100644 --- a/src/core/mem_map.h +++ b/src/core/mem_map.h @@ -50,9 +50,10 @@ enum { HARDWARE_IO_VADDR = 0x1EC00000, HARDWARE_IO_VADDR_END = (HARDWARE_IO_VADDR + HARDWARE_IO_SIZE), - VRAM_VADDR = 0x1F000000, + VRAM_VADDR_END = (VRAM_VADDR + VRAM_SIZE), + SCRATCHPAD_VADDR_END = 0x10000000, SCRATCHPAD_VADDR = (SCRATCHPAD_VADDR_END - SCRATCHPAD_SIZE), ///< Stack space }; diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index 832957cb1..875821adb 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp @@ -58,8 +58,12 @@ inline void _Read(T &var, const u32 addr) { } else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) { var = *((const T*)&g_shared_mem[vaddr & SHARED_MEMORY_MASK]); + // VRAM + } else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) { + var = *((const T*)&g_vram[vaddr & VRAM_MASK]); + } else { - _assert_msg_(MEMMAP, false, "unknown Read%d @ 0x%08X", sizeof(var) * 8, vaddr); + //_assert_msg_(MEMMAP, false, "unknown Read%d @ 0x%08X", sizeof(var) * 8, vaddr); } } @@ -90,12 +94,10 @@ inline void _Write(u32 addr, const T data) { } else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) { *(T*)&g_shared_mem[vaddr & SHARED_MEMORY_MASK] = data; - } else if ((vaddr & 0xFF000000) == 0x14000000) { - _assert_msg_(MEMMAP, false, "umimplemented write to GSP heap"); - } else if ((vaddr & 0xFFF00000) == 0x1EC00000) { - _assert_msg_(MEMMAP, false, "umimplemented write to IO registers"); - } else if ((vaddr & 0xFF000000) == 0x1F000000) { - _assert_msg_(MEMMAP, false, "umimplemented write to VRAM"); + // VRAM + } else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) { + *(T*)&g_vram[vaddr & VRAM_MASK] = data; + } else if ((vaddr & 0xFFF00000) == 0x1FF00000) { _assert_msg_(MEMMAP, false, "umimplemented write to DSP memory"); } else if ((vaddr & 0xFFFF0000) == 0x1FF80000) { @@ -125,6 +127,10 @@ u8 *GetPointer(const u32 addr) { } else if ((vaddr > SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) { return g_shared_mem + (vaddr & SHARED_MEMORY_MASK); + // VRAM + } else if ((vaddr > VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) { + return g_vram + (vaddr & VRAM_MASK); + } else { ERROR_LOG(MEMMAP, "Unknown GetPointer @ 0x%08x", vaddr); return 0; |