fix emuloop init to use correct pal value
[picodrive.git] / pico / memory.c
index f6c0eeb..00e5016 100644 (file)
@@ -257,8 +257,11 @@ void NOINLINE ctl_write_z80busreq(u32 d)
     else\r
     {\r
       z80stopCycle = SekCyclesDone();\r
-      if ((PicoOpt&POPT_EN_Z80) && !Pico.m.z80_reset)\r
+      if ((PicoOpt&POPT_EN_Z80) && !Pico.m.z80_reset) {\r
+        pprof_start(m68k);\r
         PicoSyncZ80(z80stopCycle);\r
+        pprof_end_sub(m68k);\r
+      }\r
     }\r
     Pico.m.z80Run = d;\r
   }\r
@@ -272,8 +275,11 @@ void NOINLINE ctl_write_z80reset(u32 d)
   {\r
     if (d)\r
     {\r
-      if ((PicoOpt&POPT_EN_Z80) && Pico.m.z80Run)\r
+      if ((PicoOpt&POPT_EN_Z80) && Pico.m.z80Run) {\r
+        pprof_start(m68k);\r
         PicoSyncZ80(SekCyclesDone());\r
+        pprof_end_sub(m68k);\r
+      }\r
       YM2612ResetChip();\r
       timers_reset();\r
     }\r
@@ -316,7 +322,7 @@ static u32 PicoRead8_sram(u32 a)
 static u32 PicoRead16_sram(u32 a)\r
 {\r
   u32 d;\r
-  if (SRam.end >= a && a >= SRam.start && (Pico.m.sram_reg & SRR_MAPPED))\r
+  if (SRam.start <= a && a <= SRam.end && (Pico.m.sram_reg & SRR_MAPPED))\r
   {\r
     if (SRam.flags & SRF_EEPROM)\r
       d = EEPROM_read();\r