12-in-1 + realtec mapper
[picodrive.git] / Pico / Pico.c
index 0e9ee6c..a76c9e4 100644 (file)
@@ -38,6 +38,7 @@ int PicoInit(void)
   z80_init(); // init even if we aren't going to use it\r
 \r
   PicoInitMCD();\r
+  PicoSVPInit();\r
 \r
   SRam.data=0;\r
 \r
@@ -63,6 +64,9 @@ int PicoReset(int hard)
 \r
   if (Pico.romsize<=0) return 1;\r
 \r
+  /* must call now, so that banking is reset, and correct vectors get fetched */\r
+  if (PicoResetHook) PicoResetHook();\r
+\r
   PicoMemReset();\r
   SekReset();\r
   // s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games).\r
@@ -78,7 +82,7 @@ int PicoReset(int hard)
   Pico.video.pending_ints=0;\r
   emustatus = 0;\r
 \r
-  if(hard) {\r
+  if (hard) {\r
     // clear all memory of the emulated machine\r
     memset(&Pico.ram,0,(unsigned int)&Pico.rom-(unsigned int)&Pico.ram);\r
   }\r
@@ -141,8 +145,6 @@ int PicoReset(int hard)
 \r
   PsndReset(); // pal must be known here\r
 \r
-  if (PicoResetHook) PicoResetHook();\r
-\r
   if (PicoMCD & 1) {\r
     PicoResetMCD(hard);\r
     return 0;\r
@@ -161,15 +163,16 @@ int PicoReset(int hard)
 \r
 // dma2vram settings are just hacks to unglitch Legend of Galahad (needs <= 104 to work)\r
 // same for Outrunners (92-121, when active is set to 24)\r
+// 96 is VR hack\r
 static const int dma_timings[] = {\r
-83,  167, 166,  83, // vblank: 32cell: dma2vram dma2[vs|c]ram vram_fill vram_copy\r
+96,  167, 166,  83, // vblank: 32cell: dma2vram dma2[vs|c]ram vram_fill vram_copy\r
 102, 205, 204, 102, // vblank: 40cell:\r
 16,   16,  15,   8, // active: 32cell:\r
 24,   18,  17,   9  // ...\r
 };\r
 \r
 static const int dma_bsycles[] = {\r
-(488<<8)/82,  (488<<8)/167, (488<<8)/166, (488<<8)/83,\r
+(488<<8)/96,  (488<<8)/167, (488<<8)/166, (488<<8)/83,\r
 (488<<8)/102, (488<<8)/205, (488<<8)/204, (488<<8)/102,\r
 (488<<8)/16,  (488<<8)/16,  (488<<8)/15,  (488<<8)/8,\r
 (488<<8)/24,  (488<<8)/18,  (488<<8)/17,  (488<<8)/9\r