
$MOD831
CSEG

ORG 0000h
	LJMP BEGIN
ORG 40h

BEGIN:
	MOV SCON,#01110000B ; Mode 1/Stop b/Rec en/x/x/Flags
	MOV TH1,#0FDh ; Reload value for 9600 Bd
	MOV TCON,#01010101B ; Fl1/Tim1 on/Fl0/Tim0 on/Ext1-edge/Ext0-edge
	MOV TMOD,#00100001B ; Gate1/Timer/Mode 2/Gate0/Timer/Mode 1
START:
	JNB RI,$ ; Sit here and wait for the Rx. Int. bit to go high
	MOV A,SBUF ; Move the rcv'd character to the acc.
	CLR RI ; Clear the Rx. Int. bit
	CLR TI ; Clear the Tx. Int. bit
	MOV SBUF,A ; Send out the rcv'd character
	JNB TI,$ ; Wait here until the Tx is complete
	LJMP START ; Jump back to Start to repeat the process
