'===========================================================================
' Subject: GET PRINTER STATUS                 Date: 07-17-96 (00:00)       
'  Author: Kurt Kuzba                         Code: QB, QBasic, PDS        
'  Origin: FidoNet QUIK_BAS Echo            Packet: MISC.ABC
'===========================================================================
'>   Does anyone know how to tell if there is an incoming
'>   character for a LPT port?  I checked in the QB help, and
'>   LOF is not valid for any device except COMn.
'>.....
'   You can just read the port itself.

'_|_|_|   PRNTEST.BAS
'_|_|_|   This program will test your printer. First remove paper
'_|_|_|   and take printer offline. Run program. Add paper and
'_|_|_|   go online in individual steps. Program will locate the
'_|_|_|   printer status port and test conditions. (updated 7/17)
'_|_|_|   No warrantees or guarantees are given or implied.
'_|_|_|   Released to   PUBLIC DOMAIN   by Kurt Kuzba.  (7/17/96)
DEF SEG = &H40
PRN& = PEEK(9) AND 255
PRN& = PRN& * 256 + (PEEK(8) AND 255) + 1
'_|_|_|   Printer Status port is Printer I/O port + 1
DO
   t% = INP(PRN&): E% = 16
   IF (t% AND 16) = 16 THEN PRINT "Printer Online": E% = E% XOR 16
   IF (t% AND 32) = 32 THEN PRINT "Out of Paper": E% = E% OR 32
   IF (t% AND 128) = 0 THEN PRINT "Printer Busy": E% = E% OR 128
   IF E% > 0 THEN
      PRINT "Fix Printer and try again."
      WHILE INKEY$ <> "": WEND: WHILE INKEY$ = "": WEND
   END IF
LOOP WHILE (E% > 0) AND (INKEY$ <> CHR$(27))
'_|_|_|   end   PRNTEST.BAS
'There should be nothing coming in on the printer port, usually.
'You will need to poll both the data port and the status port to
'see which one has data coming in on it when using the parallel
'port for something other than a printer. It is done all the
'time, I know. Iomega Zip drives use it, and some LAN setups.
