Message-Id: <335FC288.50A4@canvaslink.com> Date: Thu, 24 Apr 1997 16:28:56 -0400 From: Tom Grandgent Reply-To: tgrand AT canvaslink DOT com Organization: Canvas Link, Inc. Mime-Version: 1.0 To: Roger Noss Cc: djgpp AT delorie DOT com Subject: Re: timer interrupt - sample code anyone? References: <1 DOT 5 DOT 4 DOT 32 DOT 19970424175545 DOT 0068dd24 AT ubeclu DOT unibe DOT ch> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Roger Noss wrote: > > At 11:42 AM 4/24/97 -0400, you wrote: > > > >However, it's pretty easy to find vertical retrace. This should wait > >for the vertical retrace: > > > >while (inportb(0x3DA) & 1); > > Um, I hate to drag out this false lead on the thread, but my VGA specs show > that bit 1 of 0x3DA is horizontal retrace. Today I (think I) succeeded with > "& 8", for bit 3. But the funny thing is, in NT3.51 I measured 69 Hz in > full screen and 72.3 Hz in a window, *** regardless of whether I set Control > Panel -> Display to 60 Hz or 72 Hz (rebooting, of course) ***. Does anyone > understand this?? I realize that this is no longer about djgpp, so what is > the proper discussion forum for this kind of question? > > Roger Noss Hmm, interesting! I got that from Allegro's vsync_out() function, but perhaps I didn't pay enough attention to what I was doing. Now that I look more closely, that code is supposed to wait until the VGA is not in either a horizontal or vertical retrace. There is also a function called vsync_in() though, which does the same thing except checking bit 8. Then there is a function called _vga_vsync(), which simply calls _vsync_out() and then _vsync_in(). So I think this is how Allegro is waiting until the monitor has finished drawing a frame... (at least in VGA mode anyway.) Now, I also went back and looked at my old waitforretrace() macro that I used to use back in Borland C++ 3.1. It is: while (!(inp(0x3DA) & 8)) And this always worked just fine for me to provide smooth animation.. Apparently there is a bit more to this than I originally thought (?). And as for your readings in NT, are you sure you're really being able to access the -real- 0x3CA, or could NT be secretly doing some emulation or something? I say this only because I remember that OS/2 used to have a DOS session setting that was something like VERTICAL_RETRACE_EMULATION. Tom Grandgent tgrand AT canvaslink DOT com Canvas Link, Inc.