> > Its a different story when running in virtual mode. I'm not sure how
> > the various flavors of Windows are going to be, but you're essentially going
> > have to program the 8254 to run at 10 Mhz,
> Why? Is that the speed I'm looking for?
I'm not sure why Riff suggested 10MHz... AFAIK, it can't even clock that high.
What you want to do is lock your game to a fixed frame rate. I'm not completely sure how games like Quake III work -- they seem to render as fast as your hardware allows and sychronize game logic to some other frequency, or they interpolate movement for each frame based on how fast the graphics are being rendered, I can't say for sure.
What rate you need is up to you. VGA refreshes at 70Hz. It should be the same on ALL platforms. If you run it windowed on different platforms, you will see speed differences because VSync doesn't work in a window (I'm assuming Windows just doesn't handle it unless it's in full screen mode.)
You can try 30Hz, 50Hz, 60Hz, or 70Hz. What you'll want to do is program the timer to generate interrupts at these frequencies. Each time an interrupt is generated, your interrupt handler catches it and sets a memory flag.
Then, your main loop waits for this memory lap to become 1. When it does, you clear it, perform your game logic, draw the screen, and loop. When drawing, you may still want to wait for VSync before blitting.
> Never made an interrupt handler. How would I substitute it for the old one and
> what would it do differently? What's an appropriate value to make it trigger?
There should be plenty of documentation out there for the 8254 PIT. Intercepting interrupts is easy: You just overwrite the interrupt vector to point at your interrupt handler.
When you're done, restore the old pointer.
DOS uses that same interrupt handler to keep track of time. It assumes the timer is running at 18.2Hz. I think replacing the handler can cause system time on Win9X and DOS systems to drift, but I'm not sure (it certainly will on a DOS system.)
The solution is to jump to DOS's handler at 18.2Hz (you have to calculate on which ticks to do this in the interrupt handler by using some fixed-point math.) You probably don't need to worry about that now, just getting it to work will be your main concern.