+ char buf = _io_ports[M6811_SCDR];
+ if (sci_doing_xmodem) {
+ if ((sci_rx_buf_ptr+1)%BUFFER_LEN == sci_rx_buf_ptr_start) {
+ /* we drop following bytes :( */
+ return;
+ }
+ sci_rx_buf[sci_rx_buf_ptr] = buf;
+ sci_rx_buf_ptr++;
+ sci_rx_buf_ptr %= BUFFER_LEN;
+ return;
+ }
+ if (sci_echo) {
+ while (!(_io_ports[M6811_SCSR] & M6811_TDRE)); /* wait for TX ready */
+ _io_ports[M6811_SCDR] = buf; /* send byte */
+ }
+
+ /* XXX FIXME we should do something about errors. nack? */