dualcore integration in famc, bram cart C code, psp bugfixes
[picodrive.git] / Pico / cd / Memory.c
index 360c0cf..8053185 100644 (file)
@@ -392,6 +392,24 @@ static u32 OtherRead16End(u32 a, int realsize)
     goto end;\r
   }\r
 \r
+  if (a==0x400000) {\r
+    if (SRam.data != NULL) d=3; // 64k cart\r
+    goto end;\r
+  }\r
+\r
+  if ((a&0xfe0000)==0x600000) {\r
+    if (SRam.data != NULL) {\r
+      d=SRam.data[((a>>1)&0xffff)+0x2000];\r
+      if (realsize == 8) d|=d<<8;\r
+    }\r
+    goto end;\r
+  }\r
+\r
+  if (a==0x7ffffe) {\r
+    d=Pico_mcd->m.bcram_reg;\r
+    goto end;\r
+  }\r
+\r
   dprintf("m68k FIXME: unusual r%i: %06x @%06x", realsize&~1, (a&0xfffffe)+(realsize&1), SekPc);\r
 \r
 end:\r
@@ -403,6 +421,19 @@ static void OtherWrite8End(u32 a, u32 d, int realsize)
 {\r
   if ((a&0xffffc0)==0xa12000) { m68k_reg_write8(a, d); return; }\r
 \r
+  if ((a&0xfe0000)==0x600000) {\r
+    if (SRam.data != NULL && (Pico_mcd->m.bcram_reg&1)) {\r
+      SRam.data[((a>>1)&0xffff)+0x2000]=d;\r
+      SRam.changed = 1;\r
+    }\r
+    return;\r
+  }\r
+\r
+  if (a==0x7fffff) {\r
+    Pico_mcd->m.bcram_reg=d;\r
+    return;\r
+  }\r
+\r
   dprintf("m68k FIXME: strange w%i: [%06x], %08x @%06x", realsize, a&0xffffff, d, SekPc);\r
 }\r
 \r