1 diff -urN dosbox_org/include/cpu.h dosbox/include/cpu.h
2 --- dosbox_org/include/cpu.h 2005-02-10 11:20:47.000000000 +0100
3 +++ dosbox/include/cpu.h 2005-02-21 14:52:24.000000000 +0100
5 extern Bits CPU_Cycles;
6 extern Bits CPU_CycleLeft;
7 extern Bits CPU_CycleMax;
8 +extern bool CPU_TimeSynched;
9 +extern Bitu CPU_CyclesCur;
10 +extern char core_mode[10];
12 /* Some common Defines */
14 diff -urN dosbox_org/include/mapper.h dosbox/include/mapper.h
15 --- dosbox_org/include/mapper.h 2005-02-10 11:20:47.000000000 +0100
16 +++ dosbox/include/mapper.h 2005-02-21 14:52:24.000000000 +0100
20 MK_f1,MK_f2,MK_f3,MK_f4,MK_f5,MK_f6,MK_f7,MK_f8,MK_f9,MK_f10,MK_f11,MK_f12,
21 - MK_return,MK_kpminus,MK_scrolllock,MK_printscreen,MK_pause,
22 + MK_return,MK_kpminus,MK_equals,MK_scrolllock,MK_printscreen,MK_pause,
23 + MK_1, MK_2, MK_3, MK_4,
27 diff -urN dosbox_org/src/cpu/core_dyn_x86.cpp dosbox/src/cpu/core_dyn_x86.cpp
28 --- dosbox_org/src/cpu/core_dyn_x86.cpp 2005-02-10 11:20:48.000000000 +0100
29 +++ dosbox/src/cpu/core_dyn_x86.cpp 2005-02-21 14:52:24.000000000 +0100
32 #include "core_dyn_x86/decoder.h"
36 Bits CPU_Core_Dyn_X86_Run(void) {
37 /* Determine the linear address of CS:EIP */
40 block=CreateCacheBlock(chandler,ip_point,32);
43 + CPU_CyclesOld = CPU_Cycles;
44 cache.block.running=0;
45 BlockReturn ret=gen_runcode(block->cache.start);
46 + cycle_count += CPU_CyclesOld - CPU_Cycles;
49 /* Maybe check if we staying in the same page? */
50 diff -urN dosbox_org/src/cpu/core_full.cpp dosbox/src/cpu/core_full.cpp
51 --- dosbox_org/src/cpu/core_full.cpp 2005-02-10 11:20:48.000000000 +0100
52 +++ dosbox/src/cpu/core_full.cpp 2005-02-21 14:52:24.000000000 +0100
54 Bits CPU_Core_Full_Run(void) {
56 while (CPU_Cycles-->0) {
61 if (DEBUG_HeavyIsBreakpoint()) {
63 diff -urN dosbox_org/src/cpu/core_normal.cpp dosbox/src/cpu/core_normal.cpp
64 --- dosbox_org/src/cpu/core_normal.cpp 2005-02-10 11:20:48.000000000 +0100
65 +++ dosbox/src/cpu/core_normal.cpp 2005-02-21 14:52:24.000000000 +0100
67 #define SaveMd(off,val) mem_writed_inline(off,val)
70 -extern Bitu cycle_count;
74 #define CPU_FPU 1 //Enable FPU escape instructions
83 switch (core.opcode_index+Fetchb()) {
84 #include "core_normal/prefix_none.h"
85 diff -urN dosbox_org/src/cpu/core_simple.cpp dosbox/src/cpu/core_simple.cpp
86 --- dosbox_org/src/cpu/core_simple.cpp 2005-02-10 11:20:48.000000000 +0100
87 +++ dosbox/src/cpu/core_simple.cpp 2005-02-21 14:52:24.000000000 +0100
96 switch (core.opcode_index+Fetchb()) {
98 diff -urN dosbox_org/src/cpu/cpu.cpp dosbox/src/cpu/cpu.cpp
99 --- dosbox_org/src/cpu/cpu.cpp 2005-02-10 11:20:48.000000000 +0100
100 +++ dosbox/src/cpu/cpu.cpp 2005-02-21 14:52:24.000000000 +0100
102 Bits CPU_CycleMax = 2500;
103 Bits CPU_CycleUp = 0;
104 Bits CPU_CycleDown = 0;
105 +bool CPU_TimeSynched = false;
106 +Bitu CPU_CyclesCur = 0;
108 CPU_Decoder * cpudecoder;
110 void CPU_Core_Full_Init(void);
111 @@ -1793,6 +1796,37 @@
112 GFX_SetTitle(CPU_CycleMax,-1,false);
115 +static void CPU_ToggleTimeSynch(void) {
116 + CPU_TimeSynched = ! CPU_TimeSynched;
117 + GFX_SetTitle(CPU_CycleMax,-1,false);
120 +static void CPU_ToggleFullCore(void) {
121 + strcpy(core_mode, "Full");
122 + cpudecoder=&CPU_Core_Full_Run;
123 + GFX_SetTitle(CPU_CycleMax,-1,false);
126 +static void CPU_ToggleNormalCore(void) {
127 + strcpy(core_mode, "Normal");
128 + cpudecoder=&CPU_Core_Normal_Run;
129 + GFX_SetTitle(CPU_CycleMax,-1,false);
132 +static void CPU_ToggleDynamicCore(void) {
133 + strcpy(core_mode, "Dynamic");
134 + cpudecoder=&CPU_Core_Dyn_X86_Run;
135 + GFX_SetTitle(CPU_CycleMax,-1,false);
138 +static void CPU_ToggleSimpleCore(void) {
139 + strcpy(core_mode, "Simple");
140 + cpudecoder=&CPU_Core_Simple_Run;;
141 + GFX_SetTitle(CPU_CycleMax,-1,false);
144 +extern bool showcycles;
146 void CPU_Init(Section* sec) {
147 Section_prop * section=static_cast<Section_prop *>(sec);
149 @@ -1829,22 +1863,33 @@
151 MAPPER_AddHandler(CPU_CycleDecrease,MK_f11,MMOD1,"cycledown","Dec Cycles");
152 MAPPER_AddHandler(CPU_CycleIncrease,MK_f12,MMOD1,"cycleup" ,"Inc Cycles");
153 + MAPPER_AddHandler(CPU_ToggleTimeSynch,MK_equals,MMOD1,"timesynched" ,"Tog. TimeSynch");
154 + MAPPER_AddHandler(CPU_ToggleNormalCore,MK_1,MMOD1,"normal" ,"Tog. Normal Core");
155 + MAPPER_AddHandler(CPU_ToggleFullCore,MK_2,MMOD1,"full" ,"Tog. Full Core");
156 + MAPPER_AddHandler(CPU_ToggleDynamicCore,MK_3,MMOD1,"dynamic" ,"Tog. Dynamic Core");
157 + MAPPER_AddHandler(CPU_ToggleSimpleCore,MK_4,MMOD1,"simple" ,"Tog. Simple Core");
159 CPU_CycleMax=section->Get_int("cycles");;
160 CPU_CycleUp=section->Get_int("cycleup");
161 CPU_CycleDown=section->Get_int("cycledown");
162 + CPU_TimeSynched=section->Get_bool("timesynched");
163 + showcycles=section->Get_bool("showcycles");
164 const char * core=section->Get_string("core");
165 + strcpy(core_mode, "Normal");
166 cpudecoder=&CPU_Core_Normal_Run;
167 if (!strcasecmp(core,"normal")) {
168 cpudecoder=&CPU_Core_Normal_Run;
169 } else if (!strcasecmp(core,"simple")) {
170 cpudecoder=&CPU_Core_Simple_Run;
171 + strcpy(core_mode, "Simple");
172 } else if (!strcasecmp(core,"full")) {
173 cpudecoder=&CPU_Core_Full_Run;
174 + strcpy(core_mode, "Full");
177 else if (!strcasecmp(core,"dynamic")) {
178 cpudecoder=&CPU_Core_Dyn_X86_Run;
179 + strcpy(core_mode, "Dynamic");
183 diff -urN dosbox_org/src/debug/debug.cpp dosbox/src/debug/debug.cpp
184 --- dosbox_org/src/debug/debug.cpp 2005-02-10 11:20:50.000000000 +0100
185 +++ dosbox/src/debug/debug.cpp 2005-02-21 14:52:24.000000000 +0100
187 static Bitu oldflags;
189 static Bitu input_count;
191 +extern Bitu cycle_count;
192 static bool debugging;
195 diff -urN dosbox_org/src/dosbox.cpp dosbox/src/dosbox.cpp
196 --- dosbox_org/src/dosbox.cpp 2005-02-10 11:20:47.000000000 +0100
197 +++ dosbox/src/dosbox.cpp 2005-02-21 14:58:12.000000000 +0100
198 @@ -116,11 +116,34 @@
206 +extern void GFX_SetTitle(Bits cycles, Bits frameskip,bool paused);
207 +extern Bitu cycle_count;
210 static Bitu Normal_Loop(void) {
213 if (PIC_RunQueue()) {
214 + if((CPU_TimeSynched) || (showcycles)) {
215 + NewTicks=GetTicks();
217 + if((CPU_TimeSynched) && (NewTicks!=LastTicks))
220 + if((showcycles) && (NewTicks>=Ticks)) {
221 + CPU_CyclesCur=(cycle_count-CPU_CyclesCur) >> 9;
222 + Ticks=NewTicks + 512; // next update in 512ms
223 + frames*=1.95; // compensate for 512ms interval
224 + GFX_SetTitle(CPU_CycleMax,-1,false);
225 + CPU_CyclesCur=cycle_count;
234 secprop->Add_int("cycles",3000);
235 secprop->Add_int("cycleup",500);
236 secprop->Add_int("cycledown",20);
237 + secprop->Add_bool("timesynched",false);
238 + secprop->Add_bool("showcycles",false);
239 MSG_Add("CPU_CONFIGFILE_HELP",
240 "core -- CPU Core used in emulation: simple,normal,full"
245 "cycles -- Amount of instructions dosbox tries to emulate each millisecond.\n"
246 - " Setting this higher than your machine can handle is bad!\n"
247 + " Setting this higher than your machine can handle is bad! (unless timesynched is set)\n"
248 "cycleup -- Amount of cycles to increase/decrease with keycombo.\n"
249 "cycledown Setting it lower than 100 will be a percentage.\n"
250 + "timesynched -- Do not emulate more cycles than possible.\n"
251 + "showcycles -- Display the number of emulated cycles in the titlebar (uses some CPU).\n"
254 secprop->AddInitFunction(&FPU_Init);
255 diff -urN dosbox_org/src/gui/sdl_mapper.cpp dosbox/src/gui/sdl_mapper.cpp
256 --- dosbox_org/src/gui/sdl_mapper.cpp 2005-02-10 11:21:07.000000000 +0100
257 +++ dosbox/src/gui/sdl_mapper.cpp 2005-02-21 14:52:24.000000000 +0100
285 sprintf(buf,"%s \"key %d%s%s%s\"",
287 @@ -1133,7 +1148,7 @@
290 void MAPPER_AddHandler(MAPPER_Handler * handler,MapKeys key,Bitu mods,char * eventname,char * buttonname) {
293 strcpy(tempname,"hand_");
294 strcat(tempname,eventname);
295 new CHandlerEvent(tempname,handler,key,mods,buttonname);
296 diff -urN dosbox_org/src/gui/sdlmain.cpp dosbox/src/gui/sdlmain.cpp
297 --- dosbox_org/src/gui/sdlmain.cpp 2005-02-10 11:21:07.000000000 +0100
298 +++ dosbox/src/gui/sdlmain.cpp 2005-02-21 14:52:24.000000000 +0100
299 @@ -197,16 +197,23 @@
300 //Globals for keyboard initialisation
301 bool startup_state_numlock=false;
302 bool startup_state_capslock=false;
305 +extern bool showcycles;
309 void GFX_SetTitle(Bits cycles,Bits frameskip,bool paused){
311 static Bits internal_cycles=0;
312 static Bits internal_frameskip=0;
313 if(cycles != -1) internal_cycles = cycles;
314 if(frameskip != -1) internal_frameskip = frameskip;
315 + if(!showcycles) frames = 0;
317 - sprintf(title,"DOSBox %s,Cpu Cycles: %8d, Frameskip %2d, Program: %8s PAUSED",VERSION,internal_cycles,internal_frameskip,RunningProgram);
318 + sprintf(title,"Core: %s, Cpu Cycles: %8d %c %8d, FPS: %d, skip %2d, Program: %8s PAUSED",core_mode,CPU_CyclesCur,CPU_TimeSynched ? '<' : '=',internal_cycles,frames,internal_frameskip,RunningProgram);
320 - sprintf(title,"DOSBox %s,Cpu Cycles: %8d, Frameskip %2d, Program: %8s",VERSION,internal_cycles,internal_frameskip,RunningProgram);
321 + sprintf(title,"Core: %s, Cpu Cycles: %8d %c %8d, FPS: %d, skip %2d, Program: %8s",core_mode,CPU_CyclesCur,CPU_TimeSynched ? '<' : '=',internal_cycles,frames,internal_frameskip,RunningProgram);
322 SDL_WM_SetCaption(title,VERSION);
327 if (!sdl.updating) return;
330 switch (sdl.desktop.type) {
332 if (SDL_MUSTLOCK(sdl.surface)) {