============================================================================
dqbtimerfix.zip - Fix/Patch for DQBsetFrameRate in DirectQB 1.5+
============================================================================
by Plasma / Jon Petrosky  [09-12-06]
www.phatcode.net


First, some background info: Lachie launched his great QBASIC Games
Directory last week (yes, in 2006). Looking through the list of "games
pending", I noticed several of them had problems with freezing when using
DQBsetFrameRate. Interestingly, these were the same games that were
freezing during my tests with EMS Magic. So the problem was actually with
DirectQB, and not with EMS Magic...which was good news. :) But the games
were still freezing, which was not good. :( Time to find a solution...

Turns out if the program sets a framerate higher than 18, DirectQB attempts
to reprogram the Programmable Interval Timer (PIT, int 8). This fails under
Windows XP. (And also, I discovered, under DOS with the MS Network Client.)
The PIT normally runs at 18.2 Hz, so reprogramming it to run at a faster
rate is necessary for syncing to higher framerates. Or is it?

There's an alternative timer that's seldom used: The Real Time Clock (RTC).
The RTC (int 70h) runs at 1024 Hz by default, so there's no need to
reprogram it. Programs that use the RTC are also compatible with Windows XP.
Sounds good to me. What's the catch? Besides being a little tricky to
enable the RTC, none. :)

Included is the modified source for DirectQB versions 1.51, 1.61, and 1.71
that uses the RTC for timing instead of the PIT. This is useful if you have
the source code to the program in question, or if you'll still using DQB.
(The assembled object files are also included; you can simply drop them in
your DQB folder and rebuild the library with the library manager.)

Of course a lot of QB games were never released with the source code, so I
also wrote a program to patch EXEs directly (DQBTFIX). DQBTFIX should work
for all programs compiled with DQB 1.5, 1.51, 1.6, 1.61, and 1.71, provided
they are not packed. (UPX, etc.)


Some programs that now work in Windows XP after patching with DQBTFIX:

AIIB
HAM-3D Engine
IDKFA
Orc Race
Shell Shock :D
Super Sumo Wrestling 2
The Adventures
XBall IV

("Arkanoid", "Ped Xing's Quest" and "Tales of Alunia" patch ok, but still
freeze/crash for me, so there must be another problem somewhere...)


Anyway, that's all. Thanks to Lachie for the DQBsetFrameRate hint, without
it I'd probably still be trying to figure out why IDKFA was freezing with
EMS Magic.


-Plasma
