Subversion Repositories pentevo

Rev

Blame | Last modification | View Log | Download | RSS feed | ?url?

        ;***************************************************************
        ;
        ; TEROT - Output a character to the system console
        ;         update PHEAD position.
        ;
        ;***************************************************************
        ;
STEROT: MOV     R5,#' '         ;OUTPUT A SPACE
        ;
TEROT:  PUSH    ACC             ;SAVE THE ACCUMULATOR
        PUSH    DPH             ;SAVE THE DPTR
        PUSH    DPL
        JNB     CNT_S,$+7       ;WAIT FOR A CONTROL Q
        ACALL   BCK             ;GET SERIAL STATUS
        SJMP    $-5
        MOV     A,R5            ;PUT OUTPUT BYTE IN A
        JNB     BO,$+8          ;CHECK FOR MONITOR
        LCALL   2040H           ;DO THE MONITOR
        AJMP    TEROT1          ;CLEAN UP
        JNB     COUB,$+8        ;SEE IF USER WANTS OUTPUT
        LCALL   4030H
        AJMP    TEROT1
        JNB     UPB,T_1         ;NO AT IF NO XBIT
        JNB     LPB,T_1         ;AT PRINT
        LCALL   403CH           ;CALL AT LOCATION
        AJMP    TEROT1          ;FINISH OFF OUTPUT
        ;
T_1:    JNB     COB,TXX         ;SEE IF LIST SET
        MOV     DPTR,#SPV       ;LOAD BAUD RATE
        ACALL   LD_T
        CLR     LP              ;OUTPUT START BIT
        ACALL   TIMER_LOAD      ;LOAD AND START THE TIMER
        MOV     A,R5            ;GET THE OUTPUT BYTE
        SETB    C               ;SET CARRY FOR LAST OUTPUT
        MOV     R5,#9           ;LOAD TIMER COUNTDOWN
        ;
LTOUT1: RRC     A               ;ROTATE A
        JNB     TF1,$           ;WAIT TILL TIMER READY
        MOV     LP,C            ;OUTPUT THE BIT
        ACALL   TIMER_LOAD      ;DO THE NEXT BIT
        DJNZ    R5,LTOUT1       ;LOOP UNTIL DONE
        JNB     TF1,$           ;FIRST STOP BIT
        ACALL   TIMER_LOAD
        JNB     TF1,$           ;SECOND STOP BIT
        MOV     R5,A            ;RESTORE R5
        SJMP    TEROT1          ;BACK TO TEROT
        ;
        newpage
TXX:    JNB     TI,$            ;WAIT FOR TRANSMIT READY
        CLR     TI
        MOV     SBUF,R5         ;SEND OUT THE CHARACTER
        ;
TEROT1: CJNE    R5,#CR,$+6      ;SEE IF A CR
        MOV     PHEAD,#00H      ;IF A CR, RESET PHEAD AND
        ;
        CJNE    R5,#LF,NLC      ;SEE IF A LF
        MOV     A,NULLCT        ;GET THE NULL COUNT
        JZ      NLC             ;NO NULLS IF ZERO
        ;
TEROT2: MOV     R5,#NULL        ;PUT THE NULL IN THE OUTPUT REGISTER
        ACALL   TEROT           ;OUTPUT THE NULL
        DEC     A               ;DECREMENT NULL COUNT
        JNZ     TEROT2          ;LOOP UNTIL DONE
        ;
NLC:    CJNE    R5,#BS,$+5      ;DEC PHEAD IF A BACKSPACE
        DEC     PHEAD
        CJNE    R5,#20H,$+3     ;IS IT A PRINTABLE CHARACTER?
        JC      $+4             ;DON'T INCREMENT PHEAD IF NOT PRINTABLE
        INC     PHEAD           ;BUMP PRINT HEAD
        POP     DPL             ;RESTORE DPTR
        POP     DPH
        POP     ACC             ;RESTORE ACC
        RET                     ;EXIT
        ;