X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fpico.c;h=bd4621b3e8835cd2345d4981d6c3761065bf9015;hb=ae214f1c37e5b02b6413040649a40f8ba3874e1b;hp=7c7a93e7189f4928a9fd16ac1090c5784f84c937;hpb=61801d5bc85c82afc5548fc25fc890bb56f4e763;p=picodrive.git diff --git a/pico/pico.c b/pico/pico.c index 7c7a93e..bd4621b 100644 --- a/pico/pico.c +++ b/pico/pico.c @@ -16,6 +16,7 @@ int PicoSkipFrame; // skip rendering frame? int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU int PicoPadInt[2]; // internal copy int PicoAHW; // active addon hardware: PAHW_* +int PicoQuirks; // game-specific quirks int PicoRegionOverride; // override the region detection 0: Auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe int PicoAutoRgnOrder; @@ -70,6 +71,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; @@ -165,7 +169,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 = SekCycleCnt = SekCycleAim = 0; + SekCycleCnt = SekCycleAim = 0; if (PicoAHW & PAHW_MCD) // needed for MCD to reset properly, probably some bug hides behind this.. @@ -274,23 +278,25 @@ PICO_INTERNAL int CheckDMA(void) #include "pico_cmn.c" -int z80stopCycle; -int z80_cycle_cnt; /* 'done' z80 cycles before z80_run() */ +unsigned int last_z80_sync; /* in 68k cycles */ +int z80_cycle_cnt; int z80_cycle_aim; int z80_scanline; int z80_scanline_cycles; /* cycles done until z80_scanline */ /* sync z80 to 68k */ -PICO_INTERNAL void PicoSyncZ80(int m68k_cycles_done) +PICO_INTERNAL void PicoSyncZ80(unsigned int m68k_cycles_done) { int cnt; - z80_cycle_aim = cycles_68k_to_z80(m68k_cycles_done); + z80_cycle_aim += cycles_68k_to_z80(m68k_cycles_done - last_z80_sync); cnt = z80_cycle_aim - z80_cycle_cnt; + last_z80_sync = m68k_cycles_done; 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); + elprintf(EL_BUSREQ, "z80 sync %i (%u|%u -> %u|%u)", cnt, + z80_cycle_cnt, z80_cycle_cnt / 288, + z80_cycle_aim, z80_cycle_aim / 288); if (cnt > 0) z80_cycle_cnt += z80_run(cnt);