     LPTTOFL vers. 1.1
     (c) 1996 Luigi Mancinelli

1.0  WHY LPTTOFL?
 
  Is there still someone who use DOS(*)programs? Maybe not, but I think
it's possible. And sometime I know there are people who have to buy new
expensive WINDOWS version of their programs only for some little stupid
problem (and generally they use noone of  the  new  "marvelous" chances
the WINDOWS(*)environment can offer). To update regularly programs cru-
cial for one's own activity could be a good strategy (I disagree in ge-
neral but this is the usual behavior ... and I don't want to damage  my
colleagues programmers who with this habit gain their bread),  but  why
spent for a program we use  only  for  something  and that does exactly
what we need? Certainly the new WINDOWS(*)version (if there is!) offers
many other opportunities, but use we really them?  So maybe someone who
use old DOS after all there's. 
  But in many working environments you can take a real  advantage  from
the use of the cheap Microsoft Network(*) (cheap 'cause it is  encluded 
in Windows for Workgroup(*)) or some other network environment.  One of
the most useful opportunities a network environment can offer  is  cer-
tainly the sharing of the printers. But the most of well-coded DOS pro-
grams don't use DOS device LPTx to print, but they address directly  to
the BIOS printer interface (INT 17h).  And often they don't provide the
opportunity to "print to file".  Moreover sometime the old print-screen
could be used but this too addresses to INT 17h.  One simple example is
the Microsoft QBasic whose File-Print environment command to print  the
source code requires a printer directly connected to the parallel port.
  I know there are a lot of "capture" programs but LPTTOFL(c) is  quite
different.  This very little TSR simply traps calls to INT 17h and pipe
them to a dos file using INT 21h functions.  It uses a call to  INT 21h
and not a call to the address it corresponded when LPTTFL was loaded,so
you can trap subsequently INT 21h (for example starting a network)  and
all seems to work fine.  The file can be a whatever legal DOS file (net
files and net devices included), the only limitation is that  the  path
name must fit in 39 characters. 
  Moreover LPTTOFL is IBM Interrupt Sharing Protocol compliant for eve-
ry interrupt it traps (a lot) and so if other  subsequent  IBM ISR com-
pliants TSR are loaded it could be easily uninstalled.(1)


2.0  INSTALLING LPTTOFL

  To install LPTTOFL simply type LPTTOFL (or LoadHigh  LPTTOFL  if  you
want to install it in high memory). The output of the printer is so re-
directed to the default file C:\DOS\TMP\LPT.PRN.  The only things to do
is to create a subdirectory TMP in the directory DOS with  the  command
md DOS\TMP.
  But you maybe prefer to change the name.  You can type LPTTOFL <file-
name> and if LPTTOFL is already loaded only the output file is changed.

  One possible use of LPTTOFL is
 
  LPTTOFL prn. 
  or 
  LPTTOFL lpt1.

  With this command LPTTOFL is installed and outputs  on  the  parallel
port 1 are redirected to the dos device prn (or lpt1) which is normally
nothing but the parallel port 1, but that can be redirected (for  exam-
ple by a network software).


3.0  SYNTAX

  The syntax for LPTTOFL is:

  LPTTOFL [/E][/D][/R][/L[1..3]][/U][/C][/O][<File-Name>]
  
  Every switch can appear in any position on the command  line  and  is
optional.  Parameters must be separated by a blank  or  a tab, but they
can be omitted before another switch, so the command

  LPTTOFL /R/L2 pippo/D

is perfectly legal.

  /E        Enable the piping
  /D        Disable the piping
  /R        Reset the file.  Clear eventual  DOS error and truncate the
          file to zero or create it before subsequent output.
  /L[1..3]  Pipe lpt port 1..3.  If the number is omitted lpt1 is assu-
          med.
*** Version 1.1 Addition
  /C        Force to close the output file after each write operation
            (as for version 1.0)
  /O        Let the file opened between subsequent write operations and
          close it when some time (approximatively 1 second)  is passed
          without operations or when an int 28h is invoked by DOS or  a
          print screen or an LPTTOFL hot menu is invoked.  This  is the
          new default.
***
  /U        Uninstall.  The rest of the command line is ignored.
            If LPTTOFL is installed try to uninstall it and remove from
          memory.  If one or more of the interrupts to restore has been
          subsequently trapped by a not  IBM Interrupt Sharing Protocol
          compliant program uninstalling its impossible and  the  first
          offending interrupt is signaled.
            If LPTTOFL is not installed an error message is printed  on
          the standard output and the program is not loaded in memory.

  <file-name> Any DOS legal path name (even a net name) subject to  fit
          in 39 characters after canonicalization.  If the name doesn't
          contains drive specification or the path is a  relative  path
          (not starting from the root) the file name is assumed to be a
          relative name and so every time an output is attempted if the
          file is not found the program tries to  create it,  otherwise
          the file is created or truncated to zero every output  follo-
          wing a new name or a reset (/R) and not founding it on subse-
          quent outputs produces a DOS error (2 or 3 -  signaled with a
          beep) and outputs are ignored until a reset or a new file na-
          me are specified.
            Blanks are allowed in DOS path names (assuming they're  not
          the first character of a name) and so  if  the  name includes
          allowed blanks it must be delimited by " " or [ ].  (Example:
          "C:\L P\p" [..\p. k\prova]).
            If only a path is specified (ending with "\")  the  default
          name "lpt.prn" is added to the string (providing that it  can
          fit in 39 characters) and if there's no point in the name (no
          extension specified) the default extension ".prn" is added.If
          no extension is desired a point must be  explicitly  added to
          the end of the file name ("pippo.").

  Every time an output produces a DOS error, output to file stops until
a reset is made (or a new file name is specified).
  Every informative output of the LPTTOFL program  is  on the  standard
