Expose some timing constants

This commit is contained in:
Aaron Culliney 2015-07-05 13:17:41 -07:00
parent dfbb13906a
commit 4305909d67
2 changed files with 11 additions and 4 deletions

View File

@ -33,8 +33,6 @@
#include "common.h"
#define EXECUTION_PERIOD_NSECS 1000000 // AppleWin: nExecutionPeriodUsec
#define DEBUG_TIMING (!defined(NDEBUG) && 0) // enable to print timing stats
#if DEBUG_TIMING
# define TIMING_LOG(...) LOG(__VA_ARGS__)
@ -352,7 +350,7 @@ void *cpu_thread(void *dummyptr) {
static time_t throttle_warning = 0;
if (t0.tv_sec - throttle_warning > 0)
{
TIMING_LOG("lagging... %ld . %ld", deltat.tv_sec, deltat.tv_nsec);
TIMING_LOG("not sleeping to catch up ... %ld . %ld", deltat.tv_sec, deltat.tv_nsec);
throttle_warning = t0.tv_sec;
}
}

View File

@ -25,6 +25,15 @@
#define NANOSECONDS_PER_SECOND 1000000000UL
#endif
// At a rate of ~1000x/sec, the emulator will (1) determine the number X of 65c02 instructions to execute and then
// executes them, (2) perform post-instruction-churn bookkeeping, and (3) sleep for a calculated interval.
//
// * The actual wall clock time to perform the emulated churn and bookkeeping is used to determine the sleep interval
//
// * The speaker provides feedback to the calculation of X (the number of instructions to churn)
#define EXECUTION_CHURN_RATE 1000UL
#define EXECUTION_PERIOD_NSECS 1000000UL // NANOSECONDS_PER_SECOND / EXECUTION_CHURN_RATE
// timing values cribbed from AppleWin ... reference: Sather's _Understanding the Apple IIe_
// TODO: revisit this if/when attempting to actually sync up VBL/VSYNC to actual device vsync
@ -32,7 +41,7 @@
#define _M14 (157500000.0 / 11.0)
#define _M14_INT (157500000 / 11)
// 65 cycles per 912 14M clocks = 1020484.45...
// 65 cycles per 912 14M clocks = 1020484.45 ...
#define CLK_6502 ((_M14 * 65.0) / 912.0)
#define CLK_6502_INT ((_M14_INT * 65) / 912)