Qemu Brake
modification of Qemu to slow down emulation

Qemu Brake is a modification of the original emulator Qemu that can slow down the emulated machine. My motivation for writing it was to improve Qemu performance in the DOS environment, where the Qemu uses all of free CPU time and many old programs and games run too fast on modern computers.

Usage:

The '-brake' command line parameter or monitor command 'brake' determines how long to wait in the main_loop with respect to duration of time that qemu used for the emulation itself in percents. Thus e.g. zero value runs at full speed, 50 at 2/3 speed, 100 at 1/2 speed, 1000 at 1/11 speed, etc.

Sample installation of Qemu with the Kingdom of Kroz game:

To run the game directly on Linux or Windows just download and unpack this file sample.zip and follow the instructions in README.TXT file:

QEMU WITH BRAKE
---------------

Intro

This directory contains a sample of Qemu with Brake, FreeDOS, and the Kingdom
of Kroz game. It will be shown how to use the brake functionality for making
the game playable on recent computers.

Running the Game

1/ run script ./go.sh on Linux or go.bat on Windows
2/ hit enter on the boot screen of FreeDOS
3/ select second option "FreeDOS Safe Mode" and hit enter
4/ type: c:
5/ type: kingdom
6/ now start the game and see that game is too fast to be playable

Effect of the Brake

7/ enter monitor by pressing ctrl+alt+2
8/ type "brake 1000" to slow it down by 1000% (ten times)
9/ return to the emulation screen by pressing ctrl+alt+1
10/ now enjoy the game again at fine speed while Qemu uses much less CPU power
11/ once you master the game, you can try to make it a bit harder by setting the brake parameter to lower values ;-)

Compiling from sources:

Download the original Qemu sources, download the patch brake-q-0.9.0.patch from this site, and apply the patch by "patch < brake-q-0.9.0.patch" in the sources directory.

References:

The idea of the Brake was inspired by the following posts:

Known problems:

A drawback of this approach is that the timer interrupt can be missed if raised too often. This happens if the loop_main divided by (1+brake) is less than the frequency of PIT interrupts. In such case time of the emulated system runs slowly. Therefore, the actual speed measurement inside the emulated system may not reflect the real slow down. This problem occurs mainly for Linux emulation where kernel parameter HZ is of several hundreds.
For DOS emulation, where the timer interrupts are raised usually at 18Hz, this approach works nice, and one can play old DOS games at reasonable speed and save his laptop batteries. Yet, the brake slows down the Linux emulation to some degree too.

Dosbox:

The approach is similar to the "CPU cycles" parameter in Dosbox DOS emulator. But I think Qemu is faster than Dosbox, so it makes sense to me to include such capability.

Downloads:

 

Discussion
Empty discussion Add note