start:
	mov SP,#?stack-1
	mov IE,#0 ; Disable all interrupts.
        mov P1,#0 ; Turn off tr_enab and tr1_enab.

        ; This is for serial port 0
	mov t2con,#030h ; Use Timer 2 in auto reload mode for both receive and transmit baud clocks.
	mov RCAP2L,#T2RL96L
	mov RCAP2H,#T2RL96H
	mov TL2,#T2RL96L
        mov TH2,#T2RL96H
	mov SCON,#050h ; Serial port 0 mode 1 (8-bit UART), Receive Enable.
	mov a,#2 ; Stretch value. External RAM access via MOVX uses 4 machine cycles.
	mov CKCON,a ; T1M (CKCON.4) is 0 so timer 1 runs at crystal/12.
	setb TR2 ; Turn on timer 2.

        ; This is for serial port 1
        mov tmod,#020h ; Timer 1 mode 2: 8-bit auto-reload mode.
        mov th1,#255d
        mov tl1,#255d
        mov scon1,#050h ; Serial port 1 settings: mode 1 (async 10-bit), receive enable.
        setb smod ; Set smod_1 to double the baud rate.
        clr RI1 ; If it`s edge triggered, we may never get an interrupt if TI or
        clr TI1 ; RI are already set when interrupts are enabled.
        setb ES1 ; Enable interrupts.
	setb EA ; Global interrupt enable.
        setb tr1 ; Turn on timer 1. Port is now live. 