Contents of the VPRINT.DOC file
This document has been formatted in a special way. Virtually all dot
matrix printers have a condensed mode which prints 132 characters
across a standard 8 1/2 inch page. When this file is printed out in
condensed mode, the resulting printed pages can be cut down to 5 1/2 X
8 1/2 inches. The cut pages will fit nicely in the back of your
DOS manual for storage.
Typically, you can turn on this mode by sending a special control
sequence to the printer from BASIC. For example, you can turn on the
condensed mode of the IBM/Epson printer with the BASIC statement:
LPRINT chr$(15). If your printer has such a condensed mode, turn it
on now, before printing the rest of this document.
Virtual Printer Utility
for the IBM Personal Computer
(c) 1986, 1987, 1988 by David Whitman
P.O. Box 1157
North Wales, PA 19454
(215) 234-4084 (evenings only)
Table of Contents
What is VPRINT?.............................................1
Printer Emulation Options...................................7
RS-232 Emulation Options....................................8
Setting VPRINT's Buffer Size................................9
Notes for Those Upgrading to This Version of VPRINT........17
Miscellaneous and A Word From Our Sponsor..................18
>> What is VPRINT? <<
VPRINT implements a "virtual printer" by capturing output
normally sent to your printer or COM port and redirecting it to a
file of your chosing. There are many reasons you might want to
capture printer output:
* Producing formatted files from software packages that don't
support "printing to disk".
* Capturing output so it can be modified by other programs
prior to printing.
* Setting up word processors and other programs to work with
your printer. By capturing to disk, you can see exactly
what's being sent, and pinpoint problems immediately.
* Capturing output generated on one computer, to be printed on
a different system.
* Taking disk "snapshots" of your video screen. When VPRINT
is running, the PrtSc key copies the screen to your disk
* Delaying printer output for later printing. VPRINT responds
much faster than a "real" printer, but takes up much less
memory than most print spooling software. If you can't
afford the memory for a print spooler, you can VPRINT
quickly, then print the file later during a time when your
computer is idle.
>> System Requirements <<
To run VPRINT, you need:
64K of memory, minimum
1 disk drive, minimum
DOS 2.0 or later
VPRINT is designed to run on IBM PCs, but should run on all
systems that are compatible with the IBM BIOS.
The following systems are known to run VPRINT successfully. If
you are using VPRINT on a computer not on this list, please
write, and the list will be updated so that others can share this
IBM 3270 PC
IBM 3270 PC/G
>> Starting VPRINT <<
To capture printer output, you must "install" VPRINT.
Installation temporarily grafts a portion of VPRINT onto your
computer's input/output system. Once installed, VPRINT remains a
part of the I/O system until you either shut your computer off,
or reset the system by pressing Ctrl-Alt-Del.
To install VPRINT, type:
VPRINT filename.ext /i
Use whatever filename you'd like printer output to be sent to.
The filename can optionally have a drive and/or pathname. If you
don't use a filename, VPRINT will create a file named
VIRTUAL.PRN for you in the root directory of the default drive.
The "/i" tells VPRINT that you want to install the program, and
if a filename is used, the "/i" must come AFTER the filename.
After you type the above command, VPRINT will respond:
VPRINT - virtual printer (version 5.00)
User-supported software by D. Whitman
For help/info, type VPRINT ?
Emulated printers: LPT1: and LPT2:
Emulated async port: None
Filter mode: VERBATIM
Buffer size: 2048 bytes
Print file: C:\VIRTUAL.PRN
Resident section has been installed.
As programs attempt to send output to your printer, VPRINT
intercepts the output, and stores it in an internal buffer. Every
time this buffer fills up, VPRINT dumps the buffer to the file
you specified during installation.
After you have finished your printing, the buffer may still
contain some of your output, not yet transferred to disk. Before
using the output file, you should ask VPRINT to "flush" the
buffer, using the command:
>> Advanced Usage <<
The procedure given in the previous section will allow you to
capture printer output from most software packages, but does not
make use of all of VPRINT's capabilities. This section will
discuss these further options.
The VPRINT command has the following syntax:
VPRINT [?] [d:][path][filename[.ext]]] /options
If you type VPRINT ?, a one page help screen will be printed.
You can specify a fully qualified file name, including drive and
path. After installation, you can change the active printer file
by running VPRINT with a different filename. This modifies the
resident code without loading a new copy or using more memory.
VPRINT's options all start with a slash character "/" followed by
a single letter or number. If a filename is used, the options
must come AFTER the filename. Multiple options can be used. The
following options are available:
/i install (required to load resident code)
/bnn set buffer size in Kbytes: nn = 1-64 (defaults to 2)
/f flush - empty any buffered output to disk
/s report status
/p1 emulate LPT1:
/p2 emulate LPT2:
/p3 emulate both printers (default)
/pp emulate PrtSc only
/p0 don't emulate LPT ports
/a1 emulate COM1: (AUX:)
/a2 emulate COM2:
/a3 emulate both COM1: and COM2:
/a0 don't emulate COM ports (default)
/n neutral - don't filter output (default)
/l drop LFs, expand CR to CR LF
/c drop CRs, expand LF to CR LF
/d disable - flush buffer, use physical devices
/e enable - use virtual printer again, after /d
Again, like the filename, you can install VPRINT using one set of
options, then change by running VPRINT again with different
options. The new options will modify the resident code without
using more memory. The following sections will discuss these
options in more detail.
>> Printer Emulation Options <<
You can control which printer port(s) VPRINT emulates. By
default, VPRINT redirects printer output intended for both LPT1:
and LPT2:. You can restrict this to only one printer using
options /p1 and /p2 , or capture just PrtSc output with option
For example, if you only want to capture output from LPT1:, you
would install VPRINT like this:
VPRINT /i /p1
Alternatively, if VPRINT is already installed, you can restrict
capture to LPT2: with this command:
To only capture only screen print output, use the command:
Note: Selective trapping of PrtSc may only work on IBM PCs or
extremely faithful clones.
The /p3 option returns you to the default state, where output to
both printer ports is captured.
You can turn off printer emulation altogether using option /p0.
This option is provided for use during RS-232 emulation. (See
>>RS-232 Emulation Options<<
VPRINT can also trap output sent to your computer's RS-232 ports.
This allows you to redirect output to serial printers or
plotters. Only *output* is affected - input from the COM port is
By default, RS-232 emulation is turned off. You can install
VPRINT to redirect COM1: output with the following command:
VPRINT /i /a1
Similar to the parallel printer emulation options, you can select
just COM2: with option /a2, both COM ports with /a3, or neither
You may prefer to turn off parallel printer emulation with option
/p0 when using RS-232 emulation, to avoid mixing output for the
two types of devices.
>>Setting VPRINT's Buffer Size<<
By default, VPRINT sets up an internal buffer capable of holding
2048 characters. This value was determined experimentally to
give the quickest operation while using the minimum of memory on
the author's system.
If your print jobs are small, but larger than VPRINT's default 2K
buffer, you can maximize speed by specifying a buffer big enough
to hold the entire job, and eliminate disk access during
Compatibility with certain software packages may require you to
install VPRINT with a larger buffer size. If a program you're
running complains about your printer not being ready, or hangs up
when printing with VPRINT installed, reboot and try again with a
larger buffer. If you can spare the memory, a buffer size of 64K
should allow VPRINT to work with absolutely any software. See
the section titled "Software Compatibility" for more discussion
on this issue.
You can change VPRINT's default buffer size during installation,
by using option /B. For example, the following command installs
VPRINT with a buffer size of 16K:
VPRINT /i /b16
You can specify buffer sizes from 1 to 64K. If you specify a
value larger than 64, VPRINT will give you a buffer size of 64K.
A buffer size of less than one is forced up to 1K.
Unlike VPRINT's other options, once the buffer size is set, you
can't modify it without rebooting your computer and reinstalling
>> Filter Options <<
By default, VPRINT stores to disk exactly what is being sent to
your printer. However, under certain circumstances, it is
desirable to "filter" the output slightly.
Standard DOS files end each line with a carriage return character
(CR), followed by a line feed character (LF). Many programs,
including most word processors, will require files to be in this
format. Unfortunately, when sending output to a printer, not all
programs terminate lines with a CR LF pair.
For example, Volkswriter sends only line feeds at the end of
blank lines. This works fine when sent to a printer, but if
captured to a file, the resulting file will look very strange
when re-edited. (Multiple blank lines disappear, and are replaced
with a single line full of boxes with holes in them -the screen
representation of the line feed character.)
At least on older PC's, the PrtSc function acts even stranger.
PrtSc terminates each line exactly backwards, with a LF followed
by a CR. This combination will confuse most text editors,
causing very strange behavior.
VPRINT has two "filtering" modes which tend to force printed
output into standard DOS format. These modes ignore either CRs
or LFs, while replacing the other character with a CR LF pair.
Option /C ignores carriage returns, and expands LF to CR LF.
Similarly, /L ignores printed line feeds, but adds one after each
If your captured output looks strange, try turning on the
different filtering modes and see if your output looks more
You can turn off filtering with the /N option. After /N is in
effect, output will again be captured verbatim.
>> Enable Options <<
Once VPRINT is installed, it remains a part of your computer's
input/output system until you either turn off your computer or
re-boot. However, VPRINT can be temporarily disabled to allow
output to go to your printer as usual.
Option /D disables VPRINT. When /D is in effect, VPRINT remains
resident, but passes output unmodified to your printer. Option
/D also flushes VPRINT's internal buffer, so that all your output
is available on disk.
Option /E enables VPRINT, presumably after it's been disabled
with option /D. When option /E is in effect, printer output is
once again redirected to your disk file.
>> Miscellaneous Options <<
A short help summary will be printed if you type VPRINT ?, or
just VPRINT with no other options.
The /I option installs VPRINT. This option loads VPRINT's
resident code, and grafts it onto the I/O system of your
computer. Once VPRINT is loaded, there is no need to specify
/I on subsequent commands. If you use /I when the resident code
is already loaded, VPRINT will detect the resident code and will
print an error message without re-loading.
Option /F flushes VPRINT's internal buffer to disk. To avoid
constantly running your disk drive during printing, VPRINT
collects about 2000 characters, then writes them to disk all at
once. Unless you output an exact multiple of 2048 characters,
when printing is finished, part of your output is still in
VPRINT's internal buffer. Option /F forces the last part of your
output to disk.
Incidentally, VPRINT's internal buffer is automatically flushed
before shifting to a new file, and also before disabling, if you
turn on option /D.
Option /S prints a status report, indicating which options are in
effect, and where your printed output is being sent. This is the
same report which is printed after using any of the other
options, but /S allows you to check status without changing
>> Software Compatibility <<
VPRINT is compatible with essentially all software which can run
under DOS. However, certain programs may require you to install
VPRINT with a larger buffer than the default 2048 bytes.
If a software package over-runs VPRINT's buffer, VPRINT sends
signals back to your program that your "printer" has gone
off-line. Upon receiving such signals, most software will stop
printing, and ask you to correct the problem. If this happens,
abort the print and exit the program, then re-boot your computer.
If your software ignores the signals, rather than getting an
error message about your printer going off-line, your computer
may lock up and cease to respond to the keyboard. If you get
such a lock-up, just turn your computer off, wait 5 seconds, then
turn it on again.
In either case, try installing VPRINT with a larger buffer size.
The exact size needed will vary from program to program. If
you're having trouble and can spare the memory, use a buffer size
of 64K. DOS limits programs to printing 64K or less of data at
once, so a 64K buffer guarantees that VPRINT can handle anything
your software can throw at it.
Sometimes when you examine your captured output, you'll see lots
of strange characters mixed in with your text. These are control
characters sent by your software to set up and control your
printer. If you install your software to use a "generic" or
"unknown" printer, you can usually eliminate these characters.
You can also use VPRINT's filtering modes to correct the use of
carriage return and line feed characters.
>> Programming Notes <<
You can use VPRINT effectively without reading or understanding
this section. However, many users have expressed interest in how
VPRINT works, and this section is provided for their benefit.
VPRINT is written in assembly language for maximum speed and
minimum size. The source code is available to registered users
by sending a formatted disk and a stamped return mailer. The
source code is in the syntax of the CHASM assembler, which is
another product of Whitman Software. A one page advertisement
for CHASM is given near the end of this document.
Please note that VPRINT's source code is provided for educational
purposes, and to allow you to customize for your own use. Under
NO CIRCUMSTANCES may you distribute modified or translated
versions, either in the public domain or for profit.
Upon installation, VPRINT takes over the following interrupt
INT 14H - BIOS routine RS232_IO
INT 17H - BIOS routine PRINTER_IO
INT 21H - DOS function dispatcher
INT 28H - DOS_IDLE
Vectors 14H and 17H are the low level BIOS routines handling
output to RS-232 ports and parallel ports respectively. VPRINT
traps output by monitoring these interrupts, and stores the
output in its buffer. Essentially all software interfaces to
devices directly or indirectly through these interrupts.
However, any software which bypasses the BIOS for output will be
unaffected by VPRINT.
Safely emptying VPRINT's buffer turns out to be much harder than
filling it. DOS is not re-entrant, which means that it isn't
necessarily safe for a memory resident program to call DOS for
services such as disk i/o. If DOS is already in the midst of
processing a function call, a new call will clobber one of DOS's
internal stacks and crash the system.
Unfortunately, if a program is well behaved and uses DOS services
rather than direct BIOS calls for output, DOS is going to be busy
whenever VPRINT's interrupt 17H or interrupt 14H handlers are
active. VPRINT uses several different tricks to get around this
DOS maintains an undocumented flag which indicates whether a call
would be re-entrant. Although undocumented, DOS_CRITICAL is
reasonably well understood, and used by many memory resident
programs. During installation, VPRINT gets a pointer to
DOS_CRITICAL using an undocumented (but again, well understood
and commonly used) DOS function. If VPRINT's buffer is more than
half full when a character is received for printing, VPRINT
checks DOS_CRITICAL, and if it's safe, the buffer is emptied to
A second trick is taking over interrupt 28H, DOS_IDLE. This is
an undocumented DOS interrupt which is called during keyboard
input and other periods when DOS has some time to kill. With
certain restrictions, it is safe to call DOS during interrupt 28H
processing, even if DOS_CRITICAL is set. The spooler program
PRINT supplied with DOS functions by intercepting interrupt 28H.
VPRINT monitors interrupt 28H and dumps the buffer if it's more
than half full.
VPRINT's last trick is intercepting calls to the DOS function
dispatcher, interrupt 21H. If VPRINT's buffer is more than half
full when interrupt 21H is called, an attempt is made to empty
the buffer. This attempt is almost guaranteed to be successful,
since DOS can't be active - by taking over the function
dispatcher, we get a chance to do some i/o before DOS ever sees
any other request for services and becomes busy.
VPRINT's interrupt 21H handler still monitors DOS_CRITICAL before
attempting output, to guard against the chance of some other
memory resident routine making a re-entrant call, and fooling
VPRINT into thinking i/o was safe.
As a final bit of insurance, the interrupt 21H handler watches
for any output request, even if it's not obviously printer or
RS-232 related. If a request comes to output a block that
wouldn't fit in VPRINT's buffer, the buffer is emptied even if
the buffer is less than half full. Since the DOS WRITE_BLOCK
function can only handle blocks up to 64K, if VPRINT is installed
with a 64K buffer, we should be able to handle any output a
To change options in the resident code, VPRINT examines the
vector for interrupt 17H, then searches at the specified location
for a "recognition string". If this recognition string is not
matched, changes are aborted. If you load another memory
resident program after VPRINT that intercepts interrupt 17H, you
will not be able to change options or files used by the resident
part of VPRINT.
Selective trapping of PrtSc output is performed by monitoring a
IBM documented flag in the BIOS data area: STATUS_BYTE at
0050:0000. This flag contains a non-zero value if a PrtSc
operation is in progress. Clones with a non-IBM BIOS may or may
not maintain this flag at the same location, hence VPRINT's /PP
option may not work on all clones.
>> Notes for Those Upgrading to This Version of VPRINT <<
VPRINT is not yet carved in stone - improvements and corrections
are made fairly frequently, based on both my own experience using
the program, and the comments of outside users. This section
summarizes the changes which have been made since version 1.00
1.00 Very primitive DOS 1 version, to upgrade the original
EasyWriter - at one point, the only available word
processor for the IBM. Veteran PC users still shudder
when EasyWriter 1 is mentioned; among many other
defects, it wouldn't print to disk.
2.00 Updated DOS 2 version, not released
2.01 Released as U/S
3.00 Add int 28H buffer dump, add harmless output mode to
watch dos critical flag before writes.
3.01 Corrected bug in VPRINT's dos critical byte handling
3.02 Add selective trapping of PrtSc operation
4.00 Add int 21H buffer dump, variable buffer size, and kill
off VPRINT's risky output mode, since harmless mode is
now powerful enough for all programs.
5.00 Add emulation of RS-232 output
>> Miscellaneous and a Word From Our Sponsor...<<
A. Red Tape and Legal Nonsense:
VPRINT is distributed as is, with no guarantee that it will
work correctly in all situations. In no event will the
Author be liable for any damages, including lost profits,
lost savings or other incidental or consequential damages
arising out of the use of or inability to use this program,
even if the Author has been advised of the possibility of
such damages, or for any claim by any other party.
Despite the somewhat imposing statement above, it *is* my
intention to fix any bugs which are brought to my
2. Copyright Information
The entire VPRINT distribution package, consisting of the
program, documentation file, and source code file are
copyright (c) 1986, 1987 and 1988 by David Whitman. The
author reserves the exclusive right to distribute this
package, or any part thereof, for profit. The name VPRINT
(tm) applied to a microcomputer printer redirection utility
is a trade mark of David Whitman.
The VPRINT package (with the exception of the source code
file VPRINT.ASM) may be freely copied by individuals for
evaluation purposes. It is expected that those who find
the package useful will make a contribution directly to the
author of the program.
VPRINT's source code is made available to registered users
for educational purposes and to allow them to customize for
their own personal use. The source code file is available
only to those who make the suggested payment for use of
VPRINT. Under NO CIRCUMSTANCES may modified versions or
translations into other computer languages be distributed,
either for profit or in the public domain.
User's groups, clubs, libraries and clearing houses are
authorized to distribute VPRINT under the following
1. No charge is made for the software or documentation. A
nominal distribution fee may be charged, provided that
is no more that $8 total.
2. Recipients are to be informed of the user-supported
software concept, and encouraged to support it with
3. The program and documentation are distributed together
and are not modified in ANY way.
4. The source code file VPRINT.ASM or disassemblies of
VPRINT.COM may not be distributed.
B. An Offer You Can't Refuse.
VPRINT is user-supported software, distributed under a system
identical to the FREEWARE (tm) marketing scheme developed by
the late Andrew Flugelman, whose efforts are gratefully
Anyone may obtain a free copy of VPRINT by sending a blank,
formatted diskette to the author. An addressed, postage-paid
return mailer must accompany the disk (no exceptions, please).
A copy of the program, with documentation, will be sent by
return mail. The program will carry a notice suggesting a
payment to the program's author. Making the payment is
totally voluntary on the part of the user. Regardless of
whether a payment is made, the user is encouraged to share the
program with others. Payment for use is discretionary on the
part of each subsequent user.
The underlying philosophy here is based on the following
First, that the value and utility of software is best assessed
by the user on his/her own system. Only after using a
program can one really determine whether it serves personal
applications, needs, and tastes.
Second, that the creation of independent personal computer
software can and should be supported by those who benefit
from its use. Remember the Tanstaafl principal: There
Ain't No Such Thing As A Free Lunch. Support to authors
encourages the continued creation of novel, low cost
Finally, that copying and networking of programs should be
encouraged, rather than restricted. The ease with which
software can be distributed outside traditional commercial
channels reflects the strength, rather than the weakness,
of electronic information.
If you like this software, please help support it. Your support
can take three forms:
1. Become a registered user. The suggested payment for
registration is $20.
2. Suggestions, comments and bug reports. Your comments will
be taken seriously. VPRINT will evolve over time, based
on the feedback of users.
3. Spread the word. Make copies for friends, or send the
program to your favorite BBS. Astronomical advertising
costs are one big reason that commercial software is so
overpriced. To continue offering VPRINT this way, I need
your help in letting other people know about VPRINT.
Those who make the suggested $20 payment to become registered
users receive the following benefits:
1. Access to VPRINT's heavily commented source code.
2. User support, by phone or mail. SUPPORT IS ONLY AVAILABLE
TO REGISTERED USERS.
3. Notices of significant upgrades.
4. A warm, fuzzy feeling of having done the right thing. The
converse is also true. If you continue to use VPRINT
without making the suggested payment, your self-image will
gradually deteriorate until you wake up one day in the
gutter on Skid Row, grubbing for cigarette butts and
discarded floppy disks. Honest.
This documentation file was written using Volkswriter 3, then
printed and captured by VPRINT to eliminate Volkswriter's special
effects markers and get proper pagination. Option /C was in
effect to force line feeds into CR/LF pairs.
- Dave Whitman
P.O. Box 1157
North Wales, PA 19454
(215) 234-4084 (evenings only)
>> Registration Form (version 5.00)<<
Please send me a copy of the current version of VPRINT, and
add me to the list of registered VPRINT users, to be eligible for
phone support and upgrade notices. I enclose a check for $20.
Note: VPRINT requires DOS 2 or later to run.
Computer Model: ______________________________
Diskette Format: ____ single _____ double sided
City, State, Zip: ______________________________________
Where did you hear about VPRINT? _______________________
Send registration form and check to:
P.O. Box 1157
North Wales, PA 19454
>> Also Available <<
CHASM is a full featured assembler for the IBM PC.
Substantially simpler than the IBM macro assembler, CHASM is
particularly suited for those learning assembly language.
Using CHASM you can:
* Learn 8088 / 8086 / 8087 assembly language.
* Explore the inner workings of the IBM PC.
* Write lighting-fast stand alone programs.
* Produce machine language subroutines for BASIC programs.
* Write external procedures or inline code for Turbo Pascal.
Although easy enough for beginners, CHASM is powerful enough for
production coding. VPRINT was assembled using CHASM.
CHASM features macros, conditional assembly, structured
variables, operand expressions and much more. A free evaluation
version can be obtained by sending a formatted disk and stamped
return mailer to:
P.O. Box 1157
North Wales, PA 19454
A payment of $40 is requested from those who find the program
useful. Those who make this payment are upgraded to a version
which runs twice as fast.