// read from COM port
unsigned int ReadByte (unsigned int time_out)
{
	unsigned int data, timeout = time_out;
	unsigned char status;

	_outp(PORT+3, (32+8+2+1));		// 8 bit, 1 stop, parity always 1
	while (! ((status = _inp(PORT+5)) & 1))
	{
		if (! timeout--)
			return (0xFFFF);	// timeout
	}
	data = (unsigned int)_inp(PORT+0);
	if (status & 8)	return (0xFFFE);	// frame error
	if (!(status & 4)) data += 256;		// determine sync/data;
//						return data as 0...255
//						and sync as 256...511
	return (data);
}