Thread: wait for vertical retrace-crashes laptop

  1. #1
    Unregistered
    Guest

    wait for vertical retrace-crashes laptop

    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

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    <<I call this before my pixel plotting routines in a loop

    You're not using it likes this, right:
    Code:
    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 .
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Unregistered
    Guest
    Thanks for help, I have some more things to learn now....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  2. If you're getting a laptop, don't get a gateway
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-09-2004, 09:28 PM