From: notaz Date: Sun, 10 Mar 2013 23:17:38 +0000 (+0200) Subject: psxmem: handle io mirrors X-Git-Tag: r19~14 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9dd7d179658d34f7943fa0092d172bf4f78d325b;p=pcsx_rearmed.git psxmem: handle io mirrors tested on real hardware (ignoring missing fault emulation) fixes Star Wars - Episode I --- diff --git a/libpcsxcore/new_dynarec/pcsxmem.c b/libpcsxcore/new_dynarec/pcsxmem.c index a42852ad..3d149043 100644 --- a/libpcsxcore/new_dynarec/pcsxmem.c +++ b/libpcsxcore/new_dynarec/pcsxmem.c @@ -338,11 +338,17 @@ void new_dyna_pcsx_mem_init(void) // scratchpad map_l1_mem(mem_readtab, 0, 0x1f800000, 0x1000, psxH); + map_l1_mem(mem_readtab, 0, 0x9f800000, 0x1000, psxH); map_l1_mem(mem_writetab, 0, 0x1f800000, 0x1000, psxH); + map_l1_mem(mem_writetab, 0, 0x9f800000, 0x1000, psxH); // I/O map_item(&mem_readtab[0x1f801000 >> 12], mem_iortab, 1); + map_item(&mem_readtab[0x9f801000 >> 12], mem_iortab, 1); + map_item(&mem_readtab[0xbf801000 >> 12], mem_iortab, 1); map_item(&mem_writetab[0x1f801000 >> 12], mem_iowtab, 1); + map_item(&mem_writetab[0x9f801000 >> 12], mem_iowtab, 1); + map_item(&mem_writetab[0xbf801000 >> 12], mem_iowtab, 1); // L2 // unmapped tables diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index 9e442675..4373121e 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -212,8 +212,8 @@ u8 psxMemRead8(u32 mem) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) return psxHu8(mem); else return psxHwRead8(mem); @@ -237,8 +237,8 @@ u16 psxMemRead16(u32 mem) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) return psxHu16(mem); else return psxHwRead16(mem); @@ -262,8 +262,8 @@ u32 psxMemRead32(u32 mem) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) return psxHu32(mem); else return psxHwRead32(mem); @@ -287,8 +287,8 @@ void psxMemWrite8(u32 mem, u8 value) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) psxHu8(mem) = value; else psxHwWrite8(mem, value); @@ -314,8 +314,8 @@ void psxMemWrite16(u32 mem, u16 value) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) psxHu16ref(mem) = SWAPu16(value); else psxHwWrite16(mem, value); @@ -342,8 +342,8 @@ void psxMemWrite32(u32 mem, u32 value) { // if ((mem&0x1fffff) == 0x71E18 || value == 0x48088800) SysPrintf("t2fix!!\n"); t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) psxHu32ref(mem) = SWAPu32(value); else psxHwWrite32(mem, value); @@ -400,8 +400,8 @@ void *psxMemPointer(u32 mem) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) return (void *)&psxH[mem]; else return NULL;