X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FSek.c;h=333169cacda639ee94c3aadba12e1dc5a90a79e5;hb=1413b9a1185543e6fff7a3f67c5b8cdfec4b7eee;hp=659850b7838b481a7044252efa85ed435a4b0b59;hpb=b06778874d140bd5187cb74444ddc40931b9bd1d;p=picodrive.git diff --git a/Pico/Sek.c b/Pico/Sek.c index 659850b..333169c 100644 --- a/Pico/Sek.c +++ b/Pico/Sek.c @@ -163,6 +163,21 @@ PICO_INTERNAL int SekReset(void) return 0; } +void SekStepM68k(void) +{ + SekCycleAim=SekCycleCnt+1; +#if defined(EMU_CORE_DEBUG) + SekCycleCnt+=CM_compareRun(1, 0); +#elif defined(EMU_C68K) + PicoCpuCM68k.cycles=1; + CycloneRun(&PicoCpuCM68k); + SekCycleCnt+=1-PicoCpuCM68k.cycles; +#elif defined(EMU_M68K) + SekCycleCnt+=m68k_execute(1); +#elif defined(EMU_F68K) + SekCycleCnt+=fm68k_emulate(1, 0, 0); +#endif +} PICO_INTERNAL void SekSetRealTAS(int use_real) { @@ -174,6 +189,7 @@ PICO_INTERNAL void SekSetRealTAS(int use_real) #endif } + /* idle loop detection, not to be used in CD mode */ #ifdef EMU_C68K #include "cpu/Cyclone/tools/idle.h" @@ -183,8 +199,6 @@ static int *idledet_addrs = NULL; static int idledet_count = 0, idledet_bads = 0; int idledet_start_frame = 0; -static unsigned char *rom_verify = NULL; - void SekInitIdleDet(void) { void *tmp = realloc(idledet_addrs, 0x200*4); @@ -197,16 +211,17 @@ void SekInitIdleDet(void) idledet_count = idledet_bads = 0; idledet_start_frame = Pico.m.frame_count + 360; - rom_verify = realloc(rom_verify, Pico.romsize); - memcpy(rom_verify, Pico.rom, Pico.romsize); #ifdef EMU_C68K CycloneInitIdle(); #endif +#ifdef EMU_F68K + fm68k_emulate(0, 0, 1); +#endif } int SekIsIdleCode(unsigned short *dst, int bytes) { - printf("SekIsIdleCode %04x %i\n", *dst, bytes); + // printf("SekIsIdleCode %04x %i\n", *dst, bytes); switch (bytes) { case 4: @@ -272,9 +287,11 @@ int SekRegisterIdlePatch(unsigned int pc, int oldop, int newop) void SekFinishIdleDet(void) { - int done_something = idledet_count > 0; #ifdef EMU_C68K CycloneFinishIdle(); +#endif +#ifdef EMU_F68K + fm68k_emulate(0, 0, 2); #endif while (idledet_count > 0) { @@ -288,14 +305,6 @@ void SekFinishIdleDet(void) else elprintf(EL_STATUS|EL_IDLE, "idle: don't know how to restore %04x", *op); } - - if (done_something) - { - int i; - for (i = 0; i < Pico.romsize; i++) - if (rom_verify[i] != Pico.rom[i]) - printf("ROM corruption @ %06x!\n", i), exit(1); - } }