some irq hacks
[picodrive.git] / pico / cd / sek.c
index 96e6335..42fea93 100644 (file)
@@ -9,8 +9,8 @@
 #include "../pico_int.h"
 
 
-int SekCycleCntS68k=0; // cycles done in this frame
-int SekCycleAimS68k=0; // cycle aim
+unsigned int SekCycleCntS68k;
+unsigned int SekCycleAimS68k;
 
 
 /* context */
@@ -178,10 +178,8 @@ PICO_INTERNAL int SekInterruptS68k(int irq)
   PicoCpuCS68k.irq=real_irq;
 #endif
 #ifdef EMU_M68K
-  void *oldcontext = m68ki_cpu_p;
-  m68k_set_context(&PicoCpuMS68k);
-  m68k_set_irq(real_irq);
-  m68k_set_context(oldcontext);
+  // avoid m68k_set_irq() for delaying to work
+  PicoCpuMS68k.int_level = real_irq << 8;
 #endif
 #ifdef EMU_F68K
   PicoCpuFS68k.interrupts[0]=real_irq;
@@ -189,3 +187,17 @@ PICO_INTERNAL int SekInterruptS68k(int irq)
   return 0;
 }
 
+void SekInterruptClearS68k(int irq)
+{
+  int level_new = new_irq_level(irq);
+
+#ifdef EMU_C68K
+  PicoCpuCS68k.irq = level_new;
+#endif
+#ifdef EMU_M68K
+  CPU_INT_LEVEL = level_new << 8;
+#endif
+#ifdef EMU_F68K
+  PicoCpuFS68k.interrupts[0] = level_new;
+#endif
+}