]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/CMD/PRINT/PRINT_T.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / CMD / PRINT / PRINT_T.ASM
1 page 80,132
2 TITLE 4.00 PRINT TRANSIENT
3 ; $SALUT (4,25,30,41)
4 INCLUDE pridefs.inc
5
6 SaveReg MACRO reglist ;; push those registers
7 IRP reg,<reglist>
8 PUSH reg
9 ENDM
10 ENDM
11
12 RestoreReg MACRO reglist ;; pop those registers
13 IRP reg,<reglist>
14 POP reg
15 ENDM
16 ENDM
17
18 BREAK <Transient Portion>
19 ;******************* START OF SPECIFICATIONS ***********************************
20 ;
21 ; MODULE NAME: PRINT_T.SAL
22 ;
23 ; DESCRIPTIVE NAME: TRANSIENT - Print Initialization and Instalation
24 ; Routine. DOS PRINT program for background printing
25 ; of text files to the list device - Transient Portion.
26 ;
27 ; FUNCTION: - Call the DOS PARSE Service Routines to process the command
28 ; line. Search for valid input:
29 ; - filenames (may be more than one
30 ; - switches: /D:device
31 ; /B:buffsize 512 to 16k - 512 default
32 ; /Q:quesiz 4 to 32 - 10 default
33 ; /S:timeslice 1 to 255 - 8 default
34 ; /U:busytick 1 to 255 - 1 default
35 ; /M:maxtick 1 to 255 - 2 default
36 ; /T terminate
37 ; /C cancel
38 ; /P print
39 ; - Install the resident component if not already installed
40 ; - Submit files for printing to the resident component
41 ;
42 ; INPUT: Parameter string from command line in the PSP
43 ;
44 ; OUTPUT: All parameters specified are updated. Files are submitted to
45 ; the resident component for printing.
46 ;
47 ; REGISTERS USED: T.B.D.
48 ; (NOT RESTORED)
49 ;
50 ; LINKAGE: LINK - TRANSIENT
51 ;
52 ; NORMAL -
53 ; EXIT:
54 ;
55 ; ERROR -
56 ; EXIT:
57 ;
58 ; EXTERNAL -
59 ; REFERENCES:
60 ;
61 ; CHANGE 03/11/87 - Major restructureing of TRANSIENT - F. G.
62 ; LOG:
63 ;
64 ;******************* END OF SPECIFICATIONS *************************************
65 ;******************** START - PSEUDOCODE ***************************************
66 ;
67 ; START TRANSIENT
68 ;
69 ; If pdb_environ != 0
70 ; deallocate memory
71 ; endif
72 ; call SYSLOADMSG
73 ; if no error (if there is - SYSLOADMSG is already set to
74 ; display it - ie DOS ver error
75 ; if not installed
76 ; call Load_R_Msg
77 ; if no error
78 ; get all interupt values
79 ; else
80 ; load error message #
81 ; set error flag
82 ; endif
83 ; else
84 ; if PSPRINT conflict
85 ; load error message #
86 ; set error flag
87 ; endif
88 ; endif
89 ; endif
90 ; if no error and
91 ; get and set INT 24 handler
92 ; update path character
93 ; Set up for Parse_Input call
94 ; Do
95 ; Leave if end of command line
96 ; Leave if error flag set
97 ; call parse_input
98 ; if carry set
99 ; set up for Invalid_parm message
100 ; endif
101 ; Leave if error flag set
102 ; update Parse_C_B
103 ; if file_name
104 ; call Submit_Name
105 ; endif
106 ; if switch
107 ; Do_case switch
108 ; Bgncase_/D
109 ; if valid value and not installed
110 ; move device name to LISTNAME
111 ; reset carry
112 ; else
113 ; set carry
114 ; endif
115 ; Endcase_/D
116 ; Bgncase_/B
117 ; if valid value and not installed
118 ; update BLKSIZ
119 ; reset carry
120 ; else
121 ; set carry
122 ; endif
123 ; Endcase_/B
124 ; Bgncase_/Q
125 ; if valid value and not installed
126 ; update BLKSIZ
127 ; reset carry
128 ; else
129 ; set carry
130 ; endif
131 ; Endcase_/Q
132 ; Bgncase_/S
133 ; if valid value and not installed
134 ; update TIMESLICE, SLICECNT
135 ; reset carry
136 ; else
137 ; set carry
138 ; endif
139 ; Endcase_/S
140 ; Bgncase_/U
141 ; if valid value and not installed
142 ; update BUSYTICK
143 ; reset carry
144 ; else
145 ; set carry
146 ; endif
147 ; Endcase_/U
148 ; Bgncase_/M
149 ; if valid value and not installed
150 ; update MAXTICK
151 ; reset carry
152 ; else
153 ; set carry
154 ; endif
155 ; Endcase_/M
156 ; Bgncase_/T
157 ; if installed
158 ; set up for cancel
159 ; call IntWhileBusy
160 ; endif
161 ; call Set_Buffer
162 ; reset carry
163 ; Endcase_/T
164 ; Bgncase_/C
165 ; if installed
166 ; set CanFlag
167 ; else
168 ; call Set_Buffer
169 ; endif
170 ; reset carry
171 ; Endcase_/C
172 ; Bgncase_/P
173 ; if installed
174 ; reset CanFlag
175 ; else
176 ; call Set_Buffer
177 ; endif
178 ; reset carry
179 ; Endcase_/P
180 ; end_case
181 ; if carry set
182 ; set up for Invalid_parm message
183 ; endif
184 ; endif
185 ; enddo
186 ; if no error
187 ; if not installed
188 ; call Set_Buffer
189 ; else
190 ; get queue pointer
191 ; check for off line
192 ; display queue
193 ; endif
194 ; else
195 ; call DispMsg (display the fatal error)
196 ; endif
197 ;
198 ; return
199 ;
200 ; END TRANSIENT
201 ;
202 ;==================== END - PSEUDOCODE =========================================
203
204 CodeR Segment public para
205
206 extrn SliceCnt:BYTE, BusyTick:BYTE, MaxTick:BYTE, TimeSlice:BYTE
207 extrn EndRes:WORD, BlkSiz:WORD, QueueLen:BYTE, PChar:BYTE
208 extrn ListName:BYTE, FileQueue:BYTE, EndQueue:WORD, Buffer:WORD
209 extrn EndPtr:WORD, NxtChr:WORD, MoveTrans:FAR, TO_DOS:FAR
210
211 extrn MESBAS:WORD, R_MES_BUFF:WORD
212
213 CodeR EndS
214
215
216 BREAK <Transient Data>
217
218 ;----------------------------------------
219 ; Transient data
220 ;----------------------------------------
221
222 DATA SEGMENT public BYTE
223
224
225
226 public namebuf
227
228 ORG 0
229
230 SWITCHAR DB ?
231 PathChar db "\"
232
233 SubPack db 0 ; Level
234 dd ? ; pointer to filename
235
236 ;--- Ints used by print. These ints are loaded here before the
237 ; resident is installed, just in case an error before print
238 ; is installed cases it to be never installed and the ints
239 ; have to be restored.
240
241 i28vec dd ? ; SOFTINT
242 i2fvec dd ? ; COMINT
243 i05vec dd ?
244 i13vec dd ?
245 i14vec dd ?
246 i15vec dd ?
247 i17vec dd ?
248 i1cvec dd ? ; INTLOC
249
250 ;--- Temp stack for use durint int 23 and 24 processing
251 db 278 + 80H dup (?) ; 278 == IBM's ROM requirements
252 intStk dw ?
253
254
255 ;--- Print installed flag:
256 ; 0 = Not installed yet: process only configuration parameters
257 ; during the command line parse
258 ; 1 = Partially installed: process only print commands AND flag
259 ; configuration parameters as errors AND finish by executing
260 ; the keep process
261 ; 2 = Already installed: process only print commands AND flag
262 ; configuration parameters as errors
263 PInst db 0 ; defaults to not installed
264 CanFlag db 0 ; cancel mode flag (0= no cancel)
265 Ambig db ? ; =1 if a filename is ambigous
266 DevSpec db 0 ; =1 a device was specified with the
267 ; /d option, do not prompt
268 QFullMes db 0 ; =1 queue full message issued already
269 HARDCH DD ? ;Pointer to real INT 24 handler
270
271 TokBuf DB (MaxFileLen+16) dup(?) ; token buffer for input
272
273 NulPtr dw ? ; pointer to the nul in NameBuf
274 FNamPtr dw ? ; pointer to name portion of file name
275 NameBuf db (MaxFileLen+16) dup(?) ; full name buffer for file
276 ; plus room for ambigous expansion
277
278 whichmsg dw (CLASS_C shl 8)+FstMes ; initial message for
279 ; file queue loop
280
281 SearchBuf find_buf <> ; search buffer
282
283 ;--------------------------------------
284 ; PARSE Equates
285 ;--------------------------------------
286
287 EOL equ -1 ; Indicator for End-Of-Line
288 NOERROR equ 0 ; Return Indicator for No Errors
289
290 DEVICE equ 0 ; device
291 BUFFSIZ equ 1 ; buffsiz
292 QUESIZ equ 2 ; quesiz
293 TIME equ 3 ; timeslice
294 BUSYT equ 4 ; busytick
295 MAXT equ 5 ; maxtick
296 TERM equ 6 ; Terminate
297 CANC equ 7 ; Cancel
298 PRINT equ 8 ; Print
299
300 file_spec equ 5 ; Parse Type for file spec found
301
302 ;--------------------------------------
303 ; PARSE Control Block
304 ;--------------------------------------
305
306 ORDINAL DW 0 ; Current Parse ordinal value
307 SCAN_PTR DW 81h ; Current Parse location Pointer
308 MSG_PTR DW 81h ; Last Parse location Pointer
309
310 ;--------------------------------------
311 ; STRUCTURE TO DEFINE ADDITIONAL
312 ; COMMAND LINE PARAMETERS
313 ;--------------------------------------
314 PARMS LABEL WORD
315 DW OFFSET DG:PARMSX ; POINTER TO PARMS STRUCTURE
316 DB 0 ; NO DELIMITER LIST FOLLOWS
317
318 ;--------------------------------------
319 ; STRUCTURE TO DEFINE SYNTAX
320 ;--------------------------------------
321 PARMSX LABEL BYTE
322 DB 0,1 ; A POSITIONAL PARAMETER IS VALID
323 DW OFFSET DG:POS1 ; POINTER TO POSITIONAL DEFINITION
324 DB 9 ; THERE ARE 9 TYPES OF SWITCHES
325 DW OFFSET DG:SW1 ; POINTER TO THE /D:device SWITCH DEFINITION AREA
326 DW OFFSET DG:SW2 ; POINTER TO THE /B:buffsiz SWITCH DEFINITION AREA
327 DW OFFSET DG:SW3 ; POINTER TO THE /Q:quesiz SWITCH DEFINITION AREA
328 DW OFFSET DG:SW4 ; POINTER TO THE /S:timeslice SWITCH DEFINITION AREA
329 DW OFFSET DG:SW5 ; POINTER TO THE /U:busytick SWITCH DEFINITION AREA
330 DW OFFSET DG:SW6 ; POINTER TO THE /M:maxval SWITCH DEFINITION AREA
331 DW OFFSET DG:SW7 ; POINTER TO THE /T TERMINATE SWITCH DEFINITION AREA
332 DW OFFSET DG:SW8 ; POINTER TO THE /C CANCEL SWITCH DEFINITION AREA
333 DW OFFSET DG:SW9 ; POINTER TO THE /P PRINT SWITCH DEFINITION AREA
334 DW 0 ; THERE ARE NO KEYWORDS IN PRINT SYNTAX
335
336 ;--------------------------------------
337 ;
338 ; NOTE: Do NOT change the layout or size
339 ; of the following entries:
340 ; --- SW1 through SW9 ---
341 ; Their size and position are used
342 ; to calculate an index for a
343 ; DO_CASE (jump table). This is
344 ; possible ONLY if the size of all
345 ; 9 entries are exactly the same,
346 ; congruant, and in this exact
347 ; order. Any changes here MUST be
348 ; matched in the Process_A_Switch
349 ; PROC.
350 ;
351 ; The following formula is used:
352 ;
353 ; Index = (offset P_SYN - offset
354 ; SW1) / SW_SIZE
355 ;
356 ;--------------------------------------
357
358
359 ;--------------------------------------
360 ; STRUCTURE TO DEFINE THE POSITIONAL
361 ; PARAMETER (File Name)
362 ;--------------------------------------
363 POS1 LABEL WORD
364 DW 0203H ; OPTIONAL, REPEATABLE FILE SPEC
365 DW 0001H ; CAPS BY FILE TABLE
366 DW OFFSET DG:PARSE_BUFF ; PLACE RESULT IN BUFFER
367 DW OFFSET DG:NOVALS ; NO VALUES LIST REQUIRED
368 DB 0 ; NO KEYWORDS
369
370 ;--------------------------------------
371 ; STRUCTURE TO DEFINE /D:device SWITCH
372 ;--------------------------------------
373 SW1 LABEL WORD
374 DW 2001H ; MUST BE PRINT OUTPUT DEVICE
375 ; (optional simple string)
376 DW 1h ; Caps by file table
377 DW OFFSET DG:PARSE_BUFF ; PLACE RESULT IN BUFFER
378 DW OFFSET DG:NOVALS ; VALUE LIST NOT NECESSARY
379 DB 1 ; ONE SWITCH IN FOLLOWING LIST
380 SW_PTR DB "/D",0 ; /D: INDICATES DEVICE SPECIFIED
381
382 SW_SIZE equ $ - SW1
383 ;--------------------------------------
384 ; STRUCTURE TO DEFINE /B:buffsiz SWITCH
385 ;--------------------------------------
386 SW2 LABEL WORD
387 DW 8001H ; MUST BE NUMERIC (optional)
388 DW 0 ; NO FUNCTION FLAGS
389 DW OFFSET DG:PARSE_BUFF ; PLACE RESULT IN BUFFER
390 DW OFFSET DG:VALUE_BUF ; NEED VALUE LIST FOR buffsiz
391 DB 1 ; ONE SWITCH IN FOLLOWING LIST
392 B_SWITCH DB "/B",0 ; /B: INDICATES buffsiz REQUESTED
393
394 ;--------------------------------------
395 ; STRUCTURE TO DEFINE /Q:quesiz SWITCH
396 ;--------------------------------------
397 SW3 LABEL WORD
398 DW 8001H ; MUST BE NUMERIC (optional)
399 DW 0 ; NO FUNCTION FLAGS
400 DW OFFSET DG:PARSE_BUFF ; PLACE RESULT IN BUFFER
401 DW OFFSET DG:VALUE_QUE ; NEED VALUE LIST FOR quesiz
402 DB 1 ; ONE SWITCH IN FOLLOWING LIST
403 Q_SWITCH DB "/Q",0 ; /Q: INDICATES quesiz REQUESTED
404
405 ;--------------------------------------
406 ; STRUCTURE TO DEFINE /S:timeslice SWITCH
407 ;--------------------------------------
408 SW4 LABEL WORD
409 DW 8001H ; MUST BE NUMERIC (optional)
410 DW 0 ; NO FUNCTION FLAGS
411 DW OFFSET DG:PARSE_BUFF ; PLACE RESULT IN BUFFER
412 DW OFFSET DG:VALUE_TIME ; NEED VALUE LIST FOR timeslice
413 DB 1 ; ONE SWITCH IN FOLLOWING LIST
414 S_SWITCH DB "/S",0 ; /S: INDICATES timeslice REQUESTED
415
416 ;--------------------------------------
417 ; STRUCTURE TO DEFINE /U:busytick SWITCH
418 ;--------------------------------------
419 SW5 LABEL WORD
420 DW 8001H ; MUST BE NUMERIC (optional)
421 DW 0 ; NO FUNCTION FLAGS
422 DW OFFSET DG:PARSE_BUFF ; PLACE RESULT IN BUFFER
423 DW OFFSET DG:VALUE_BUSY ; NEED VALUE LIST FOR busytick
424 DB 1 ; ONE SWITCH IN FOLLOWING LIST
425 U_SWITCH DB "/U",0 ; /U: INDICATES busytick REQUESTED
426
427 ;--------------------------------------
428 ; STRUCTURE TO DEFINE /M:maxtick SWITCH
429 ;--------------------------------------
430 SW6 LABEL WORD
431 DW 8001H ; MUST BE NUMERIC (optional)
432 DW 0 ; NO FUNCTION FLAGS
433 DW OFFSET DG:PARSE_BUFF ; PLACE RESULT IN BUFFER
434 DW OFFSET DG:VALUE_MAXT ; NEED VALUE LIST FOR maxtick
435 DB 1 ; ONE SWITCH IN FOLLOWING LIST
436 M_SWITCH DB "/M",0 ; /M: INDICATES maxtick REQUESTED
437
438 ;--------------------------------------
439 ; STRUCTURE TO DEFINE /T Terminate SWITCH
440 ;--------------------------------------
441 SW7 LABEL WORD
442 DW 8001H ; SWITCH ONLY
443 ; (optional simple string)
444 DW 0 ; NO FUNCTION FLAGS
445 DW OFFSET DG:PARSE_BUFF ; PLACE RESULT IN BUFFER
446 DW OFFSET DG:NOVALS ; VALUE LIST NOT NECESSARY
447 DB 1 ; ONE SWITCH IN FOLLOWING LIST
448 DB "/T",0 ; /T: INDICATES Terminate REQUESTED
449
450 ;--------------------------------------
451 ; STRUCTURE TO DEFINE /C Cancel SWITCH
452 ;--------------------------------------
453 SW8 LABEL WORD
454 DW 8003H ; SWITCH ONLY
455 ; (optional, repeatable simple string)
456 DW 0 ; NO FUNCTION FLAGS
457 DW OFFSET DG:PARSE_BUFF ; PLACE RESULT IN BUFFER
458 DW OFFSET DG:NOVALS ; VALUE LIST NOT NECESSARY
459 DB 1 ; ONE SWITCH IN FOLLOWING LIST
460 C_SW_ptr DB "/C",0 ; /C: INDICATES Cancel REQUESTED
461
462 ;--------------------------------------
463 ; STRUCTURE TO DEFINE /P Print SWITCH
464 ;--------------------------------------
465 SW9 LABEL WORD
466 DW 8003H ; SWITCH ONLY
467 ; (optional, repeatable simple string)
468 DW 0 ; NO FUNCTION FLAGS
469 DW OFFSET DG:PARSE_BUFF ; PLACE RESULT IN BUFFER
470 DW OFFSET DG:NOVALS ; VALUE LIST NOT NECESSARY
471 DB 1 ; ONE SWITCH IN FOLLOWING LIST
472 P_SW_ptr DB "/P",0 ; /P: INDICATES Print REQUESTED
473
474 ;--------------------------------------
475 ; VALUE LIST FOR FILE NAMES
476 ;--------------------------------------
477 NOVALS LABEL WORD
478 DB 0 ; NO VALUES
479
480 ;--------------------------------------
481 ; VALUE LIST DEFINITION FOR buffsiz
482 ;--------------------------------------
483 VALUE_BUF LABEL BYTE
484 DB 1 ; ONE VALUE ALLOWED
485 DB 1 ; ONLY ONE RANGE
486 DB BUFFSIZ ; IDENTIFY IT AS buffsiz
487 ; USER CAN SPECIFY /+512 THROUGH /+16K
488 DD MinBufferLen,MaxBufferLen
489
490 ;--------------------------------------
491 ; VALUE LIST DEFINITION FOR quesiz
492 ;--------------------------------------
493 VALUE_QUE LABEL BYTE
494 DB 1 ; ONE VALUE ALLOWED
495 DB 1 ; ONLY ONE RANGE
496 DB QUESIZ ; IDENTIFY IT AS quesiz
497 ; USER CAN SPECIFY /+4 THROUGH /+32
498 DD MinQueueLen,MaxQueueLen
499
500 ;--------------------------------------
501 ; VALUE LIST DEFINITION FOR timeslice
502 ;--------------------------------------
503 VALUE_TIME LABEL BYTE
504 DB 1 ; ONE VALUE ALLOWED
505 DB 1 ; ONLY ONE RANGE
506 DB TIME ; IDENTIFY IT AS timeslice
507 ; USER CAN SPECIFY /+1 THROUGH /+255
508 DD MinTimeSlice,MaxTimeSlice
509
510 ;--------------------------------------
511 ; VALUE LIST DEFINITION FOR busytick
512 ;--------------------------------------
513 VALUE_BUSY LABEL BYTE
514 DB 1 ; ONE VALUE ALLOWED
515 DB 1 ; ONLY ONE RANGE
516 DB BUSYT ; IDENTIFY IT AS busytick
517 ; USER CAN SPECIFY /+1 THROUGH /+255
518 DD MinBusyTick,MaxBusyTick
519
520 ;--------------------------------------
521 ; VALUE LIST DEFINITION FOR maxtick
522 ;--------------------------------------
523 VALUE_MAXT LABEL BYTE
524 DB 1 ; ONE VALUE ALLOWED
525 DB 1 ; ONLY ONE RANGE
526 DB MAXT ; IDENTIFY IT AS maxtick
527 ; USER CAN SPECIFY /+1 THROUGH /+255
528 DD MinMaxTick,MaxMaxTick
529
530 ;--------------------------------------
531 ; RETURN BUFFER FOR PARSE INFORMATION
532 ;--------------------------------------
533 PARSE_BUFF LABEL BYTE
534 P_TYPE DB ? ; TYPE RETURNED
535 P_ITEM_TAG DB ? ; SPACE FOR ITEM TAG
536 P_SYN DW ? ; POINTER TO LIST ENTRY
537 P_PTR_L DW ? ; SPACE FOR POINTER / VALUE - LOW
538 P_PTR_H DW ? ; SPACE FOR POINTER / VALUE - HIGH
539
540 ;----------------------------------------
541 ; SUBLIST for Message call
542 ;----------------------------------------
543
544 SUBLIST LABEL WORD
545
546 DB sub_size ; size of sublist
547 DB 0 ; reserved
548 insert_ptr_off DW 0 ; pointer to insert - offset
549 insert_ptr_seg DW DG ; pointer to insert - segment
550 insert_num DB 0 ; number of insert
551 DB Char_Field_ASCIIZ ; data type flag - ASCII Z string
552 DB MaxFileLen ; maximum field size
553 DB 1 ; minimum field size
554 DB " " ; pad character
555
556 sub_size equ $ - SUBLIST ; size of sublist
557
558
559 OPEN_FILE label dword
560
561 dw offset DG:NameBuf ; name pointer offset
562 open_seg dw ? ; name pointer segment
563
564 DATA ENDS
565
566 BREAK <Transient Code>
567
568 Code Segment public para
569 Code EndS
570
571 Code Segment public para
572
573 public TransRet,TransSize,GoDispMsg
574
575 extrn SYSLOADMSG:NEAR, SYSGETMSG:NEAR, SYSDISPMSG:NEAR
576 extrn SYSPARSE:NEAR
577
578 ASSUME CS:DG,DS:nothing,ES:nothing,SS:Stack
579
580 ; $SALUT (4,4,9,41)
581
582 TRANSIENT:
583 ;-------------------------------------
584 ; Install Print
585 ;-------------------------------------
586
587 cld
588 mov ax,ds:[pdb_environ]
589 or ax,ax
590
591 ; $if nz ; if pdb_environ != 0 ;AC000;
592 JZ $$IF1
593
594 push es ; deallocate memory
595 mov es,ax
596 mov ah,dealloc
597 int 21h
598 pop es
599
600 ; $endif ; ;AC000;
601 $$IF1:
602
603 call SYSLOADMSG ; Initialize the Message Service code ;AN000;
604
605 ; $if c ; if error ;AC000;
606 JNC $$IF3
607
608 mov ah,dh ; set up class for DispMsg
609
610 ; $else ; else - no error - keep going
611 JMP SHORT $$EN3
612 $$IF3:
613
614 push cs
615 pop ax
616 mov ds,ax
617 mov es,ax
618
619 ASSUME DS:DG,ES:DG
620 ; NOTE: es must ALWAYS point to DG
621
622 mov ax,0100h ; Ask if already installed
623 int ComInt
624 or al,al
625
626 ; $if z ; if not installed ;AC000;
627 JNZ $$IF5
628
629 call Load_R_Msg ; ;AC000;
630
631 ; $if nc ; if no error ;AC000;
632 JC $$IF6
633
634 call Save_Vectors ; ;AC000;
635
636 ; $endif ; endif - NB: - If carry IS set, ;AC000;
637 $$IF6:
638 ; Load_R_Msg will have loaded the
639 ; error message #
640
641 ; $else ; else - we are installed ;AC000;
642 JMP SHORT $$EN5
643 $$IF5:
644
645 cmp al,1
646
647 ; $if z ; if PSPRINT conflict ;AC000;
648 JNZ $$IF9
649
650 mov ax,(CLASS_B shl 8) + CONFLICTMES ; load error message # ;AC000;
651
652 stc ; set the error flag ;AC000;
653
654 ; $else ; ;AC000;
655 JMP SHORT $$EN9
656 $$IF9:
657
658 mov [PInst],2 ; remember print already installed
659 ; and that we only do one pass
660 mov al," " ; invalidate install switches ;AN005;
661 mov SW_PTR,al ; /D ;AN005;
662 mov B_SWITCH,al ; /B ;AN005;
663 mov Q_SWITCH,al ; /Q ;AN005;
664 mov S_SWITCH,al ; /S ;AN005;
665 mov U_SWITCH,al ; /U ;AN005;
666 mov M_SWITCH,al ; /M ;AN005;
667 clc ; reset the error flag ;AC000;
668
669 ; $endif ; ;AC000;
670 $$EN9:
671 ; $endif ; ;AC000;
672 $$EN5:
673 ; $endif ; ;AC000;
674 $$EN3:
675
676 ; $if nc,and ; if no errors so far and..............;AC000;
677 JC $$IF14
678
679 call GetHInt ; save current int 24 vector
680 call SetInts ; set int 23 and 24 vectors
681 mov ax,CHAR_OPER shl 8
682 int 21h
683 mov [SWITCHAR],dl ; Get user switch character
684 cmp dl,"-"
685
686 ; $if e ; if "-" ;AC000;
687 JNE $$IF14
688 mov [PathChar],"/" ; alternate path character
689 ; $endif ; ;AC000;
690 $$IF14:
691
692 ; Set up for Parse_Input call
693
694 ; $do ; Do_until end of command line ;AC000;
695 $$DO16:
696
697 ; $leave c ; quit if an error occured ;AC000;
698 JC $$EN16
699
700 call parse_input ; ;AC000;
701
702 mov [ordinal],cx ; update Parse_C_B ;AC000;
703 mov [scan_ptr],si ; ;AC000;
704
705 cmp al,EOL ; are we at the end? ;AC000;
706
707 ; $leave e ; leave if end of line ;AC000;
708 JE $$EN16
709
710 cmp al,noerror ; ;AC000;
711
712 ; $if ne ; if error ;AC000;
713 JE $$IF19
714
715 mov ah,Parse_error ; set class to Parse error ;AC000;
716
717
718 stc ; set the error flag ;AC000;
719
720 ; $endif ; endif ;AC000;
721 $$IF19:
722
723 ; $leave c ; leave the loop if error ocurred ;AC000;
724 JC $$EN16
725
726 cmp [p_type],File_Spec ; is it a file spec? ;AC000;
727
728 ; $if e ; if it is a file spec ;AC000;
729 JNE $$IF22
730
731 call Submit_File ; ;AC000;
732
733 ; $else ; else - we must now have a ;AC000;
734 JMP SHORT $$EN22
735 $$IF22:
736 ; valid switch!
737
738
739 ; Do_case switch
740
741 push cs ; set up for CASE ;AC000;
742 pop ds ; ;AC000;
743 mov ax,[p_syn] ; ;AC000;
744 sub ax,OFFSET DG:SW_PTR ; ;AC000;
745 mov dl,SW_SIZE ; ;AC000;
746 div dl ; ;AC000;
747 cmp ah,noerror ; ;AC000;
748 mov di,ax ; ;AC000;
749 mov ax,(CLASS_B shl 8) + invparm ; set message in case of error ;AC000;
750
751 ; $if e ; if no error in jump calculation ;AC000;
752 JNE $$IF24
753
754 call Process_A_Switch ; ;AC000;
755
756 ; $else
757 JMP SHORT $$EN24
758 $$IF24:
759
760 stc ; set the error flag ;AC000;
761
762 ; $endif ; endif - no error in jump calculation ;AC000;
763 $$EN24:
764
765 ; $endif ; endif - name or switch ;AC000:
766 $$EN22:
767
768 ; $leave c ; leave the loop if error ocurred ;AC000;
769 JC $$EN16
770
771 ; $enddo ; enddo ;AC000;
772 JMP SHORT $$DO16
773 $$EN16:
774
775 ; $if nc,long ; if no error so far ;AC000;
776 JNC $$XL1
777 JMP $$IF30
778 $$XL1:
779
780 cmp [PInst],0 ; is print already installed?
781
782 ; $if e ; if not installed ;AC000;
783 JNE $$IF31
784
785 call Set_Buffer ; NOTE from now on the TRANSIENT could ;AC000;
786 ; be in a SEGMENT that is different
787 ; than the one set up by the loader!
788 ; *** MOV xx,DG will no longer work ***
789 ; (use PUSH CS , POP xx instead)
790
791 ; $endif ; endif - installed ;AC000;
792 $$IF31:
793
794 ; Grab the pointer to the queue and
795 ; lock it down. Remember that since
796 ; there are threads in the background,
797 ; we may get a busy return. We sit
798 ; here in a spin loop until we can
799 ; actually lock the queue.
800
801 mov ax,0104h ; get status
802 call IntWhileBusy ; on return DS:SI points to queue
803
804 ASSUME DS:nothing
805 ;------------------------------------
806 ; check for off-line
807 ;------------------------------------
808
809 cmp dx,ErrCnt1 ; check count
810
811 ; $if ae ; if count too high ;AC000;
812 JNAE $$IF33
813
814 mov ax,(CLASS_B shl 8) + CntMes ; printer might be off-line ;AC000;
815 call DispMsg ; ;AC000;
816
817 ; $endif ; endif - count Too high ;AC000;
818 $$IF33:
819
820 ; ;------------------------------------
821 ; ; display current queue
822 ; ; ds:si points to print queue
823 ; ; ds:di must point to display
824 ; ; buffer
825 ; ; xNameTrans will copy the name into
826 ; ; the name buffer. It will do
827 ; ; any name truncation if needed
828 ; ; (including any DBSC characters)
829 ; ;
830 ; ;------------------------------------
831 ; mov di,offset dg:NameBuf ; ;AN009;
832 ; mov ax,(xNameTrans SHL 8) ; check for name translation ;AN009;
833 ; int 21h ; get real path and name ;AN009;
834
835 ;;;;;;;;;;;;;xxxxxxxxxxxxxxxxx
836 call copy_to_arg_buf
837 ;;;;;;;;;;;;;xxxxxxxxxxxxxxxxx
838
839 mov ax,[whichmsg] ; ;AN000;
840 mov [whichmsg],(CLASS_C shl 8) + SecMes ; set up in queue msg ;AC000;
841 cmp byte ptr ds:[si],0 ; is the queue empty?
842
843 ; $if ne ; if queue not empty ;AC000;
844 JE $$IF35
845
846 ; $do ; ;AC000;
847 $$DO36:
848
849 push ds
850 call DispMsg ; ;AC000;
851 pop ds
852 add si,MaxFileLen ; point to next entry in queue
853
854 ;;;;;;;;;;;;;xxxxxxxxxxxxxxxxx
855 call copy_to_arg_buf
856 ;;;;;;;;;;;;;xxxxxxxxxxxxxxxxx
857
858 ; mov di,offset dg:NameBuf ; ;AN009;
859 ; mov ax,(xNameTrans SHL 8) ; check for name translation ;AN009;
860 ; int 21h ; get real path and name ;AN009;
861 mov ax,[whichmsg] ; ;AC009;
862 cmp byte ptr ds:[si],0 ; end of queue?
863
864 ; $enddo e ; ;AC000;
865 JNE $$DO36
866
867 ; $else ; else - queue is empty ;AC000;
868 JMP SHORT $$EN35
869 $$IF35:
870
871 mov ax,(CLASS_B shl 8) + NoFils ; ;AC000;
872 call DispMsg ; ;AC000;
873
874 ; $endif ; endif - queue not empty ;AC000;
875 $$EN35:
876
877 ;------------------------------------
878 ; exit transient
879 ;------------------------------------
880
881 mov ax,0105H ; unlock the print queue
882 call IntWhileBusy ; on return DS:SI points to queue
883 cmp [PInst],1 ; are we partially installed ?
884
885 ; $if e ; if so... complete the process ;AC000;
886 JNE $$IF40
887
888 mov ax,CodeR ; close Std Devices
889 mov ds,ax
890
891 ASSUME DS:CodeR
892
893 xor bx,bx
894 mov cx,5 ; StdIN,StdOUT,StdERR,StdAUX,StdPRN
895
896 ; $do ; Close STD handles before keep process;AC000;
897 $$DO41:
898
899 mov ah,CLOSE
900 int 21h
901 inc bx
902
903 ; $enddo loop ; ;AC000;
904 LOOP $$DO41
905
906
907 mov dx,[ENDRES] ; install print...
908 mov ax,KEEP_PROCESS shl 8 ; Exit code 0
909
910 ; $else ; else - ;AC000;
911 JMP SHORT $$EN40
912 $$IF40:
913
914 mov ax,(EXIT shl 8) ; quit with no error
915
916 ; $endif ; endif - ;AC000;
917 $$EN40:
918
919 ; $else ; else - a fatal error occured ;AC000;
920 JMP SHORT $$EN30
921 $$IF30:
922
923 call DispMsg ; display the error message ;AC000;
924 mov ax,(EXIT shl 8) ; quit with error
925
926
927 ; $endif ; erdif - errors ;AC000;
928 $$EN30:
929
930
931 int 21h ; either EXIT or KEEP_PROCESS
932
933 push es
934 xor ax,ax
935 push ax
936
937 foo proc far
938 ret ; Must use this method, version may be < 2.00
939 foo endp
940
941 BREAK <Process_A_Switch>
942 ;******************* START OF SPECIFICATIONS ***********************************
943 ;
944 ; NAME: Process_A_Switch
945 ;
946 ; FUNCTION: This routine is a DO Case that processes all valid switched for
947 ; PRINT.
948 ;
949 ; INPUT: Jump table offset calculated in the main routine.
950 ;
951 ; OUTPUT: Proper processing for the switch
952 ;
953 ; REGISTERS USED: T.B.D.
954 ; (NOT RESTORED)
955 ;
956 ; LINKAGE: Call from: TRANSIENT
957 ;
958 ; NORMAL -
959 ; EXIT:
960 ;
961 ; ERROR -
962 ; EXIT:
963 ;
964 ; EXTERNAL Call to: DispMsg Parse_Input GetAbsN
965 ; REFERENCES: IntWhileBusy GetAbsN2
966 ;
967 ; CHANGE 04/01/87 - make SWITCH processing a PROC - FJG
968 ; LOG:
969 ;
970 ;******************* END OF SPECIFICATIONS *************************************
971 ;******************** START - PSEUDOCODE ***************************************
972 ;
973 ; START Process_A_Switch
974 ; END Process_A_Switch
975 ;
976 ;******************** END - PSEUDOCODE ***************************************
977
978 Process_A_Switch PROC NEAR
979
980 shl di,1 ; ;AC000;
981
982 jmp cs:JMPTABLE[di] ; ;AC000;
983
984 JMPTABLE LABEL WORD ; ;AC000;
985
986 DW CASE_D ; ;AN000;
987 DW CASE_B ; ;AN000;
988 DW CASE_Q ; ;AN000;
989 DW CASE_S ; ;AN000;
990 DW CASE_U ; ;AN000;
991 DW CASE_M ; ;AN000;
992 DW CASE_T ; ;AN000;
993 DW CASE_C ; ;AN000;
994 DW CASE_P ; ;AN000;
995
996 ASSUME ds:DG,es:DG
997
998 CASE_D: ; Bgncase_/D ;AN000;
999
1000 cmp [PInst],0 ; ;AC000;
1001
1002 ; $if e,and ; if not installed ;AC000;
1003 JNE $$IF47
1004
1005 ; move device name to LISTNAME
1006 mov bp,[P_PTR_L] ; ;AC000;
1007 mov di,bp ; save start address ;AC000;
1008 mov ax,[P_PTR_H] ; ;AC000;
1009 mov es,ax ;
1010
1011 ASSUME es:nothing
1012
1013 xor al,al ; find the length of input name ;AN000;
1014 mov cx,9 ; it can not be longer than 8 + : ;AN000;
1015
1016 ASSUME es:DG ; this is a bogus assume to keep the
1017 ; assembler happy
1018 repne scas NameBuf ; (use NameBuf to tell assembler its ;AN000;
1019 ; a byte search)
1020 ASSUME es:nothing ; this puts it back right
1021
1022 dec di ; back up to first null ;AN000;
1023 mov ax,di ; pointer to end ;AN000;
1024 sub ax,bp ; subtract start pointer ;AN000;
1025 mov cx,ax ; difference is the length ;AN000;
1026 or cx,cx ; is it non zero? ;AN000;
1027
1028 ; $if ne ; if we have a name ;AN000;
1029 JE $$IF47
1030
1031 mov si,di ; set DS:SI up to source (Parse Buffer);AN000;
1032 mov ax,es ; set ES:DI up to LISTNAME (in CodeR) ;AN000;
1033 mov ds,ax ; ;AN000;
1034 mov ax,CodeR ;
1035 mov es,ax ;
1036
1037 ASSUME DS:nothing,ES:CodeR
1038
1039 mov WORD PTR [LISTNAME],2020h ; Nul out default
1040 mov [LISTNAME+2]," " ;
1041 mov di,OFFSET CodeR:LISTNAME ;
1042 dec si ; back up to last character ;AN004;
1043 cmp BYTE PTR [si],':' ; is there a ':' at the end of the name?
1044
1045 ; $if e ; if it is ;AC000;
1046 JNE $$IF48
1047 dec cx ; Chuck the trailing ':'
1048 ; $endif ; ;AC000;
1049 $$IF48:
1050
1051 cmp cx,8 ; is the name still longer than 8?
1052
1053 ; $if a ; if it is ;AC000;
1054 JNA $$IF50
1055 mov cx,8 ; Limit to 8 chars for device
1056 ; $endif ; ;AC000;
1057 $$IF50:
1058
1059 mov si,bp ; ;AC000;
1060 rep movsb ; move the device name into LISTNAME ;AC000;
1061 mov si,bp ;
1062 mov [DevSpec],1 ; remember that a device was specified
1063 clc ; reset carry ;AC000;
1064
1065 ; $else ; else ;AC000;
1066 JMP SHORT $$EN47
1067 $$IF47:
1068
1069 stc ; set carry ;AC000;
1070
1071 ; $endif ; endif ;AC000;
1072 $$EN47:
1073
1074 push cs ;
1075 pop cx ;
1076 mov ds,cx ;
1077 mov es,cx ;
1078 mov al," " ; invalidate this switch ;AN005;
1079 mov SW_PTR,al ; /D ;AN005;
1080
1081
1082 JMP CASE_END ; Endcase_/D ;AN000;
1083
1084 CASE_B: ; Bgncase_/B ;AN000;
1085
1086 ASSUME ds:DG,es:DG
1087
1088 cmp [PInst],0 ;
1089
1090 ; $if e ; if not installed ;AC000;
1091 JNE $$IF54
1092
1093 mov ax,[P_PTR_L] ; get the value ;AC000;
1094 push ds ; update BLKSIZ
1095 mov dx,CodeR ;
1096 mov ds,dx ;
1097
1098 ASSUME DS:CodeR
1099
1100 mov [BLKSIZ],ax ;
1101 pop ds ;
1102
1103 ASSUME DS:DG
1104
1105 clc ; reset carry ;AC000;
1106
1107 ; $else ; else ;AC000;
1108 JMP SHORT $$EN54
1109 $$IF54:
1110
1111 stc ; set carry ;AC000;
1112
1113 ; $endif ; endif ;AC000;
1114 $$EN54:
1115
1116 mov al," " ; invalidate this switch ;AN005;
1117 mov B_SWITCH,al ; /B ;AN005;
1118
1119 JMP CASE_END ; Endcase_/B ;AN000;
1120
1121 CASE_Q: ; Bgncase_/Q ;AN000;
1122
1123 cmp [PInst],0 ;
1124
1125 ; $if e ; if not installed ;AC000;
1126 JNE $$IF57
1127
1128 mov ax,[P_PTR_L] ; get the value ;AC000;
1129 push ds ; update BLKSIZ
1130 mov dx,CodeR ;
1131 mov ds,dx ;
1132
1133 ASSUME DS:CodeR
1134
1135 mov [QueueLen],al ;
1136 pop ds ;
1137
1138 ASSUME DS:DG
1139
1140 clc ; reset carry ;AC000;
1141
1142 ; $else ; else ;AC000;
1143 JMP SHORT $$EN57
1144 $$IF57:
1145
1146 stc ; set carry ;AC000;
1147
1148 ; $endif ; endif ;AC000;
1149 $$EN57:
1150
1151 mov al," " ; invalidate this switch ;AN005;
1152 mov Q_SWITCH,al ; /Q ;AN005;
1153
1154 JMP CASE_END ; Endcase_/Q ;AN000;
1155
1156 CASE_S: ; Bgncase_/S ;AN000;
1157
1158 cmp [PInst],0 ;
1159
1160 ; $if e ; if not installed ;AC000;
1161 JNE $$IF60
1162
1163 mov ax,[P_PTR_L] ; get the value ;AC000;
1164 push ds ; update TIMESLICE, SLICECNT
1165 mov dx,CodeR ;
1166 mov ds,dx ;
1167
1168 ASSUME ds:CodeR
1169
1170 mov [TIMESLICE],al ;
1171 mov [SLICECNT],al ;
1172 pop ds ;
1173
1174 ASSUME ds:DG
1175
1176 clc ; reset carry ;AC000;
1177
1178 ; $else ; else ;AC000;
1179 JMP SHORT $$EN60
1180 $$IF60:
1181
1182 stc ; set carry ;AC000;
1183
1184 ; $endif ; endif ;AC000;
1185 $$EN60:
1186
1187 mov al," " ; invalidate this switch ;AN005;
1188 mov S_SWITCH,al ; /S ;AN005;
1189
1190 JMP CASE_END ; Endcase_/S ;AN000;
1191
1192 CASE_U: ; Bgncase_/U ;AN000;
1193
1194 cmp [PInst],0 ;
1195
1196 ; $if e ; if not installed ;AC000;
1197 JNE $$IF63
1198
1199 mov ax,[P_PTR_L] ; get the value ;AC000;
1200 push ds ; update BUSYTICK
1201 mov dx,CodeR ;
1202 mov ds,dx ;
1203
1204 ASSUME ds:CodeR
1205
1206 mov [BUSYTICK],al ;
1207 pop ds ;
1208
1209 ASSUME ds:DG
1210
1211 clc ; reset carry ;AC000;
1212
1213 ; $else ; else ;AC000;
1214 JMP SHORT $$EN63
1215 $$IF63:
1216
1217 stc ; set carry ;AC000;
1218
1219 ; $endif ; endif ;AC000;
1220 $$EN63:
1221
1222 mov al," " ; invalidate this switch ;AN005;
1223 mov U_SWITCH,al ; /U ;AN005;
1224
1225 JMP CASE_END ; Endcase_/U ;AN000;
1226
1227 CASE_M: ; Bgncase_/M ;AN000;
1228
1229 cmp [PInst],0 ;
1230
1231 ; $if e ; if not installed ;AC000;
1232 JNE $$IF66
1233
1234 mov ax,[P_PTR_L] ; get the value ;AC000;
1235 push ds ; update MAXTICK
1236 mov dx,CodeR ;
1237 mov ds,dx ;
1238
1239 ASSUME ds:CodeR
1240
1241 mov [MAXTICK],al ;
1242 pop ds ;
1243
1244 ASSUME ds:DG
1245
1246 clc ; reset carry ;AC000;
1247
1248 ; $else ; else ;AC000;
1249 JMP SHORT $$EN66
1250 $$IF66:
1251
1252 stc ; set carry ;AC000;
1253
1254 ; $endif ; endif ;AC000;
1255 $$EN66:
1256
1257 mov al," " ; invalidate this switch ;AN005;
1258 mov M_SWITCH,al ; /M ;AN005;
1259
1260 JMP CASE_END ; Endcase_/M ;AN000;
1261
1262 CASE_T: ; Bgncase_/T ;AN000;
1263
1264 push si ; save parse pointer
1265
1266 cmp [PInst],0 ; has print been installed?
1267
1268 ; $if e ; if not installed ;AC000;
1269 JNE $$IF69
1270
1271 call Set_Buffer ; do it now ;AC000;
1272
1273 ; $endif ; endif ;AC000;
1274 $$IF69:
1275 ; set up for cancel
1276 mov ax,0103H ; cancel command
1277
1278 call IntWhileBusy ;
1279
1280 pop si ; restore parse pointer
1281
1282 clc ; reset carry ;AC000;
1283
1284 JMP CASE_END ; Endcase_/T ;AN000;
1285
1286 CASE_C: ; Bgncase_/C ;AN000;
1287
1288 cmp [PInst],0 ; has print been installed?
1289
1290 ; $if ne ; if installed ;AC000;
1291 JE $$IF71
1292
1293 mov [CanFlag],1 ; set CanFlag
1294
1295 ; $else ; else ;AC000;
1296 JMP SHORT $$EN71
1297 $$IF71:
1298
1299 call Set_Buffer ; ;AC000;
1300
1301 ; $endif ; endif ;AC000;
1302 $$EN71:
1303
1304 clc ; reset carry ;AC000;
1305
1306 JMP CASE_END ; Endcase_/C ;AN000;
1307
1308 CASE_P: ; Bgncase_/P ;AN000;
1309
1310 cmp [PInst],0 ; has print been installed?
1311
1312 ; $if ne ; if installed ;AC000;
1313 JE $$IF74
1314
1315 mov [CanFlag],0 ; reset CanFlag
1316
1317 ; $else ; else ;AC000;
1318 JMP SHORT $$EN74
1319 $$IF74:
1320
1321 call Set_Buffer ; ;AC000;
1322
1323 ; $endif ; endif ;AC000;
1324 $$EN74:
1325
1326 clc ; reset carry ;AC000;
1327
1328 ; Endcase_/P
1329
1330 CASE_END: ; End_case ;AN000;
1331
1332 ; $if c ; if carry set ;AC000;
1333 JNC $$IF77
1334
1335 mov ax,(Parse_error shl 8) + INVPARM ; set up for Invalid_parm message ;AN000:
1336
1337 cmp [PInst],0 ; has print been installed?
1338
1339 ; $if ne ; if installed ;AN005;
1340 JE $$IF78
1341
1342 call DispMsg ; display the message and keep going ;AN005;
1343
1344 ; $endif ; endif ;AN005;
1345 $$IF78:
1346
1347 ; $endif ; endif ;AC000;
1348 $$IF77:
1349
1350 ret
1351
1352 Process_A_Switch ENDP
1353
1354 BREAK <Submit_File>
1355 ;******************* START OF SPECIFICATIONS ***********************************
1356 ;
1357 ; NAME: Submit_File - PRINT TRANSIENT to Resident Interface Routine
1358 ;
1359 ; FUNCTION: Resolved ambiguous file names (containing ? and *) and submits
1360 ; the file to the Resident component of PRINT for printing.
1361 ;
1362 ; INPUT: File name in Parse buffer
1363 ;
1364 ; OUTPUT: None.
1365 ;
1366 ; NOTE: This code is primarily old code, but it has been completely
1367 ; restructured and SALUTed.
1368 ;
1369 ; REGISTERS USED: T.B.D.
1370 ; (NOT RESTORED)
1371 ;
1372 ; LINKAGE: Call from: TRANSIENT
1373 ;
1374 ; NORMAL -
1375 ; EXIT:
1376 ;
1377 ; ERROR -
1378 ; EXIT:
1379 ;
1380 ; EXTERNAL Call to: DispMsg Parse_Input GetAbsN
1381 ; REFERENCES: IntWhileBusy GetAbsN2
1382 ;
1383 ; CHANGE 04/01/87 - change PaFile to Submit_File - F. G.
1384 ; LOG:
1385 ;
1386 ;******************* END OF SPECIFICATIONS *************************************
1387 ;******************** START - PSEUDOCODE ***************************************
1388 ;
1389 ; START
1390 ; .
1391 ; .
1392 ; .
1393 ; .
1394 ; .
1395 ;
1396 ; INPUT: CanFlag and Ambig set appropriately
1397 ;
1398 ; if CanFlag
1399 ; set up cancel
1400 ; call IntWhileBusy
1401 ; if error
1402 ; process the error
1403 ; endif
1404 ; else
1405 ; if Ambig and
1406 ;
1407 ; call getabsn
1408 ;
1409 ; if error
1410 ; load error message
1411 ; call DispMsg
1412 ; else
1413 ; do (until not Ambig)
1414 ; call open_file
1415 ; if error
1416 ; do error handling
1417 ; else
1418 ; close file
1419 ; submit packet
1420 ; if error
1421 ; set up message
1422 ; endif
1423 ; endif
1424 ; if error
1425 ; call Dispmsg
1426 ; endif
1427 ; leave if error
1428 ; if Ambig
1429 ; call Absn2 (will set fail if at end)
1430 ; else
1431 ; set fail
1432 ; endif
1433 ; enddo on fail
1434 ; if no message
1435 ; reset fail
1436 ; endif
1437 ; endif
1438 ; endif
1439 ; .
1440 ; .
1441 ; .
1442 ; if error message
1443 ; call DispMsg
1444 ; endif
1445 ;
1446 ; ret
1447 ;
1448 ; END
1449 ;
1450 ;******************** END - PSEUDOCODE ***************************************
1451
1452 Submit_File PROC NEAR
1453
1454 ASSUME ds:DG,es:DG
1455
1456 nop ; for production - uncomment this line and comment the next
1457 ; int 3
1458 nop
1459
1460 cmp [PInst],0 ; has print been installed?
1461
1462 ; $if e ; if not ..... ;AC000;
1463 JNE $$IF81
1464
1465 call Set_Buffer ; ... better do it now ;AC000;
1466
1467 ; $endif ; endif - installed ;AC000;
1468 $$IF81:
1469
1470 cld ; just in case...
1471 mov [Ambig],0 ; assume not an ambigous file
1472
1473 ;------------------------------------
1474 ; Check for drive specifier
1475 ;------------------------------------
1476
1477 mov si,P_PTR_L ; ;AC000;
1478 mov ax,P_PTR_H ; ;AC000;
1479 mov ds,ax
1480
1481 ASSUME ds:nothing
1482
1483 mov di,offset dg:NameBuf ; buffer for full file name
1484 cmp byte ptr [si+1],":" ; check if there is a drive designator
1485
1486 ; $if ne ; if no : ;AC000;
1487 JE $$IF83
1488
1489 mov ah,Get_Default_Drive ; get it...
1490 int 21h
1491 mov dl,al ; save for later (used in DoPath)
1492 inc dl ; adjust to proper code (A=1,B=2,...)
1493 add al,"A" ; conver to letter code
1494 stosb ; store letter code
1495 mov al,":"
1496 stosb
1497 clc ; clear error flag ;AC000;
1498
1499 ; $else ; else - theres a drive ;AC000;
1500 JMP SHORT $$EN83
1501 $$IF83:
1502
1503 mov al,byte ptr [si] ; get drive letter
1504 sub al,"@" ; conver to proper code...
1505
1506 ; $if a ; if a valid drive ;AC000;
1507 JNA $$IF85
1508
1509 mov dl,al ; save for later (used in DoPath)
1510 movsb ; move the drive letter
1511 movsb ; move the ":"
1512 clc ; ;AC000;
1513
1514 ; $else ; ;AC000;
1515 JMP SHORT $$EN85
1516 $$IF85:
1517
1518 mov ax,(CLASS_B shl 8) + InvDrvMes ; set up error message ;AC000;
1519 stc ; set error flag ;AC000;
1520
1521 ; $endif ; ;AC000;
1522 $$EN85:
1523
1524 ; $endif ; endif - : ;AC000;
1525 $$EN83:
1526
1527
1528 ;------------------------------------
1529 ; could have CF & message # here
1530 ;------------------------------------
1531 ; $if nc ; if no error so far ;AC000;
1532 JC $$IF89
1533
1534 ;------------------------------------
1535 ; Check for full path
1536 ;------------------------------------
1537 mov al,[PathChar]
1538 cmp byte ptr [si],al ; does it start from the root?
1539
1540 ; $if ne ; if not get the current path ;AC000;
1541 JE $$IF90
1542
1543 stosb ; store path character
1544 push si
1545 mov si,di ; buffer for current directory
1546 mov ah,Current_Dir ; get current directory
1547 int 21h
1548
1549 ; $if c ; if an error occures ;AC000;
1550 JNC $$IF91
1551
1552 pop si ; clear the stack
1553
1554 mov ax,(CLASS_B shl 8) + InvDrvMes ; set up error message ;AC000;
1555
1556 ; $else ; else - no error so far ;AC000;
1557 JMP SHORT $$EN91
1558 $$IF91:
1559
1560
1561 ; $do ; find terminating nul ;AC000;
1562 $$DO93:
1563
1564 lodsb
1565 or al,al
1566
1567 ; $enddo z ; ;AC000;
1568 JNZ $$DO93
1569
1570 dec si ; adjust to point to nul
1571 mov ax,di ; save pointer to beg. of path
1572 mov di,si ; here is were the file name goes
1573 pop si ; points to file name
1574 cmp ax,di ; if equal then file is in the root
1575
1576 ; $if ne ; if not, add a path char ;AC000;
1577 JE $$IF95
1578
1579 mov al,[PathChar]
1580 stosb ; put path separator before file name
1581
1582 ; $endif ; ;AC000;
1583 $$IF95:
1584 ;------------------------------------
1585 ; Check for valid drive.
1586 ;------------------------------------
1587
1588 ; Done by getting current dir of
1589 ; the drive in question (already in
1590 ; DL) into NameBuf. If no error the
1591 ; valid drive and we throw away the
1592 ; current dir stuf by overwriting it
1593 ; with the filename.
1594
1595 clc ; reset error flag ;AC000;
1596
1597 ; $endif ; ;AC000;
1598 $$EN91:
1599
1600 ; $else ; else - it starts from the root ;AC000;
1601 JMP SHORT $$EN90
1602 $$IF90:
1603 ; DL has drive number (from DrvFound)
1604 push si
1605 mov si,di ; buffer for current directory
1606 mov ah,Current_Dir ; get current directory
1607 int 21h
1608 pop si
1609
1610 ; $if c ; ;AC000;
1611 JNC $$IF99
1612
1613 mov ax,(CLASS_B shl 8) + InvDrvMes ; ;AC000;
1614
1615 ; $endif ; ;AC000;
1616 $$IF99:
1617
1618 ; $endif ; ;AC000;
1619 $$EN90:
1620
1621 ; $endif ; endif errors ;AC000;
1622 $$IF89:
1623
1624 ;------------------------------------
1625 ; could have CF & message # here
1626 ;------------------------------------
1627
1628 ; $if nc ; if no error so far ;AC000;
1629 JC $$IF103
1630
1631 mov cx,MaxFileLen ; lets not overflow file name buffer
1632 mov ax,di ; CX := MaxFileLen -
1633 ; long(&NameBuf - &PtrLastchar)
1634 sub ax,offset dg:NameBuf ; size of the filename so far
1635 sub cx,ax ; size left for the filename
1636
1637 ; $if c ; if too long ;AC000;
1638 JNC $$IF104
1639
1640 mov cx,1 ; Set cx to Fall through to FNTooLong
1641
1642 ; $endif ; ;AC000;
1643 $$IF104:
1644
1645 ; WHILE (Length(FileName) <= MaxFileLen)
1646 ; $search ; DO copy in the file name ;AC000;
1647 $$DO106:
1648
1649 lodsb
1650 stosb
1651 cmp al,"*"
1652
1653 ; $if e,or ; if its ambigous - *, or...... ;AC000;
1654 JE $$LL107
1655
1656 cmp al,"?" ; :
1657
1658 ; $if e ; if its ambigous - ?, .......: ;AC000;
1659 JNE $$IF107
1660 $$LL107:
1661
1662 mov [Ambig],1 ; ambigous filename found
1663
1664 ; $endif ; endif - ambigous ;AC000;
1665 $$IF107:
1666
1667 or al,al ; end of name?
1668 clc ; ;AC000;
1669
1670 ; $exitif z ; ;AC000;
1671 JNZ $$IF106
1672
1673 ; $orelse ; ;AC000;
1674 JMP SHORT $$SR106
1675 $$IF106:
1676
1677 ; $endloop loop ; ;AC000;
1678 LOOP $$DO106
1679
1680 dec di ; the name was too long !
1681 mov [NulPtr],di
1682 mov ax,(CLASS_C shl 8) + NamTMes ; ;AC000;
1683 stc ; ;AN010;
1684
1685 ; $endsrch ; we have the full absolute name... ;AC000;
1686 $$SR106:
1687
1688
1689 ; $endif ; endif errors ;AC000;
1690 $$IF103:
1691
1692 push cs ; restore ds to DG
1693 pop ds
1694
1695 ASSUME ds:DG
1696
1697 ;------------------------------------
1698 ; could have CF & message #
1699 ;------------------------------------
1700 ; $if nc,long ; ;AC000;
1701 JNC $$XL2
1702 JMP $$IF114
1703 $$XL2:
1704
1705 dec di
1706 mov [NulPtr],di ; save pointer to termanting nul
1707
1708 ;------------------------------------
1709 ; check for an option following name
1710 ;------------------------------------
1711 call Parse_Input ; ;AC000;
1712
1713 cmp ax,noerror ; a parse error? ;AC000;
1714
1715 ; $if e ; if no parse error ;AC000;
1716 JNE $$IF115
1717
1718
1719 cmp [P_SYN],offset DG:C_SW_ptr ; is it the cancel switch /C ;AC000;
1720
1721 ; $if e ; if it is ;AC000;
1722 JNE $$IF116
1723
1724 mov [CanFlag],1 ; set cancel flag
1725
1726 ; $else ; else - it is not ;AC000;
1727 JMP SHORT $$EN116
1728 $$IF116:
1729
1730 cmp [P_SYN],offset DG:P_SW_ptr ; is it the print switch /P ;AC000;
1731
1732 ; $if e ; if it is ;AC000;
1733 JNE $$IF118
1734
1735 mov [CanFlag],0 ; reset cancel flag
1736
1737 ; $endif ; ;AC000;
1738 $$IF118:
1739
1740 ; $endif ; ;AC000;
1741 $$EN116:
1742
1743 ; $if e ; if /C or /P found ;AC000;
1744 JNE $$IF121
1745
1746 mov [ordinal],cx ; ;AC000;
1747 mov [scan_ptr],si ; ;AC000;
1748
1749 ; $endif ; ;AC000;
1750 $$IF121:
1751
1752 ; $endif ; ;AC000;
1753 $$IF115:
1754 ;--------------------------------------
1755 ;------------------------------------
1756 ; check file exists
1757 ;------------------------------------
1758
1759 cmp [CanFlag],1 ; are we in cancel mode
1760
1761 ; $if e ; if cancel mode ;AC000;
1762 JNE $$IF124
1763 ;------------------------------------
1764 ; Issue a cancel command
1765 ;------------------------------------
1766
1767 ; NOTE: ds:dx MUST point to NameFuf !!!
1768
1769 ; set up cancel
1770 mov dx,offset dg:NameBuf ; filename
1771 mov ax,0102H
1772 call IntWhileBusy
1773
1774 ; $if c ; ;AC000;
1775 JNC $$IF125
1776
1777 cmp ax,2
1778
1779 ; $if ne ; Original Print Code timing jump ;AC000;
1780 JE $$IF126
1781 ;------------------------------------
1782 ;***** PROCESS CANCEL ERROR
1783 ;------------------------------------
1784 ; $endif ; ;AC000;
1785 $$IF126:
1786
1787 mov ax,(CLASS_C shl 8) + BadCanMes ; ;AC000;
1788 stc ; ;AC000;
1789
1790 ; $endif ; ;AC000;
1791 $$IF125:
1792
1793 ; $else long ; submit mode active ;AC000;
1794 JMP $$EN124
1795 $$IF124:
1796
1797 cmp [Ambig],1 ; is this an ambigous name?
1798
1799 ; $if e,and ; if it is ambigous ;AC000;
1800 JNE $$IF130
1801
1802 ; do another ambigous name
1803 call GetAbsN ; get abs name into NameBuf
1804
1805 ; $if c ; if an error occured ;AC000;
1806 JNC $$IF130
1807
1808 mov ax,(CLASS_C shl 8) + BadNameMes ; ;AC000;
1809 call DispMsg ; call DispMsg ;AN000;
1810
1811 ; $else long ; there is at least 1 name ;AC000;
1812 JMP $$EN130
1813 $$IF130:
1814
1815 ; $do ; until all names processed ;AC000;
1816 $$DO132:
1817
1818 ; Check if this is a local drive -
1819 ; If it is, convert the filename
1820 ; to its physical name.
1821
1822 lea si,NameBuf ; DS:SI = NameBuf containing name ;AN010;
1823 mov bl,ds:[si] ; get DRIVE ID ;AN010;
1824 sub bl,40h ; convert to a number ;AN010;
1825 ; IOCtl call to see if target drive is local
1826 mov ax,(IOCTL SHL 8) + 9 ;AN010;
1827 INT 21h ; IOCtl + dev_local <4409> ;AN010;
1828
1829 ; $if nc,and ; target drive local and ;AN010;
1830 JC $$IF133
1831
1832 test dx,1200H ; check if (x & 0x1000) ;AN010;
1833 ; (redirected or shared)
1834 ; $if z,and ; if RC indicates NO network drive ;AN010;
1835 JNZ $$IF133
1836
1837 ; Translate the file name into an
1838 ; absolute path name - note that
1839 ; from this point on only SERVER DOS
1840 ; calls will work with this name!
1841
1842 lea di,TokBuf ; DS:DI = output buffer ;AN010;
1843 mov ax,(xNameTrans SHL 8) ; check for name translation ;AN010;
1844 int 21h ; get real path and name ;AN010;
1845
1846 ; $if nc ; if no errors so far ;AN010;
1847 JC $$IF133
1848
1849 xchg di,si ; switch source and destination ;AN010;
1850 mov cx,((MaxFileLen+16)/2) ; move Max buffer ;AN010;
1851 cld ;AN010;
1852 rep movsw ; move name back into NameBuf ;AN010;
1853
1854 ; $endif ; ;AN010;
1855 $$IF133:
1856 ; set up to open file
1857 xor cx,cx ; zero attribute type ;AC000;
1858 mov di,cx ; ;AC001;
1859 dec di ; no list supplied ;AC001;
1860 mov dx,(ignore_cp shl 8) + (failopen shl 4) + openit ; ;AC001;
1861 mov open_seg,es ; segment fix up for OPEN_FILE ;AC000;
1862 lds si,OPEN_FILE ; ;AC001;
1863 mov bx,open_mode ; set open mode ;AC000;
1864 mov ah,ExtOpen ; open for reading exist. ;AN010;
1865 mov al,ds:[si] ; recover drive ID ;AN010;
1866
1867 call TO_DOS ; make a SERVER DOS call ;AC010;
1868
1869 ; $if c ; if error ;AC000;
1870 JNC $$IF135
1871
1872 ; do error handling
1873 SaveReg <SI,DI,BP,ES,DS>
1874
1875 mov ah,GetExtendedError
1876 int 21h
1877 mov ah,DOS_error
1878
1879 RestoreReg <DS,ES,BP,DI,SI>
1880 stc ; ;AC000;
1881
1882 ; $else ; ;AC000;
1883 JMP SHORT $$EN135
1884 $$IF135:
1885 ; close file
1886 mov bx,ax ; copy handle
1887 mov ah,close
1888 int 21h ;
1889 clc ; clear error flag ;AC000;
1890
1891 ; submit packet
1892 mov dx,offset dg:NameBuf ;
1893 mov word ptr [SubPack+1],dx ; store pointer to name in
1894 mov word ptr [SubPack+3],ds ; submit packet
1895 mov dx,offset dg:SubPack ; DS:DX address of packet
1896 mov ax,0101H ; submit a file to resident
1897 call IntWhileBusy
1898
1899 ; $if nc,and ; if successfull, or ;AC000;
1900 JC $$IF137
1901
1902 cmp ax,error_queue_full
1903
1904 ; $if ne ; if error but queue not full ;AC000;
1905 JE $$IF137
1906
1907 mov [QFullMes],0 ; queue is not full
1908 clc ; reset the error flag ;AC000;
1909
1910 ; $else ; else - the queue IS full ;AC000;
1911 JMP SHORT $$EN137
1912 $$IF137:
1913
1914 cmp [QFullMes],1 ; has the message already been issued?
1915
1916 ; $if ne ; if the message has not been posted ;AC000;
1917 JE $$IF139
1918
1919 mov [QFullMes],1 ; set the 'message posted' flag
1920 mov ax,(CLASS_B shl 8) + FullMes ; load msg # ;AC000;
1921 stc ; display the message ;AC000;
1922 ; $else
1923 JMP SHORT $$EN139
1924 $$IF139:
1925 clc ; make sure carry clear
1926 ; $endif ; message processed ;AC000;
1927 $$EN139:
1928
1929 ; $endif ; queue errors ;AC000;
1930 $$EN137:
1931
1932 ; $endif ; OPENing errors ;AC000;
1933 $$EN135:
1934
1935 ; $if c ; if error ;AC000;
1936 JNC $$IF144
1937
1938 call DispMsg ; display the error with this file ;AC000;
1939
1940 ; $endif ; ;AC000;
1941 $$IF144:
1942
1943 ; $leave c ; quit if error in displaying message ;AC000;
1944 JC $$EN132
1945
1946 cmp [Ambig],1 ; are we processing an ambigous name?
1947
1948 ; $if e ; if Ambiguous ;AC000;
1949 JNE $$IF147
1950 ; call Absn2 (will set fail if at end)
1951 call GetAbsN2 ; get another file name
1952
1953 ; $else ; ;AC000;
1954 JMP SHORT $$EN147
1955 $$IF147:
1956
1957 mov ax,0 ; set fail ;AC000;
1958 stc ; ;AC000;
1959
1960 ; $endif ; ;AC000;
1961 $$EN147:
1962
1963 ; $enddo c,long ; end do on fail ;AC000;
1964 JC $$XL3
1965 JMP $$DO132
1966 $$XL3:
1967 $$EN132:
1968
1969 cmp ax,0 ; is there a message? ;AC000;
1970
1971 ; $if e ; if no message ;AC000;
1972 JNE $$IF151
1973
1974 clc ; reset fail ;AC000;
1975
1976 ; $endif ; no message to display ;AC000;
1977 $$IF151:
1978
1979 ; $endif ; any submission errors ;AC000;
1980 $$EN130:
1981
1982 ; $endif ; submit or cancel ;AC000;
1983 $$EN124:
1984
1985 ; $endif ; any errors so far ;AC000;
1986 $$IF114:
1987
1988 ; $if c ; if error ;AC000;
1989 JNC $$IF156
1990
1991 call DispMsg ; display the submit error ;AC000;
1992
1993 ; $endif ; ;AC000;
1994 $$IF156:
1995
1996 ret ; finished submission ;AC000;
1997
1998 Submit_File ENDP
1999
2000 BREAK <Set_Buffer>
2001 ;******************* START OF SPECIFICATIONS ***********************************
2002 ;
2003 ; NAME: Set_Buffer - PRINT Build Resident Buffer routine.
2004 ;
2005 ; FUNCTION: Calculate the buffer size required by the resident component and
2006 ; move the transient portion accordingly
2007 ;
2008 ; NOTE: This code is primarily old code, but it has been partly
2009 ; restructured in order to SALUT it.
2010 ;
2011 ; INPUT: None.
2012 ;
2013 ; OUTPUT: Resident Buffer established, and TRANSIENT moved accordingly.
2014 ;
2015 ; REGISTERS USED: T.B.D.
2016 ; (NOT RESTORED)
2017 ;
2018 ; LINKAGE: Called from: TRANSIENT
2019 ;
2020 ; NORMAL -
2021 ; EXIT:
2022 ;
2023 ; ERROR -
2024 ; EXIT:
2025 ;
2026 ; EXTERNAL Calls to: DispMsg, Parse_Input
2027 ; REFERENCES:
2028 ;
2029 ; CHANGE 03/11/87 - Change SETBUF to Set_Buffer - F. G.
2030 ; LOG:
2031 ;
2032 ;******************* END OF SPECIFICATIONS *************************************
2033 ;******************** START - PSEUDOCODE ***************************************
2034 ;
2035 ; START
2036 ; END
2037 ;
2038 ;******************** END - PSEUDOCODE ***************************************
2039
2040 Set_Buffer PROC NEAR
2041
2042 push cs
2043 pop ds
2044 assume ds:DG
2045 mov dl,[PathChar] ; transfer PathChar (in PRINT_T)
2046 mov ax,CodeR
2047 mov es,ax
2048 assume es:CodeR
2049 mov [PChar],dl ; to PChar (in PRINT_R)
2050
2051
2052 ;------------------------------------
2053 ; check device
2054 ;------------------------------------
2055
2056 cmp [DevSpec],1 ; was it already specified?
2057
2058 ; $if ne,and ; if not specified ........... ;AC000;
2059 JE $$IF158
2060
2061 lea di,TokBuf ; ES:DI point to TokBuf : ;AC000;
2062 mov [TokBuf],9 ; max of 9 chars :
2063 mov [TokBuf+1],0 ; assume zero in :
2064
2065 push es ; ;AC000;
2066 mov ax,ds ; ;AC000;
2067 mov es,ax ; ;AC000;
2068
2069 assume es:DG ; ;AC000;
2070
2071 mov ax,(CLASS_D shl 8) + prompt ; DispMsg treats 'prompt' as : ;AC000;
2072 ; a special case :
2073 call DispMsg ; : ;AC000;
2074
2075 mov ax,(CLASS_B shl 8) + NEXT_LINE ; advance to next line after : ;AC000;
2076 ; "buffered input" call:
2077 call DispMsg ; : ;AC000;
2078
2079 pop es ; ;AC000;
2080
2081 assume es:CodeR
2082
2083 mov cl,[TokBuf+1] ; check how many read in :
2084 or cl,cl ; :
2085
2086 ; $if nz ; if a CR was typed..........: ;AC000;
2087 JZ $$IF158
2088
2089 xor ch,ch
2090 mov si,offset dg:TokBuf+2
2091 mov di,offset CodeR:ListName
2092 push si
2093 mov dx,si ; get ready to capitalize ;AN007;
2094 add si,cx
2095 mov byte ptr [si],0 ; turn it into an ascii z string ;AN007;
2096 mov ax,(GetExtCntry SHL 8) + Cap_ASCIIZ ; let DOS capitalize the string ;AN007;
2097 INT 21h ; call DOS to do it ;AN007;
2098 dec si
2099 cmp byte ptr [si],':'
2100
2101 ; $if e ; if a : ;AC000;
2102 JNE $$IF159
2103 dec cx ; get rid of trailing ':'
2104 ; $endif ; endif - a : ;AC000;
2105 $$IF159:
2106
2107 cmp cx,8 ; is it greater than 8 ? ;AN000;
2108
2109 ; $if a ; if greater - force it to 8.: ;AC000;
2110 JNA $$IF161
2111
2112 mov cx,8 ; ;AN000;
2113
2114 ; $endif ; ;AC000;
2115 $$IF161:
2116
2117 pop si
2118
2119 rep movsb ; ;AC000;
2120
2121 ; $endif ; ;AC000;
2122 $$IF158:
2123 ;------------------------------------
2124 ; queue size
2125 ;------------------------------------
2126 push es
2127 pop ds
2128
2129 ASSUME ds:CodeR
2130
2131 mov ax,MaxFileLen ; maximum length of a file name
2132 mul [QueueLen] ; AX = result
2133 add ax,offset CodeR:FileQueue
2134 mov [EndQueue],ax ; save pointer to last nul
2135 inc ax
2136 mov [buffer],ax ; beggining of buffer
2137
2138 ;------------------------------------
2139 ;--- buffer size
2140 ;------------------------------------
2141
2142 add ax,[BlkSiz]
2143 mov [ENDPTR],AX ; Set end of buffer pointer
2144 mov [NXTCHR],AX ; Buffer empty
2145 add ax,100h ; allow for header
2146 add ax,16 ; Convert to para
2147 shr ax,1
2148 shr ax,1
2149 shr ax,1
2150 shr ax,1
2151 mov [EndRes],ax ; Add size of buffer to term res size
2152
2153 ; Now JUMP into PRINT_R - the resident
2154 jmp MoveTrans ; code to initialize the buffer space
2155
2156 TransRet: ; after moving the transient we come
2157 ; here.
2158 sti ; Ints were off during initialization
2159 push cs ; CAUTION !!!! from here on in DG is
2160 pop ax ; not the ASSEMBLED DG - its bogus -
2161 mov ds,ax ; after the move! Only PUSH/POP will
2162 mov es,ax ; work.
2163 mov WORD PTR [insert_ptr_seg],ax ; fix up segment in SUBLIST for msgs! ;AC002;
2164 mov WORD PTR [P_PTR_H],ax ; fix up segment for PARSE ;AC002;
2165
2166 ASSUME ds:DG,es:DG
2167
2168
2169 call SYSLOADMSG ; RE-Initialize the Message Services ;AN016;
2170 ; - WARNING!!! the Message retriver
2171 ; keeps track of offset and SEGMENT
2172 ; for extended and parse errors
2173 ; EVEN THOUGH WE ARE NEAR!!! since
2174 ; the location could now have been
2175 ; moved - it must now be reset
2176
2177 ;------------------------------------
2178 ; normalize int handlers for new location of dg
2179 ;------------------------------------
2180
2181 mov ax,(SET_INTERRUPT_VECTOR shl 8) or 23h
2182 mov dx,OFFSET DG:INT_23
2183 int 21h
2184 mov ax,(SET_INTERRUPT_VECTOR shl 8) or 24h
2185 mov dx,OFFSET DG:INT_24
2186 int 21h
2187
2188 mov [PInst],1 ; remember we just installed resident part
2189
2190 ret ; finished ;AC000;
2191
2192 Set_Buffer ENDP
2193
2194 BREAK <copy_to_arg_buf>
2195 ;******************* START OF SPECIFICATIONS ***********************************
2196 ;
2197 ; NAME: copy_to_arg_buf
2198 ;
2199 ; FUNCTION: Copies the names of the files in the print queue into NameBuf
2200 ; - one name copied per invocation
2201 ;
2202 ; INPUT:
2203 ;
2204 ; OUTPUT:
2205 ;
2206 ;
2207 ; REGISTERS USED: T.B.D.
2208 ;
2209 ; LINKAGE: Called from:
2210 ;
2211 ;
2212 ; CHANGE 05/20/87 - Header added - F. G.
2213 ; LOG:
2214 ;
2215 ;******************* END OF SPECIFICATIONS *************************************
2216 ;******************** START - PSEUDOCODE ***************************************
2217 ;
2218 ; START copy_to_arg_buf
2219 ;
2220 ; ret
2221 ;
2222 ; END copy_to_arg_buf
2223 ;
2224 ;******************** END - PSEUDOCODE ***************************************
2225
2226 copy_to_arg_buf PROC NEAR
2227
2228 push di
2229 push si
2230 push ax ; must preserve AX (could be message #);AN000;
2231 mov di,offset dg:NameBuf
2232
2233 ; $do ; ;AC000;
2234 $$DO164:
2235
2236 lodsb
2237 or al,al
2238
2239 ; $leave z ; ;AC000;
2240 JZ $$EN164
2241
2242 stosb
2243
2244 ; $enddo ; ;AC000;
2245 JMP SHORT $$DO164
2246 $$EN164:
2247
2248 stosb
2249 pop ax ; must preserve AX (could be message #);AN000;
2250 pop si
2251 pop di
2252
2253 ret
2254
2255 copy_to_arg_buf ENDP
2256
2257 BREAK <IntWhileBusy>
2258 ;******************* START OF SPECIFICATIONS ***********************************
2259 ;
2260 ; NAME: IntWhileBusy
2261 ;
2262 ; FUNCTION:
2263 ;
2264 ; INPUT:
2265 ;
2266 ; OUTPUT:
2267 ;
2268 ;
2269 ; REGISTERS USED: T.B.D.
2270 ;
2271 ; LINKAGE: Called from:
2272 ;
2273 ;
2274 ; CHANGE 05/20/87 - Header added - F. G.
2275 ; LOG:
2276 ;
2277 ;******************* END OF SPECIFICATIONS *************************************
2278 ;******************** START - PSEUDOCODE ***************************************
2279 ;
2280 ; START IntWhileBusy
2281 ;
2282 ; ret
2283 ;
2284 ; END IntWhileBusy
2285 ;
2286 ;******************** END - PSEUDOCODE ***************************************
2287
2288 IntWhileBusy PROC NEAR
2289
2290 ; $search complex ; ;AC000;
2291 JMP SHORT $$SS167
2292 $$DO167:
2293
2294 pop ax
2295
2296 ; $strtsrch ; ;AC000;
2297 $$SS167:
2298
2299 push ax
2300 int ComInt
2301
2302 ; $exitif nc ; ;AC000;
2303 JC $$IF167
2304
2305 add sp,2 ; clear off AX and clear carry
2306
2307 ; $orelse ; ;AC000;
2308 JMP SHORT $$SR167
2309 $$IF167:
2310
2311 cmp ax,error_busy
2312
2313 ; $leave nz ; ;AC000;
2314 JNZ $$EN167
2315
2316 ; $endloop ; ;AC000;
2317 JMP SHORT $$DO167
2318 $$EN167:
2319
2320 add sp,2 ; clear off AX
2321 stc ; ;AC000;
2322
2323 ; $endsrch ; ;AC000;
2324 $$SR167:
2325
2326 ret
2327
2328 IntWhileBusy ENDP
2329
2330 BREAK <GetAbsN>
2331 ;******************* START OF SPECIFICATIONS ***********************************
2332 ;
2333 ; NAME: GetAbsN
2334 ;
2335 ; FUNCTION: Return first absolute name from ambigous name
2336 ;
2337 ; INPUT: NameBuf has the ambigous File Name
2338 ;
2339 ; OUTPUT: Carry Set if no files match
2340 ; else NameBuf has the absolute name
2341 ;
2342 ; REGISTERS USED: T.B.D.
2343 ;
2344 ; LINKAGE: Called from:
2345 ;
2346 ;
2347 ; CHANGE 05/20/87 - Header added - F. G.
2348 ; LOG:
2349 ;
2350 ;******************* END OF SPECIFICATIONS *************************************
2351 ;******************** START - PSEUDOCODE ***************************************
2352 ;
2353 ; START GetAbsN
2354 ;
2355 ; ret
2356 ;
2357 ; END GetAbsN
2358 ;
2359 ;******************** END - PSEUDOCODE ***************************************
2360
2361 GetAbsN PROC NEAR
2362
2363 ASSUME ds:DG,es:DG
2364
2365 mov ah,Set_DMA ; buffer for ffirst / fnext
2366 mov dx,offset dg:SearchBuf
2367 int 21h
2368 ;------------------------------------
2369 ; look for a match
2370 ;------------------------------------
2371 mov dx,offset dg:NameBuf
2372 mov cx,0 ; no attributes
2373 mov ah,Find_First
2374 int 21h
2375
2376 ; $if nc ; if no error ;AC000;
2377 JC $$IF174
2378
2379 ;------------------------------------
2380 ; Place new name in NameBuf
2381 ;------------------------------------
2382 mov si,[NulPtr]
2383 std ; scan back
2384
2385 ; $do ; ;AC000;
2386 $$DO175:
2387
2388 lodsb
2389 cmp al,PathChar
2390
2391 ; $enddo e ; ;AC000;
2392 JNE $$DO175
2393
2394 cld ; just in case...
2395 inc si
2396 inc si
2397 mov [FnamPtr],si
2398 call CopyName
2399 clc ; ;AC000;
2400
2401 ; $endif ; endif -no error ;AC000;
2402 $$IF174:
2403
2404 ret
2405
2406 GetAbsN ENDP
2407
2408 BREAK <GetAbsN2>
2409 ;******************* START OF SPECIFICATIONS ***********************************
2410 ;
2411 ; NAME: GetAbsN2
2412 ;
2413 ; FUNCTION: Return next absolute name from ambigous
2414 ;
2415 ; INPUT:
2416 ;
2417 ; OUTPUT:
2418 ;
2419 ; REGISTERS USED: T.B.D.
2420 ;
2421 ; LINKAGE: Called from:
2422 ;
2423 ;
2424 ; CHANGE 05/20/87 - Header added - F. G.
2425 ; LOG:
2426 ;
2427 ;******************* END OF SPECIFICATIONS *************************************
2428 ;******************** START - PSEUDOCODE ***************************************
2429 ;
2430 ; START GetAbsN2
2431 ;
2432 ; ret
2433 ;
2434 ; END GetAbsN2
2435 ;
2436 ;******************** END - PSEUDOCODE ***************************************
2437
2438 GetAbsN2 PROC NEAR
2439
2440 mov ah,Set_DMA ; buffer for ffirst / fnext
2441 mov dx,offset dg:SearchBuf
2442 int 21h
2443 mov ah,Find_Next
2444 int 21h
2445
2446 ; $if nc ; if no error ;AC000;
2447 JC $$IF178
2448
2449 call CopyName ; we found one
2450 clc ; ;AC000;
2451
2452 ; $endif ; endif - no error ;AC000;
2453 $$IF178:
2454
2455 mov ax,0 ; signal no message available
2456
2457 ret ; return
2458
2459 GetAbsN2 ENDP
2460
2461 BREAK <CopyName>
2462 ;******************* START OF SPECIFICATIONS ***********************************
2463 ;
2464 ; NAME: CopyName
2465 ;
2466 ; FUNCTION: Copy name from search buf to NameBuf
2467 ;
2468 ; INPUT:
2469 ;
2470 ; OUTPUT:
2471 ;
2472 ; REGISTERS USED: T.B.D.
2473 ;
2474 ; LINKAGE: Called from:
2475 ;
2476 ;
2477 ; CHANGE 05/20/87 - Header added - F. G.
2478 ; LOG:
2479 ;
2480 ;******************* END OF SPECIFICATIONS *************************************
2481 ;******************** START - PSEUDOCODE ***************************************
2482 ;
2483 ; START CopyName
2484 ;
2485 ; ret
2486 ;
2487 ; END CopyName
2488 ;
2489 ;******************** END - PSEUDOCODE ***************************************
2490
2491 CopyName PROC NEAR
2492
2493 mov di,[FNamPtr]
2494 mov si,offset dg:SearchBuf.find_buf_pname
2495 cld
2496
2497 ; $do ; until null is found ;AC000;
2498 $$DO180:
2499
2500 lodsb ; move the name
2501 stosb
2502 or al,al ; nul found?
2503
2504 ; $enddo e ; ;AC000;
2505 JNE $$DO180
2506
2507 ret
2508
2509 CopyName ENDP
2510
2511 BREAK <Save_Vectors>
2512 ;******************* START OF SPECIFICATIONS ***********************************
2513 ;
2514 ; NAME: Save_Vectors
2515 ;
2516 ; FUNCTION: save int vectors in case of error
2517 ;
2518 ; INPUT:
2519 ;
2520 ; OUTPUT:
2521 ;
2522 ; REGISTERS USED: T.B.D.
2523 ;
2524 ; LINKAGE: Called from:
2525 ;
2526 ;
2527 ; CHANGE 05/20/87 - Header added - F. G.
2528 ; LOG:
2529 ;
2530 ;******************* END OF SPECIFICATIONS *************************************
2531 ;******************** START - PSEUDOCODE ***************************************
2532 ;
2533 ; START Save_Vectors
2534 ;
2535 ; ret
2536 ;
2537 ; END Save_Vectors
2538 ;
2539 ;******************** END - PSEUDOCODE ***************************************
2540
2541 Save_Vectors PROC NEAR
2542
2543 mov ax,(get_interrupt_vector shl 8) or SOFTINT ; (SOFTINT)
2544 int 21h
2545
2546 ASSUME es:nothing
2547
2548 mov word ptr [i28vec+2],es
2549 mov word ptr [i28vec],bx
2550
2551 mov ax,(get_interrupt_vector shl 8) or COMINT ; (COMINT)
2552 int 21h
2553 mov word ptr [i2fvec+2],es
2554 mov word ptr [i2fvec],bx
2555
2556 mov ax,(get_interrupt_vector shl 8) or 13h
2557 int 21h
2558 mov word ptr [i13vec+2],es
2559 mov word ptr [i13vec],bx
2560
2561 mov ax,(get_interrupt_vector shl 8) or 15h
2562 int 21h
2563 mov word ptr [i15vec+2],es
2564 mov word ptr [i15vec],bx
2565
2566 mov ax,(get_interrupt_vector shl 8) or 17h
2567 int 21h
2568 mov word ptr [i17vec+2],es
2569 mov word ptr [i17vec],bx
2570
2571 mov ax,(get_interrupt_vector shl 8) or 14h
2572 int 21h
2573 mov word ptr [i14vec+2],es
2574 mov word ptr [i14vec],bx
2575
2576 mov ax,(get_interrupt_vector shl 8) or 05h
2577 int 21h
2578 mov word ptr [i05vec+2],es
2579 mov word ptr [i05vec],bx
2580
2581 mov ax,(get_interrupt_vector shl 8) or INTLOC ; (INTLOC)
2582 int 21h
2583 mov word ptr [i1cvec+2],es
2584 mov word ptr [i1cvec],bx
2585
2586 push cs
2587 pop es
2588
2589 ASSUME es:DG
2590
2591 Save_Vectors ENDP
2592
2593 BREAK <GetHInt>
2594 ;******************* START OF SPECIFICATIONS ***********************************
2595 ;
2596 ; NAME: GetHInt
2597 ;
2598 ; FUNCTION: Install PRINT Interupt Handler routines
2599 ;
2600 ; INPUT:
2601 ;
2602 ; OUTPUT:
2603 ;
2604 ; REGISTERS USED: T.B.D.
2605 ;
2606 ; LINKAGE: Called from: TRANSIENT,
2607 ;
2608 ;
2609 ; CHANGE 05/20/87 - Header added - F. G.
2610 ; LOG:
2611 ;
2612 ;******************* END OF SPECIFICATIONS *************************************
2613 ;******************** START - PSEUDOCODE ***************************************
2614 ;
2615 ; START GetHInt
2616 ;
2617 ; ret
2618 ;
2619 ; END GetHInt
2620 ;
2621 ;******************** END - PSEUDOCODE ***************************************
2622
2623 GetHInt PROC NEAR
2624
2625 ASSUME ds:DG,es:DG
2626
2627 push es
2628 mov ax,(GET_INTERRUPT_VECTOR shl 8) OR 24h
2629 int 21h
2630
2631 ASSUME es:nothing
2632
2633 mov WORD PTR [HARDCH],bx
2634 mov WORD PTR [HARDCH+2],es
2635 pop es
2636
2637 ASSUME es:DG
2638
2639 ret
2640
2641 GetHInt ENDP
2642
2643 BREAK <SetInts>
2644 ;******************* START OF SPECIFICATIONS ***********************************
2645 ;
2646 ; NAME: SetInts
2647 ;
2648 ; FUNCTION: Install PRINT Interupt Handler routines
2649 ;
2650 ; INPUT:
2651 ;
2652 ; OUTPUT:
2653 ;
2654 ; REGISTERS USED: T.B.D.
2655 ; (NOT RESTORED)
2656 ;
2657 ; LINKAGE: Called from: TRANSIENT,
2658 ;
2659 ; NORMAL
2660 ; EXIT:
2661 ;
2662 ; ERROR
2663 ; EXIT:
2664 ;
2665 ; EXTERNAL
2666 ; REFERENCES:
2667 ;
2668 ; CHANGE 05/20/87 - Header added - F. G.
2669 ; LOG:
2670 ;
2671 ;******************* END OF SPECIFICATIONS *************************************
2672 ;******************** START - PSEUDOCODE ***************************************
2673 ;
2674 ; START SetInts
2675 ;
2676 ; ret
2677 ;
2678 ; END SetInts
2679 ;
2680 ;******************** END - PSEUDOCODE ***************************************
2681
2682 SetInts PROC NEAR
2683
2684 ASSUME ds:DG,es:DG
2685
2686 mov AX,(SET_INTERRUPT_VECTOR shl 8) OR 23h
2687 mov DX,OFFSET DG:INT_23
2688 int 21h
2689
2690 mov ax,(SET_INTERRUPT_VECTOR shl 8) OR 24h
2691 mov dx,OFFSET DG:INT_24
2692 int 21h
2693
2694 ret
2695
2696 SetInts ENDP
2697
2698 BREAK <Int_24>
2699 ;******************* START OF SPECIFICATIONS ***********************************
2700 ;
2701 ; NAME: Int_24
2702 ;
2703 ; FUNCTION: INT 24 handler
2704 ;
2705 ; INPUT:
2706 ;
2707 ; OUTPUT:
2708 ;
2709 ; NOTE: This is coded as a PROC but is never called
2710 ;
2711 ; REGISTERS USED: T.B.D.
2712 ; (NOT RESTORED)
2713 ;
2714 ; LINKAGE: INTerupt 24
2715 ;
2716 ; NORMAL
2717 ; EXIT:
2718 ;
2719 ; ERROR
2720 ; EXIT:
2721 ;
2722 ; CHANGE 05/20/87 - Header added - F. G.
2723 ; LOG:
2724 ;
2725 ;******************* END OF SPECIFICATIONS *************************************
2726 ;******************** START - PSEUDOCODE ***************************************
2727 ;
2728 ; START Int_24
2729 ;
2730 ; ret
2731 ;
2732 ; END Int_24
2733 ;
2734 ;******************** END - PSEUDOCODE ***************************************
2735
2736
2737 INT_24_RETADDR DW OFFSET DG:INT_24_BACK
2738
2739 in_int_23 db 0 ; reentrancy flag
2740
2741
2742 INT_24 PROC FAR
2743
2744 ASSUME ds:nothing,es:nothing,ss:nothing
2745
2746 pushf
2747 push cs
2748 push [INT_24_RETADDR]
2749 push WORD PTR [HARDCH+2]
2750 push WORD PTR [HARDCH]
2751
2752 ret
2753
2754 INT_24 ENDP
2755
2756 BREAK <INT_24_BACK>
2757 ;******************* START OF SPECIFICATIONS ***********************************
2758 ;
2759 ; NAME: INT_24_BACK
2760 ;
2761 ; FUNCTION: INT 24 post processor
2762 ;
2763 ; INPUT:
2764 ;
2765 ; OUTPUT:
2766 ;
2767 ; NOTE: This is NOT a PROC
2768 ;
2769 ; REGISTERS USED: T.B.D.
2770 ; (NOT RESTORED)
2771 ;
2772 ; LINKAGE: INTerupt 24
2773 ;
2774 ; NORMAL
2775 ; EXIT:
2776 ;
2777 ; ERROR
2778 ; EXIT:
2779 ;
2780 ; CHANGE 05/20/87 - Header added - F. G.
2781 ; LOG:
2782 ;
2783 ;******************* END OF SPECIFICATIONS *************************************
2784 ;******************** START - PSEUDOCODE ***************************************
2785 ;
2786 ; START INT_24_BACK
2787 ;
2788 ; ret
2789 ;
2790 ; END INT_24_BACK
2791 ;
2792 ;******************** END - PSEUDOCODE ***************************************
2793
2794 INT_24_BACK:
2795
2796 cmp al,2 ; Abort?
2797
2798 ; $if z ; if abort ;AC000;
2799 JNZ $$IF182
2800
2801 inc [in_int_23] ; no int 23's allowed
2802 push cs
2803 pop ds
2804
2805 ASSUME ds:DG
2806
2807 push cs
2808 pop ss
2809
2810 ASSUME ss:DG
2811
2812 mov sp, offset dg:intStk ; setup local int stack
2813 cmp [PInst],2
2814
2815 ; $if ne ; if not installed ;AC000;
2816 JE $$IF183
2817
2818 call Restore_ints
2819
2820 ; $endif ; endif - not installed ;AC000;
2821 $$IF183:
2822
2823 mov ah,EXIT
2824 mov al,0FFH
2825 int 21h
2826
2827 ; $endif ; endif - abort
2828 $$IF182:
2829
2830 IRET
2831
2832 BREAK <Int_23>
2833 ;******************* START OF SPECIFICATIONS ***********************************
2834 ;
2835 ; NAME: Int_23
2836 ;
2837 ; FUNCTION: INT 23 handler
2838 ;
2839 ; INPUT:
2840 ;
2841 ; OUTPUT:
2842 ;
2843 ; NOTE: This is NOT a PROC
2844 ;
2845 ; REGISTERS USED: T.B.D.
2846 ; (NOT RESTORED)
2847 ;
2848 ; LINKAGE: INTerupt 23
2849 ;
2850 ; NORMAL
2851 ; EXIT:
2852 ;
2853 ; ERROR
2854 ; EXIT:
2855 ;
2856 ; CHANGE 05/20/87 - Header added - F. G.
2857 ; LOG:
2858 ;
2859 ;******************* END OF SPECIFICATIONS *************************************
2860 ;******************** START - PSEUDOCODE ***************************************
2861 ;
2862 ; START Int_23
2863 ;
2864 ; ret
2865 ;
2866 ; END Int_23
2867 ;
2868 ;******************** END - PSEUDOCODE ***************************************
2869
2870 INT_23:
2871
2872 ASSUME ds:nothing,es:nothing,ss:nothing
2873
2874 cmp [in_int_23],0 ; check for a re-entrant call
2875
2876 ; $if e ; If its OK ;AC000;
2877 JNE $$IF186
2878
2879 inc [in_int_23] ; make sure no more int 23's
2880 push cs
2881 pop ds
2882
2883 ASSUME ds:DG
2884
2885 push cs
2886 pop ss
2887
2888 ASSUME ss:DG
2889
2890 mov sp, offset dg:intStk ; setup local int stack
2891 cmp [PInst],2
2892
2893 ; $if ne ; if not installed - undo ;AC000;
2894 JE $$IF187
2895
2896 call Restore_ints ; ;AC000;
2897
2898 ; $else ; else - dont undo ;AC000;
2899 JMP SHORT $$EN187
2900 $$IF187:
2901
2902 mov ax,0105H
2903 call IntWhileBusy ; unlock print queue (just in case)
2904
2905 ; $endif ; endif - undo ;AC000;
2906 $$EN187:
2907
2908 mov ah,EXIT
2909 mov al,0FFH
2910 int 21h
2911
2912 ; $endif ; endif - its OK ;AC000;
2913 $$IF186:
2914
2915 iret ;
2916
2917 BREAK <Restore_ints>
2918 ;******************* START OF SPECIFICATIONS ***********************************
2919 ;
2920 ; NAME: Restore_ints
2921 ;
2922 ; FUNCTION: Restore all ints used by print to original values
2923 ;
2924 ; INPUT:
2925 ;
2926 ; OUTPUT:
2927 ;
2928 ; REGISTERS USED: T.B.D.
2929 ; (NOT RESTORED)
2930 ;
2931 ; LINKAGE: Called from: TRANSIENT,
2932 ;
2933 ; NORMAL
2934 ; EXIT:
2935 ;
2936 ; ERROR
2937 ; EXIT:
2938 ;
2939 ; EXTERNAL
2940 ; REFERENCES:
2941 ;
2942 ; CHANGE 05/20/87 - Header added - F. G.
2943 ; LOG:
2944 ;
2945 ;******************* END OF SPECIFICATIONS *************************************
2946 ;******************** START - PSEUDOCODE ***************************************
2947 ;
2948 ; START Restore_ints
2949 ;
2950 ; ret
2951 ;
2952 ; END Restore_ints
2953 ;
2954 ;******************** END - PSEUDOCODE ***************************************
2955
2956 Restore_ints PROC NEAR
2957
2958 ASSUME ds:DG,es:nothing,ss:DG
2959
2960 cli
2961 mov ax,(set_interrupt_vector shl 8) or SOFTINT ; (SOFTINT)
2962 push ds
2963 lds dx,[i28vec]
2964 int 21h
2965 pop ds
2966
2967 mov ax,(set_interrupt_vector shl 8) or COMINT ; (COMINT)
2968 push ds
2969 lds dx,[i2fvec]
2970 int 21h
2971 pop ds
2972
2973 mov ax,(set_interrupt_vector shl 8) or 13h
2974 push ds
2975 lds dx,[i13vec]
2976 int 21h
2977 pop ds
2978
2979 mov ax,(set_interrupt_vector shl 8) or 15h
2980 push ds
2981 lds dx,[i15vec]
2982 int 21h
2983 pop ds
2984
2985 mov ax,(set_interrupt_vector shl 8) or 17h
2986 push ds
2987 lds dx,[i17vec]
2988 int 21h
2989 pop ds
2990
2991 mov ax,(set_interrupt_vector shl 8) or 14h
2992 push ds
2993 lds dx,[i14vec]
2994 int 21h
2995 pop ds
2996
2997 mov ax,(set_interrupt_vector shl 8) or 05h
2998 push ds
2999 lds dx,[i05vec]
3000 int 21h
3001 pop ds
3002
3003 mov ax,(set_interrupt_vector shl 8) or INTLOC ; (INTLOC)
3004 push ds
3005 lds dx,[i1cvec]
3006 int 21h
3007 pop ds
3008 sti
3009
3010 ret
3011
3012 Restore_ints ENDP
3013
3014
3015 BREAK <Parse_Input>
3016 ;******************* START OF SPECIFICATIONS ***********************************
3017 ;
3018 ; NAME: Parse_Input - PRINT Command Line Parser
3019 ;
3020 ; FUNCTION: Call the DOS PARSE Service Routines to process the command
3021 ; line. Search for valid input:
3022 ; - filenames (may be more than one
3023 ; - switches: /D:device
3024 ; /B:buffsize 512 to 16k - 512 default
3025 ; /Q:quesiz 4 to 32 - 10 default
3026 ; /S:timeslice 1 to 255 - 8 default
3027 ; /U:busytick 1 to 255 - 1 default
3028 ; /M:maxtick 1 to 255 - 2 default
3029 ; /T terminate
3030 ; /C cancel
3031 ; /P print
3032 ;
3033 ; INPUT: Current Parse parameters in the Parse_C_B
3034 ; [ORDINAL] - CURRENT ORDINAL VALUE
3035 ; [SCAN_PTR] - CURRENT SCAN POINT
3036 ; - DS:[SCAN_PTR] - Pionter to Parse string
3037 ; ES:DI - Pointer to PARMS block
3038 ;
3039 ; OUTPUT: PARSE_BUFF filled in:
3040 ;
3041 ; P_TYPE - TYPE RETURNED
3042 ; P_ITEM_TAG - SPACE FOR ITEM TAG
3043 ; P_SYN - POINTER TO LIST ENTRY
3044 ; P_PTR_L - SPACE FOR POINTER / VALUE - LOW
3045 ; P_PTR_H - SPACE FOR POINTER / VALUE - HIGH
3046 ;
3047 ; REGISTERS USED: T.B.D.
3048 ; (NOT RESTORED)
3049 ;
3050 ; LINKAGE: Called from: TRANSIENT, Set_Buffer and Submit_File
3051 ;
3052 ; NORMAL CF = 0
3053 ; EXIT:
3054 ;
3055 ; ERROR CF = 1 If user enters:
3056 ; EXIT: - any invalid parameter or switch
3057 ; - an invalid value for a valid switch
3058 ; AX = Parse error number
3059 ;
3060 ; EXTERNAL - System parse service routines
3061 ; REFERENCES:
3062 ;
3063 ; CHANGE 03/11/87 - First release - F. G.
3064 ; LOG:
3065 ;
3066 ;******************* END OF SPECIFICATIONS *************************************
3067 ;******************** START - PSEUDOCODE ***************************************
3068 ;
3069 ; START
3070 ; END
3071 ;
3072 ;******************** END - PSEUDOCODE ***************************************
3073
3074 Parse_Input PROC NEAR
3075
3076 Syntax_Error equ 9 ; Parse syntax error
3077 Parse_EOL equ 0FFh ; Parse End Of Line
3078 ;--------------------------------------
3079 ; Load appropriate registers
3080 ; from the Parse_Control_Block
3081 ;--------------------------------------
3082 ASSUME ds:DG,es:DG,ss:nothing
3083
3084 mov cx,[ORDINAL] ; CURRENT ORDINAL VALUE ;AN000;
3085 mov si,[SCAN_PTR] ; CURRENT SCAN POINT ;AN000;
3086 mov [MSG_PTR],si ; Save start in case of error ;AN000;
3087 lea di,PARMS ; ;AN000;
3088 mov dx,0 ; RESERVED ;AN000;
3089 push ds ; ;AN000;
3090 mov ax,CodeR ; ;AN000;
3091 sub ax,10h ; back up 100h to start of psp ;AN000;
3092 mov ds,ax ; DS:SI = command string in PSP ;AN000;
3093
3094 ;--------------------------------------
3095 ASSUME ds:nothing ; Call the Parse service routines
3096 ;--------------------------------------
3097
3098 ; CX - Ordinal value
3099 ; DX - zero (reserved)
3100 ; DS:SI - Pionter to Parse string
3101 ; ES:DI - Pointer to PARMS block
3102
3103 call SYSPARSE ; PARSE IT! ;AN000;
3104
3105 pop ds ; ;AN000;
3106
3107 ASSUME ds:DG
3108
3109 cmp ax,NOERROR ; no errors? ;AN000;
3110
3111 ; $if e ; if no errors ;AN000;
3112 JNE $$IF191
3113
3114 clc ; WE'ER DONE ;AN000;
3115
3116 ; $else ; else - there was an error ;AN000;
3117 JMP SHORT $$EN191
3118 $$IF191:
3119
3120 cmp al,Parse_EOL ; error FFh ? ;AN000;
3121
3122 ; $if ne ; if not EOL ;AN000;
3123 JE $$IF193
3124
3125 cmp al,Syntax_Error ; error 1 to 9 ? ;AN000;
3126
3127 ; $if a ; if parse error ;AN000;
3128 JNA $$IF194
3129
3130 mov al,Syntax_Error ; Parse syntax error
3131
3132 ; $endif ; endif errors ;AN000;
3133 $$IF194:
3134
3135 lea bx,Parse_Ret_Code
3136 xlat cs:[bx]
3137
3138 ; $endif ; endif errors ;AN000;
3139 $$IF193:
3140
3141 stc ; SET ERROR FLAG ;AN000;
3142
3143 ; $endif ; endif - no error ;AN000;
3144 $$EN191:
3145
3146 ret ; NORMAL RETURN TO CALLER ;AN000;
3147
3148 Parse_Ret_Code label byte
3149
3150 db 0 ; Ret Code 0 - ;AC003;
3151 db 9 ; Ret Code 1 - Too many parameters ;AC003;
3152 db 9 ; Ret Code 2 - Required parameter msg ;AC003;
3153 db 3 ; Ret Code 3 - Invalid switch ;AC003;
3154 db 9 ; Ret Code 4 - Invalid keyword ;AC003;
3155 db 9 ; Ret Code 5 - (reserved) ;AC003;
3156 db 6 ; Ret Code 6 - Parm val out of range ;AC003;
3157 db 9 ; Ret Code 7 - Parameter val not allow ;AC003;
3158 db 9 ; Ret Code 8 - Parm format not correct ;AC003;
3159 db 9 ; Ret Code 9 - Invalid Parameter ;AC003;
3160
3161 Parse_Input ENDP
3162
3163
3164
3165 BREAK <DispMsg>
3166 ;******************* START OF SPECIFICATIONS ***********************************
3167 ;
3168 ; NAME: DispMsg - PRINT Display Transient Message Routine
3169 ;
3170 ; FUNCTION: Display the transient messages for PRINT
3171 ;
3172 ; INPUT: Al = message number
3173 ; Ah = class - 0 - Message Service class
3174 ; 1 - DOS extended error
3175 ; 2 - Parse error
3176 ; A - PRINT_R message
3177 ; B - PRINT_T message
3178 ; C - PRINT_T message with insert
3179 ; DS:SI = sublist
3180 ; D - PRINT_T message with input buffer where:
3181 ; ES:DI = input buffer
3182 ; OUTPUT: - Messages output to Output Device
3183 ;
3184 ; REGISTERS USED: CX DX
3185 ; (NOT RESTORED)
3186 ;
3187 ; LINKAGE: Call from PRINT_R, TRANSIENT
3188 ;
3189 ; NORMAL -
3190 ; EXIT:
3191 ;
3192 ; ERROR -
3193 ; EXIT:
3194 ;
3195 ; CHANGE 03/11/87 - First release - F. G.
3196 ; LOG: 09/28/87 - move back to tranient - make 'NEAR'
3197 ;
3198 ;******************* END OF SPECIFICATIONS *************************************
3199 ;******************** START - PSEUDOCODE ***************************************
3200 ;
3201 ; START DispMsg
3202 ;
3203 ; point to SUBLIST
3204 ; reset response (DL)
3205 ; set class to utility (DH)
3206 ; reset insert (CX)
3207 ; set output handle (BX)
3208 ; if CLASS requires insert
3209 ; load insert required
3210 ; endif
3211 ; if CLASS requires response
3212 ; flush keystroke buffer
3213 ; load response required (Dir CON in no echo)
3214 ; endif
3215 ; if CLASS is not Utility
3216 ; set CLASS
3217 ; endif
3218 ; call SysDispMsg to display message
3219 ; if error
3220 ; set class to DOS_error
3221 ; set error flag
3222 ; endif
3223 ;
3224 ; ret
3225 ;
3226 ; END DispMsg
3227 ;
3228 ;******************** END - PSEUDOCODE ***************************************
3229
3230 DispMsg PROC NEAR
3231
3232 ASSUME CS:DG,DS:nothing,ES:nothing,SS:nothing
3233
3234 push ds ; ;AN000;
3235 push si ; ;AN000;
3236 push cs ; called before and after relocation ;AC002;
3237 pop ds ; - don't use DG ;AC002;
3238
3239 ASSUME CS:DG,DS:DG,ES:nothing,SS:nothing
3240
3241 lea si,SUBLIST ; point to sublist ;AN000;
3242 xor dx,dx ; reset response (DL) ;AN000;
3243 dec dh ; ;AN000;
3244 xor cx,cx ; reset insert (CX) ;AN000;
3245 mov bx,STDOUT ; set output handle (BX) ;AC014;
3246
3247 cmp ah,CLASS_C ; is it CLASS C ;AN000;
3248
3249 ; $if e,or ; CLASS C requires insert ;AC012;
3250 JE $$LL198
3251
3252 cmp ah,DOS_Error ; is it a DOS error? ;AN012;
3253
3254 ; $if e ; DOS requires insert ;AN012;
3255 JNE $$IF198
3256 $$LL198:
3257
3258 mov cx,offset DG:NameBuf ; set up insert pointer to NameBuf ;AN005;
3259 mov insert_ptr_off,cx ; ;AN005;
3260 push cs ; ;AN005;
3261 pop [insert_ptr_seg] ; ;AN005;
3262 cmp ah,CLASS_C ; ;AC012;
3263 ; $if e,and ; ;AC012;
3264 JNE $$IF199
3265 cmp al,BadNameMes ; ;AN010;
3266 ; $if b ; ;AN010;
3267 JNB $$IF199
3268 mov [insert_num],1 ; ;AN005;
3269 ; $else ; ;AN010;
3270 JMP SHORT $$EN199
3271 $$IF199:
3272 mov [insert_num],0 ; ;AN010;
3273 ; $endif ; ;AN010;
3274 $$EN199:
3275 mov cx,1 ; 1 parameter to replace ;AN005;
3276
3277 ; $endif ; ;AN000;
3278 $$IF198:
3279
3280 cmp ah,CLASS_D ; is it CLASS D ;AN000;
3281
3282 ; $if e ; CLASS D requires response ;AN000;
3283 JNE $$IF203
3284
3285 ; flush keystroke buffer?
3286 mov dl,buffered_input ; load response required (INT 21h 0A) ;AN000;
3287
3288 ; $endif ; ;AN000;
3289 $$IF203:
3290
3291 cmp ah,Parse_error
3292
3293 ; $if be ; if Parse or DOS error
3294 JNBE $$IF205
3295
3296 mov dh,ah
3297 mov bx,STDERR ; set output handle (BX) ;AN014;
3298
3299 ; $endif ;
3300 $$IF205:
3301
3302 ; $if e ; if it is a parse error - show them
3303 JNE $$IF207
3304 ; what is wrong
3305 mov cx,[MSG_PTR] ; set up sublist offset ;AN005;
3306 mov [insert_ptr_off],cx ; ;AN005;
3307 mov cx,CodeR ; set up sublist segment (PSP) ;AN005;
3308 sub cx,10h ; ;AN005;
3309 mov [insert_ptr_seg],cx ; ;AN005;
3310 push si ; save current pointer ;AN005;
3311 push ds ; ;AN005;
3312 mov si,[SCAN_PTR] ; point to end of bad parm ;AN005;
3313 mov ds,cx ; ;AN005;
3314 mov BYTE PTR ds:[si],0 ; terminate the parameter ;AN005;
3315 pop ds ; restore current pointer ;AN005;
3316 pop si ; ;AN005;
3317 mov [insert_num],0 ; ;AN005;
3318 mov cx,1 ; 1 parameter to replace ;AN005;
3319
3320 ; $endif
3321 $$IF207:
3322
3323 xor ah,ah ; ;AN000;
3324
3325 call SysDispMsg ; to display message ;AN002;
3326
3327 ; $if c ; error .................. ;AN000;
3328 JNC $$IF209
3329
3330 mov ah,DOS_error ; load error exit code ;AN000;
3331 stc ; indicate failure ;AN000;
3332
3333 ; $endif ; ;AN000;
3334 $$IF209:
3335
3336 pop si ; ;AN000;
3337 pop ds ; ;AN000;
3338
3339 ret ; ;AN000;
3340
3341 DispMsg ENDP
3342
3343 GoDispMsg PROC FAR
3344
3345 call DispMsg ; This allows long calls form CODER ;AN000;
3346
3347 ret ; ;AN000;
3348
3349 GoDispMsg ENDP
3350
3351 BREAK <Load_R_Msg>
3352 ;******************* START OF SPECIFICATIONS ***********************************
3353 ;
3354 ; NAME: Load_R_Msg - PRINT Load Resident Message Routine
3355 ;
3356 ; FUNCTION: Load the PRINT resident messages into their
3357 ; current message buffer. Note that PRINT 'pumps' the
3358 ; error text out as part of the data stream. For this reason
3359 ; the message service code is NOT used to display RESIDENT messages.
3360 ;
3361 ; INPUT: Messages in PRINT_RM, and Message Retriver code in PRINT_TM.
3362 ;
3363 ; OUTPUT: Resident messages loaded into the resident message buffer
3364 ; and Message Sevices code initalized
3365 ;
3366 ; NOTE: Messages ERRO through ERR12, ERRMEST through AllCan, FATMES
3367 ; BADDDRVM, GOODMES and BADMES are used in place - whereever
3368 ; the Message retriever points to them. BADDRVM is moved directly behind
3369 ; FATMES.
3370 ;
3371 ; REGISTERS USED: DS:SI - points to message text
3372 ; (NOT RESTORED) ( AX - message # - not destroyed)
3373 ; ( DH - Class - not destroyed)
3374 ;
3375 ; LINKAGE: Call from TRANSIENT
3376 ;
3377 ; NORMAL CF = 0
3378 ; EXIT:
3379 ;
3380 ; ERROR CF = 1
3381 ; EXIT: AX = error number
3382 ;
3383 ; CHANGE 03/11/87 - First release - F. G.
3384 ; LOG: 09/28/87 - P1175 - all resident messages must be moved
3385 ;
3386 ;******************* END OF SPECIFICATIONS *************************************
3387 ;******************** START - PSEUDOCODE ***************************************
3388 ;
3389 ; START
3390 ; END
3391 ;
3392 ;******************** END - PSEUDOCODE ***************************************
3393
3394 Load_R_Msg PROC NEAR
3395
3396 ;--------------------------------------
3397 ; Load the Resident Messages
3398 ;--------------------------------------
3399 mov ax,CodeR ; ;AN000;
3400 mov es,ax ; ;AN000;
3401
3402 ASSUME DS:nothing,ES:CodeR
3403
3404 lea di,R_MES_BUFF ; set destination to resident buffer ;AN000;
3405 mov bx,OFFSET CodeR:MESBAS ; use BX as an index to MESBAS (CodeR) ;AN000;
3406
3407 ;--------------------------------------
3408 ; Move messages ERR0 thru ERR12
3409 ;--------------------------------------
3410
3411 mov ax,ERR0 ; message # 19 to start ;AN000;
3412 mov dx,(DOS_error shl 8) ; Class is DOS error ;AN000;
3413
3414 ; $do ; ;AN000;
3415 $$DO211:
3416
3417 call MoveMes ; LOAD the message ;AN000;
3418 ; $leave c ; leave loop if ERROR ;AN000;
3419 JC $$EN211
3420 mov byte ptr es:[di],DOLLAR ; append a delimiter
3421 inc di ; move to next message ;AN000;
3422 inc al ; advance message # ;AN000;
3423 cmp al,ERR12 ; are we past ERR12 ? ;AN000;
3424
3425 ; $enddo a ; if not, do it again ;AN000;
3426 JNA $$DO211
3427 $$EN211:
3428
3429 ; $if nc ; if no ERROR ;AN000;
3430 JC $$IF214
3431 ;--------------------------------------
3432 ; Do rocessing for ERRMEST through
3433 ; BADDRVM
3434 ;--------------------------------------
3435
3436 mov ax, errmest ; message # 3 to start ;AN000;
3437 mov dx,(CLASS_Util shl 8) ; Class is Utility ;AN000;
3438
3439 ; $do ; now we are past ERR12 ;AN000;
3440 $$DO215:
3441
3442 call MoveMes ; LOAD the message ;AC002;
3443 ; $leave c ; leave loop if ERROR ;AC002;
3444 JC $$EN215
3445 inc al ; advance message # ;AC002;
3446 cmp al,BADDRVM ; are we past BADDRVM ;AC002;
3447
3448 ; $enddo a ; ;AN000;
3449 JNA $$DO215
3450 $$EN215:
3451
3452 ; $endif ; endif - no error ;AN000;
3453 $$IF214:
3454
3455 push cs ; ;AN000;
3456 pop es ; ;AN000;
3457 push cs ; ;AN000;
3458 pop ds ; ;AN000;
3459
3460 ASSUME DS:DG,ES:DG
3461
3462 ret ; ;AN000;
3463
3464 Load_R_Msg ENDP
3465 ;--------------------------------------
3466 ; Move the Messages into their
3467 ; final resting place
3468 ;--------------------------------------
3469 MoveMes PROC NEAR
3470
3471 mov es:[bx],di ; save the pointer to this message ;AN000;
3472 call SYSGETMSG ; line up the pointer on the message ;AN000;
3473 ; $if nc ; if no error ;AN000;
3474 JC $$IF219
3475 ; all being well --- WE NOW HAVE---
3476 ; DS:SI - aimed at the message file
3477 ; ES:DI - aimed at the Resident Buffer
3478 ; CX - # of characters
3479 cld ; go ahead ;AN000;
3480 rep movsb ; and copy it! ;AN000;
3481 inc bx ; set up for next pointer ;AN000;
3482 inc bx ; ;AN000;
3483
3484 ; $endif ; endif - no error ;AN000;
3485 $$IF219:
3486
3487 ret ; ;AN000;
3488
3489 MoveMes ENDP
3490
3491
3492 CODE ENDS
3493
3494
3495 STACK SEGMENT STACK
3496
3497 dw 100 dup(0)
3498
3499 TransSize LABEL BYTE ; end of transient
3500 ; only because code is para algned
3501 STACK ENDS
3502
3503 END Transient
3504 \1a