/* 
IDLE.C
*/ 
 
#include <stdlib.h> 
#include <stdio.h> 
#include <string.h>
#include <conio.h> 
#include <time.h> 
#include <pharlap.h>
 
#ifdef __WATCOMC__ 
#define _kbhit kbhit
#endif 
 
void Yield(void); 
 
main(int argc, char *argv[]) 
{ 
    time_t t1, t2; 
    unsigned long iter = 0; 
    int do_yield = (argc > 1) ? 1 : 0; 
     
    time(&t1); 
    while (! _kbhit()) 
    { 
        if (do_yield) 
            Yield(); 
        iter++; 
        if ((time(&t2)-t1) >= 60) 
            break; 
    } 
    time(&t2); 
     
    printf("%lu iterations in %lu seconds\n", iter, t2-t1); 
    return 0; 
} 

void Yield(void)
{
    SWI_REGS r;
    memset(&r, 0, sizeof(r));
    r.eax = 0x1680;
    _dx_real_int(0x2f, &r);
    return;
}
