private int readByte(int data, long cycles,
		       boolean restart, boolean timeout) {
    boolean dataOut = (data & SERIAL_DATA_OUT) != 0;
    boolean clkOut = (data & SERIAL_CLK_OUT) != 0;

    if (restart) {
      // Set everything to "low" and go...
      rbCtr = 0;
      rbByte = 0;
      rbState = WAIT_BIT;
      dataHi();
      System.out.println("Start reading byte - data lo");
      waitTimeout = 200 + cycles;
      eoiCtr = 0;
      lastChar = false;
      return 0;
    }

    if (timeout) {
      System.out.println("//// EOI Timeout???");
      if (eoiCtr == 0) {
	System.out.println("//// EOI 1 => dataLo");
	dataLo();
	waitTimeout = 80 + cycles;
      } else {
	System.out.println("///// EOI 2 => dataHi");
	dataHi();
	// No more timeout...
	waitTimeout = 0;
	lastChar = true;
      }
      eoiCtr++;
    }

    if (rbState == WAIT_BIT) {
      if (clkOut)
	rbState = READ_BIT;
    } else {
      if (!clkOut) {
	rbByte |= dataOut ? 0 : (1 << rbCtr);
// 	System.out.println("//// Read bit: " + rbCtr + " => " + rbByte);
	rbState = WAIT_BIT;
	rbCtr++;
	waitTimeout = 0;
      }
    }

    if (rbCtr == 8) {
      return rbByte;
    }
    return 0;
  }