Get rid of ack/nack code.
[uccvend-snackrom.git] / ROM2 / sci.c
index fe59f75..6ef3cd3 100644 (file)
@@ -50,6 +50,11 @@ void send_string(char* c) {
        }
 }
 
+char toupper(char c) {
+       if (c >= 'a' && c <= 'z') c -= 'a'-'A';
+       return c;
+}
+
 void sci_rx_int() {
        char buf = _io_ports[M6811_SCDR];
        if (sci_doing_xmodem) {
@@ -72,7 +77,8 @@ void sci_rx_int() {
                /* overrun :( */
                return;
        }
-       sci_rx_buf[sci_rx_buf_ptr] = buf;
+       /* we upper case because no commands care that things aren't */
+       sci_rx_buf[sci_rx_buf_ptr] = toupper(buf);
 
        if (buf == '\n' || buf == '\r') {
                sci_rx_buf[sci_rx_buf_ptr] = '\0';
@@ -98,14 +104,6 @@ void msg_clr() {
        sci_rx_buf_ptr = 0;
 }
 
-void send_ack() {
-       send_string("!" CRLF);
-}
-
-void send_nack() {
-       send_string("?" CRLF);
-}
-
 u16 sci_timer;
 void serial_rti() { /* called every 6.6 ms */
        if (sci_timer) sci_timer--;
@@ -113,10 +111,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 +129,4 @@ void serial_write(const char *str, int len) {
                _io_ports[M6811_SCDR] = *c; /* send byte */
        }
 }
+

UCC git Repository :: git.ucc.asn.au