Welcome to Emulationworld

Forum Index | FAQ | New User | Login | Search

Make a New PostPrevious ThreadView All ThreadsNext ThreadShow in Flat Mode*


SubjectRe: Alright I gotta have you be a little more descriptive here Reply to this message
Posted byBart T.
Posted on11/29/03 03:05 PM



> > Its a different story when running in virtual mode. I'm not sure how
> consistent
> > the various flavors of Windows are going to be, but you're essentially going
> to
> > 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.


----
Bart

-
Entire Thread
Subject  Posted byPosted On
*Just a matter of time...Assembly fun cont'd  Snowball 211/29/03 02:46 AM
.*Re: Just a matter of time...Assembly fun cont'd  Riff11/29/03 03:15 AM
..*Some background  Snowball 211/29/03 03:40 AM
...*Re: Some background  Riff11/29/03 04:01 AM
....*Alright I gotta have you be a little more descriptive here  Snowball 211/29/03 01:39 PM
......Re: Alright I gotta have you be a little more descriptive here  Bart T.11/29/03 03:05 PM
......*Re: Alright I gotta have you be a little more descriptive here  finaldave12/02/03 06:36 AM
.......*Re: Alright I gotta have you be a little more descriptive here  Bart T.12/02/03 11:34 AM
........*Re: Alright I gotta have you be a little more descriptive here  finaldave12/03/03 08:04 AM
.........*Re: Alright I gotta have you be a little more descriptive here  Bart T.12/03/03 11:14 AM
..........*Re: Alright I gotta have you be a little more descriptive here  smf12/04/03 06:02 AM
....*Re: Some background  abcdef11/29/03 07:27 AM