apple2ix/src/timing.h
Aaron Culliney 527c04e41f Support for new timing model
This is part 2 of 2

    * Handles UI changes to support new delay model, added ability to toggle to
      alternate speed scale

    * Code cleanups
2013-10-06 01:31:58 -07:00

59 lines
1.2 KiB
C

/*
* Apple // emulator for *nix
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
/*
* 65c02 CPU Timing Support.
*
* Copyleft 2013 Aaron Culliney
*
*/
#ifndef _TIMING_H_
#define _TIMING_H_
#include "common.h"
#define NANOSECONDS 1000000000
// 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
#define CPU_SCALE_FASTEST 4.05
#define CPU_SCALE_STEP_DIV 0.01
#define CPU_SCALE_STEP 0.05
#define SPKR_SAMPLE_RATE 44100
extern double g_fCurrentCLK6502;
extern bool g_bFullSpeed;
extern uint64_t g_nCumulativeCycles;
extern int g_nCpuCyclesFeedback;
extern double cpu_scale_factor;
extern double cpu_altscale_factor;
struct timespec timespec_diff(struct timespec start, struct timespec end, bool *negative);
void timing_toggle_cpu_speed();
void timing_initialize();
void cpu_thread();
void CpuCalcCycles(const unsigned long nExecutedCycles);
#endif // whole file