Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!ukma!psuvm.bitnet!cunyvm!byuvax!taylorj
From: taylorj@byuvax.bitnet
Newsgroups: comp.lang.pascal
Subject: RE: How to check for printer line status ?
Message-ID: <211taylorj@byuvax.bitnet>
Date: 24 Jun 88 07:07:47 GMT
Lines: 49

The following code fragment should get you started.  E-mail me if you have
any questions.

   {Determines if parallel printer is connected and ready to print}
   {Warns if printer is off or off line}
   {Printer number can be 1 - 3}
function lptready(portnum: integer) :boolean;
begin
  reg.ah := 2;   {read printer status}
  reg.dx := portnum - 1;
  intr($17, reg);
  if ((reg.ah and $80) = $80)
  or ((reg.ah and $08) = $08) then begin   {not busy or I/O error}
    lptready := true;
    case reg.ah of
      $08: begin
        warning(2, 'Your printer is off line.  Press the "on-line" or "select"
button.');
        waitkey;
       end;
      $C8: begin
        warning(2, 'Your printer is off.  Please turn it on.');
        waitkey;
      end;
    end;
  end else begin
    lptready := false;
  end;
end;


   {Determines if com port exists}
   {Port number can be 1 or 2}
function comready(portnum: integer) :boolean;
begin
  reg.ah := 3;   {read com port status}
  reg.dx := portnum - 1;
  intr($14, reg);
  if reg.ah = 96 then begin
    comready := true;
  end else begin
    comready := false;
  end;
end;

You probably need to be slightly familiar with interrupts from Turbo to
have the appropriate register type.

Jim Taylor
Microcomputer Support for Curriculum, Brigham Young University
taylorj@byuvax.bitnet