home *** CD-ROM | disk | FTP | other *** search
/ The California Collection / TheCaliforniaCollection.cdr / his038 / qbints.lzh / PRINTER.BAS < prev    next >
Encoding:
BASIC Source File  |  1989-04-23  |  1.5 KB  |  38 lines

  1. 'Sun  Apr 23, 1989   2:20:12 pm
  2. '*****************************************************************************
  3. 'This routine checks to see if printer (assumes LPT1:) is turned on. If the
  4. 'returned value is 0 then the printer is OFF LINE, if 1 the printer is ON lINE
  5. '*****************************************************************************
  6.  
  7. TYPE RegType
  8.      ax    AS INTEGER
  9.      bx    AS INTEGER
  10.      cx    AS INTEGER
  11.      dx    AS INTEGER
  12.      bp    AS INTEGER
  13.      si    AS INTEGER
  14.      di    AS INTEGER
  15.      flags AS INTEGER
  16. END TYPE
  17. DIM SHARED inregs AS RegType, outregs AS RegType
  18. DECLARE FUNCTION printer ()
  19.  
  20. PRINT printer
  21.  
  22. FUNCTION printer
  23.      inregs.ax = 2 * 256: inregs.dx = 0
  24.      CALL interrupt(&H17, inregs, outregs)
  25.      ah = FIX(outregs.ax / 256)
  26.      bit7 = FIX(ah / 128)
  27.      bit6 = FIX((ah - (bit7 * 128)) / 64)
  28.      bit5 = FIX((ah - (bit7 * 128) - (bit6 * 64)) / 32)
  29.      bit4 = FIX((ah - (bit7 * 128) - (bit6 * 64) - (bit5 * 32)) / 16)
  30.      bit3 = FIX((ah - (bit7 * 128) - (bit6 * 64) - (bit5 * 32) - (bit4 * 16)) / 8)
  31.      bit2 = FIX((ah - (bit7 * 128) - (bit6 * 64) - (bit5 * 32) - (bit4 * 16) - (bit3 * 8)) / 4)
  32.      bit1 = FIX((ah - (bit7 * 128) - (bit6 * 64) - (bit5 * 32) - (bit4 * 16) - (bit3 * 8) - (bit2 * 4)) / 2)
  33.      bit0 = FIX((ah - (bit7 * 128) - (bit6 * 64) - (bit5 * 32) - (bit4 * 16) - (bit3 * 8) - (bit2 * 4) - (bit1 * 2)))
  34.      PRINT bit0; bit1; bit2; bit3; bit4; bit5; bit6; bit7
  35.      printer = ABS(bit6)
  36. END FUNCTION
  37.  
  38.