BII: additional delay test

This commit is contained in:
kanjitalk755 2022-03-16 13:40:14 +09:00
parent 33c3419b08
commit f07b34a451
5 changed files with 35 additions and 6 deletions

View File

@ -374,6 +374,16 @@ void cpu_do_check_ticks(void)
if (emulated_ticks <= 0)
emulated_ticks += emulated_ticks_quantum;
}
#else
uint16 emulated_ticks;
void cpu_do_check_ticks(void)
{
static int delay = -1;
if (delay < 0)
delay = PrefsFindInt32("delay");
if (delay)
usleep(delay);
}
#endif

View File

@ -190,6 +190,16 @@ static void sigsegv_dump_state(sigsegv_info_t *sip)
#endif
}
uint16 emulated_ticks;
void cpu_do_check_ticks(void)
{
static int delay = -1;
if (delay < 0)
delay = PrefsFindInt32("delay");
if (delay)
usleep(delay);
}
/*
* Main program

View File

@ -85,6 +85,7 @@ prefs_desc common_prefs_items[] = {
{"title", TYPE_STRING, false, "window title"},
{"sound_buffer", TYPE_INT32, false, "sound buffer length"},
{"name_encoding", TYPE_INT32, false, "file name encoding"},
{"delay", TYPE_INT32, false, "additional delay [uS] every 64k instructions"},
{NULL, TYPE_END, false, NULL} // End of list
};

View File

@ -338,9 +338,9 @@ extern void m68k_execute(void);
#if USE_JIT
extern void m68k_compile_execute(void);
#endif
extern void cpu_do_check_ticks(void);
#ifdef USE_CPU_EMUL_SERVICES
extern int32 emulated_ticks;
extern void cpu_do_check_ticks(void);
static inline void cpu_check_ticks(void)
{
@ -348,8 +348,12 @@ static inline void cpu_check_ticks(void)
cpu_do_check_ticks();
}
#else
#define cpu_check_ticks()
#define cpu_do_check_ticks()
extern uint16 emulated_ticks;
static inline void cpu_check_ticks(void)
{
if (!++emulated_ticks)
cpu_do_check_ticks();
}
#endif
#endif /* NEWCPU_H */

View File

@ -316,9 +316,9 @@ extern void m68k_execute(void);
extern void m68k_compile_execute(void);
extern void m68k_do_compile_execute(void);
#endif
extern void cpu_do_check_ticks(void);
#ifdef USE_CPU_EMUL_SERVICES
extern int32 emulated_ticks;
extern void cpu_do_check_ticks(void);
static inline void cpu_check_ticks(void)
{
@ -326,8 +326,12 @@ static inline void cpu_check_ticks(void)
cpu_do_check_ticks();
}
#else
#define cpu_check_ticks()
#define cpu_do_check_ticks()
extern uint16 emulated_ticks;
static inline void cpu_check_ticks(void)
{
if (!++emulated_ticks)
cpu_do_check_ticks();
}
#endif
cpuop_func op_illg_1;