X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fcd%2Fsek.c;h=baf0d9e5e1e9e74a751f45dca65c588e01614fe8;hb=7669591e0876778fc4f3977b145c012f2e3a12e9;hp=65c8c2333d7cc0ca981b014c3d07c25a3fabade3;hpb=a736af3ecf708652f90e9cb05445d984960a0eec;p=picodrive.git diff --git a/pico/cd/sek.c b/pico/cd/sek.c index 65c8c23..baf0d9e 100644 --- a/pico/cd/sek.c +++ b/pico/cd/sek.c @@ -1,11 +1,16 @@ -// (c) Copyright 2007 notaz, All rights reserved. - +/* + * PicoDrive + * (C) notaz, 2007 + * + * This work is licensed under the terms of MAME license. + * See COPYING file in the top-level directory. + */ #include "../pico_int.h" -int SekCycleCntS68k=0; // cycles done in this frame -int SekCycleAimS68k=0; // cycle aim +unsigned int SekCycleCntS68k; +unsigned int SekCycleAimS68k; /* context */ @@ -112,15 +117,10 @@ PICO_INTERNAL void SekInitS68k(void) } #endif #ifdef EMU_F68K - { - void *oldcontext = g_m68kcontext; - g_m68kcontext = &PicoCpuFS68k; - memset(&PicoCpuFS68k, 0, sizeof(PicoCpuFS68k)); - fm68k_init(); - PicoCpuFS68k.iack_handler = SekIntAckFS68k; - PicoCpuFS68k.sr = 0x2704; // Z flag - g_m68kcontext = oldcontext; - } + memset(&PicoCpuFS68k, 0, sizeof(PicoCpuFS68k)); + fm68k_init(); + PicoCpuFS68k.iack_handler = SekIntAckFS68k; + PicoCpuFS68k.sr = 0x2704; // Z flag #endif } @@ -144,12 +144,7 @@ PICO_INTERNAL int SekResetS68k(void) } #endif #ifdef EMU_F68K - { - void *oldcontext = g_m68kcontext; - g_m68kcontext = &PicoCpuFS68k; - fm68k_reset(); - g_m68kcontext = oldcontext; - } + fm68k_reset(&PicoCpuFS68k); #endif return 0; @@ -173,10 +168,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; @@ -184,3 +177,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 +}