- lds zh,rxcount ;if rxcount < RXBUFSIZE
- cpi zh,RXBUFSIZE ; (room for at least 1 char?)
- brsh srxi_ov ;
- inc zh ;
- sts rxcount,zh ; rxcount++
-
- ldi zl,low(rxfifo) ;
- lds zh,rxidx_w ;
- add zl,zh ;
- inc zh ;
- andi zh,RXBUFMASK ;
- sts rxidx_w,zh ; rxidx_w = ++rxidx_w % RXBUFSIZE
- ldi zh,high(rxfifo) ;
- brcc PC+2 ;
- inc zh ;
- st z,temp ; rxfifo[rxidx_w] = char
-srxi_ov: ;endif
-
-srxi_end2:
+ lds zh,rxcount ;2 if rxcount < RXBUFSIZE
+ cpi zh,RXBUFSIZE ;1 (room for at least 1 char?)
+ brsh srxi_ov ;1
+ inc zh ;1
+ sts rxcount,zh ;2 rxcount++
+
+ ldi zl,low(rxfifo) ;1
+ lds zh,rxidx_w ;2
+ add zl,zh ;1
+ inc zh ;1
+ andi zh,RXBUFMASK ;1
+ sts rxidx_w,zh ;2 rxidx_w = ++rxidx_w % RXBUFSIZE
+ ldi zh,high(rxfifo) ;1
+ adc zh,_0 ;1
+ st z,temp ;2 rxfifo[rxidx_w] = char
+srxi_ov: ;=19 endif
+
+srxi_end: