X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fcd%2Fpico.c;h=8bd716fe9323bbc544cbafd1affebfb57dbbb7df;hb=4c2e35547fd6f849648234989419a4a02d2546b4;hp=b0b123cbe31d1237d94bb892492365d19179ac0d;hpb=7b3f44c6b677a60b63b092f825a2b6c58166b70c;p=picodrive.git diff --git a/pico/cd/pico.c b/pico/cd/pico.c index b0b123c..8bd716f 100644 --- a/pico/cd/pico.c +++ b/pico/cd/pico.c @@ -1,5 +1,10 @@ -// (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" #include "../sound/ym2612.h" @@ -8,7 +13,7 @@ extern unsigned char formatted_bram[4*0x10]; extern unsigned int s68k_poll_adclk; void (*PicoMCDopenTray)(void) = NULL; -int (*PicoMCDcloseTray)(void) = NULL; +void (*PicoMCDcloseTray)(void) = NULL; PICO_INTERNAL void PicoInitMCD(void) @@ -45,13 +50,12 @@ PICO_INTERNAL int PicoResetMCD(void) Reset_CD(); LC89510_Reset(); gfx_cd_reset(); - PicoMemResetCD(1); #ifdef _ASM_CD_MEMORY_C //PicoMemResetCDdecode(1); // don't have to call this in 2M mode #endif // use SRam.data for RAM cart - if (PicoOpt&POPT_EN_MCD_RAMCART) { + if (PicoOpt & POPT_EN_MCD_RAMCART) { if (SRam.data == NULL) SRam.data = calloc(1, 0x12000); } @@ -67,6 +71,9 @@ PICO_INTERNAL int PicoResetMCD(void) static __inline void SekRunM68k(int cyc) { int cyc_do; + + pprof_start(m68k); + SekCycleAim+=cyc; if ((cyc_do=SekCycleAim-SekCycleCnt) <= 0) return; #if defined(EMU_CORE_DEBUG) @@ -82,6 +89,7 @@ static __inline void SekRunM68k(int cyc) g_m68kcontext=&PicoCpuFM68k; SekCycleCnt+=fm68k_emulate(cyc_do, 0, 0); #endif + pprof_end(m68k); } static __inline void SekRunS68k(int cyc) @@ -208,24 +216,20 @@ static __inline void update_chips(void) // update gfx chip if (Pico_mcd->rot_comp.Reg_58 & 0x8000) gfx_cd_update(); - - // delayed setting of DMNA bit (needed for Silpheed) - if (Pico_mcd->m.state_flags & 2) { - Pico_mcd->m.state_flags &= ~2; - if (!(Pico_mcd->s68k_regs[3] & 4)) { - Pico_mcd->s68k_regs[3] |= 2; - Pico_mcd->s68k_regs[3] &= ~1; -#ifdef USE_POLL_DETECT - if ((s68k_poll_adclk&0xfe) == 2) { - SekSetStopS68k(0); s68k_poll_adclk = 0; - } -#endif - } - } } #define PICO_CD +#define CPUS_RUN(m68k_cycles,s68k_cycles) \ +{ \ + if ((PicoOpt&POPT_EN_MCD_PSYNC) && (Pico_mcd->m.busreq&3) == 1) { \ + SekRunPS(m68k_cycles, s68k_cycles); /* "better/perfect sync" */ \ + } else { \ + SekRunM68k(m68k_cycles); \ + if ((Pico_mcd->m.busreq&3) == 1) /* no busreq/no reset */ \ + SekRunS68k(s68k_cycles); \ + } \ +} #include "../pico_cmn.c"