X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fpico.c;h=6a065e67191ed5010427a6db984b5b237703dc2c;hb=2446536be520914616403876d7e49621ac6f4b95;hp=d3123868c49eb3a6028ca0aecc481bab4621c571;hpb=b8a1c09ad1ef0b807c2eb1632d34e6bfae14b633;p=picodrive.git diff --git a/pico/pico.c b/pico/pico.c index d312386..6a065e6 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" @@ -23,6 +23,9 @@ struct PicoSRAM SRam; int emustatus; // rapid_ym2612, multi_ym_updates int scanlines_total; +int p32x_msh2_multiplier = MSH2_MULTI_DEFAULT; +int p32x_ssh2_multiplier = SSH2_MULTI_DEFAULT; + void (*PicoWriteSound)(int len) = NULL; // called at the best time to send sound buffer (PsndOut) to hardware void (*PicoResetHook)(void) = NULL; void (*PicoLineHook)(void) = NULL; @@ -192,10 +195,8 @@ int PicoReset(void) if (!(PicoOpt & POPT_DIS_IDLE_DET)) SekInitIdleDet(); - if (PicoOpt & POPT_EN_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 +210,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) @@ -219,6 +220,9 @@ void PicoLoopPrepare(void) // FIXME: PAL has 313 scanlines.. scanlines_total = Pico.m.pal ? 312 : 262; + Pico.m.dirtyPal = 1; + rendstatus_old = -1; + if (PicoAHW & PAHW_32X) p32x_timers_recalc(); } @@ -272,6 +276,8 @@ PICO_INTERNAL int CheckDMA(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) @@ -286,6 +292,8 @@ static __inline void SekRunM68k(int cyc) #elif defined(EMU_F68K) SekCycleCnt+=fm68k_emulate(cyc_do+1, 0, 0); #endif + + pprof_end(m68k); } #include "pico_cmn.c" @@ -303,38 +311,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)