How to slow down real-time

Emulation of old PCs, PC hardware, or PC peripherals.

How to slow down real-time

Postby jh3141 » 2017-12-30 @ 21:06

I'd like to be able to make games run slower than real time, in order to help learn to play them better. Is there any way of doing this with currently available emulators? I'm using the standard build of DOSBox-X at the moment, but have no real aversion to either switching to another system or even applying a non-standard patch.

What I want in more depth, in case it isn't clear:

A way to effectively slow down time, so that the emulated program runs slower, whatever method it uses to determine how fast to run:

* Obviously I can currently slow the CPU itself down by changing the 'cycles' setting, but this doesn't do what I want for most games made from the late 80s onwards: it drops the effective frame rate, but each frame includes larger changes that make it harder, not easier to play.
* So I need to change the speed of other timing sources, too: timer interrupts, vertical retrace interrupts, real-time clock value, and so on.

How can I do this? Preferably, I'd like to be able to turn it on/off easily while emulation is running.
jh3141
Newbie
 
Posts: 1
Joined: 2017-12-30 @ 19:36

Re: How to slow down real-time

Postby superfury » 2017-12-30 @ 22:58

Afaik this isn't directly possible with most emulators without changing source code and recompilation(and even then there's the problem of the system clock used for CMOS time).

So, in general, it's at least 5 possible sources:
- CPU clock(Hz or IPS).
- Timer(PIT).
- CMOS(Maybe Windows/Linux clock, if used).
- Video rendering(framerate/line rate/pixel rate).
- Audio rendering(samplerate).

All of those sources might be used, depending on the application running.

If the emulator has a base BUS clock(e.g. UniPCemu) you can change it manually in the code(currently locked to 14MHz). Other sources (CMOS) would require a custom Windows/Linux driver to apply, since that's it's source.

Most clocks are usually based on those kinds of clocks(e.g. gettimeofday or OS-specific equivalent, see UniPCemu's support/highrestimer.c source code of gettimeofday in universal format, used throughout emulation). Such a function, and/or SDL_Delay() function is usually the clock source(together with Windows/Linux time for RTC).
superfury
l33t
 
Posts: 2293
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: How to slow down real-time

Postby vladstamate » 2017-12-30 @ 23:27

Yeah, you would think such a simple thing as slowing down (or even speeding up) would be a no brainer once you have emulators. But in our quests as emulator writers to pursue perfection we did not have time to add such a feature.

To answer your question, Superfury put it all right. However for most of the games, you might be fine only slowing down PIT or CMOS for example.
User avatar
vladstamate
Oldbie
 
Posts: 802
Joined: 2015-8-23 @ 01:43

Re: How to slow down real-time

Postby superfury » 2017-12-31 @ 11:13

In some cases it might even require some or all of those five devices to slowdown relatively to the base clock. Like audio processing(non-PIT, e.g. Sound Blaster, Game Blaster) and video processing(VGA/CGA/MDA) combined with the CPU clock. Like in 8088 MPH, which uses both the PIT, CPU and Video combined to not produce errors. Or 8088 corruption, which adds the Sound Blaster to the 8088 MPH mix(afaik using all those sources except the CMOS). I don't know any program using more, except if you want to display the current CMOS time while running 8088 corruption, which it currently doesn't support XD
superfury
l33t
 
Posts: 2293
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: How to slow down real-time

Postby vladstamate » 2017-12-31 @ 13:00

Another idea (to think outside the box so to speak) is rather than slow down the emulator, slow down the host machine. This way the emulator will not be able to keep up. It is inconvenient as it requires a reboot but it can work.
User avatar
vladstamate
Oldbie
 
Posts: 802
Joined: 2015-8-23 @ 01:43

Re: How to slow down real-time

Postby superfury » 2017-12-31 @ 21:30

Theoretically, only slowing down the reported time reported TO windows will solve all cases? But it requires a custom driver and control software to direct the driver to do so(although slowing down all other software as well?)?
superfury
l33t
 
Posts: 2293
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: How to slow down real-time

Postby ripa » 2018-1-03 @ 21:45

I actually made such a version of Dosbox that allows adjusting the emulated video refresh rate, which works for speeding up and slowing down many games.
viewtopic.php?p=326732#p326732

I might have had a version where refresh rate could be adjusted on the fly with some keyboard shortcut instead of having to adjust the config file...
ripa
Oldbie
 
Posts: 547
Joined: 2005-4-18 @ 00:53
Location: Finland


Return to PC Emulation

Who is online

Users browsing this forum: airs, Danfun64 and 2 guests