1 ; SCCSID = @(#)pridefs.asm 4.4 85/07/17
2 title DOS Print Utility
4 ;MS-DOS PSPRINT/PRINT program for background printing of text files
9 ; INT 28H is a software interrupt generated by the DOS
10 ; in its I/O wait loops. This spooler can be assembled for
11 ; operation using only this interrupt which is portable from
12 ; system to system. It may also be assembled to use a hardware
13 ; timer interrupt in addition to the software INT 28H. The
14 ; purpose of using hardware interrupts is to allow printing to
15 ; continue during programs which do not enter the system and
16 ; therefore causes the INT 28H to go away. A timer interrupt is
17 ; chosen in preference to a "printer buffer empty" interrupt
18 ; because PRINT in the timer form is generic. It can be given
19 ; the name of any currently installed character device as the
20 ; "printer", this makes it portable to devices which are
21 ; installed by the user even in the hardware case. It could be
22 ; Revised to use a buffer empty interrupt (no code is given for
23 ; this case), if this is done the PROMPT and BADMES messages and
24 ; their associated code should be removed as PRINT will then be
29 ; New INT 2FH interface, Pathnames, context switch.
30 ; V2.50 09/14/83 M.A.U
31 ; Turned it back to a print
33 ; Repaired bug in file cancel code
35 ; Added int 23 and 24 handlers to transient.
37 ; Allways checks for valid drive.
38 ; V3.00 02/03/84 M.A.U
39 ; Partitioned so as to assemble on a PC
40 ; By the by, it is V3.00 now.
42 ; Chains into INT19 (bootstrap) to unhook
43 ; INT_1C (timer) and INT_15 (AT's Wait On Event)
49 ; BEWARE ALL YEE WHO ENTER HERE.
50 ; PRINT is an amazingly complex program. MS-DOS versions below 3.00 are
51 ; NOT re-entrant, this means that this utility is basically not a
52 ; possibility. It gets by on the fact that it is written by the same
53 ; person who wrote the OS. Since you are not that person, you must be very
54 ; careful about making any modification to this utility. There are a
55 ; number of things which may seem to be unnecessary on first examination.
56 ; BEWARE, almost every line of code is there for a very good reason. The
57 ; order of things is very carefully chosen. PRINT is full of potential
58 ; windows, make sure that you do not open one by careless modification. Do
59 ; not look for a lot of help from the comments, a complete explanation
60 ; would probably fill a book. A succesful modifier will have an in-depth
61 ; knowledge of the internal function of MS-DOS, and of the PRINT utility
62 ; itself through in depth study of the comments AND the code.
65 subttl General Definition
77 HARDINT EQU FALSE
;No hardware ints
78 AINT EQU FALSE
;No need to do interrupt acknowledge
83 INTLOC EQU 1
CH ;Hardware interrupt location (Timer)
84 REBOOT EQU 19H
;ROM BIOS "Bootstrap"
85 AINT EQU TRUE
;Acknowledge interrupts
86 EOI EQU 20H
;End Of Interrupt "instruction"
87 AKPORT EQU 20H
;Interrupt Acknowledge port
90 ; The following values have to do with the ERRCNT variable and the CNTMES
91 ; message. The values define levels at wich it is assumed an off-line error
92 ; exists. ERRCNT1 defines the value of ERRCNT above which the CNTMES message
93 ; is printed by the transient. ERRCNT2 defines the value of ERRCNT above
94 ; which the resident will give up trying to print messages on the printer, it
95 ; is much greater than ERRCNT1 because a much tighter loop is involved. The
96 ; bounding event which determines the correct value is the time required to
108 ;WARNING DANGER WARNING:
109 ; PRINT is a systems utility. It is clearly understood that it may have
110 ; to be entirely re-written for future versions of MS-DOS. The following
111 ; TWO vectors are version specific, they may not exist at all in future
112 ; versions. If they do exist, they may function differently.
113 ; ANY PROGRAM WHICH IMITATES PRINTS USE OF THESE VECTORS IS ALSO A SYSTEMS
114 ; UTILITY AND IS THEREFORE NOT VERSION PORTABLE IN ANY WAY SHAPE OR FORM.
115 ; YOU HAVE BEEN WARNED, "I DID IT THE SAME WAY PRINT DID" IS NOT AN REASON
116 ; TO EXPECT A PROGRAM TO WORK ON FUTURE VERSIONS OF MS-DOS.
118 SOFTINT EQU 28H
;Software interrupt generated by DOS
119 ComInt EQU 2FH
;Communications interrupt used by PSPRINT
120 ; Multiplex number 0 and 1
122 ;----- Default (and Minimal) Print queue length
123 DefQueueLen equ
10 ; 10 files worth
124 MinQueueLen equ
4 ; 4 files worth min
125 MaxQueueLen equ
32 ; 32 files worth max.
127 ;----- Maximum length of a file name (incl nul)
130 ; **************** Bogosity Warning *****************
131 ; Below is the equate that MaxFile SHOULD be. Since the 3.0/3.1 documentation
132 ; documents each queue entry as being 64 chars long. Yes it is known that
133 ; that causes Print to misbehave on files deep in trees. But for
134 ; compatibilities sake, IBM insisted that we change the code back to the
136 ;MaxFileLen equ 63 + 2 + 12 ; 63 characters as Command.com's
138 ; 2 character for the Drive ext.
139 ; 12 characters for the max. valid
171 error_queue_full EQU
8
172 error_name_too_long EQU
12
182 BREAK <Segment Definitions
>
185 CodeR
Segment public para
188 Code Segment public para
191 Data Segment public byte
197 DG group
Code,Data,Stack
199 SaveReg
MACRO reglist
;; push those registers
206 RestoreReg
MACRO reglist
;; pop those registers