svp compiler: few more ops
[picodrive.git] / Pico / Memory.c
index f9d7f69..8632c7a 100644 (file)
@@ -37,6 +37,8 @@ extern unsigned int ppop;
 \r
 #ifdef IO_STATS\r
 void log_io(unsigned int addr, int bits, int rw);\r
+#elif defined(_MSC_VER)\r
+#define log_io\r
 #else\r
 #define log_io(...)\r
 #endif\r
@@ -301,23 +303,11 @@ static void OtherWrite8End(u32 a,u32 d,int realsize)
 #endif\r
   elprintf(EL_UIO, "strange w%i: %06x, %08x @%06x", realsize, a&0xffffff, d, SekPc);\r
 \r
-  if(a >= 0xA13004 && a < 0xA13040) {\r
-    // dumb 12-in-1 or 4-in-1 banking support\r
-    int len;\r
-    a &= 0x3f; a <<= 16;\r
-    len = Pico.romsize - a;\r
-    if (len <= 0) return; // invalid/missing bank\r
-    if (len > 0x200000) len = 0x200000; // 2 megs\r
-    memcpy(Pico.rom, Pico.rom+a, len); // code which does this is in RAM so this is safe.\r
-    return;\r
-  }\r
-\r
   // for games with simple protection devices, discovered by Haze\r
-  else if ((a>>22) == 1)\r
+  if ((a>>22) == 1)\r
     Pico.m.prot_bytes[(a>>2)&1] = (u8)d;\r
 }\r
 \r
-\r
 #include "MemoryCmn.c"\r
 \r
 \r
@@ -498,15 +488,26 @@ static void PicoWrite32(u32 a,u32 d)
 // -----------------------------------------------------------------\r
 \r
 // TODO: asm code\r
-u32  (*PicoRead16Hook)(u32 a, int realsize) = OtherRead16End;\r
-void (*PicoWrite8Hook)(u32 a, u32 d, int realsize) = OtherWrite8End;\r
+static void OtherWrite16End(u32 a,u32 d,int realsize)\r
+{\r
+  PicoWrite8Hook(a,  d>>8, realsize);\r
+  PicoWrite8Hook(a+1,d&0xff, realsize);\r
+}\r
 \r
-PICO_INTERNAL void PicoMemSetup(void)\r
+u32  (*PicoRead16Hook) (u32 a, int realsize) = OtherRead16End;\r
+void (*PicoWrite8Hook) (u32 a, u32 d, int realsize) = OtherWrite8End;\r
+void (*PicoWrite16Hook)(u32 a, u32 d, int realsize) = OtherWrite16End;\r
+\r
+PICO_INTERNAL void PicoMemResetHooks(void)\r
 {\r
   // default unmapped/cart specific handlers\r
   PicoRead16Hook = OtherRead16End;\r
   PicoWrite8Hook = OtherWrite8End;\r
+  PicoWrite16Hook = OtherWrite16End;\r
+}\r
 \r
+PICO_INTERNAL void PicoMemSetup(void)\r
+{\r
   // Setup memory callbacks:\r
 #ifdef EMU_C68K\r
   PicoCpuCM68k.checkpc=PicoCheckPc;\r