From ea7ce8a23b1fc9a6815577e7af439a6d6c528951 Mon Sep 17 00:00:00 2001 From: Autch Date: Mon, 18 Feb 2019 01:56:38 +0900 Subject: [PATCH] =?UTF-8?q?CPU=E6=99=82=E9=96=93=E3=82=92=E3=82=AF?= =?UTF-8?q?=E3=83=AD=E3=83=83=E3=82=AF=E3=83=99=E3=83=BC=E3=82=B9=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- emu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emu.c b/emu.c index e4012e8..c16625d 100644 --- a/emu.c +++ b/emu.c @@ -91,12 +91,15 @@ int emu_work(void *ctx) unsigned nClocksDivBy1k = nSystemClock / 1000; unsigned nMSecPerFrame = 1000 / context->o_fps; unsigned nClocksShr14 = nSystemClock >> 14; // nClocks SHift to Right 14bits + unsigned clocksPerFrame = nSystemClock / context->o_fps; SDL_TimerID clock_keeper = SDL_AddTimer(500, emu_clockkeeper_work, context); do { unsigned real_org = SDL_GetTicks(); + CLK = 0; + do { /* 命令実行。 */ if(!context->core.in_halt) { @@ -124,7 +127,7 @@ int emu_work(void *ctx) if (bWD_EN_EWD) core_trap_from_devices(context, TRAP_NMI, 0); SDL_Delay(1); - }while(!context->bEndFlag && (SDL_GetTicks() - real_org) < nMSecPerFrame); + }while(!context->bEndFlag && CLK < clocksPerFrame); /* 実時間との同期 */ if (!context->o_nowait) {