home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
info
/
dostips5.arc
/
DOSPRINT
< prev
next >
Wrap
Text File
|
1987-10-18
|
8KB
|
209 lines
PrtSc Toggler
(PC Magazine August 1986 User-to-User)
If you hit Shift-PrtSc accidentally when your printer is on, you
have to wait until it finishes typing the screen and then readjust the
paper to the top of the next page. If it's off, your system will hang
until DOS realizes that the printer is not going to respond.
When you hit Shift-PrtSc, DOS issues Interrupt 5, which first
looks at a location in low memory called STATUS_BYTE to see whether
your system is already dumping a screen to the printer. If STATUS_BYTE
is equal to 1, DOS thinks a screen dump is taking place and exits the
routine without dumping another screen to the printer. If STATUS_BYTE
is equal to 0, the routine sets STATUS_BYTE to 1 so that it cannot
interrupt itself, then does the actual dump, and finally resets STATUS
_BYTE equal to 0 and exits the routine.
This means you can disable the Shift-PrtSc routine with a simple
assembly language routine, DISABLE.COM, which sets STATUS_BYTE to 1.
A similar routine, ENABLE.COM, can turn it back on by setting STATUS
_BYTE to 0. You can create both files in DOS using the DEBUG version
or in BASIC using PRTSCTOG.BAS below.
Create the following with an ASCII word processor and give it the
filename SCRIPT. Put the file on the same disk with DEBUG.COM and type
DEBUG<SCRIPT.
N DISABLE.COM
A 100
PUSH DS
MOV AX,0050
MOV DS,AX
MOV BYTE PTR [0000],01
POP DS
INT 20
RCX
E
W
N ENABLE.COM
E 10A 0
W
Q
- - - - -
100 'PRTSCTOG.BAS
110 OPEN "R",1,"DISABLE.COM",1:FIELD #1,1 AS A$
120 FOR X=1 TO 14:READ CHAR:LSET A$=CHR$(CHAR)
130 PUT #1,X:NEXT:CLOSE:RESTORE
140 OPEN "R",1,"ENABLE.COM",1:FIELD #1,1 AS A$
150 FOR X=1 TO 14:READ CHAR:IF X=11 THEN CHAR=0
160 LSET A$=CHR$(CHAR):PUT #1,X:NEXT:CLOSE
170 DATA 30,184,80,0,142,216,198,6,0,0,1,31,205,32
-----------------------------------------------------------------
Resident Form-Feed Program
(PC Magazine August 1986 PC Tutor)
FORMFEED.COM is a memory-resident program that provides a printer
form-feed key (Alt-PrtSc) on the PC keyboard. FORMFEED.COM does not
clear the keystroke from the keyboard hardware but just branches to
the previous Interrupt 9 keyboard handler after it's done. Thus, if
you load FORMFEED twice, you'll get two form-feeds with an Alt-PrtSc.
Before writing the form-feed character (a hex )Ch) out to the printer,
FORMFEED does a printer status call to Interrupt 17h, so it doesn't
hang if the printer is off-line.
You can either load DEBUG and type the lines as shown below, or
you can type the lines into an ASCII file called FORMFEED.SCR and run:
DEBUG <FORMFEED.SCR
Be sure to include the blank line (that is, a carriage return by
itself) shown near the bottom.
N FORMFEED.COM
A
JMP 0103 ;Jump to Init
DW 0,0
STI ;New Int 9
PUSH AX
IN AL,60 ;Get key
CMP AL,37 ;See if PrtSc
JNZ 012A
MOV AH,02 ;Check for Alt
INT 16
TEST AL,08
JZ 012A
PUSH DX
MOV DX,0000 ;Check printer
MOV AH,02 ; status
INT 17
TEST AH,80
JZ 0129
MOV AL,0C ;Print formfeed
MOV AH,00
INT 17
POP DX
POP AX
CS:
JMP FAR [0102] ;Run old Int 9
MOV AX,3509 ;Init: save
INT 21 ; Int 9
MOV [0102],BX
MOV [0104],ES
MOV DX,0106 ;Set new
MOV AX,2509 ; Int 9
INT 21
MOV DX,0130
INT 27 ;Terminate
R CX
4A
W
Q
-----------------------------------------------------------------
Double Printer Duty
(PC Magazine Vol 5 No 18 Sept 16, 1986 PC Advisor)
The problem: How to get one printer to run from the mono/parallel
port and another, different printer to run from the AST SixPak parallel
port while allowing AST's SuperSpool to work properly.
The solution: SuperSpool needs a patch to make it switch between
parallel ports (see below). However, to make the switch you need to
quit your application and run a batch file, which may interfere with
some memory-resident programs.
Move convenient would be an A-B switch (less than $100 from mail-
order houses) that you run out of LPT1 and connect to both printers;
choosing a printer is then as easy as flipping a switch. A print
spooler that can accommodate two printers will give you the same
convenience and provide the added benefit of freeing up the RAM your
software buffer is using.
- - - - -
Swapping Printers with AST Cards
(PC Magazine Vol 4 No 3 Feb 5, 1985 User-to-User)
When SuperSpool is installed at bootup, it prevents output to any
printer but the one you've originally specified. If you've set
SuperSpool to use LPT1, you're shut out of LPT2.
Create the batch file LPTSWAP.BAT. Also create the file SWAP.BAS.
Make sure both files are in your current directory along with MODE.COM,
BASICA.COM, and SUPERSPL.COM. Enter LPTSWAP at the DOS prompt, and
normal printer output will be routed to LPT2. Do it again, and you're
back to LPT1. (This clobbers SideKick.)
LPTSWAP.BAT:
SUPERSPL/P
SUPERSPL LPT2:
MODE LPT1:
MODE LPT2:
BASICA SWAP
SUPERSPL LPT1:
SWAP.BAS:
10 DEF SEG=&H40
20 A=PEEK(8):B=PEEK(9)
30 POKE 8,PEEK(10):POKE 9,PEEK(11)
40 POKE 10,A:POKE 11,B
50 SYSTEM
-----------------------------------------------------------------
ANSI on the Printer
(PC Magazine Vol 5 No 19 Nov 11, 1986 PC Tutor)
In using ANSI.SYS and the PROMPT command to set screen colors,
an AUTOEXEC.BAT contains the following command:
PROMPT $e[35;44;1m$p$g$e[33;44;1m
Aside from the colors, the prompt now shows the current drive and
directory. A problem arises when toggling the printer echo with
Ctrl-PrtSc -- to print a DIR listing, for example. Part of the
string that follows the PROMPT command gets printed instead of the
prompt on the screen.
The way to fix this is don't use printer echo. Use redirection
of output instead. When you want to print a DIR listing, simply
execute:
DIR > PRN
Or you could put the PROMPT command in its own separate batch file
(say PR.BAT) and issue a PROMPT without any parameters before toggling
printer echo. This returns your prompt to normal before you print.
Then, after you've toggle printer echo off, execute PR.
Although the problem of echoing the ANSI prompt on the printer
looks a little strange when you first see it (because what you see
being printed is not what you see on the screen), it's really fairly
simple. COMMAND.COM is in charge of displaying the DOS prompt. The
prompt it tells DOS to display looks much like the string that follows
the PROMPT command, except that COMMAND.COM substitutes the ASCII
Escape code (27 or 1B in hex) for the $e, the current subdirectory
for $p, and the right angle bracket for $g.
COMMAND sends the string to DOS, and DOS sends the string to the
device driver ANSI.SYS to be displayed to the screen. ANSI.SYS
recognizes the two strings that begin with an Escape code as control
sequences. It doesn't display them but instead does something else.
(In this case above, it changes the screen color, for example.)
However, when you have printer echo toggled on, DOS blindly sends the
same string out to the printer. Your printer gobbles up the Escape
code and probably the left bracket also, but then gives up and prints
the rest of it as is.
Some PC printers actually respond to ANSI control sequences.
However, since IBM's control sequence to change colors is not part of
the standard ANSI control sequence set, these printers, too, would
probably not respond well to the prompt you're using.