* device/lib/printf_large.c: 6 bytes less __data mem (6 more __idata)
[fw/sdcc] / device / lib / _ser.c
index 74e0ce2518126e0b9c307130b056b3917510e0be..b06f69af9298fafc2415938886f586a500a561b8 100644 (file)
@@ -29,7 +29,7 @@
 /*      $Id$    */
 
 
-#include <8051.h>
+#include <8052.h>
 
 #include "ser.h"
 
@@ -83,6 +83,11 @@ ser_interrupt_handler(void) interrupt 4 using 1
 {
   ES=0;
 
+  if (RI) {
+    RI = 0;
+    ser_rxBuffer[ser_rxIndexIn++] = SBUF;
+  }
+
   if (TI) {
     TI = 0;
     if (ser_txIndexIn == ser_txIndexOut) {
@@ -93,11 +98,6 @@ ser_interrupt_handler(void) interrupt 4 using 1
     }
   }
 
-  if (RI) {
-    RI = 0;
-    ser_rxBuffer[ser_rxIndexIn++] = SBUF;
-  }
-
   ES=1;
 }
 
@@ -142,10 +142,10 @@ ser_printString(char *String)
   }
 }
 
-short
+char
 ser_charAvail(void)
 {
-  short ret = 0;
+  char ret = 0;
 
   if (ser_rxIndexIn != ser_rxIndexOut) {
     ret = 1;