X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fcd%2Fpico.c;h=2b652957c27ea4b6f461be1ccfdab9bf6d86ad75;hb=895d15121be3762c7007a3afe24c5d78bbdc8be7;hp=733515802eac7ae29aaa837cf7afb5c6db4668ae;hpb=ef090115c8ea74938ed44e36a42e4a53d4447a9e;p=picodrive.git diff --git a/pico/cd/pico.c b/pico/cd/pico.c index 7335158..2b65295 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" @@ -38,20 +43,19 @@ PICO_INTERNAL int PicoResetMCD(void) memset(&Pico_mcd->pcm, 0, sizeof(Pico_mcd->pcm)); memset(&Pico_mcd->m, 0, sizeof(Pico_mcd->m)); - *(unsigned int *)(Pico_mcd->bios + 0x70) = 0xffffffff; // reset hint vector (simplest way to implement reg6) + memset(Pico_mcd->bios + 0x70, 0xff, 4); // reset hint vector (simplest way to implement reg6) Pico_mcd->m.state_flags |= 1; // s68k reset pending Pico_mcd->s68k_regs[3] = 1; // 2M word RAM mode with m68k access after reset 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); } @@ -64,26 +68,6 @@ PICO_INTERNAL int PicoResetMCD(void) return 0; } -static __inline void SekRunM68k(int cyc) -{ - int cyc_do; - SekCycleAim+=cyc; - if ((cyc_do=SekCycleAim-SekCycleCnt) <= 0) return; -#if defined(EMU_CORE_DEBUG) - SekCycleCnt+=CM_compareRun(cyc_do, 0); -#elif defined(EMU_C68K) - PicoCpuCM68k.cycles=cyc_do; - CycloneRun(&PicoCpuCM68k); - SekCycleCnt+=cyc_do-PicoCpuCM68k.cycles; -#elif defined(EMU_M68K) - m68k_set_context(&PicoCpuMM68k); - SekCycleCnt+=m68k_execute(cyc_do); -#elif defined(EMU_F68K) - g_m68kcontext=&PicoCpuFM68k; - SekCycleCnt+=fm68k_emulate(cyc_do, 0, 0); -#endif -} - static __inline void SekRunS68k(int cyc) { int cyc_do; @@ -98,9 +82,11 @@ static __inline void SekRunS68k(int cyc) #elif defined(EMU_M68K) m68k_set_context(&PicoCpuMS68k); SekCycleCntS68k+=m68k_execute(cyc_do); + m68k_set_context(&PicoCpuMM68k); #elif defined(EMU_F68K) g_m68kcontext=&PicoCpuFS68k; SekCycleCntS68k+=fm68k_emulate(cyc_do, 0, 0); + g_m68kcontext=&PicoCpuFM68k; #endif } @@ -212,6 +198,16 @@ static __inline void update_chips(void) #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"