Skip to main content


Lately I've been working on trying to add some speed / performance hacks to #DOSBox. The idea is a bit similar to the old DOSIDLE.EXE / POWER.EXE TSRs: detect when the system is idle or busy-looping, and give up the rest of the CPU cycles until something interesting happens (next frame, next BIOS tick, whatever).

There are a bunch of timing sources on the IBM PC and it's tricky to get them all, but as a proof of concept - here's the delay loop from GORILLA.BAS:

'Rest:
' pauses the program
SUB Rest (t#)
s# = TIMER
t2# = MachSpeed * t# / SPEEDCONST
DO
LOOP UNTIL TIMER - s# > t2#
END SUB

So, it busy-loops until the timer tick. In DOSBox I modified the BIOS INT 1A handler so that if the emulated machine requests the time twice and the same tick comes up, it's probably spinning, so I take away all the remaining cycle budget and sleep instead. And it actually works! Host CPU usage drops significantly - or, if you put it in Turbo Mode, the game plays WAY faster!

Lo, thar be cookies on this site to keep track of your login. By clicking 'okay', you are CONSENTING to this.