2013-07-06 04:37:13 +00:00
|
|
|
/*
|
2013-10-06 06:22:08 +00:00
|
|
|
* Apple // emulator for *nix
|
2013-06-28 06:36:25 +00:00
|
|
|
*
|
2013-10-06 06:22:08 +00:00
|
|
|
* This software package is subject to the GNU General Public License
|
|
|
|
* version 2 or later (your choice) as published by the Free Software
|
|
|
|
* Foundation.
|
2013-06-28 06:36:25 +00:00
|
|
|
*
|
2013-10-06 06:22:08 +00:00
|
|
|
* THERE ARE NO WARRANTIES WHATSOEVER.
|
2013-06-28 06:36:25 +00:00
|
|
|
*
|
2013-10-06 06:22:08 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 65c02 CPU Timing Support.
|
|
|
|
*
|
|
|
|
* Copyleft 2013 Aaron Culliney
|
2013-07-06 04:37:13 +00:00
|
|
|
*
|
2013-06-28 06:36:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _TIMING_H_
|
|
|
|
#define _TIMING_H_
|
|
|
|
|
2013-10-06 06:22:08 +00:00
|
|
|
#include "common.h"
|
|
|
|
|
2013-06-28 06:36:25 +00:00
|
|
|
#define NANOSECONDS 1000000000
|
|
|
|
|
2013-10-06 06:22:08 +00:00
|
|
|
// timing values cribbed from AppleWin
|
|
|
|
|
|
|
|
// 14318181.81...
|
|
|
|
#define _M14 (157500000.0 / 11.0)
|
|
|
|
|
|
|
|
// 65 cycles per 912 14M clocks = 1020484.45...
|
|
|
|
#define CLK_6502 ((_M14 * 65.0) / 912.0)
|
|
|
|
|
|
|
|
#define CPU_SCALE_SLOWEST 0.25
|
2013-10-06 08:31:58 +00:00
|
|
|
#define CPU_SCALE_FASTEST 4.05
|
2013-10-06 06:22:08 +00:00
|
|
|
#define CPU_SCALE_STEP_DIV 0.01
|
|
|
|
#define CPU_SCALE_STEP 0.05
|
|
|
|
|
2013-11-17 02:31:23 +00:00
|
|
|
#define SPKR_SAMPLE_RATE 22050
|
2013-10-06 06:22:08 +00:00
|
|
|
|
|
|
|
extern double g_fCurrentCLK6502;
|
|
|
|
extern bool g_bFullSpeed;
|
|
|
|
extern uint64_t g_nCumulativeCycles;
|
|
|
|
extern int g_nCpuCyclesFeedback;
|
|
|
|
extern double cpu_scale_factor;
|
2013-10-06 08:31:58 +00:00
|
|
|
extern double cpu_altscale_factor;
|
2013-10-06 06:22:08 +00:00
|
|
|
|
|
|
|
struct timespec timespec_diff(struct timespec start, struct timespec end, bool *negative);
|
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
void timing_toggle_cpu_speed();
|
2013-06-28 06:36:25 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
void timing_initialize();
|
2013-06-28 06:36:25 +00:00
|
|
|
|
2013-10-06 06:22:08 +00:00
|
|
|
void cpu_thread();
|
|
|
|
|
|
|
|
void CpuCalcCycles(const unsigned long nExecutedCycles);
|
2013-06-28 06:36:25 +00:00
|
|
|
|
|
|
|
#endif // whole file
|