From: Bernard Blackham Date: Wed, 23 Jun 2004 15:20:57 +0000 (+0000) Subject: Bugfixes X-Git-Tag: ROMW~16 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=74fa3423b3feafe4877c3bfc819462e80797ed3a;p=uccvend-snackrom.git Bugfixes --- diff --git a/ROM2/sci.c b/ROM2/sci.c index fe59f75..646e443 100644 --- a/ROM2/sci.c +++ b/ROM2/sci.c @@ -113,10 +113,14 @@ void serial_rti() { /* called every 6.6 ms */ /* for gdb compatibility */ int serial_readchar(u8 timeout) { + int ret; sci_timer = timeout * 152; while (sci_timer && sci_rx_buf_ptr_start == sci_rx_buf_ptr); /* spin */ if (sci_timer == 0) return SERIAL_TIMEOUT; - return sci_rx_buf[sci_rx_buf_ptr_start++]; + ret = sci_rx_buf[sci_rx_buf_ptr_start]; + sci_rx_buf_ptr_start++; + sci_rx_buf_ptr_start %= BUFFER_LEN; + return ret; } void serial_write(const char *str, int len) { @@ -127,3 +131,4 @@ void serial_write(const char *str, int len) { _io_ports[M6811_SCDR] = *c; /* send byte */ } } +