ticks = usec / CLK_RATE; ticks = ticks * 10000;
if (usec < 200000) ticks = (usec * 10000) / CLK_RATE; else ticks = (usec / CLK_RATE) * 10000;
delay(int usec){	int     ticks, paranoia = 0x10000000;	int     t, timerh, timerl;	if (usec <= 0)		usec = 1;	ticks = usec / CLK_RATE;	ticks = ticks * 10000;	while (ticks) {		t = min(ticks, 65535);		timerh = (t & 0xff00) >> 8;		timerl = (t & 0xff);		via_reg(VIA1, vT2C) = timerl;		via_reg(VIA1, vT2CH) = timerh;		while (!(via_reg(VIA1, vIFR) & V1IF_T2) && paranoia)			paranoia--;		ticks -= t;	}	if (!paranoia)		printf("paranoia in delay()!!!\n");}