; ---------------------------------------------------------------------------
; SERIAL.ASM  - Serial Port routines
; ---------------------------------------------------------------------------

comport_prefix  db 'COM', 0
comport         dw 0
COM1            EQU 03f8h
COM2            EQU 02f8h
COM3            EQU 03e8h
COM4            EQU 02e8h
COM1IRQ         EQU 4
COM2IRQ         EQU 3
COM3IRQ         EQU 4 
COM4IRQ         EQU 3

comport_init proc far
; DX = port, AL = Params
        mov  ah, 0
        int  14h
        ret
comport_init endp

comport_write proc far
; DX = port, AL = Char
        mov  ah, 1
        int  14h
        clc
        and  al, 80h
        cmp  al, 80h
        jne  nowriteerror
        stc
nowriteerror:
        ret
comport_write endp

comport_read proc far
; DX = port
; returns AL = char  AH = line status 
        mov  ah, 2
        mov  al, 0  ; articom
        int  14h
        ret
comport_read endp

comport_status proc far
; DX = port
; returns AL = modem status  AH = line status 
        mov  ah, 3
        mov  al, 0  ; articom
        int  14h
        ret
comport_status endp
