X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fpico.c;h=1c58f227016502ecddfd918338a9aa3916e4c4fd;hb=ea38612fad50103e224a3d00492d40b7dcff9e94;hp=45572695aa30cd00b6856dbe8f35a40442f0d6ad;hpb=fa8fb7544593a0ed43f3354cc5f41150464b55bf;p=picodrive.git diff --git a/pico/pico.c b/pico/pico.c index 4557269..1c58f22 100644 --- a/pico/pico.c +++ b/pico/pico.c @@ -36,6 +36,9 @@ void PicoInit(void) memset(&PicoPad,0,sizeof(PicoPad)); memset(&PicoPadInt,0,sizeof(PicoPadInt)); + Pico.est.Pico_video = &Pico.video; + Pico.est.Pico_vram = Pico.vram; + // Init CPUs: SekInit(); z80_init(); // init even if we aren't going to use it @@ -61,6 +64,7 @@ void PicoExit(void) void PicoPower(void) { Pico.m.frame_count = 0; + SekCycleCnt = SekCycleAim = 0; // clear all memory of the emulated machine memset(&Pico.ram,0,(unsigned char *)&Pico.rom - Pico.ram); @@ -167,15 +171,15 @@ int PicoReset(void) } SekReset(); + // ..but do not reset SekCycle* to not desync with addons + // 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); - SekCycleCnt = SekCycleAim = 0; Pico.m.dirtyPal = 1; Pico.m.z80_bank68k = 0; Pico.m.z80_reset = 1; - memset(Pico.zram, 0, sizeof(Pico.zram)); // ?? PicoDetectRegion(); Pico.video.status = 0x3428 | Pico.m.pal; // 'always set' bits | vblank | collision | pal @@ -284,8 +288,11 @@ int z80_scanline_cycles; /* cycles done until z80_scanline */ /* sync z80 to 68k */ PICO_INTERNAL void PicoSyncZ80(unsigned int m68k_cycles_done) { + int m68k_cnt; int cnt; - z80_cycle_aim += cycles_68k_to_z80(m68k_cycles_done - last_z80_sync); + + m68k_cnt = m68k_cycles_done - last_z80_sync; + z80_cycle_aim += cycles_68k_to_z80(m68k_cnt); cnt = z80_cycle_aim - z80_cycle_cnt; last_z80_sync = m68k_cycles_done;