// Filename : VSYNC.C // Coded by : Scott Evans // Created/Modified : 23/2/98 // Description : Vertical blank timer routine #include // Timer variable volatile u_long timer; // Function : InstallTimer() // Coded by : Scott Evans // Created/Modified : 23/2/98 // Description : Sets the program timer routine // Parameters : None // Returns : None // Notes : None void InstallTimer(void) { InstallVsyncCallback(GameTimerCallback); #ifdef DEBUG_INFO PrintFM("Completed\n"); #endif } // Function : RemoveTimer() // Coded by : Scott Evans // Created/Modified : 23/2/98 // Description : Removes the program timer routine // Parameters : None // Returns : None // Notes : None void RemoveTimer(void) { RemoveVsyncCallback(); #ifdef DEBUG_INFO PrintFM("Timer function removed\n"); #endif } // Function : GameTimerCallback() // Coded by : Scott Evans // Created/Modified : 23/2/98 // Description : Function to be called each vertical blank // Parameters : None // Returns : None // Notes : None void GameTimerCallback(void) { timer++; } // Function : GetTimer() // Coded by : Scott Evans // Created/Modified : 23/2/98 // Description : Get value of timer // Parameters : None // Returns : None // Notes : None u_long GetTimer(void) { return(timer); } // Function : InstallVsyncCallback() // Coded by : Scott Evans // Created/Modified : 23/2/98 // Description : Set the vertical blank function // Parameters : f - function to call each vertical blank // Returns : None // Notes : None void InstallVsyncCallback(void (*f)(void)) { VSyncCallback(f); } // Function : RemoveVsyncCallback() // Coded by : Scott Evans // Created/Modified : 23/2/98 // Description : Removes the vertical blank function // Parameters : None // Returns : None // Notes : None void RemoveVsyncCallback(void) { VSyncCallback(NULL); } // Function : ResetTimer() // Coded by : Scott Evans // Created/Modified : 23/2/98 // Description : Resets the timer variable // Parameters : value - new timer value // Returns : None // Notes : None void ResetTimer(u_long value) { timer=value; }