summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/PRINT/PRIDEFS.INC
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/CMD/PRINT/PRIDEFS.INC')
-rw-r--r--v4.0/src/CMD/PRINT/PRIDEFS.INC537
1 files changed, 537 insertions, 0 deletions
diff --git a/v4.0/src/CMD/PRINT/PRIDEFS.INC b/v4.0/src/CMD/PRINT/PRIDEFS.INC
new file mode 100644
index 0000000..c0efae8
--- /dev/null
+++ b/v4.0/src/CMD/PRINT/PRIDEFS.INC
@@ -0,0 +1,537 @@
1; $SALUT (4,25,30,41)
2;******************* START OF SPECIFICATIONS ***********************************
3;
4; MODULE NAME: PRINT.COM
5;
6; DESCRIPTIVE NAME: DOS PRINT program for background printing of
7; text files to the list device.
8;
9; FUNCTION: DOS PRINT program for background printing of
10; text files to the list device. The utility is
11; constructed of 3 .SAL files. They are:
12;
13; PRINT_R.SAL - The resident portion of PRINT
14; PRINT_T.SAL - The transient portion of PRINT
15; PRINT_SR.SAL - The service routines of PRINT
16;
17; NOTE: The Link order is VERY important for this module.
18; This is due to the Resident/Transient nature of
19; PRINT.
20;
21; INT 28H is a software interrupt generated by the
22; DOS in its I/O wait loops. This spooler
23; can be assembled for operation using only this
24; interrupt which is portable from system to
25; system. It may also be assembled to use a
26; hardware timer interrupt in addition to the
27; software INT 28H. The purpose of using
28; hardware interrupts is to allow printing to
29; continue during programs which do not enter
30; the system and therefore causes the INT 28H to
31; go away. A timer interrupt is chosen in
32; preference to a "printer buffer empty" interrupt
33; because PRINT in the timer form is generic. It
34; can be given the name of any currently installed
35; character device as the "printer", this makes it
36; portable to devices which are installed by the
37; user even in the hardware case. It could be
38; Revised to use a buffer empty interrupt (no
39; code is given for this case), if this is done
40; the PROMPT and BADMES messages and their
41; associated code should be removed as PRINT will
42; then be device specific.
43;
44; NOTE From Aaron Reynolds
45;
46; BEWARE ALL YEE WHO ENTER HERE.
47; PRINT is an amazingly complex program. MS-DOS versions below 3.00 are
48; NOT re-entrant, this means that this utility is basically not a
49; possibility. It gets by on the fact that it is written by the same
50; person who wrote the OS. Since you are not that person, you must be very
51; careful about making any modification to this utility. There are a
52; number of things which may seem to be unnecessary on first examination.
53; BEWARE, almost every line of code is there for a very good reason. The
54; order of things is very carefully chosen. PRINT is full of potential
55; windows, make sure that you do not open one by careless modification. Do
56; not look for a lot of help from the comments, a complete explanation
57; would probably fill a book. A succesful modifier will have an in-depth
58; knowledge of the internal function of MS-DOS, and of the PRINT utility
59; itself through in depth study of the comments AND the code.
60;
61; ENTRY POINT:
62;
63; INPUT:
64;
65; EXIT NORMAL:
66;
67; EXIT ERROR:
68;
69; INTERNAL REFERENCES:
70;
71; ROUTINES:
72;
73; DATA AREAS:
74;
75; EXTERNAL REFERENCES:
76;
77; ROUTINES:
78;
79; DATA AREAS:
80;
81; NOTES:
82;
83; REVISION HISTORY: Ax000 Version 4.0 05/01/87 - first release FG
84; Ax001 DCR D201 - Extended Atrib change FG
85; Ax002 P 1175 - move msgs back to TRANS FG
86; Ax003 P 1487 - PARSE error message problemFG
87; Ax004 P 1546 - PARSE error trailing : FG
88; Ax005 P 1717 - multiples of same switch FG
89; Ax006 P 1996 - Extended open error FG
90; Ax007 P 2052 - [PRN] prompt lpt1 error FG
91; Ax008 P 2053 - CPSW prints empty file FG
92; Ax009 P 2229 - filename truncation FG
93; Ax010 D 389 - use transname /server DOS FG
94; Ax011 P 3122 - attrib missing /server DOS FG
95; Ax012 P 3949 - Error in opening an open FG
96; Ax013 P 3949 - open mode - second attempt FG
97; Ax014 P 4396 - some messages need STDOUT FG
98; Ax015 P 4880 - DRIVERS not recognized FG
99;
100; PRE-VERSION 4.0 HISTORY:
101;
102; V1.00 07/03/82
103; V2.00 07/05/83 A.R
104; New INT 2FH interface, Pathnames, context switch.
105; V2.50 09/14/83 M.A.U
106; Turned it back to a print
107; 11/21/83 M.A.U
108; Repaired bug in file cancel code
109; 11/28/83 M.A.U
110; Added int 23 and 24 handlers to transient.
111; 01/27/84 M.A.U
112; Allways checks for valid drive.
113; V3.00 02/03/84 M.A.U
114; Partitioned so as to assemble on a PC
115; By the by, it is V3.00 now.
116; 05/23/85 K.G.S
117; Chains into INT19 (bootstrap) to unhook
118; INT_1C (timer) and INT_15 (AT's Wait On Event)
119;
120; COPYRIGHT: "The DOS PRINT Utility"
121; "Version 4.00 (C) Copyright 1988 Microsoft
122; "Licenced Material - Program Property of Microsoft"
123;
124;
125;******************* END OF SPECIFICATIONS *************************************
126 subttl PRINT - Program Organization
127 page
128;******************* START PROGRAM ORGANIZATION *******************************
129;
130;
131;Group / Label Contents File
132; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ Ä¿
133;CODER ³ Data buffer ³ Ã PRINT_RM
134; ÃÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ´ ÄÙ
135; ³ ³ Ä¿
136; ³ Resident ³ ³
137; ³ Code ³ ³
138; ³ ³ ³
139;filequeue --- ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
140; ³ Resident ³ ³
141; ³ Initalization³ ÃÄ PRINT_R
142; ³ Code ³ ³
143; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
144; ÃÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ´ ÄÙ
145; ³ CL1 data ³ ³
146; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
147; ³ CL2 data ³
148; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
149; ³ CLB data ³ ³
150; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ÃÄ PRINT_TM
151; ³ CLC data ³ ³
152; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
153; ³ CLD data ³ ³
154; ÃÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ´ ÄÙ
155;DG ³ Transient ³ Ä¿
156; ³ code ³ ³
157; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
158; ³ DispMsg ³ ³
159; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
160; ³ SYSMSG ³ ³
161; ³ Code ³ ³
162; ³ Parser ³ ³
163; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
164; ³ Transient ³ ÃÄ PRINT_T
165; ³ data ³ ³
166; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
167; ³ Stack ³ ³
168;transsize --- ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ÄÙ
169;
170;
171;******************* END ROGRAM ORGANIZATION ********************************
172
173 subttl PRINT - Data Space
174 page
175
176INCLUDE SYSVAR.INC
177
178FALSE EQU 0
179TRUE EQU NOT FALSE
180
181IBM EQU IBMVER
182;IBMVER EQU IBM
183;MSVER EQU FALSE
184
185 IF MSVER
186HARDINT EQU FALSE ;No hardware ints
187AINT EQU FALSE ;No need to do interrupt acknowledge
188 ENDIF
189
190 IF IBM
191HARDINT EQU TRUE
192INTLOC EQU 1CH ;Hardware interrupt location (Timer)
193REBOOT EQU 19H ;ROM BIOS "Bootstrap"
194AINT EQU TRUE ;Acknowledge interrupts
195EOI EQU 20H ;End Of Interrupt "instruction"
196AKPORT EQU 20H ;Interrupt Acknowledge port
197 ENDIF
198
199; The following values have to do with the ERRCNT variable and the CNTMES
200; message. The values define levels at wich it is assumed an off-line error
201; exists. ERRCNT1 defines the value of ERRCNT above which the CNTMES message
202; is printed by the transient. ERRCNT2 defines the value of ERRCNT above
203; which the resident will give up trying to print messages on the printer, it
204; is much greater than ERRCNT1 because a much tighter loop is involved. The
205; bounding event which determines the correct value is the time required to
206; do a form feed.
207
208 IF IBM
209ERRCNT1 EQU 1500
210ERRCNT2 EQU 20000
211 ELSE
212ERRCNT1 EQU 1500
213ERRCNT2 EQU 20000
214 ENDIF
215
216
217;WARNING DANGER WARNING:
218; PRINT is a systems utility. It is clearly understood that it may have
219; to be entirely re-written for future versions of MS-DOS. The following
220; TWO vectors are version specific, they may not exist at all in future
221; versions. If they do exist, they may function differently.
222; ANY PROGRAM WHICH IMITATES PRINTS USE OF THESE VECTORS IS ALSO A SYSTEMS
223; UTILITY AND IS THEREFORE NOT VERSION PORTABLE IN ANY WAY SHAPE OR FORM.
224; YOU HAVE BEEN WARNED, "I DID IT THE SAME WAY PRINT DID" IS NOT AN REASON
225; TO EXPECT A PROGRAM TO WORK ON FUTURE VERSIONS OF MS-DOS.
226
227SOFTINT EQU 28H ;Software interrupt generated by DOS
228ComInt EQU 2FH ;Communications interrupt used by PSPRINT
229 ; Multiplex number 0 and 1
230
231;----- Default (and Maximal / Minimal) Print queue length
232MinQueueLen equ 4 ; 4 files worth min
233MaxQueueLen equ 32 ; 32 files worth max.
234DefQueueLen equ 10 ; 10 files worth
235
236;----- Default (and Maximal / Minimal) Print buffer length
237MinBufferLen equ 512 ; set minimum to 512 bytes
238MaxBufferLen equ 1024 * 16 ; maximum is 16 K bytes
239DefBufferLen equ MinBufferLen ; set default to minimum
240
241;----- Default (and Maximal / Minimal) Time Slice
242MinTimeSlice equ 1 ; set minimum to 1
243MaxTimeSlice equ 255 ; maximum is 255
244DefTimeSlice equ 10 ; set default to 10
245
246;----- Default (and Maximal / Minimal) Busy Tick
247MinBusyTick equ 1 ; set minimum to 1
248MaxBusyTick equ 255 ; maximum is 255
249DefBusyTick equ MinBusyTick ; set default to minimum
250
251;----- Default (and Maximal / Minimal) Max Tick
252MinMaxTick equ 1 ; set minimum to 1
253MaxMaxTick equ 255 ; maximum is 255
254DefMaxTick equ 2 ; set default to 2
255
256;----- Maximum length of a file name (incl nul)
257MaxFileLen equ 64
258
259; **************** Bogosity Warning *****************
260; Below is the equate that MaxFile SHOULD be. Since the 3.0/3.1 documentation
261; documents each queue entry as being 64 chars long. Yes it is known that
262; that causes Print to misbehave on files deep in trees. But for
263; compatibilities sake, IBM insisted that we change the code back to the
264; way it was.
265;MaxFileLen equ 63 + 2 + 12 ; 63 characters as Command.com's
266 ; max. path length
267 ; 2 character for the Drive ext.
268 ; 12 characters for the max. valid
269 ; DOS filename
270
271 ;----------------------------------------
272 ; definition of the MODE bits
273 ; for an extended open
274 ;----------------------------------------
275
276; BITS DEFINED FOR THE MODE WORD
277; FORMAT = 0WF00000ISSS0AAA
278; Write ÄÄÄÄÄÄÄÄÄÄÄÙ³ ³³ ÀÄÄÄ Access code
279; 0 = no commit ³ ³³ 0 = read
280; 1 = auto commit ³ ³³ 1 = write
281; ³ ³³ 2 = read/write
282; Fail action ÄÄÄÄÄÄÄÄÄÄÄÄÙ ³³ 3 = execute
283; 0 = INT 24h ³³ 4 = FCB
284; 1 = return error ³³
285; ³ÀÄÄÄ Sharing mode
286; ³ 0 = compatability
287; ³ 1 = deny read/write
288; ³ 2 = deny write
289; ³ 3 = deny read
290; ³ 4 = deny none
291; Inherit
292; 0 = pass handle to child
293; 1 = no inherit
294;
295MODE_COM equ 0100000000000000b ; Auto Commit
296MODE_NO24 equ 0010000000000000b ; No 24 - return error
297MODE_NOINH equ 0000000010000000b ; No child procees access
298; Sharing mode
299MODE_SH_COMP equ 0000000000000000b ; 0 = compatability
300MODE_SH_D_RW equ 0000000000010000b ; 1 = deny read/write
301MODE_SH_D_W equ 0000000000100000b ; 2 = deny write
302MODE_SH_D_R equ 0000000000110000b ; 3 = deny read
303MODE_SH_D_NONE equ 0000000001000000b ; 4 = deny none
304; Access code
305MODE_AC_R equ 0000000000000000b ; 0 = read
306MODE_AC_W equ 0000000000000001b ; 1 = write
307MODE_AC_RW equ 0000000000000010b ; 2 = read/write
308MODE_AC_EXE equ 0000000000000011b ; 3 = execute
309MODE_AC_FCB equ 0000000000000100b ; 4 = FCB
310
311GET_CPSW equ 3 ; Get state of CPSW
312CPSW_on equ 1 ; CPSW is active
313major_code equ 0ADh ; INT 2F PRINT semaphore
314minor_code equ 040h ; INT 2F PRINTER set and lock CP
315 ;
316 ; The Extended Open mode is set as:
317 ; Shareing Mode - Compatability
318 ; Access - Read
319 ; Inharitance - yes
320 ; -- WARNING ----
321 ; These MUST be set this way
322 ; in order to do a second open
323 ; of a file accross the network
324
325open_mode equ MODE_NO24+MODE_SH_COMP+MODE_AC_R ;AC013;
326
327
328ignore_cp equ 1 ; dont validate CP - it may be different
329 ; than CON
330
331openit equ 1 ; extended open 'exsists' action
332failopen equ 0 ; extended open 'does not exsist' action
333
334Cap_ASCIIZ equ 22h ; Capitalize ASCIIZ string (INT 21 - 65)
335
336;----- Message related information
337
338 ;================================================
339 ; PRINT Message Skeleton File
340 ;================================================
341
342;util PRINT
343
344;class 1
345
346;use EXTEND19
347;use EXTEND20
348;use EXTEND21
349;use EXTEND22
350;use EXTEND23
351;use EXTEND24
352;use EXTEND25
353;use EXTEND26
354;use EXTEND27
355;use EXTEND28
356;use EXTEND29
357;use EXTEND30
358;use EXTEND31
359
360;class 2
361 ;1 - Too many operands
362 ;2 - Required operand missing
363;use PARSE3 ;3 - Not in switch list provided
364 ;4 - Not in keyword list provided
365;use PARSE6 ;6 - Out of range specified
366 ;7 - Not in value list provided
367 ;8 - Not in string list provided
368;use PARSE9 ;9 - Invalid Parameter
369
370;class A
371
372;def 6 " error reading file",CR,LF,"$"
373;def 7 "File not found",CR,LF,"$"
374;def 8 CR,LF,LF,"File $"
375;def 9 " canceled by operator$"
376;def 10 CR,LF,LF,"All files canceled by operator$"
377;def 11 "File allocation table bad drive "
378;def 12 "A.",CR,LF,"$"
379;def 13 "List output is not assigned to a device",CR,LF
380;def 14 "Resident part of PRINT installed",CR,LF
381
382;class B
383
384;use 1 COMMON1
385;def 2 CR,LF
386;def 15 "Cannot use PRINT - Use NET PRINT",CR,LF
387;def 17 "PRINT queue is full",CR,LF
388;def 18 "PRINT queue is empty",CR,LF
389;def 19 "Access denied",CR,LF
390;def 20 "Invalid drive specification",CR,LF
391;def 21 "Errors on list device indicate that it",CR,LF
392; "may be off-line. Please check it.",CR,LF
393
394;class C
395
396;def 22 CR,LF,LF," %1 is currently being printed",CR,LF
397;def 23 " %1 is in queue",CR,LF
398;use 24 EXTEND2
399;def 25 "Pathname too long",CR,LF
400;def 26 "File not in PRINT queue",CR,LF
401
402;class D
403
404;def 27 "Name of list device [PRN]: "
405
406;end
407 ;--------------------------------------
408 ; PRINT Equates
409 ;--------------------------------------
410
411MesSerCLASS equ 0 ; Message Service class
412DOS_error equ 1 ; DOS extended error
413Parse_error equ 2 ; Parse error
414CLASS_A equ 0Ah ; PRINT_R message
415CLASS_B equ 0Bh ; PRINT_T message
416CLASS_C equ 0Ch ; PRINT_T message with insert
417CLASS_D equ 0Dh ; PRINT_T message with input buffer where:
418CLASS_Util equ 0FFh ; PRINT utility message (Class A - D)
419buffered_input equ 0Ah ; Buffered keyboard input
420
421; CLASS 1
422
423ERR0 equ 19
424ERR12 equ 31
425
426; CLASS 2
427
428INVPARM equ 9 ; Invalid parameter (PARSE)
429
430; CLASS A
431
432ERRMEST equ 6 ; error reading file
433ErrMesT2 equ 7 ; File not found
434CanMes equ 8 ; File
435CanFilNam equ 9 ; canceled by operator
436AllCan equ 10 ; All files canceled by operator
437FATMES equ 11 ; File allocation table bad drive
438BADDRVM equ 12 ; A.
439BADMES equ 13 ; List output is not assigned to a device
440GOODMES equ 14 ; Resident part of PRINT installed
441
442; CLASS B
443
444NEXT_LINE equ 2 ; advance to next line
445CONFLICTMES equ 15 ; Cannot use PRINT - Use NET PRINT
446FULLMES equ 17 ; PRINT queue is full
447NoFils equ 18 ; PRINT queue is empty
448AccDen equ 19 ; Access denied
449InvDrvMes equ 20 ; Invalid drive specification
450CNTMES equ 21 ; Errors on list device indicate that it
451 ; may be off-line. Please check it.
452
453; CLASS C
454
455FstMes equ 22 ; %1 is currently being printed
456SecMes equ 23 ; %1 is in queue
457BadNameMes equ 24 ; %1 File not found
458NamTMes equ 25 ; %1 Pathname too long
459BadCanMes equ 26 ; %1 File not in PRINT queue
460
461; CLASS D
462
463PROMPT equ 27 ; Name of list device [PRN]:
464
465DOLLAR equ "$"
466Std_Out_Dev equ 1
467
468; $SALUT (0,41,46,52)
469
470.xlist
471.xcref
472BREAK MACRO subtitle
473 SUBTTL subtitle
474 PAGE
475ENDM
476
477SaveReg MACRO reglist ;; push those registers
478IRP reg,<reglist>
479 PUSH reg
480ENDM
481ENDM
482.xcref SaveReg
483
484RestoreReg MACRO reglist ;; pop those registers
485IRP reg,<reglist>
486 POP reg
487ENDM
488ENDM
489; $SALUT (4,25,30,41)
490
491 INCLUDE DEVSYM.INC
492 INCLUDE SYSCALL.INC
493 INCLUDE ERROR.INC
494 INCLUDE FIND.INC
495 include dpl.asm
496 INCLUDE PDB.INC
497 INCLUDE SYSCALL.INC
498 INCLUDE MI.INC
499 INCLUDE SYSMSG.INC
500 include versiona.inc
501.list
502.cref
503
504
505 MSG_UTILNAME <PRINT>
506
507
508error_busy EQU 9
509error_queue_full EQU 8
510error_name_too_long EQU 12
511get_ea_by_handle equ 2
512
513IF1
514 IF IBM
515; %out IBM VERSION
516 ELSE
517 %out MS-DOS VERSION
518 ENDIF
519ENDIF
520
521BREAK <Segment Definitions>
522
523
524CodeR Segment public para
525CodeR EndS
526
527Code Segment public para
528Code EndS
529
530Data Segment public byte
531Data EndS
532
533Stack Segment Stack
534Stack Ends
535
536DG group Code,Data,Stack
537