

ORG 000H
        JMP     MAIN
ORG 023H
        JMP     SERIAL ; label where to jump to transmit the next bit
ORG 030H
MAIN:
        MOV     SCON,#50H
        MOV     TMOD,#20H
        MOV     TH1,#-24
        SETB    TR1
        SETB    EA
        SETB    ES
        MOV     A,#'A'  ; moving the intial ASCII code after which increament will take place of this intial value
        MOV     SBUF,A ; as this ASCII code is now present in A, moving it in the Serial Buffer
        JMP     $ ; waiting for the interupt to occour

SERIAL:
        CLR     TI ; when jumped to the label after the interpt, clearing the flag
        INC     A  ; increamented it to get the next ASCII code
        CJNE    A,#'Z'+1,SKIP ; deciding whether the last code has arrived 
        MOV     A,#'A' ; if it is arrived than moving the initial code again
SKIP:
        MOV     SBUF,A
RETI

END


