1) JNB TI, $ ; Wait till done transmitting 

2)CJNE R1,#BUFFER+BUFFER_SIZE,MAIN_LOOP ; if(R1 == BUFFER+BUFFER_SIZE) 
MOV R1,#BUFFER ; R1 == BUFFER