*SERIAL PORT DRIVER WITH NORMAL LINE FEEDS
 ORG 0C900H
DTRB DW 0
DTRNB DW 0
DTRBL DW 0
DTWBR DW WB
DTWB DW WB
DTREW DW 0
DTEOF DW EOF
DTCLO DW CLOSE
DTSEK DW 0
DTCTL DW 0
DTBLK DW 874/4
DTITO DB 1
DTINT DW INIT
*
WB CALL WTBLK
 XTHL
 INX H
 INX H
 INX H
 XTHL
 LXI H,0
 RET
*   
EOF CALL WTBLK
 LXI H,0
 RET
*   
CLOSE MVI A,'L'-40H
 CALL PRINT
 RET
*
INIT MVI A,0DH
 CALL PRINT
 RET
*   
WTBLK MOV A,D
 ORA E
 RZ 
 MOV A,M
 CALL PRINT
 INX H
 DCX D
 JMP WTBLK
*   
PRINT PUSH PSW
 MOV B,A
P1 CALL STAT
 JZ P1
P2 CALL STAT1
 JZ P2
 MOV A,B
 OUT 0F9H
 POP PSW
 RET
*   
STAT IN 0F8H
 ANI 80H
 RET
STAT1 IN 0F8H
 ANI 20H
 RET
