famec: split fm68k_emulate

in FAMEC_NO_GOTOS mode at least
This commit is contained in:
notaz 2017-10-15 00:45:55 +03:00
parent fdcfd32374
commit 12f23dac6f
8 changed files with 83 additions and 34 deletions

View file

@ -107,7 +107,7 @@ static void SekRunM68kOnce(void)
#elif defined(EMU_M68K)
Pico.t.m68c_cnt += m68k_execute(cyc_do) - cyc_do;
#elif defined(EMU_F68K)
Pico.t.m68c_cnt += fm68k_emulate(cyc_do, 0) - cyc_do;
Pico.t.m68c_cnt += fm68k_emulate(&PicoCpuFM68k, cyc_do, 0) - cyc_do;
#endif
}
@ -138,8 +138,7 @@ static void SekRunS68k(unsigned int to)
SekCycleCntS68k += m68k_execute(cyc_do) - cyc_do;
m68k_set_context(&PicoCpuMM68k);
#elif defined(EMU_F68K)
g_m68kcontext = &PicoCpuFS68k;
SekCycleCntS68k += fm68k_emulate(cyc_do, 0) - cyc_do;
SekCycleCntS68k += fm68k_emulate(&PicoCpuFS68k, cyc_do, 0) - cyc_do;
g_m68kcontext = &PicoCpuFM68k;
#endif
}

View file

@ -151,8 +151,7 @@ PICO_INTERNAL int SekResetS68k(void)
#ifdef EMU_F68K
{
void *oldcontext = g_m68kcontext;
g_m68kcontext = &PicoCpuFS68k;
fm68k_reset();
fm68k_reset(&PicoCpuFS68k);
g_m68kcontext = oldcontext;
}
#endif

View file

@ -49,7 +49,7 @@ static int otherRun(void)
CycloneRun(currentC68k);
return 1-currentC68k->cycles;
#elif defined(EMU_F68K)
return fm68k_emulate(1, 0);
return fm68k_emulate(g_m68kcontext, 1, 0);
#endif
}

View file

@ -38,7 +38,7 @@ static void SekSyncM68k(void)
#elif defined(EMU_M68K)
Pico.t.m68c_cnt += m68k_execute(cyc_do) - cyc_do;
#elif defined(EMU_F68K)
Pico.t.m68c_cnt += fm68k_emulate(cyc_do, 0) - cyc_do;
Pico.t.m68c_cnt += fm68k_emulate(&PicoCpuFM68k, cyc_do, 0) - cyc_do;
#endif
}

View file

@ -81,7 +81,7 @@ extern M68K_CONTEXT PicoCpuFM68k, PicoCpuFS68k;
}
#define SekIsStoppedM68k() (PicoCpuFM68k.execinfo&FM68K_HALTED)
#define SekIsStoppedS68k() (PicoCpuFS68k.execinfo&FM68K_HALTED)
#define SekShouldInterrupt() fm68k_would_interrupt()
#define SekShouldInterrupt() fm68k_would_interrupt(&PicoCpuFM68k)
#define SekNotPolling PicoCpuFM68k.not_polling
#define SekNotPollingS68k PicoCpuFS68k.not_polling

View file

@ -157,10 +157,7 @@ PICO_INTERNAL int SekReset(void)
REG_USP = 0; // ?
#endif
#ifdef EMU_F68K
{
g_m68kcontext = &PicoCpuFM68k;
fm68k_reset();
}
fm68k_reset(&PicoCpuFM68k);
#endif
return 0;
@ -178,7 +175,7 @@ void SekStepM68k(void)
#elif defined(EMU_M68K)
Pico.t.m68c_cnt += m68k_execute(1);
#elif defined(EMU_F68K)
Pico.t.m68c_cnt += fm68k_emulate(1, 0);
Pico.t.m68c_cnt += fm68k_emulate(&PicoCpuFM68k, 1, 0);
#endif
}
@ -320,7 +317,7 @@ void SekInitIdleDet(void)
CycloneInitIdle();
#endif
#ifdef EMU_F68K
fm68k_emulate(0, 1);
fm68k_idle_install();
#endif
}
@ -431,7 +428,7 @@ void SekFinishIdleDet(void)
CycloneFinishIdle();
#endif
#ifdef EMU_F68K
fm68k_emulate(0, 2);
fm68k_idle_remove();
#endif
while (idledet_count > 0)
{