I need some pointer help in moving a Turbo C 2.1 (DOS) program to a console application in Windows, using the free Borland C++ v5.5 compiler (in C mode, not C++). Specifically, I need to save the system TIMER interrupt vector, install a vector to myTIMER interrupt and, on program exit, restore the original TIMER vector. In Turbo C 2.1, I used the following:
Code:
#define TIMER 0X1C
void interrupt (* oldtimer )( void );   /* <- BCC55: expected ')' error    */
void main(void) {
    oldtimer = getvect( TIMER );    /* save the Timer vector in oldtimer   */
    setvect(TIMER, MyTimer);        /* install a new vector to MyTimer     */
        /* MyTimer() calls (*oldtimer)(); decrements global MyWaitTimer    */
        /* ... program executes, loading MyWaitTimer with timeouts as reqd */
    setvect(TIMER, oldtimer);       /* Restore the original TIMER vector   */
}
In Borland C++ v5.5, there is no getvect()/setvect(). So, how can I save the Timer vector, in a form that I can call it, install a vector to MyTimer, and restore the original Timer vector at program exit? Alterntely, I need a timer that can set a flag on timeout, or a countdown timer that I can load and then check it to see if it has expired.
Go easy on me, I'm an embedded systems guy with no Windows programming experience, who learned just enough DOS stuff to write a C program, some 20-odd years ago.
Thanks,
jhilory