aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2013-03-11 01:17:38 +0200
committernotaz2013-03-15 02:19:21 +0200
commit9dd7d179658d34f7943fa0092d172bf4f78d325b (patch)
tree5a408bed3137b59fd016149aba14814a36ba47d7
parent507d7c1d3eb09cbe2b7706f3fe8b88c99df54823 (diff)
downloadpcsx_rearmed-9dd7d179658d34f7943fa0092d172bf4f78d325b.tar.gz
pcsx_rearmed-9dd7d179658d34f7943fa0092d172bf4f78d325b.tar.bz2
pcsx_rearmed-9dd7d179658d34f7943fa0092d172bf4f78d325b.zip
psxmem: handle io mirrors
tested on real hardware (ignoring missing fault emulation) fixes Star Wars - Episode I
-rw-r--r--libpcsxcore/new_dynarec/pcsxmem.c6
-rw-r--r--libpcsxcore/psxmem.c28
2 files changed, 20 insertions, 14 deletions
diff --git a/libpcsxcore/new_dynarec/pcsxmem.c b/libpcsxcore/new_dynarec/pcsxmem.c
index a42852a..3d14904 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 9e44267..4373121 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;