output and can be redirected.

  LPTTOFL returns to DOS with an exit code of

  0   If successfull.
  1   If Invalid DOS version. Only DOS version >=3.0 is accepted.
  2   If an unexpected DOS Swappable Data Area is found.   Maybe not an
      MS-DOS.
  3   If a conflicting program already installed. Very improbable.
  4   If a newer version of LPTTOFL installed (For future use).
  8   For syntax error.
  40h If LPTTOFL without parameters has been typed and LPTTOFL  is  al-
      ready installed
  80h If trying to uninstall LPTTOFL but LPTTOFL is not installed.
  81h If unable to uninstall LPTTOFL(unable to restore some interrupt).
  82h If unable to release DOS memory uninstalling LPTTOFL.
  FFh If invalid check sum (program altered).


4.0  HOT MENU
  
  LPTTOFL is configurable even with an hot-key.  
  The keys <CTRL><ALT><LEFT SHIFT> must be hold  pressed  and  the  key
<Print Screen> must be pressed.

  IF THE ACTUAL SCREEN MODE IS A TEXT MODE an hot  menu  is visualized
and can be choiced to reset the file, enable or disable piping, inspect
and eventually reset actual dos error, change the parallel port to pipe
or change the file name.  When changing file name is choiced the actual
name is showed and if some editing key(arrows,<CTRL S>,<CTRL D> etc.)is
pressed the name can be edited, otherwise the line is cleared and a new
name can be entered.Pressing <ESC> cancels the input name operation re-
storing the previous name, <CARRIAGE RETURN> accepts actual string  and
tries to store the new name.  If there is an error it is signaled  with
a beep and the cursor is positioned on the offending char.

  Editing keys for input of file name:
  <left arrow>,<CTRL S>  one character left
  <right arrow>,<CTRL D> one character right
  <Home>,<CTRL Q>H       to the beginning of the line
  <End>,<CTRL Q>E        to the end of the line
  <CTRL left arrow>,<CTRL A>   to the previous "\" or the beginning  of
                         the line
  <CTRL right arrow>,<CTRL F>  to the next "\" or the end of the line
  <Del>,<CTRL G>         delete character at cursor position
  <Backspace>,<CTRL H>   delete  character  immediately  before  actual
                         cursor position
  <Ins><CTRL V>          toggle between Insert mode and Overwrite mode
  <CTRL Q>L              restore the line to the previos file name

  Unaccepted DOS file name characters are refused.

  IF THE ACTUAL SCREEN MODE IS A GRAPHIC MODE no menu is displayed,two
beeps signal the recognising of the hot key and a key is waited for. If
this key is a spacebar the file is reset, otherwise nothing is done.


5.0  INTERFACING WITH USER PROGRAMS
  
  A program can communicate with LPTTOFL and control it with a  special
use of the interrupt 17h.  For more information about how  this  can be
done contact the author.


6.0  CREDITS

  Thanks to Chris Dunford for posting on internet informations  on  the
IBM Interrupt Sharing Protocol and to the indispensable  Ralph  Brown's
interrupt list.

-

(*) WINDOWS, WINDOWS for WORKGROUP, MS-DOS, QBASIC are trademark of Mi-
crosoft Corporation.


7.0  DISCLAIM

                            NO WARRANTY

     BECAUSE THE PROGRAM IS DISTRIBUTED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT  PERMITTED  BY  APPLICABLE LAW.  EXCEPT  WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDER PROVIDE THE PROGRAM "AS IS"
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED  OR  IMPLIED,  INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS  FOR A
PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST
OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

       IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL THE COPYRIGHT HOLDER, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENE-
RAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES  ARISING OUT OF THE USE OR
INABILITY  TO USE  THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU  OR  THIRD PARTIES
OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF THE
HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

   Every care has been taken to avoid interferences between  LPTTOFL  and o-
ther TSRs, but because of the nature of this and the most of TSRs  conflicts
are possible.  Often changing the load order can solve the problem.



8.0  LICENCE

      The files here included can be freely distributed, provided
   that they're distributed together, without stripping copyright
   informations and without any change (I'd like to get blame for
   my own errors and credit only where it is due - as Chris  Dun-
   ford says).  Commercial use couldn't be done  without explicit
   permission of the author.


  This program is shareware, but I prefer to call it Pizza-Ware. If you 
find it useful  you can pay a pizza to the author or, if you're to  far 
for this, you can send $20 to him (that is: to me).
  Using this program beyond a reasonable 30 days trial period is  unle-
gal, but we all know that a lot of people are not worried for this.
  If you register I send you (via uuencode E-Mail or on a diskette with
a Post package if you pay the postal charges) your registered copy  and
so we all are glad :-).
  Suggestion are accepted and welcomed even from unregistered users,but 
only registered users will receive informations on the program from me. 
  Site licence are possible (with a large discount).

  I have to apologize for my English, but  I  hope  that  everybody can
understand it.


9.0 VERSION 1.1
  
  With the old 1.0 version a '*' key on the  keypad  invoked  a  screen
hardcopy.  This was a bug and it is removed.
  The version 1.0 closed the output file after  every  write  operation
and this could cause some indesired behaviour.  Now the file is kept o-
pened until it seems reasonable to close it.
  The old version forced a buffer write in some situation  (for example
when a printer status is requested with an int 17h call) in which  this
is not really needed and this could cause (in some context) a  relevant
slowness.  This is also removed.


(c) 1996 by Luigi Mancinelli
E-Mail: manci@alpha.science.unitn.it
Post :
  Luigi Mancinelli
  c/o Laboratori Didattici
  Facolt di Scienze
  Universit degli Studi di Trento
  38050 POVO-TRENTO (TN)
  ITALY
