PDA

View Full Version : wait for vertical retrace-crashes laptop



Unregistered
04-10-2002, 05:45 AM
Juts wondered if anyone has had the same problem and if someone knew why: Im using mode 0x13 in dos and I have a problem with a wait for vertical retrace function. It goes like this (canīt get curly braces here on this keyboard now...so only whats inside):

while((inp(0x03da) & 0x08));
while(!(inp(0x03da) & 0x08));

I call this before my pixel plotting routines in a loop and it makes for example one pixel on screen dissapear and perhaps appear once in a while. When I have run the program everything behaves really strange. If I try to write anything with the keyboard only strange symbols appear and enter is out of function. Obviously I have messed badly with the systems internals, but what? Shouldnīt the wait_for_retrace implementation stop the flickering of animated stuff rather than almost remove it?
I use Turbo C compiler and running win98 and also tried in pure DOS on a laptop with LCD. I believe LCDs might have different ways to refresh from other screens, but then again, I can run DOS games brilliantly on the laptop?
Anyone have nay ideas?
Thanks

Magos
04-10-2002, 10:39 AM
<<I call this before my pixel plotting routines in a loop

You're not using it likes this, right:


for(Y=0; Y<200; Y++)
{
for(X=0; X<320; X++)
{
WaitForVerticalRetrace();
PlotPixel(X, Y);
}
}

You should call it before the loops. Or even better, use a temporary buffer where you draw your "screen", wait for the retrace and then move the data from the buffer to the video memory.

You say it crashes when you exit the program? Are you sure you've deallocated all dynamically allocated memory?

And for the weird characters, are you replacing the original keyboard handler without restoring it?

Hope some of this helps :).

Unregistered
04-13-2002, 05:00 AM
Thanks for help, I have some more things to learn now....