; Printer.asm - primitives for access LPTx ports.     2006 Chris Evans

PRT_TIMEOUT    EQU 01h
PRT_IOERROR    EQU 08h
PRT_SELECTED   EQU 10h
PRT_OUTOFPAPER EQU 20h
PRT_ACK        EQU 40h
PRT_NOTBUSY    EQU 80h
PRT_WRITECHAR  EQU 00h
PRT_INITPORT   EQU 01h
PRT_GETSTATUS  EQU 02h

lpt             db 'LPT',0
printer         db 'PRN',0
printerstatus   db 0
lptport         dw 0

; Basic BIOS int-17h support
; Remember to set port number in DX, Character in AL.

lpt_putch  proc far
        mov  ah, 00h
        ; al = byte to print
        mov  lptport, dx     ; LPT1 = 0   etc...
        int  17h
        mov  printerstatus, ah
        ret
lpt_putch  endp

lpt_init proc far
        mov  ah, PRT_INITPORT
        mov  lptport, dx
        int  17h
        mov  printerstatus, ah
        ret
lpt_init endp

lpt_query proc far
        mov  ah, PRT_GETSTATUS
        mov  lptport, dx
        int  17h
        mov  printerstatus, ah
        ret
lpt_query endp


