X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fpico.c;h=859935e7e3b52c3ad44603a4c6b7a3a754e754b1;hb=531a8f38839713938a441f9287724e5e72c492c3;hp=c4b90311b055470c3f04c48059d785fa7d61c417;hpb=5e128c6d279ac90f7b6078740ab1d0ba516969b9;p=picodrive.git diff --git a/pico/pico.c b/pico/pico.c index c4b9031..859935e 100644 --- a/pico/pico.c +++ b/pico/pico.c @@ -1,11 +1,11 @@ -// PicoDrive - -// (c) Copyright 2004 Dave, All rights reserved. -// (c) Copyright 2006-2008 notaz, All rights reserved. -// Free for non-commercial use. - -// For commercial use, separate licencing terms must be obtained. - +/* + * PicoDrive + * (c) Copyright Dave, 2004 + * (C) notaz, 2006-2010 + * + * 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" @@ -54,6 +54,7 @@ void PicoExit(void) if (SRam.data) free(SRam.data); + pevt_dump(); } void PicoPower(void) @@ -61,7 +62,7 @@ void PicoPower(void) Pico.m.frame_count = 0; // clear all memory of the emulated machine - memset(&Pico.ram,0,(unsigned int)&Pico.rom-(unsigned int)&Pico.ram); + memset(&Pico.ram,0,(unsigned char *)&Pico.rom - Pico.ram); memset(&Pico.video,0,sizeof(Pico.video)); memset(&Pico.m,0,sizeof(Pico.m)); @@ -69,6 +70,9 @@ void PicoPower(void) Pico.video.pending_ints=0; z80_reset(); + // my MD1 VA6 console has this in IO + Pico.ioports[1] = Pico.ioports[2] = Pico.ioports[3] = 0xff; + // default VDP register values (based on Fusion) Pico.video.reg[0] = Pico.video.reg[1] = 0x04; Pico.video.reg[0xc] = 0x81; @@ -77,7 +81,7 @@ void PicoPower(void) if (PicoAHW & PAHW_MCD) PicoPowerMCD(); - if (!(PicoOpt & POPT_DIS_32X)) + if (PicoOpt & POPT_EN_32X) PicoPower32x(); PicoReset(); @@ -145,6 +149,10 @@ int PicoReset(void) if (Pico.romsize <= 0) return 1; +#if defined(CPU_CMP_R) || defined(CPU_CMP_W) || defined(DRC_CMP) + PicoOpt |= POPT_DIS_VDP_FIFO|POPT_DIS_IDLE_DET; +#endif + /* must call now, so that banking is reset, and correct vectors get fetched */ if (PicoResetHook) PicoResetHook(); @@ -160,7 +168,7 @@ int PicoReset(void) SekReset(); // s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games). SekSetRealTAS(PicoAHW & PAHW_MCD); - SekCycleCntT=0; + SekCycleCntT = SekCycleCnt = SekCycleAim = 0; if (PicoAHW & PAHW_MCD) // needed for MCD to reset properly, probably some bug hides behind this.. @@ -192,10 +200,8 @@ int PicoReset(void) if (!(PicoOpt & POPT_DIS_IDLE_DET)) SekInitIdleDet(); - if (!(PicoOpt & POPT_DIS_32X)) { + if (PicoOpt & POPT_EN_32X) PicoReset32x(); - return 0; - } // reset sram state; enable sram access by default if it doesn't overlap with ROM Pico.m.sram_reg = 0; @@ -209,7 +215,7 @@ int PicoReset(void) return 0; } -// flush cinfig changes before emu loop starts +// flush config changes before emu loop starts void PicoLoopPrepare(void) { if (PicoRegionOverride) @@ -218,6 +224,9 @@ void PicoLoopPrepare(void) // FIXME: PAL has 313 scanlines.. scanlines_total = Pico.m.pal ? 312 : 262; + + Pico.m.dirtyPal = 1; + rendstatus_old = -1; } @@ -266,25 +275,6 @@ PICO_INTERNAL int CheckDMA(void) return burn; } -static __inline void SekRunM68k(int cyc) -{ - int cyc_do; - SekCycleAim+=cyc; - if ((cyc_do=SekCycleAim-SekCycleCnt) <= 0) return; -#if defined(EMU_CORE_DEBUG) - // this means we do run-compare - 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) - SekCycleCnt+=m68k_execute(cyc_do); -#elif defined(EMU_F68K) - SekCycleCnt+=fm68k_emulate(cyc_do+1, 0, 0); -#endif -} - #include "pico_cmn.c" int z80stopCycle; @@ -300,38 +290,47 @@ PICO_INTERNAL void PicoSyncZ80(int m68k_cycles_done) z80_cycle_aim = cycles_68k_to_z80(m68k_cycles_done); cnt = z80_cycle_aim - z80_cycle_cnt; + pprof_start(z80); + elprintf(EL_BUSREQ, "z80 sync %i (%i|%i -> %i|%i)", cnt, z80_cycle_cnt, z80_cycle_cnt / 228, z80_cycle_aim, z80_cycle_aim / 228); if (cnt > 0) z80_cycle_cnt += z80_run(cnt); + + pprof_end(z80); } void PicoFrame(void) { + pprof_start(frame); + Pico.m.frame_count++; if (PicoAHW & PAHW_SMS) { PicoFrameMS(); - return; + goto end; } // TODO: MCD+32X if (PicoAHW & PAHW_MCD) { PicoFrameMCD(); - return; + goto end; } if (PicoAHW & PAHW_32X) { PicoFrame32x(); - return; + goto end; } //if(Pico.video.reg[12]&0x2) Pico.video.status ^= 0x10; // change odd bit in interlace mode PicoFrameStart(); PicoFrameHints(); + +end: + pprof_end(frame); } void PicoFrameDrawOnly(void)