tweak size of auto-cycle interval (ih8regs);
switch to auto-cycle guessing if appropriate Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2660
This commit is contained in:
		
							parent
							
								
									caf6a80ef4
								
							
						
					
					
						commit
						97470261fb
					
				
					 5 changed files with 38 additions and 21 deletions
				
			
		| 
						 | 
				
			
			@ -33,7 +33,8 @@
 | 
			
		|||
extern Bits CPU_Cycles;
 | 
			
		||||
extern Bits CPU_CycleLeft;
 | 
			
		||||
extern Bits CPU_CycleMax;
 | 
			
		||||
extern bool CPU_CycleAuto;
 | 
			
		||||
extern bool CPU_CycleAutoAdjust;
 | 
			
		||||
extern bool CPU_AutoDetermineMode;
 | 
			
		||||
 | 
			
		||||
/* Some common Defines */
 | 
			
		||||
/* A CPU Handler */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: callback.cpp,v 1.32 2006-04-22 15:25:44 c2woody Exp $ */
 | 
			
		||||
/* $Id: callback.cpp,v 1.33 2006-06-25 18:49:32 c2woody Exp $ */
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ void CALLBACK_Idle(void) {
 | 
			
		|||
	reg_eip=oldeip;
 | 
			
		||||
	SegSet16(cs,oldcs);
 | 
			
		||||
	SETFLAGBIT(IF,oldIF);
 | 
			
		||||
	if (!CPU_CycleAuto && CPU_Cycles>0) 
 | 
			
		||||
	if (!CPU_CycleAutoAdjust && CPU_Cycles>0) 
 | 
			
		||||
		CPU_Cycles=0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: cpu.cpp,v 1.81 2006-04-27 13:22:27 c2woody Exp $ */
 | 
			
		||||
/* $Id: cpu.cpp,v 1.82 2006-06-25 18:49:32 c2woody Exp $ */
 | 
			
		||||
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include "dosbox.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -29,6 +29,7 @@
 | 
			
		|||
#include "support.h"
 | 
			
		||||
 | 
			
		||||
Bitu DEBUG_EnableDebugger(void);
 | 
			
		||||
extern void GFX_SetTitle(Bits cycles ,Bits frameskip,bool paused);
 | 
			
		||||
 | 
			
		||||
#if 1
 | 
			
		||||
#undef LOG
 | 
			
		||||
| 
						 | 
				
			
			@ -45,7 +46,8 @@ Bits CPU_CycleMax = 2500;
 | 
			
		|||
Bits CPU_CycleUp = 0;
 | 
			
		||||
Bits CPU_CycleDown = 0;
 | 
			
		||||
CPU_Decoder * cpudecoder;
 | 
			
		||||
bool CPU_CycleAuto;
 | 
			
		||||
bool CPU_CycleAutoAdjust;
 | 
			
		||||
bool CPU_AutoDetermineMode;
 | 
			
		||||
 | 
			
		||||
void CPU_Core_Full_Init(void);
 | 
			
		||||
void CPU_Core_Normal_Init(void);
 | 
			
		||||
| 
						 | 
				
			
			@ -1431,13 +1433,26 @@ void CPU_SET_CRX(Bitu cr,Bitu value) {
 | 
			
		|||
	switch (cr) {
 | 
			
		||||
	case 0:
 | 
			
		||||
		{
 | 
			
		||||
			Bitu changed=cpu.cr0 ^ value;		
 | 
			
		||||
			Bitu changed=cpu.cr0 ^ value;
 | 
			
		||||
			if (!changed) return;
 | 
			
		||||
			cpu.cr0=value;
 | 
			
		||||
			if (value & CR0_PROTECTION) {
 | 
			
		||||
				cpu.pmode=true;
 | 
			
		||||
				LOG(LOG_CPU,LOG_NORMAL)("Protected mode");
 | 
			
		||||
				PAGING_Enable((value & CR0_PAGING)>0);
 | 
			
		||||
 | 
			
		||||
				if (!CPU_AutoDetermineMode) break;
 | 
			
		||||
 | 
			
		||||
				CPU_AutoDetermineMode=false;
 | 
			
		||||
				CPU_CycleAutoAdjust=true;
 | 
			
		||||
				CPU_CycleLeft=0;
 | 
			
		||||
				CPU_Cycles=0;
 | 
			
		||||
				CPU_CycleMax=0;
 | 
			
		||||
/* #if (C_DYNAMIC_X86)
 | 
			
		||||
				CPU_Core_Dyn_X86_Cache_Init(true);
 | 
			
		||||
				cpudecoder=&CPU_Core_Dyn_X86_Run;
 | 
			
		||||
#endif */
 | 
			
		||||
				GFX_SetTitle(-1,-1,false);
 | 
			
		||||
			} else {
 | 
			
		||||
				cpu.pmode=false;
 | 
			
		||||
				if (value & CR0_PAGING) LOG_MSG("Paging requested without PE=1");
 | 
			
		||||
| 
						 | 
				
			
			@ -1889,9 +1904,8 @@ void CPU_ENTER(bool use32,Bitu bytes,Bitu level) {
 | 
			
		|||
	reg_esp=(reg_esp&cpu.stack.notmask)|((sp_index)&cpu.stack.mask);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void GFX_SetTitle(Bits cycles ,Bits frameskip,bool paused);
 | 
			
		||||
static void CPU_CycleIncrease(bool pressed) {
 | 
			
		||||
	if (!pressed || CPU_CycleAuto)
 | 
			
		||||
	if (!pressed || CPU_CycleAutoAdjust)
 | 
			
		||||
		return;
 | 
			
		||||
	Bits old_cycles=CPU_CycleMax;
 | 
			
		||||
	if(CPU_CycleUp < 100){
 | 
			
		||||
| 
						 | 
				
			
			@ -1907,7 +1921,7 @@ static void CPU_CycleIncrease(bool pressed) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static void CPU_CycleDecrease(bool pressed) {
 | 
			
		||||
	if (!pressed || CPU_CycleAuto)
 | 
			
		||||
	if (!pressed || CPU_CycleAutoAdjust)
 | 
			
		||||
		return;
 | 
			
		||||
	if(CPU_CycleDown < 100){
 | 
			
		||||
		CPU_CycleMax = (Bits)(CPU_CycleMax / (1 + (float)CPU_CycleDown / 100.0));
 | 
			
		||||
| 
						 | 
				
			
			@ -1978,12 +1992,14 @@ public:
 | 
			
		|||
		CPU_CycleLeft=0;//needed ?
 | 
			
		||||
		CPU_Cycles=0;
 | 
			
		||||
		const char *cyclesLine = section->Get_string("cycles");
 | 
			
		||||
		if (!strcasecmp(cyclesLine,"auto")) {
 | 
			
		||||
		CPU_AutoDetermineMode=false;
 | 
			
		||||
		if (!strcasecmp(cyclesLine,"max")) {
 | 
			
		||||
			CPU_CycleMax=0;
 | 
			
		||||
			CPU_CycleAuto=true;
 | 
			
		||||
			CPU_CycleAutoAdjust=true;
 | 
			
		||||
		} else {
 | 
			
		||||
			if (!strcasecmp(cyclesLine,"auto")) CPU_AutoDetermineMode=true;
 | 
			
		||||
			CPU_CycleMax=atoi(cyclesLine);
 | 
			
		||||
			CPU_CycleAuto=false;
 | 
			
		||||
			CPU_CycleAutoAdjust=false;
 | 
			
		||||
		}
 | 
			
		||||
		CPU_CycleUp=section->Get_int("cycleup");
 | 
			
		||||
		CPU_CycleDown=section->Get_int("cycledown");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: dosbox.cpp,v 1.99 2006-03-28 10:17:34 qbix79 Exp $ */
 | 
			
		||||
/* $Id: dosbox.cpp,v 1.100 2006-06-25 18:49:32 c2woody Exp $ */
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <stdarg.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -158,7 +158,7 @@ increaseticks:
 | 
			
		|||
				ticksRemain = 20;
 | 
			
		||||
			}
 | 
			
		||||
			ticksAdded = ticksRemain;
 | 
			
		||||
			if (CPU_CycleAuto && (ticksScheduled >= 1000 || ticksDone >= 1000) ) {
 | 
			
		||||
			if (CPU_CycleAutoAdjust && (ticksAdded > 15 || ticksScheduled >= 250 || ticksDone >= 250) ) {
 | 
			
		||||
				/* ratio we are aiming for is around 90% usage*/
 | 
			
		||||
				Bits ratio = (ticksScheduled * (90*1024/100)) / ticksDone ;
 | 
			
		||||
//				LOG_MSG("Done %d schedulded %d ratio %d cycles %d", ticksDone, ticksScheduled, ratio, CPU_CycleMax);
 | 
			
		||||
| 
						 | 
				
			
			@ -276,7 +276,7 @@ void DOSBOX_Init(void) {
 | 
			
		|||
 | 
			
		||||
	secprop=control->AddSection_prop("cpu",&CPU_Init,true);//done
 | 
			
		||||
	secprop->Add_string("core","normal");
 | 
			
		||||
	secprop->Add_string("cycles","3000");
 | 
			
		||||
	secprop->Add_string("cycles","auto");
 | 
			
		||||
	secprop->Add_int("cycleup",500);
 | 
			
		||||
	secprop->Add_int("cycledown",20);
 | 
			
		||||
	MSG_Add("CPU_CONFIGFILE_HELP",
 | 
			
		||||
| 
						 | 
				
			
			@ -287,8 +287,8 @@ void DOSBOX_Init(void) {
 | 
			
		|||
		".\n"
 | 
			
		||||
		"cycles -- Amount of instructions dosbox tries to emulate each millisecond.\n"
 | 
			
		||||
		"          Setting this higher than your machine can handle is bad!\n"
 | 
			
		||||
		"          You can also let DOSBox guess the correct value by setting it to auto.\n"
 | 
			
		||||
		"          Please note that this guessing feature is still experimental.\n"
 | 
			
		||||
		"          You can also let DOSBox guess the correct value by setting it to max.\n"
 | 
			
		||||
		"          The default setting (auto) switches to max if appropriate.\n"
 | 
			
		||||
		"cycleup   -- Amount of cycles to increase/decrease with keycombo.\n"
 | 
			
		||||
		"cycledown    Setting it lower than 100 will be a percentage.\n"
 | 
			
		||||
	);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: sdlmain.cpp,v 1.117 2006-06-12 19:11:14 qbix79 Exp $ */
 | 
			
		||||
/* $Id: sdlmain.cpp,v 1.118 2006-06-25 18:49:32 c2woody Exp $ */
 | 
			
		||||
 | 
			
		||||
#ifndef _GNU_SOURCE
 | 
			
		||||
#define _GNU_SOURCE
 | 
			
		||||
| 
						 | 
				
			
			@ -208,7 +208,7 @@ struct SDL_Block {
 | 
			
		|||
static SDL_Block sdl;
 | 
			
		||||
 | 
			
		||||
extern const char* RunningProgram;
 | 
			
		||||
extern bool CPU_CycleAuto;
 | 
			
		||||
extern bool CPU_CycleAutoAdjust;
 | 
			
		||||
//Globals for keyboard initialisation
 | 
			
		||||
bool startup_state_numlock=false;
 | 
			
		||||
bool startup_state_capslock=false;
 | 
			
		||||
| 
						 | 
				
			
			@ -218,8 +218,8 @@ void GFX_SetTitle(Bits cycles,Bits frameskip,bool paused){
 | 
			
		|||
	static Bits internal_frameskip=0;
 | 
			
		||||
	if(cycles != -1) internal_cycles = cycles;
 | 
			
		||||
	if(frameskip != -1) internal_frameskip = frameskip;
 | 
			
		||||
	if(CPU_CycleAuto)
 | 
			
		||||
		sprintf(title,"DOSBox %s, Cpu Cycles:     auto, Frameskip %2d, Program: %8s",VERSION,internal_frameskip,RunningProgram);
 | 
			
		||||
	if(CPU_CycleAutoAdjust)
 | 
			
		||||
		sprintf(title,"DOSBox %s, Cpu Cycles:      max, Frameskip %2d, Program: %8s",VERSION,internal_frameskip,RunningProgram);
 | 
			
		||||
	else
 | 
			
		||||
		sprintf(title,"DOSBox %s, Cpu Cycles: %8d, Frameskip %2d, Program: %8s",VERSION,internal_cycles,internal_frameskip,RunningProgram);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue