X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fnew_dynarec%2Fpcsxmem.c;h=8b6714bf02cda65092343d9c036640b5b6f9fabf;hb=5a05d80c2ed15a50915dc7f820155893c4735e01;hp=a323c18dd25d86510334c9bb4244a5cc0eb20372;hpb=a06c1d6e156b90ce9bfa18664256dfe8f815857e;p=pcsx_rearmed.git diff --git a/libpcsxcore/new_dynarec/pcsxmem.c b/libpcsxcore/new_dynarec/pcsxmem.c index a323c18d..8b6714bf 100644 --- a/libpcsxcore/new_dynarec/pcsxmem.c +++ b/libpcsxcore/new_dynarec/pcsxmem.c @@ -1,5 +1,5 @@ /* - * (C) Gražvydas "notaz" Ignotas, 2010 + * (C) Gražvydas "notaz" Ignotas, 2010-2011 * * This work is licensed under the terms of GNU GPL version 2 or later. * See the COPYING file in the top-level directory. @@ -15,6 +15,8 @@ //#define memprintf printf #define memprintf(...) +int pcsx_ram_is_ro; + static void read_mem8() { memprintf("ari64_read_mem8 %08x @%08x %u\n", address, psxRegs.pc, psxRegs.cycle); @@ -72,6 +74,7 @@ extern void ari_write_ram32(); extern void ari_write_ram_mirror8(); extern void ari_write_ram_mirror16(); extern void ari_write_ram_mirror32(); +extern void ari_write_ram_mirror_ro32(); extern void ari_read_bios8(); extern void ari_read_bios16(); extern void ari_read_bios32(); @@ -89,6 +92,26 @@ void (*writemem[0x10000])(); void (*writememb[0x10000])(); void (*writememh[0x10000])(); +static void write_biu() +{ + memprintf("write_biu %08x, %08x @%08x %u\n", address, word, psxRegs.pc, psxRegs.cycle); + + if (address != 0xfffe0130) + return; + + switch (word) { + case 0x800: case 0x804: + pcsx_ram_is_ro = 1; + break; + case 0: case 0x1e988: + pcsx_ram_is_ro = 0; + break; + default: + memprintf("write_biu: unexpected val: %08x\n", word); + break; + } +} + /* IO handlers */ static u32 io_read_sio16() { @@ -313,14 +336,15 @@ void new_dyna_pcsx_mem_init(void) writemem[i] = writemem [0x8000|i] = writemem [0xa000|i] = ari_write_ram_mirror32; } + // stupid BIOS RAM check + writemem[0] = ari_write_ram_mirror_ro32; + pcsx_ram_is_ro = 0; + // RAM direct for (i = 0x8000; i < 0x8020; i++) { readmemb[i] = ari_read_ram8; readmemh[i] = ari_read_ram16; readmem[i] = ari_read_ram32; - writememb[i] = ari_write_ram8; - writememh[i] = ari_write_ram16; - writemem[i] = ari_write_ram32; } // BIOS and it's mirrors @@ -338,7 +362,7 @@ void new_dyna_pcsx_mem_init(void) writememh[0x1f80] = ari_write_io16; writemem[0x1f80] = ari_write_io32; - writemem[0xfffe] = write_mem32; + writemem[0xfffe] = write_biu; #endif // fill IO tables