VOGONS


Determining CPU Cycles?

Topic actions

First post, by Roark

User metadata
Rank Newbie
Rank
Newbie

With reference to: Determining CPU Cycles?

OK, how about something even simpler. A DosBox DOS program that can set the cycles of the CPU in a batch file before a game is started. Similar to the mount and imgmount commands that work with the hard drives. That would give me good enough control to handle the situation just fine.

All this talk about making DosBox handle the CPU cycles better is fine but impractical. There were way to many old machines and there are too many new machines to automate the calculation accurately. Even if you could get good numbers for the old CPU's the new CPU's have to be translated over so DosBox can slow them down accurately and the numbers are all different for the new CPU's as well. Point is, it is not a variable that can be totally automated. BTW - not all programs are interrupt driven. Many communicated directly with the CPU without ever talking to DOS or the Bios.

Reply 1 of 4, by Stiletto

User metadata
Rank l33t++
Rank
l33t++

no, we don't bump 12-year-old threads here... split.

You should take a look at TOPBENCH and use it to tune where your cycles align with actual CPU speeds, that's what I'd do and basically what it was designed for.
https://dosbenchmark.wordpress.com/

If you want more accuracy than that, then you should check out something like PCEm instead. DOSBox is not a PC emulator.

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto

Reply 2 of 4, by Sammy

User metadata
Rank Oldbie
Rank
Oldbie

It depends also what cpu you emulate in Dosbox , 486, Pentium, MMX....

I normaly use "Pentium" and Set cycles to 80.000

When i run the Setup of Bleifuss2 (screamer2) it says Pentium 160 Mhz detected.

When i Set to 60.000 cycles it says Pentium 120 Mhz detected.

When Set to 61.000 or something , i can also force 121, 123, 127... et cetera... MHz.

Reply 3 of 4, by Roark

User metadata
Rank Newbie
Rank
Newbie

OK folks, thanks for the feedback however it sort of misses my point. First please let me clarify that when I put up the post I was replying to an old post at: Determining CPU Cycles? I, of course, am at fault for not noticing how old it actually was -- sorry if it caused a problem.

The bit about setting up a Pentium is good and I may use it but even some of the older programs fail with this arrangement and setting a specific cycle for them though a batch job would be handy.

As far as testing the benchmarks of the machines, I believe I pointed out that that would be impractical. I suppose if I did it just for my specific machine it would work fine but I have three machines in action and they all have different CPU's. I do not truly cherish having to benchmark each one just to set up a UNIQUE dosbox configuration for each of them. OK, maybe I am a bit lazy but it is an example of why I said it is an impractical solution.

I have looked at other solutions besides DosBox - not PCEm specifically but I will look into it of course - Problem is, most of them do not give you enough control to run a wide range of DOS applications. Either that or they lack a working graphics card or sound card. Of course they emulate hardware that woks minimally but they usually do not emulate the hardware you truly need to get the software running. Just something I have discovered. Again, I have not looked into PCEm yet so I will do so.

Reply 4 of 4, by Scali

User metadata
Rank l33t
Rank
l33t

In short: the cycles-measurement is rather meaningless, because DOSBox is designed to treat every instruction as '1 cycle'.
On real CPUs, there can be massive differences between execution times of different instructions, and even a single instruction can take shorter or longer depending on its input (eg early-out on mul/div).
Which is why trying to calibrate DOSBox with benchmarks is rather useless. It all depends on the instruction mix an application uses.

When I was developing 8088-code, I found that some optimizations for 8088 actually ran slower in DOSBox, because they used more instructions than the slower variety on real hardware.

PCEm tries to do simple 'weighting' of instructions, also based on which CPU you choose (because the weights are different for different CPU types), but it is not entirely correct.
Emulators for other systems (C64, Amiga etc) tend to be cycle-exact. Not only for the CPU, but also for the rest of the system (audio, video, I/O). I have yet to find a PC emulator that does this. Then again, there is such a wide variety of hardware out there that making everything cycle-exact is too much of a chore (eg, every single VGA chip or SB-compatible chip has its own timing characteristics). Having the CPU itself (nearly) cycle-exact would be a nice start however.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/