/*
- * (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.
//#define memprintf printf
#define memprintf(...)
-static int ram_is_ro;
+int pcsx_ram_is_ro;
static void read_mem8()
{
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();
void (*writememb[0x10000])();
void (*writememh[0x10000])();
-static void write_mem_check_ro32()
-{
- if (!ram_is_ro)
- *(u32 *)(address | 0x80000000) = word;
-}
-
static void write_biu()
{
memprintf("write_biu %08x, %08x @%08x %u\n", address, word, psxRegs.pc, psxRegs.cycle);
switch (word) {
case 0x800: case 0x804:
- ram_is_ro = 1;
+ pcsx_ram_is_ro = 1;
break;
case 0: case 0x1e988:
- ram_is_ro = 0;
+ pcsx_ram_is_ro = 0;
break;
default:
memprintf("write_biu: unexpected val: %08x\n", word);
static void io_write_dma_icr32(u32 value)
{
- u32 tmp = ~value & HW_DMA_ICR;
- HW_DMA_ICR = ((tmp ^ value) & 0xffffff) ^ tmp;
+ u32 tmp = value & 0x00ff803f;
+ tmp |= (SWAPu32(HW_DMA_ICR) & ~value) & 0x7f000000;
+ if ((tmp & HW_DMA_ICR_GLOBAL_ENABLE && tmp & 0x7f000000)
+ || tmp & HW_DMA_ICR_BUS_ERROR) {
+ if (!(SWAPu32(HW_DMA_ICR) & HW_DMA_ICR_IRQ_SENT))
+ psxHu32ref(0x1070) |= SWAP32(8);
+ tmp |= HW_DMA_ICR_IRQ_SENT;
+ }
+ HW_DMA_ICR = SWAPu32(tmp);
}
#define make_dma_func(n) \
}
// stupid BIOS RAM check
- writemem[0] = write_mem_check_ro32;
- ram_is_ro = 0;
+ writemem[0] = ari_write_ram_mirror_ro32;
+ pcsx_ram_is_ro = 0;
// RAM direct
for (i = 0x8000; i < 0x8020; i++) {