Miroslav Novák

/ : Obsah / Contents | Piškvorky / Gomoku | Algoritmus Piškvorek | Hlubina / Depth | Hadi / Snakes | Super Střílečka II / Super Shooting II | Gred | Kufr | Robůtek / Mini Robot | Cvssvnlog | Qemu Brake | Pay MUZO

Qemu Brake

Qemu Brake je úprava emulátoru Qemu pro zpomalení emulace. To je vhodné zejména pro emulace DOS-ovských her. Spustitelné Qemu s Brake a s hrou Kingdom of Kroz je ke stažení zde: sample.zip.
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.


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. Thus e.g. zero value runs at full speed, 1 at 1/2 speed, 10 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:



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 10
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.


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 the time of emulated system runs slowly. 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.


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.



E-mail: novakmiroslavpost.cz