]>
Commit | Line | Data |
---|---|---|
c34dd68b | 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 | |
4 | @@ -27,6 +27,9 @@ | |
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]; | |
11 | ||
12 | /* Some common Defines */ | |
13 | /* A CPU Handler */ | |
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 | |
17 | @@ -21,7 +21,8 @@ | |
18 | ||
19 | enum MapKeys { | |
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, | |
24 | ||
25 | }; | |
26 | ||
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 | |
30 | @@ -188,6 +188,8 @@ | |
31 | } | |
32 | #include "core_dyn_x86/decoder.h" | |
33 | ||
34 | +Bitu CPU_CyclesOld; | |
35 | + | |
36 | Bits CPU_Core_Dyn_X86_Run(void) { | |
37 | /* Determine the linear address of CS:EIP */ | |
38 | restart_core: | |
39 | @@ -204,8 +206,10 @@ | |
40 | block=CreateCacheBlock(chandler,ip_point,32); | |
41 | } | |
42 | run_block: | |
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; | |
47 | switch (ret) { | |
48 | case BR_Normal: | |
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 | |
53 | @@ -64,8 +64,8 @@ | |
54 | Bits CPU_Core_Full_Run(void) { | |
55 | FullData inst; | |
56 | while (CPU_Cycles-->0) { | |
57 | -#if C_DEBUG | |
58 | cycle_count++; | |
59 | +#if C_DEBUG | |
60 | #if C_HEAVY_DEBUG | |
61 | if (DEBUG_HeavyIsBreakpoint()) { | |
62 | FillFlags(); | |
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 | |
66 | @@ -48,7 +48,7 @@ | |
67 | #define SaveMd(off,val) mem_writed_inline(off,val) | |
68 | #endif | |
69 | ||
70 | -extern Bitu cycle_count; | |
71 | +Bitu cycle_count; | |
72 | ||
73 | #if C_FPU | |
74 | #define CPU_FPU 1 //Enable FPU escape instructions | |
75 | @@ -151,8 +151,8 @@ | |
76 | return debugCallback; | |
77 | }; | |
78 | #endif | |
79 | - cycle_count++; | |
80 | #endif | |
81 | + cycle_count++; | |
82 | restart_opcode: | |
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 | |
88 | @@ -144,8 +144,8 @@ | |
89 | return debugCallback; | |
90 | }; | |
91 | #endif | |
92 | - cycle_count++; | |
93 | #endif | |
94 | + cycle_count++; | |
95 | restart_opcode: | |
96 | switch (core.opcode_index+Fetchb()) { | |
97 | ||
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 | |
101 | @@ -44,6 +44,9 @@ | |
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; | |
107 | +char core_mode[10]; | |
108 | CPU_Decoder * cpudecoder; | |
109 | ||
110 | void CPU_Core_Full_Init(void); | |
111 | @@ -1793,6 +1796,37 @@ | |
112 | GFX_SetTitle(CPU_CycleMax,-1,false); | |
113 | } | |
114 | ||
115 | +static void CPU_ToggleTimeSynch(void) { | |
116 | + CPU_TimeSynched = ! CPU_TimeSynched; | |
117 | + GFX_SetTitle(CPU_CycleMax,-1,false); | |
118 | +} | |
119 | + | |
120 | +static void CPU_ToggleFullCore(void) { | |
121 | + strcpy(core_mode, "Full"); | |
122 | + cpudecoder=&CPU_Core_Full_Run; | |
123 | + GFX_SetTitle(CPU_CycleMax,-1,false); | |
124 | +} | |
125 | + | |
126 | +static void CPU_ToggleNormalCore(void) { | |
127 | + strcpy(core_mode, "Normal"); | |
128 | + cpudecoder=&CPU_Core_Normal_Run; | |
129 | + GFX_SetTitle(CPU_CycleMax,-1,false); | |
130 | +} | |
131 | + | |
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); | |
136 | +} | |
137 | + | |
138 | +static void CPU_ToggleSimpleCore(void) { | |
139 | + strcpy(core_mode, "Simple"); | |
140 | + cpudecoder=&CPU_Core_Simple_Run;; | |
141 | + GFX_SetTitle(CPU_CycleMax,-1,false); | |
142 | +} | |
143 | + | |
144 | +extern bool showcycles; | |
145 | + | |
146 | void CPU_Init(Section* sec) { | |
147 | Section_prop * section=static_cast<Section_prop *>(sec); | |
148 | reg_eax=0; | |
149 | @@ -1829,22 +1863,33 @@ | |
150 | #endif | |
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"); | |
158 | CPU_Cycles=0; | |
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"); | |
175 | } | |
176 | #if (C_DYNAMIC_X86) | |
177 | else if (!strcasecmp(core,"dynamic")) { | |
178 | cpudecoder=&CPU_Core_Dyn_X86_Run; | |
179 | + strcpy(core_mode, "Dynamic"); | |
180 | } | |
181 | #endif | |
182 | else { | |
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 | |
186 | @@ -92,7 +92,7 @@ | |
187 | static Bitu oldflags; | |
188 | DBGBlock dbg; | |
189 | static Bitu input_count; | |
190 | -Bitu cycle_count; | |
191 | +extern Bitu cycle_count; | |
192 | static bool debugging; | |
193 | ||
194 | ||
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 @@ | |
199 | ||
200 | Bits RemainTicks; | |
201 | Bits LastTicks; | |
202 | +Bits Ticks = 0; | |
203 | + | |
204 | +bool showcycles; | |
205 | + | |
206 | +extern void GFX_SetTitle(Bits cycles, Bits frameskip,bool paused); | |
207 | +extern Bitu cycle_count; | |
208 | +extern Bitu frames; | |
209 | ||
210 | static Bitu Normal_Loop(void) { | |
211 | Bits ret,NewTicks; | |
212 | while (1) { | |
213 | if (PIC_RunQueue()) { | |
214 | + if((CPU_TimeSynched) || (showcycles)) { | |
215 | + NewTicks=GetTicks(); | |
216 | + | |
217 | + if((CPU_TimeSynched) && (NewTicks!=LastTicks)) | |
218 | + CPU_Cycles=0; | |
219 | + | |
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; | |
226 | + frames=0; | |
227 | + } | |
228 | + } | |
229 | + | |
230 | ret=(*cpudecoder)(); | |
231 | if (ret<0) return 1; | |
232 | if (ret>0) { | |
233 | @@ -243,6 +266,8 @@ | |
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" | |
241 | #if (C_DYNAMIC_X86) | |
242 | @@ -250,9 +275,11 @@ | |
243 | #endif | |
244 | ".\n" | |
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" | |
252 | ); | |
253 | #if C_FPU | |
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 | |
258 | @@ -748,6 +748,9 @@ | |
259 | case MK_kpminus: | |
260 | key=SDLK_KP_MINUS; | |
261 | break; | |
262 | + case MK_equals: | |
263 | + key=SDLK_EQUALS; | |
264 | + break; | |
265 | case MK_scrolllock: | |
266 | key=SDLK_SCROLLOCK; | |
267 | break; | |
268 | @@ -757,6 +760,18 @@ | |
269 | case MK_printscreen: | |
270 | key=SDLK_PRINT; | |
271 | break; | |
272 | + case MK_1: | |
273 | + key=SDLK_1; | |
274 | + break; | |
275 | + case MK_2: | |
276 | + key=SDLK_2; | |
277 | + break; | |
278 | + case MK_3: | |
279 | + key=SDLK_3; | |
280 | + break; | |
281 | + case MK_4: | |
282 | + key=SDLK_4; | |
283 | + break; | |
284 | } | |
285 | sprintf(buf,"%s \"key %d%s%s%s\"", | |
286 | entry, | |
287 | @@ -1133,7 +1148,7 @@ | |
288 | } | |
289 | ||
290 | void MAPPER_AddHandler(MAPPER_Handler * handler,MapKeys key,Bitu mods,char * eventname,char * buttonname) { | |
291 | - char tempname[17]; | |
292 | + char tempname[99]; | |
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; | |
303 | + | |
304 | +Bitu frames = 0; | |
305 | +extern bool showcycles; | |
306 | + | |
307 | +#include "cpu.h" | |
308 | + | |
309 | void GFX_SetTitle(Bits cycles,Bits frameskip,bool paused){ | |
310 | char title[200]={0}; | |
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; | |
316 | if(paused) | |
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); | |
319 | else | |
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); | |
323 | } | |
324 | ||
325 | @@ -597,6 +604,7 @@ | |
326 | int ret; | |
327 | if (!sdl.updating) return; | |
328 | sdl.updating=false; | |
329 | + frames++; | |
330 | switch (sdl.desktop.type) { | |
331 | case SCREEN_SURFACE: | |
332 | if (SDL_MUSTLOCK(sdl.surface)) { |