home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / progc / c_all592.arj / TI431.ASC < prev    next >
Text File  |  1991-08-27  |  4KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  TURBO BASIC                            NUMBER  :  431
  9.   VERSION  :  1.1
  10.        OS  :  PC-DOS
  11.      DATE  :  APRIL 4, 1989                            PAGE  :  1/2
  12.  
  13.     TITLE  :  CHECKING PRINTER STATUS
  14.  
  15.  
  16.  
  17.  
  18.   This program shows you how to obtain the status  of  the  printer
  19.   using the REG and CALL INTERRUPT statements.
  20.  
  21.   PRINTER SERVICES -
  22.   (copied from page 239 of The Peter Norton  Programmer's  Guide To
  23.   The IBM PC)
  24.  
  25.  
  26.   Send one byte to printer :
  27.      Interrupt    Registers
  28.        (hex)     Input      Output                 Description
  29.         ---      -----------------                 -----------
  30.         17     AH=00     AH=success/failure    Status bit setting:
  31.                AL=character     status code        0=time out
  32.                DX=printer number                   1=unused
  33.                                                    2=unused
  34.                                                    3=1:I/O error
  35.                                                    4=1:selected
  36.                                                    5=1:out of paper
  37.                                                    6=1:acknowledge
  38.                                                    7=1:not busy
  39.   Initialize printer:
  40.         17     AH=01     AH=status code  Status code bit settings:
  41.                DX=printer number            see printer service 00
  42.  
  43.   Get printer status:
  44.         17     AH=02     AH=status code   Status code bit setting:
  45.                DX=printer number            see printer service 00
  46.  
  47.   =================================================================
  48.                           --- MAIN PROGRAM ---
  49.   CLS
  50.   CALL CheckPrinter
  51.   END                                     'End of program
  52.   '-------------------
  53.   SUB CheckPrinter
  54.  
  55.      REG 1, &H0200                   'load the AH register with 02
  56.      REG 4, &H0000                   'Load the DX register with 0
  57.  
  58.      CALL INTERRUPT &H17             'Invoke interrupt 17 hex
  59.  
  60.      IF HEX$(REG(1)) = "9000" THEN   'If status bits 4 and 7 are
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  TURBO BASIC                            NUMBER  :  431
  75.   VERSION  :  1.1
  76.        OS  :  PC-DOS
  77.      DATE  :  APRIL 4, 1989                            PAGE  :  2/2
  78.  
  79.     TITLE  :  CHECKING PRINTER STATUS
  80.  
  81.  
  82.  
  83.  
  84.                                      'set
  85.         PRINT "PRINTER IS READY"
  86.  
  87.  
  88.   The following  message covers all other status conditions such as
  89.   OUT OF PAPER and OFF LINE.
  90.  
  91.   The reason for  using  one  message  to  cover  all  other status
  92.   conditions is that various printers return different values for
  93.   an  OUT  OF  PAPER or an OFF LINE condition.   For  example,  hex
  94.   values returned for an OFF LINE condition include:
  95.  
  96.   'C000,2800,8800,8000 depending on the printer being used.
  97.  
  98.   =================================================================
  99.  
  100.      ELSE
  101.         PRINT "PRINTER IS NOT READY"
  102.         PRINT "Value returned is ";HEX$(REG(1))
  103.         SELECT CASE HEX$(REG(1))
  104.  
  105.   These  are  the  values  returned  for  a  Panasonic KX-1092i  or
  106.   equivalent printer.
  107.   The values  you  use  may  have  to  be modified depending on the
  108.   printer being used.
  109.  
  110.       CASE "800"
  111.         PRINT "A Panasonic KX-1092i or equivalent printer is
  112.                offline"
  113.       CASE "F800"
  114.         PRINT "A Panasonic KX-1092i or equivalent printer is off"
  115.       CASE "2800"
  116.         PRINT "A Panasonic KX-1092i or equivalent printer is out of
  117.                paper";
  118.           PRINT "and off line"
  119.       CASE "B800"
  120.         PRINT "A Panasonic KX-1092i or equivalent printer is out of
  121.                paper";
  122.         PRINT "and on line"
  123.       END SELECT
  124.     END IF
  125.   END SUB
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.