home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
printer
/
lptcom02.arc
/
LPTCOM.DOC
< prev
next >
Wrap
Text File
|
1988-04-19
|
5KB
|
108 lines
LPTCOM
======
A serial line printer driver for MS-DOS/PC-DOS systems that use printers
with XON/XOFF flow control through one of the COM ports.
Introduction
============
Most printers (but not all) that are used by PC's are attached in one of two
possible ways; on the parallel printer port or on a serial communications port.
Historically, when a serial port is used, one of the control leads is used by
the printer to signal when it is busy, and unable to receive more characters to
print, or ready, when it is available for more characters. However, some
printers do not employ this technique, relying on a more communications-
oriented method called XON/XOFF. In this method, the printer, using the
receive data signal into the PC transmits the XOFF character (hex 13) when it
needs to declare BUSY and then sends the XON character (hex 11) when it needs
to declare READY.
Neither the standard printer LPT driver nor the communications COM driver
recognize this signalling protocol. Typically, when a printer is attached to
a COM port, all you need to do is issue the MODE LPT:=COM1: command and all I/O
directed to the LPT device is instead re-directed to the COM1 device. However,
the XOFF from the printer gets ignored and the printer's buffer readily gets
overrun (usually causing the printer to spasm with 'beeps'). Output is
directed to the printer driver (and redirected to COM1) using the DOS print
services (interrupt number 17). LPTCOM is a simple program (terminate-stay-
resident) that takes over this interrupt and manipulates the transmit and
receive functions of the COM port to send data to the printer and also receive
XON/XOFF signals from the printer.
Even if you are not a PC wizard, you should be able to read the simple code
and get the gist of how it works.
How to use LPTCOM
=================
There are two programs of which you will only need one, depending on which
COM port your printer is attached. LPTCOM1 will direct LPT output to COM1 and
LPTCOM2 will direct output to COM2. You will probably use one of the two
command sequences listed below.
if your printer is on COM1 if your printer is on COM2
MODE COM1: 4800,N,8,1,P MODE COM2: 4800,N,8,1,P
LPTCOM1 LPTCOM2
If you don't understand the MODE command, I'd suggest that you look it up in
your DOS reference manual so that the communications parameters match your
printer's. I'd also suggest putting the appropriate commands in AUTOEXEC.BAT
so you won't have to do this each time you start up your PC. Remember to put
LPTCOM1.COM or LPTCOM2.COM in the root directory or in a directory on the PATH
so that it is available for execution.
What to avoid
=============
Since LPTCOM is executed as a stay resident program, I do not suggest running
it more than once. A subsequent execution won't hurt but the previous LPTCOM
run will remain in memory without providing any functionality since the new
LPTCOM has taken over the printer vector.
Limitations
===========
LPTCOM will ignore any printer designation (LPT1,LPT2, etc). If you have more
than one printer on your system, you will have to modify LPTCOM yourself. Good
luck.
If your printer issues an XOFF without an XON later, such as when you switch it
off in the middle of a print jam, your system will hang. However, that's what
DOS does now anyway so why worry ?
good computing !
FRSW
Toad Hall Comments:
My compliments to the original author for the decency of releasing
the source code. Such release permit full understanding, adapting to
local conditions, and (hopefully) improvements.
My changes (commented in the new source):
1. Tweaked assembler source is LPTCOM02.ASM (version 0.2).
2. Compiled versions for COM1 and COM2 are LPTCOM12.COM and LPTCOM22.COM,
respectively.
3. LPTCOM will now test to see if it's already installed.
If resident for the same port (COM1 or COM2), it will issue a
warning message ("Already installed for port %") and abort.
(Errorlevel returned will be the installed port (1 or 2)
if you're running in a batch file.)
If already resident for the OTHER port, it will issue the same
warning message, but will go right ahead and "re-install" itself
for the new port (pre-empting the previously installed LPTCOM).
(Errorlevel returned will be 0.)
I'd like to return the upgraded code to the author, but don't know how
to reach him. If anyone happens to know where he is and can forward
the new assembler source and documentation to him, I'm sure he'd
appreciate it.
David P Kirschbaum
Toad Hall
kirsch@braggvax.ARPA