Also, this may be simpler/faster: void count(int time) { int value = 0; while (value < time) { while (inb(BASEPORT+1) & 0x80)); while (inb(BASEPORT+1) ^ 0x80)); value++; } } - Kal.