famec: remove unused dual code

This commit is contained in:
notaz 2013-09-24 01:11:13 +03:00
parent 55d7dcb209
commit 99ade2ee2f
5 changed files with 10 additions and 63 deletions

View file

@ -152,7 +152,7 @@ extern M68K_CONTEXT *g_m68kcontext;
/* General purpose functions */ /* General purpose functions */
void fm68k_init(void); void fm68k_init(void);
int fm68k_reset(void); int fm68k_reset(void);
int fm68k_emulate(int n, int dualcore, int idle_mode); int fm68k_emulate(int n, int idle_mode);
int fm68k_would_interrupt(void); // to be called from fm68k_emulate() int fm68k_would_interrupt(void); // to be called from fm68k_emulate()
unsigned fm68k_get_pc(M68K_CONTEXT *context); unsigned fm68k_get_pc(M68K_CONTEXT *context);

View file

@ -647,7 +647,7 @@ void fm68k_init(void)
#endif #endif
if (!initialised) if (!initialised)
fm68k_emulate(0, 0, 0); fm68k_emulate(0, 0);
#ifdef FAMEC_DEBUG #ifdef FAMEC_DEBUG
puts("FAME initialized."); puts("FAME initialized.");
@ -666,7 +666,7 @@ void fm68k_init(void)
int fm68k_reset(void) int fm68k_reset(void)
{ {
if (!initialised) if (!initialised)
fm68k_emulate(0, 0, 0); fm68k_emulate(0, 0);
// Si la CPU esta en ejecucion, salir con M68K_RUNNING // Si la CPU esta en ejecucion, salir con M68K_RUNNING
if (m68kcontext.execinfo & M68K_RUNNING) if (m68kcontext.execinfo & M68K_RUNNING)
@ -794,7 +794,7 @@ static FAMEC_EXTRA_INLINE u32 execute_exception_group_0(s32 vect, s32 addr, u16
// main exec function // main exec function
////////////////////// //////////////////////
int fm68k_emulate(s32 cycles, int dualcore, int idle_mode) int fm68k_emulate(s32 cycles, int idle_mode)
{ {
#ifndef FAMEC_NO_GOTOS #ifndef FAMEC_NO_GOTOS
u32 Opcode; u32 Opcode;
@ -814,10 +814,8 @@ int fm68k_emulate(s32 cycles, int dualcore, int idle_mode)
} }
#ifdef PICODRIVE_HACK #ifdef PICODRIVE_HACK
if (dualcore) goto dualcore_mode;
if (idle_mode == 1) goto idle_install; if (idle_mode == 1) goto idle_install;
else if (idle_mode == 2) goto idle_remove; else if (idle_mode == 2) goto idle_remove;
famec_restart:
#endif #endif
// won't emulate double fault // won't emulate double fault
@ -962,58 +960,7 @@ famec_End:
printf("pc: 0x%08x\n",m68kcontext.pc); printf("pc: 0x%08x\n",m68kcontext.pc);
#endif #endif
#ifdef PICODRIVE_HACK return cycles - m68kcontext.io_cycle_counter;
if (!dualcore)
#endif
return cycles - m68kcontext.io_cycle_counter;
#ifdef PICODRIVE_HACK
dualcore_mode:
while (1)
{
extern int SekCycleAim, SekCycleCnt, SekCycleAimS68k, SekCycleCntS68k;
#define PS_STEP_M68K ((488<<16)/20) // ~24
if (dualcore == 1)
{
dualcore = (488<<16); // ~ cycn in Pico.c
// adjust for first iteration
g_m68kcontext = &PicoCpuFS68k;
cycles = m68kcontext.io_cycle_counter = 0;
}
if (g_m68kcontext == &PicoCpuFS68k)
{
SekCycleCntS68k += cycles - m68kcontext.io_cycle_counter;
// end?
dualcore -= PS_STEP_M68K;
if (dualcore < 0) return 0;
// become main 68k
g_m68kcontext = &PicoCpuFM68k;
if ((cycles = SekCycleAim-SekCycleCnt-(dualcore>>16)) > 0)
{
if ((m68kcontext.execinfo & FM68K_HALTED) && m68kcontext.interrupts[0] <= (M68K_PPL))
SekCycleCnt += cycles; // halted
else goto famec_restart;
//else { printf("go main %i\n", cycles); goto famec_restart; }
}
cycles = m68kcontext.io_cycle_counter = 0;
}
if (g_m68kcontext == &PicoCpuFM68k)
{
int cycn_s68k = (dualcore + dualcore/2 + dualcore/8) >> 16;
SekCycleCnt += cycles - m68kcontext.io_cycle_counter;
// become sub 68k
g_m68kcontext = &PicoCpuFS68k;
if ((cycles = SekCycleAimS68k-SekCycleCntS68k-cycn_s68k) > 0)
{
if ((m68kcontext.execinfo & FM68K_HALTED) && m68kcontext.interrupts[0] <= (M68K_PPL))
SekCycleCntS68k += cycles; // halted
else goto famec_restart;
}
cycles = m68kcontext.io_cycle_counter = 0;
}
}
#endif
init_jump_table: init_jump_table:
{ {

View file

@ -107,7 +107,7 @@ static __inline void SekRunS68k(unsigned int to)
m68k_set_context(&PicoCpuMM68k); m68k_set_context(&PicoCpuMM68k);
#elif defined(EMU_F68K) #elif defined(EMU_F68K)
g_m68kcontext = &PicoCpuFS68k; g_m68kcontext = &PicoCpuFS68k;
SekCycleCntS68k += fm68k_emulate(cyc_do, 0, 0) - cyc_do; SekCycleCntS68k += fm68k_emulate(cyc_do, 0) - cyc_do;
g_m68kcontext = &PicoCpuFM68k; g_m68kcontext = &PicoCpuFM68k;
#endif #endif
} }

View file

@ -39,7 +39,7 @@ static void SekSyncM68k(void)
#elif defined(EMU_M68K) #elif defined(EMU_M68K)
SekCycleCnt += m68k_execute(cyc_do) - cyc_do; SekCycleCnt += m68k_execute(cyc_do) - cyc_do;
#elif defined(EMU_F68K) #elif defined(EMU_F68K)
SekCycleCnt += fm68k_emulate(cyc_do, 0, 0) - cyc_do; SekCycleCnt += fm68k_emulate(cyc_do, 0) - cyc_do;
#endif #endif
} }

View file

@ -176,7 +176,7 @@ void SekStepM68k(void)
#elif defined(EMU_M68K) #elif defined(EMU_M68K)
SekCycleCnt+=m68k_execute(1); SekCycleCnt+=m68k_execute(1);
#elif defined(EMU_F68K) #elif defined(EMU_F68K)
SekCycleCnt+=fm68k_emulate(1, 0, 0); SekCycleCnt+=fm68k_emulate(1, 0);
#endif #endif
} }
@ -317,7 +317,7 @@ void SekInitIdleDet(void)
CycloneInitIdle(); CycloneInitIdle();
#endif #endif
#ifdef EMU_F68K #ifdef EMU_F68K
fm68k_emulate(0, 0, 1); fm68k_emulate(0, 1);
#endif #endif
} }
@ -425,7 +425,7 @@ void SekFinishIdleDet(void)
CycloneFinishIdle(); CycloneFinishIdle();
#endif #endif
#ifdef EMU_F68K #ifdef EMU_F68K
fm68k_emulate(0, 0, 2); fm68k_emulate(0, 2);
#endif #endif
while (idledet_count > 0) while (idledet_count > 0)
{ {