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

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / CMD / GRAPHICS / GRPARMS.ASM
1 PAGE ,132 ;AN000;
2 TITLE DOS - GRAPHICS Command - Command line parsing module ;AN000;
3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4 ;; DOS - GRAPHICS Command
5 ;; (C) Copyright 1988 Microsoft
6 ;; ;AN000;
7 ;; File Name: GRPARMS.ASM ;AN000;
8 ;; ---------- ;AN000;
9 ;; ;AN000;
10 ;; Description: ;AN000;
11 ;; ------------ ;AN000;
12 ;; ;AN000;
13 ;; This file contains modules for parsing the GRAPHICS.COM ;AN000;
14 ;; command line; using the DOS PARSER. ;AN000;
15 ;; ;AN000;
16 ;; ;AN000;
17 ;; Documentation Reference: ;AN000;
18 ;; ------------------------ ;AN000;
19 ;; OASIS High Level Design ;AN000;
20 ;; OASIS GRAPHICS I1 Overview ;AN000;
21 ;; DOS 3.3 Message Retriever Interface Supplement. ;AN000;
22 ;; TUPPER I0 Document - PARSER HIGH LEVEL DESIGN REVIEW ;AN000;
23 ;; ;AN000;
24 ;; Procedures Contained in This File: ;AN000;
25 ;; ---------------------------------- ;AN000;
26 ;; PARSE_PARMS - Parse the command line ;AN000;
27 ;; GET_R - Get /R ;AN000;
28 ;; GET_B - Get /B ;AN000;
29 ;; GET_LCD - Get /LCD ;AN000;
30 ;; GET_PRINTBOX - Get /PRINTBOX ;AN000;
31 ;; GET_PROFILE - Get the profile path and file name ;AN000;
32 ;; GET_TYPE - Get the printer type ;AN000;
33 ;; ;AN000;
34 ;; Include Files Required: ;AN000;
35 ;; ----------------------- ;AN000;
36 ;; GRINST.EXT - Externals for installation modules ;AN000;
37 ;; GRPARSE.EXT - Externals for the DOS parser code ;AN000;
38 ;; GRSHAR.STR - Shared Data Area Structure ;AN000;
39 ;; GRMSG.EQU - Equates for GRAPHICS.COM error messages ;AN000;
40 ;; STRUC.INC - Macros for using structured assembly language ;AN000;
41 ;; ;AN000;
42 ;; External Procedure References: ;AN000;
43 ;; ------------------------------ ;AN000;
44 ;; FROM FILE GRINST.ASM: ;AN000;
45 ;; GRAPHICS_INSTALL - Main module for the installation of GRAPHICS ;AN000;
46 ;; SYSPARSE - DOS system parser ;AN000;
47 ;; SYSDISPMSG - DOS message retriever ;AN000;
48 ;; ;AN000;
49 ;; Linkage Instructions: ;AN000;
50 ;; -------------------- ;AN000;
51 ;; Refer to GRAPHICS.ASM ;AN000;
52 ;; ;AN000;
53 ;; Change History: ;AN000;
54 ;; --------------- ;AN000;
55 ;; ;AN000;
56 ;; ;AN000;
57 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
58 CODE SEGMENT PUBLIC 'CODE' ;AN000;
59 ASSUME CS:CODE,DS:CODE ;AN000;
60 PARSE_PARMS PROC NEAR ;AN000;
61 jmp PARSE_PARMS_START ;AN000;
62 PUBLIC PARSE_PARMS ;AN000;
63 .XLIST ;AN000;
64 INCLUDE GRMSG.EQU ; Include GRAPHICS error messages equates ;AN000;
65 INCLUDE GRSHAR.STR ; Include the Shared data area structure ;AN000;
66 INCLUDE GRINST.EXT ; Include externals for the installation module ;AN000;
67 INCLUDE GRPARSE.EXT ; Include externals for the DOS parse code ;AN000;
68 INCLUDE STRUC.INC ; Include macros for using STRUCTURES ;AN000;
69 .LIST ;AN000;
70 ;AN000;
71 PAGE ;AN000;
72 ;===============================================================================;AN000;
73 ; ;AN000;
74 ; PARSE_PARMS : PARSE THE COMMAND LINE PARAMETERS. ;AN000;
75 ; ;AN000;
76 ;-------------------------------------------------------------------------------;AN000;
77 ; ;AN000;
78 ; INPUT: DS,ES = SEGMENT CONTAINING THE PROGRAM PREFIX SEGMENT ;AN000;(PSP)
79 ; ;AN000;
80 ; OUTPUT: SWITCHES = A bit mask in the shared data area indicating ;AN000;
81 ; which command line switches are set. ;AN000;
82 ; PROFILE_PATH = The profile file name and path (ASCIIZ string);AN000;
83 ; PRINTBOX_ID_PTR = Offset of the printbox id (ASCIIZ string) ;AN000;
84 ; PRINTER_TYPE_PARM = printer type (ASCIIZ string) ;AN000;
85 ; CARRY FLAG IS SET if an error occurred ;AN000;
86 ; ;AN000;
87 ;-------------------------------------------------------------------------------;AN000;
88 ; ;AN000;
89 ; DESCRIPTION: Call the DOS parser to parse the command line parameters ;AN000;
90 ; of the GRAPHICS command line which is obtained from the PSP (Program Segment ;AN000;
91 ; Prefix). ;AN000;
92 ; ;AN000;
93 ; The format of the command line is: ;AN000;
94 ; ;AN000;
95 ; ;AN000;
96 ; GRAPHICS {prt_type {profile}} {/R} {/B} {[/LCD | /PRINTBOX:id]} ;AN000;
97 ; ;AN000;
98 ; (All arguments are optional, /PRINTBOX can be spelled /PB.) ;AN000;
99 ; ;AN000;
100 ; If no printer type is specified then, a null pointer is returned. ;AN000;
101 ; If no profile name is supplied then, a null string is returned. ;AN000;
102 ; If "/LCD" is specified then, a pointer to the printbox id: "LCD" is returned. ;AN000;
103 ; ;AN000;
104 ; ;AN000;
105 ; LOGIC: ;AN000;
106 ; Set addressibility to the command line parameters in the PSP ;AN000;
107 ; CALL SYSPARSE ; Call the system parser ;AN000;
108 ; While not (End Of Line) AND no error ;AN000;
109 ; IF argument is the profile name ;AN000;
110 ; THEN Get the profile name ;AN000;
111 ; IF argument is the printbox switch ;AN000;
112 ; THEN Get the printbox id ;AN000;
113 ; IF argument is a /r ;AN000;
114 ; THEN Get /r ;AN000;
115 ; IF argument is /b ;AN000;
116 ; THEN Get /b ;AN000;
117 ; IF argument /lcd ;AN000;
118 ; THEN Get /lcd ;AN000;
119 ; CALL SYSPARSE ;AN000;
120 ; If error ;AN000;
121 ; Then display the appropriate error message ;AN000;
122 ; ;AN000;
123 ;-------------------------------------------------------------------------------;AN000;
124 ; BIT MASK INDICATING THE COMMAND LINE SWITCHES PARSED SO FAR: ;AN000;
125 ;-------------------------------------------------------------------------------;AN000;
126 SWITCH_PARSED DB 0 ;AN000;
127 GOT_R EQU 1 ; Found /R ;AN000;
128 GOT_B EQU 2 ; Found /B ;AN000;
129 GOT_LCD EQU 4 ; Found /LCD ;AN000;
130 GOT_PRINTBOX EQU 8 ; Found /PB:id or /PRINTBOX:id ;AN000;
131 ;AN000;
132 ;===============================================================================;AN000;
133 ; ;AN000;
134 ; CONTROL BLOCK DEFINITIONS FOR THE PARSER: ;AN000;
135 ; ;AN000;
136 ;===============================================================================;AN000;
137 ;AN000;
138 ;-------------------------------------------------------------------------------;AN000;
139 ; PARMS INPUT BLOCK ;AN000;
140 ;-------------------------------------------------------------------------------;AN000;
141 PARMS LABEL WORD ;AN000;
142 DW PARMSX ; Offset of parms extension block ;AN000;
143 DB 0 ; No delimiters to define ;AN000;
144 ; or end of line markers. ;AN000;
145 ;AN000;
146 ;AN000;
147 ;-------------------------------------------------------------------------------;AN000;
148 ; PARMS EXTENSION BLOCK : Describe what's on the command line ;AN000;
149 ;-------------------------------------------------------------------------------;AN000;
150 PARMSX LABEL BYTE ;AN000;
151 DB 0,2 ; Max. 2 positional parameters ;AN000;
152 DW TYPE_CTL ; Offset of type control block ;AN000;
153 DW PROF_CTL ; Offset of profile control block ;AN000;
154 ;AN000;
155 DB 4 ; Max. 4 switch types ;AN000;
156 DW PRINTBOX_CTL ; Offset of control for Printbox ;AN000;
157 DW R_CTL ; Offset of control for /R ;AN000;
158 DW B_CTL ; Offset of control for /B ;AN000;
159 DW LCD_CTL ; Offset of control for /LCD ;AN000;
160 ;AN000;
161 DB 0 ; No keywords ;AN000;
162 ;AN000;
163 ;-------------------------------------------------------------------------------;AN000;
164 ; ;AN000;
165 ; Describe the printer type parameter: ;AN000;
166 ; ;AN000;
167 ;-------------------------------------------------------------------------------;AN000;
168 TYPE_CTL LABEL WORD ;AN000;
169 DW 2001H ; Optional simple string ;AN000;
170 DW 0002H ; Capitalize it ;AN000;
171 DW TYPE_RESULT ; Offset of result buffer for printer type ;AN000;
172 DW NO_VALUES ; No values (NOTE: The type returned is checked;AN000;
173 DB 0 ; for validity by LOAD_PROFILE);AN000;
174 ;AN000;
175 NO_VALUES DB 0 ;AN000;
176 ;AN000;
177 TYPE_RESULT LABEL BYTE ;AN000;
178 DB ? ; Type ;AN000;
179 DB ? ; Item tag ;AN000;
180 DW ? ; Offset of synomym ;AN000;
181 DD ? ; Pointer to string found ;AN000;
182 ;AN000;
183 ;-------------------------------------------------------------------------------;AN000;
184 ; ;AN000;
185 ; Describe the format of the PROFILE parameter: ;AN000;
186 ; ;AN000;
187 ;-------------------------------------------------------------------------------;AN000;
188 ;AN000;
189 PROF_CTL LABEL WORD ;AN000;
190 DW 0201H ; File spec. - Optional ;AN000;
191 DW 0001h ; Capitalize ;AN000;
192 DW PROFILE_RESULT ; Offset of result buffer for Profile ;AN000;
193 DW NO_VALUES ; No values needed ;AN000;
194 DB 0 ;AN000;
195 ;AN000;
196 ;AN000;
197 PROFILE_RESULT LABEL BYTE ;AN000;
198 DB ? ; Type ;AN000;
199 DB ? ; Item tag ;AN000;
200 DW ? ; Offset of synomym ;AN000;
201 DD ? ; Offset of string ;AN000;
202 ;AN000;
203 ;-------------------------------------------------------------------------------;AN000;
204 ; ;AN000;
205 ; Describe the format of /R ;AN000;
206 ; ;AN000;
207 ;-------------------------------------------------------------------------------;AN000;
208 R_CTL LABEL WORD ;AN000;
209 DW 0 ; ;AN000;
210 DW 0 ; ;AN000;
211 DW R_RESULT ; Offset of result buffer for a simple switch ;AN000;
212 DW NO_VALUES ; No values can be given with these switches. ;AN000;
213 DB 1 ; 1 name for this switch ;AN000;
214 DB "/R",0 ; Reverse ;AN000;
215 ;AN000;
216 R_RESULT LABEL BYTE ;AN000;
217 DB ? ; Type ;AN000;
218 DB ? ; Item tag ;AN000;
219 DW ? ; Offset of synomym ;AN000;
220 DD ? ; Offset of value ;AN000;
221 ;AN000;
222 ;-------------------------------------------------------------------------------;AN000;
223 ; ;AN000;
224 ; Describe the format of /B ;AN000;
225 ; ;AN000;
226 ;-------------------------------------------------------------------------------;AN000;
227 B_CTL LABEL WORD ;AN000;
228 DW 0 ; ;AN000;
229 DW 0 ; ;AN000;
230 DW B_RESULT ; Offset of result buffer for a simple switch ;AN000;
231 DW NO_VALUES ; No values can be given with these switches. ;AN000;
232 DB 1 ; 1 name allowed for this switch ;AN000;
233 DB "/B",0 ; Background ;AN000;
234 ;AN000;
235 B_RESULT LABEL BYTE ;AN000;
236 DB ? ; Type ;AN000;
237 DB ? ; Item tag ;AN000;
238 DW ? ; Offset of synomym ;AN000;
239 DD ? ; Offset of value ;AN000;
240 ;AN000;
241 ;-------------------------------------------------------------------------------;AN000;
242 ; ;AN000;
243 ; Describe the format of /LCD ;AN000;
244 ; ;AN000;
245 ;-------------------------------------------------------------------------------;AN000;
246 LCD_CTL LABEL WORD ;AN000;
247 DW 0 ; ;AN000;
248 DW 0 ; ;AN000;
249 DW LCD_RESULT ; Offset of result buffer for a /LCD ;AN000;
250 DW NO_VALUES ; No values can be given with these switches. ;AN000;
251 DB 1 ; 1 name: ;AN000;
252 DB "/LCD",0 ; /LCD ;AN000;
253 ;AN000;
254 LCD_RESULT LABEL BYTE ;AN000;
255 DB ? ; Type ;AN000;
256 DB ? ; Item tag ;AN000;
257 DW ? ; Offset of synomym ;AN000;
258 DD ? ; Offset of value ;AN000;
259 ;AN000;
260 ;-------------------------------------------------------------------------------;AN000;
261 ; ;AN000;
262 ; Describe the format of the PRINTBOX switch: ;AN000;
263 ; ;AN000;
264 ;-------------------------------------------------------------------------------;AN000;
265 PRINTBOX_CTL LABEL WORD ;AN000;
266 DW 2001H ; Optional simple string ;AN000;
267 DW 0001H ; Capitalize ;AN000;
268 DW PRINTBOX_RESULT ; Offset of result buffer for Printbox ;AN000;
269 DW NO_VALUES ; Values will be validated when loading profile ;AN000;
270 DB 2 ; 2 synomym for this switch: ;AN000;
271 DB "/PRINTBOX",0 ; ;AN000;
272 DB "/PB",0 ;AN000;
273 ;AN000;
274 PRINTBOX_RESULT LABEL BYTE ;AN000;
275 DB ? ; Type ;AN000;
276 DB ? ; Item tag ;AN000;
277 DW ? ; Offset of synomym ;AN000;
278 DD ? ; Offset of value ;AN000;
279 ;AN000;
280 ;===============================================================================;AN000;
281 ; ;AN000;
282 ; DOS "MESSAGE RETRIEVER" Substitution list control block: ;AN000;
283 ; ;AN000;
284 ;-------------------------------------------------------------------------------;AN000;
285 SUBLIST LABEL DWORD ; List for substitution: ;AN000;
286 DB 11 ; Size of this list ;AN000;
287 DB 0 ; Reserved ;AN000;
288 SAVE_SI DD ? ; Ptr to data item ;AN001;
289 DB 1 ; Variable to be substitued: %1 ;AN000;
290 DB 00010000B ; %1 is an ASCIIZ string left justifi;AN000;ed
291 DB 0 ; Unlimited size for %1 ;AN000;
292 DB 1 ; Minimum size is 1 character ;AN000;
293 DB " " ; Delimiter is "space" ;AN000;
294 ;AN000;
295 ;===============================================================================;AN000;
296 ; ;AN000;
297 ; START OF EXECUTABLE CODE: ;AN000;
298 ; ;AN000;
299 ;-------------------------------------------------------------------------------;AN000;
300 ;AN000;
301 PARSE_PARMS_START: ;AN000;
302 PUSH AX ;AN000;
303 PUSH BX ;AN000;
304 PUSH CX ;AN000;
305 PUSH DX ;AN000;
306 PUSH SI ;AN000;
307 PUSH DI ;AN000;
308 PUSH ES ;AN000;
309 ;-------------------------------------------------------------------------------;AN000;
310 ; Set up addressibility for the parser ;AN000;
311 ;-------------------------------------------------------------------------------;AN000;
312 MOV SI,81H ; DS:SI := Command line parameters ;AN000;
313 ; to be parsed ;AN000;
314 PUSH CS ;AN000;
315 POP ES ;AN000;
316 LEA DI,PARMS ; ES:DI := Parms control block ;AN000;
317 ;(deleted ;AN001;) XOR DX,DX ; CX,DX must be zero for the ;AN000;
318 XOR CX,CX ; Initially, CX should be zero ;AN001;
319 MOV AX,0 ; No error yet ;AN000;
320 ;-------------------------------------------------------------------------------;AN000;
321 ; Parse FIRST argument ;AN000;
322 ;-------------------------------------------------------------------------------;AN000;
323 ;(deleted ;AN001;) CALL SYSPARSE ; Get one argument from the command line;AN000;
324 CALL CALL_SYSPARSE ; Get one argument from the command line;AN001;
325 ;(deleted ;AN001;) MOV BX,DX ; BX := Offset of result block ;AN000;
326 .WHILE <AX EQ RC_NO_ERROR> ; While there is no error ;AN000;
327 ;-------------------------------------------------------------------------------;AN000;
328 ; Get the argument: ;AN000;
329 ;-------------------------------------------------------------------------------;AN000;
330 .SELECT ;AN000;
331 .WHEN <BX EQ <OFFSET TYPE_RESULT>> ;AN000;
332 CALL GET_TYPE ;AN000;
333 .WHEN <BX EQ <OFFSET PROFILE_RESULT>> ;AN000;
334 CALL GET_PROFILE_NAME ;AN000;
335 .WHEN <BX EQ <OFFSET LCD_RESULT >> ;AN000;
336 CALL GET_LCD ;AN000;
337 .WHEN <BX EQ <OFFSET R_RESULT>> ;AN000;
338 CALL GET_REVERSE ;AN000;
339 .WHEN <BX EQ <OFFSET B_RESULT>> ;AN000;
340 CALL GET_BACKGROUND ;AN000;
341 .WHEN <BX EQ <OFFSET PRINTBOX_RESULT>> ;AN000;
342 CALL GET_PRINTBOX_ID ;AN000;
343 .OTHERWISE ;AN000;
344 ;-------No result block was returned by the parser ;AN000;
345 STC ; Set error ;AN000;
346 .ENDSELECT ;AN000;
347 .LEAVE C ; IF error occurred while parsing the ;AN000;
348 ; previous argument, exit the loop: ;AN000;
349 ; stop parsing the command line. ;AN000;
350 ;-------------------------------------------------------------------------------;AN000;
351 ; Parse next argument: ;AN000;
352 ;-------------------------------------------------------------------------------;AN000;
353 ;(deleted ;AN001;) XOR DX,DX ; ;AN000;
354 ;(deleted ;AN001;) CALL SYSPARSE ; Get one argument from the command line;AN000;
355 CALL CALL_SYSPARSE ; Get one argument from the command line;AN001;
356 ;(deleted ;AN001;) MOV BX,DX ; ES:BX := Offset of result block ;AN000;
357 .ENDWHILE ;AN000;
358 ;-------------------------------------------------------------------------------;AN000;
359 ; Check for error, select and display an error message ;AN000;
360 ;-------------------------------------------------------------------------------;AN000;
361 .IF <AL NE RC_EOL> ; IF an error occurred ;AN000;
362 .THEN ; then, display error message ;AN000;
363 MOV CX,0 ; Assume no substitutions ;AN000;
364 .SELECT ; (CX := Number of substitutions ;AN000;
365 .WHEN <AL EQ RC_TOO_MANY> ; When RC = Too many parameters ;AN000;
366 MOV AX,TOO_MANY_PARMS ; (AL = Message number to display) ;AN000;
367 .WHEN <AL EQ RC_Not_In_Val> ; When RC = Not in value list provided ;AN000;
368 MOV AX,VALUE_NOT_ALLOWED ; (AL = Message number to display) ;AN000;
369 .WHEN <AL EQ RC_Not_In_Sw> ; When RC = Not in switch list provided ;AN000;
370 MOV CX,1 ; 1 substitution in this message ;AN000;
371 MOV BYTE PTR [SI],0 ; PUT NUL AT END OF THIS PARM ;AN001;
372 LEA SI,SUBLIST ; DS:[SI]:="Invalid parm" Substitution;AN000; list
373 ;(deleted ;AN001;) LES DX,ES:[BX+4] ; ES:DX := Offset of offending parm. ;AN000;
374 ;(deleted ;AN001;) MOV [SI]+2,DX ; Store offset to this offender in the;AN000;
375 MOV [SI]+4,ES ; substitution list control block ;AN000;
376 MOV AX,INVALID_PARM ; AL := 'Invalid parameter' msg number;AN000;
377 .WHEN <AL EQ RC_INVLD_COMBINATION> ; When RC = Invalid combination of parms;AN000;
378 MOV AX,INVALID_COMBINATION ; (AL = Message number to display) ;AN000;
379 .WHEN <AL EQ RC_DUPLICATE_PARMS> ; When RC = Invalid combination of parms;AN000;
380 MOV AX,DUPLICATE_PARM ; (AL = Message number to display) ;AN000;
381 .OTHERWISE ; ;AN000;
382 MOV AX,FORMAT_NOT_CORRECT ; RC = Anything else, tell the user ;AN000;
383 ; something is wrong with his ;AN000;
384 .ENDSELECT ; command line. ;AN000;
385 CALL DISP_ERROR ; Display the selected error message ;AN000;
386 STC ; Indicate parse error occurred ;AN000;
387 .ENDIF ;AN000;
388 ;AN000;
389 POP ES ;AN000;
390 POP DI ;AN000;
391 POP SI ;AN000;
392 POP DX ;AN000;
393 POP CX ;AN000;
394 POP BX ;AN000;
395 POP AX ;AN000;
396 RET ; Return to GRAPHICS_INSTALL ;AN000;
397 ;AN000;
398 PARSE_PARMS ENDP ;AN000;
399 CALL_SYSPARSE PROC NEAR ;COMMON INVOCATION OF SYSPARSE ;AN001;
400 ;INPUT: - CX=ORDINAL VALUE ;AN001;
401 ; DS:SI=WHERE COMMAND LINE IS, SAVED IN "SAVE_SI" ;AN001;
402 ; ES:DI=WHERE PARMS DESCRIPTOR BLOCK IS ;AN001;
403 ;OUTPUT: CX=NEW ORDINAL VALUE ;AN001;
404 ; BX=OFFSET OF RESULT BLOCK, IF ONE IS RETURNED ;AN001;
405 ; SI=OFFSET OF CHAR BEYOND PARSED PARM IN COMMAND LINE ;AN001;
406 ;AN001;
407 XOR DX,DX ;CLEAR DX FOR PARSER ;AN001;
408 MOV WORD PTR SAVE_SI,SI ;REMEMBER WHERE TO START LOOKING ;AN001;
409 CALL SYSPARSE ;GO PARSE THE NEXT PARM ;AN001;
410 ;AN001;
411 MOV BX,DX ; BX := Offset of result block ;AN001;
412 RET ;RETURN TO CALLER ;AN001;
413 CALL_SYSPARSE ENDP ;AN001;
414 PAGE ;AN000;
415 ;===============================================================================;AN000;
416 ; ;AN000;
417 ; PROCEDURE_NAME: GET_PROFILE ;AN000;
418 ; ;AN000;
419 ; INPUT: ES:[BX] := Result block ;AN000;
420 ; ;AN000;
421 ; OUTPUT: PROFILE_PATH = The profile file name and path (ASCIIZ string) ;AN000;
422 ; ;AN000;
423 ;-------------------------------------------------------------------------------;AN000;
424 GET_PROFILE_NAME PROC ;AN000;
425 PUSH AX ;AN000;
426 PUSH BX ;AN000;
427 PUSH DX ;AN000;
428 PUSH SI ;AN000;
429 PUSH DI ;AN000;
430 ;AN000;
431 ;-------------------------------------------------------------------------------;AN000;
432 ; Get the name of the profile path found on the command line: ;AN000;
433 ;-------------------------------------------------------------------------------;AN000;
434 MOV DI,ES:[BX+4] ; DI := Offset of filename found ;AN000;
435 XOR BX,BX ; BX := Byte index ;AN000;
436 MOV SI,OFFSET PROFILE_PATH ; [BX][SI] := Where to store it ;AN000;
437 ;AN000;
438 .IF <<BYTE PTR [DI]> NE 0> ; Don't copy a NULL parm ;AN000;
439 .REPEAT ; While not end of path name (NULL terminated) ;AN000;
440 MOV AL,[BX][DI] ; Copy the byte (including the NULL) ;AN000;
441 MOV [BX][SI],AL ;AN000;
442 INC BX ; Get next one ;AN000;
443 .UNTIL <<BYTE PTR [BX-1][DI]> EQ 0> ; ;AN000;
444 .ENDIF ;AN000;
445 ;AN000;
446 POP DI ;AN000;
447 POP SI ;AN000;
448 POP DX ;AN000;
449 POP BX ;AN000;
450 POP AX ;AN000;
451 CLC ;AN000;
452 RET ;AN000;
453 GET_PROFILE_NAME ENDP ;AN000;
454 ;AN000;
455 PAGE ;AN000;
456 ;===============================================================================;AN000;
457 ; ;AN000;
458 ; PROCEDURE_NAME: GET_TYPE ;AN000;
459 ; ;AN000;
460 ; INPUT: ES:[BX] := Result block ;AN000;
461 ; PRINTER_TYPE_LENGTH := Maximum length for the printer type string ;AN000;
462 ; ;AN000;
463 ; OUTPUT: PRINTER_TYPE_PARM = ASCIIZ string containing ;AN000;
464 ; the Printer type. ;AN000;
465 ; AX = Error code ;AN000;
466 ; ;AN000;
467 ;-------------------------------------------------------------------------------;AN000;
468 GET_TYPE PROC ;AN000;
469 PUSH BX ;AN000;
470 PUSH CX ;AN000;
471 PUSH SI ;AN000;
472 PUSH DI ;AN000;
473 ;AN000;
474 ;---------------------------------------------------------------------- ;AN000;
475 ; Overwrite the DEFAULT TYPE with the type found on the command line ;AN000;
476 ;---------------------------------------------------------------------- ;AN000;
477 MOV SI,ES:[BX+4] ; DS:SI := Offset of printer type found ;AN000;
478 .IF <<BYTE PTR [SI]> NE 0> ; Do not copy an empty string ;AN000;
479 .THEN ; ;AN000;
480 MOV CL,PRINTER_TYPE_LENGTH ; CX := Maximum number of bytes ;AN000;
481 XOR CH,CH ; to copy ;AN000;
482 MOV DI,OFFSET PRINTER_TYPE_PARM; ES:DI := Where to store it ;AN000;
483 REP MOVSB ; Copy the string ;AN000;
484 ;---------------------------------------------------------------------- ;AN000;
485 ; Verify that the string supplied is not too long: ;AN000;
486 ;---------------------------------------------------------------------- ;AN000;
487 .IF <<BYTE PTR [DI-1]> EQ 0> ; If the last byte is a null ;AN000;
488 .THEN ; then, the string was not longer ;AN000;
489 ; than the maximum ;AN000;
490 CLC ; Clear the carry flag = No error ;AN000;
491 .ELSE ; else, string provided is too long ;AN000;
492 MOV AX,RC_Not_In_Sw ; Error := RC for Invalid parm ;AN000;
493 STC ; Set error ;AN000;
494 .ENDIF ; ENDIF string too long ;AN000;
495 .ENDIF ; ENDIF string provided ;AN000;
496 ;AN000;
497 GET_TYPE_END: ;AN000;
498 POP DI ;AN000;
499 POP SI ;AN000;
500 POP CX ;AN000;
501 POP BX ;AN000;
502 RET ;AN000;
503 GET_TYPE ENDP ;AN000;
504 ;AN000;
505 PAGE ;AN000;
506 ;===============================================================================;AN000;
507 ; ;AN000;
508 ; PROCEDURE_NAME: GET_REVERSE ;AN000;
509 ; ;AN000;
510 ; INPUT: ES:[BX] := Result block ;AN000;
511 ; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000;
512 ; ;AN000;
513 ; OUTPUT: CS:[BP].SWITCHES (Bit mask in the Shared data area) is updated ;AN000;
514 ; with the value of the switch found. ;AN000;
515 ; GOT_R is set in SWITCH_PARSED ;AN000;
516 ; AX := Error message number. ;AN000;
517 ; CARRY FLAG IS SET IF ERROR FOUND ;AN000;
518 ; ;AN000;
519 ; ;AN000;
520 ;-------------------------------------------------------------------------------;AN000;
521 GET_REVERSE PROC ;AN000;
522 ;AN000;
523 TEST SWITCH_PARSED,GOT_R ; If already parsed this switch ;AN000;
524 JNZ DUPLICATE_R ; then, error ;AN000;
525 OR SWITCH_PARSED,GOT_R ; else, say we parsed it. ;AN000;
526 ;AN000;
527 ;-------------------------------------------------------------------------------;AN000;
528 ; Set the Reverse switch in the Shared data area ;AN000;
529 ;-------------------------------------------------------------------------------;AN000;
530 OR CS:[BP].SWITCHES,REVERSE_SW ; Set the command line switch ;AN000;
531 CLC ; Clear the error flag ;AN000;
532 JMP SHORT GET_REVERSE_END ; Return ;AN000;
533 ;AN000;
534 DUPLICATE_R: ; Already got this switch ;AN000;
535 MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000;
536 STC ; SET ERROR ;AN000;
537 GET_REVERSE_END: ;AN000;
538 ;AN000;
539 RET ;AN000;
540 GET_REVERSE ENDP ;AN000;
541 ;AN000;
542 PAGE ;AN000;
543 ;===============================================================================;AN000;
544 ; ;AN000;
545 ; PROCEDURE_NAME: GET_BACKGROUND ;AN000;
546 ; ;AN000;
547 ; INPUT: ES:[BX] := Result block ;AN000;
548 ; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000;
549 ; ;AN000;
550 ; OUTPUT: CS:[BP].SWITCHES (Bit mask in the Shared data area) is updated ;AN000;
551 ; with the value of the switch found. ;AN000;
552 ; ;AN000;
553 ; GOT_B is set in SWITCH_PARSED ;AN000;
554 ; AX := Error message number. ;AN000;
555 ; CARRY FLAG IS SET IF ERROR FOUND ;AN000;
556 ; ;AN000;
557 ;-------------------------------------------------------------------------------;AN000;
558 GET_BACKGROUND PROC ;AN000;
559 ;AN000;
560 TEST SWITCH_PARSED,GOT_B ; If already parsed this switch ;AN000;
561 JNZ DUPLICATE_B ; then, error ;AN000;
562 OR SWITCH_PARSED,GOT_B ; else, say we parsed it. ;AN000;
563 ;-------------------------------------------------------------------------------;AN000;
564 ; Set the switch in the Shared data area ;AN000;
565 ;-------------------------------------------------------------------------------;AN000;
566 OR CS:[BP].SWITCHES,BACKGROUND_SW ; Set the command line switch ;AN000;
567 CLC ; Clear the error flag ;AN000;
568 JMP SHORT GET_BACKGROUND_END ; Return ;AN000;
569 ;AN000;
570 DUPLICATE_B: ; Already got this switch ;AN000;
571 MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000;
572 STC ; SET ERROR ;AN000;
573 ;AN000;
574 GET_BACKGROUND_END: ;AN000;
575 RET ;AN000;
576 GET_BACKGROUND ENDP ;AN000;
577 ;AN000;
578 PAGE ;AN000;
579 ;===============================================================================;AN000;
580 ; ;AN000;
581 ; PROCEDURE_NAME: GET_LCD ;AN000;
582 ; ;AN000;
583 ; INPUT: SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000;
584 ; ;AN000;
585 ; OUTPUT: PRINTBOX_ID_PTR := Point to /LCD ASCIIZ string. ;AN000;
586 ; GOT_B is set in SWITCH_PARSED ;AN000;
587 ; AX := Error message number. ;AN000;
588 ; CARRY FLAG IS SET IF ERROR FOUND ;AN000;
589 ; ;AN000;
590 ;-------------------------------------------------------------------------------;AN000;
591 ; Data Referenced: ;AN000;
592 ; ;AN000;
593 ; LCD_BOX = An ASCIIZ string representing the LCD printbox id. ;AN000;
594 ; ;AN000;
595 ;-------------------------------------------------------------------------------;AN000;
596 GET_LCD PROC ;AN000;
597 ;AN000;
598 TEST SWITCH_PARSED,GOT_LCD ; If already parsed this switch ;AN000;
599 JNZ DUPLICATE_LCD ; then, error: Duplicate switch ;AN000;
600 TEST SWITCH_PARSED,GOT_PRINTBOX ; If printbox already mentioned ;AN000;
601 JNZ BAD_COMBINATION ; then, error: Invalid combination ;AN000;
602 ;AN000;
603 ;-------------------------------------------------------------------------------;AN000;
604 ; Set the pointer to the print box id to "LCD" ;AN000;
605 ;-------------------------------------------------------------------------------;AN000;
606 MOV AX,OFFSET LCD_BOX ; PRINTBOX id := LCD ;AN000;
607 MOV PRINTBOX_ID_PTR,AX ; Save pointer to this printbox id. ;AN000;
608 OR SWITCH_PARSED,GOT_LCD ; Say we found this switch ;AN000;
609 CLC ; Clear the error flag ;AN000;
610 JMP SHORT GET_LCD_END ; Return ;AN000;
611 ;AN000;
612 ;-------------------------------------------------------------------------------;AN000;
613 ; /LCD was already parsed: ;AN000;
614 ;-------------------------------------------------------------------------------;AN000;
615 DUPLICATE_LCD: ; Already got this switch ;AN000;
616 MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000;
617 STC ; SET ERROR ;AN000;
618 JMP SHORT GET_LCD_END ; Return ;AN000;
619 ;AN000;
620 ;-------------------------------------------------------------------------------;AN000;
621 ; /PRINTBOX was already parsed: ;AN000;
622 ;-------------------------------------------------------------------------------;AN000;
623 BAD_COMBINATION: ; /LCD and /PRINTBOX invalid at same ;AN000;
624 MOV AX,RC_INVLD_COMBINATION ; time, Set the error flag ;AN000;
625 STC ; AX := Error code ;AN000;
626 ;AN000;
627 GET_LCD_END: ;AN000;
628 RET ;AN000;
629 GET_LCD ENDP ;AN000;
630 ;AN000;
631 PAGE ;AN000;
632 ;===============================================================================;AN000;
633 ; ;AN000;
634 ; PROCEDURE_NAME: GET_PRINTBOX ;AN000;
635 ; ;AN000;
636 ; INPUT: ES:[BX] := Result block ;AN000;
637 ; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000;
638 ; ;AN000;
639 ; OUTPUT: DEFAULT_BOX := Is overwritten to contain the printbox id. found on ;AN000;
640 ; the command line. ;AN000;
641 ; GOT_PRINTBOX is set in SWITCH_PARSED ;AN000;
642 ; AX := Error message number. ;AN000;
643 ; CARRY FLAG IS SET IF ERROR FOUND ;AN000;
644 ; ;AN000;
645 ;-------------------------------------------------------------------------------;AN000;
646 GET_PRINTBOX_ID PROC ;AN000;
647 ;AN000;
648 PUSH CX ;AN000;
649 PUSH SI ;AN000;
650 PUSH DI ;AN000;
651 ;AN000;
652 ;-------------------------------------------------------------------------------;AN000;
653 ; Test for error in the printbox statement: ;AN000;
654 ;-------------------------------------------------------------------------------;AN000;
655 TEST SWITCH_PARSED,GOT_LCD ; If /LCD already mentioned ;AN000;
656 JNZ BAD_COMBINATION2 ; then, error: Invalid combination ;AN000;
657 TEST SWITCH_PARSED,GOT_PRINTBOX ; If already parsed this switch ;AN000;
658 JNZ DUPLICATE_PRINTBOX ; then, error: Duplicate switch ;AN000;
659 ;AN000;
660 MOV DI,ES:[BX+4] ; DI := Offset of switch VALUE found;AN000;
661 ;AN000;
662 .IF <<BYTE PTR [DI]> EQ 0> ; IF no printbox id ;AN000;
663 .THEN ; then, ;AN000;
664 ;----------------------------------------------------------------------;AN000;
665 ; No printbox id. was found: ;AN000;
666 ;----------------------------------------------------------------------;AN000;
667 MOV AX,FORMAT_NOT_CORRECT ; AX := Error code ;AN000;
668 STC ; Set the error flag ;AN000;
669 .ELSE ; else, ;AN000;
670 OR SWITCH_PARSED,GOT_PRINTBOX; Say we found this switch ;AN000;
671 ;----------------------------------------------------------------------;AN000;
672 ; Overwrite DEFAULT_BOX with the Printbox id. found ;AN000;
673 ;----------------------------------------------------------------------;AN000;
674 MOV CL,PRINTBOX_ID_LENGTH ; CX := Maximum number of bytes ;AN000;
675 XOR CH,CH ; to copy ;AN000;
676 MOV SI,DI ; [DS][SI] := Value found ;AN000;
677 MOV DI,OFFSET DEFAULT_BOX ; [ES][DI] := Default value ;AN000;
678 REP MOVSB ; Copy the string ;AN000;
679 ;----------------------------------------------------------------------;AN000;
680 ; Verify that the Printbox id. string is not too long: ;AN000;
681 ;----------------------------------------------------------------------;AN000;
682 .IF <<BYTE PTR [DI-1]> EQ 0> ; If the last byte is a null ;AN000;
683 .THEN ; then, the string was not longer ;AN000;
684 ; than the maximum ;AN000;
685 CLC ; Clear the carry flag = No error ;AN000;
686 .ELSE ; else, string provided is too long ;AN000;
687 MOV AX,RC_Not_In_Sw ; Error := RC for Invalid parm ;AN000;
688 STC ; Set error ;AN000;
689 .ENDIF ; ENDIF printbox id. too long ;AN000;
690 .ENDIF ; ENDIF printbox id. provided ;AN000;
691 ;AN000;
692 JMP SHORT GET_PRINTBOX_END ; Return ;AN000;
693 ;AN000;
694 ;-------------------------------------------------------------------------------;AN000;
695 ; /PRINTBOX was already parsed: ;AN000;
696 ;-------------------------------------------------------------------------------;AN000;
697 DUPLICATE_PRINTBOX: ; Already got this switch ;AN000;
698 MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000;
699 STC ; SET ERROR ;AN000;
700 JMP SHORT GET_PRINTBOX_END ; Return ;AN000;
701 ;AN000;
702 ;-------------------------------------------------------------------------------;AN000;
703 ; /LCD was already parsed: ;AN000;
704 ;-------------------------------------------------------------------------------;AN000;
705 BAD_COMBINATION2: ; /LCD and /PRINTBOX invalid at same;AN000;
706 MOV AX,RC_INVLD_COMBINATION ; time, Set the error flag ;AN000;
707 STC ; AX := Error code ;AN000;
708 ;AN000;
709 GET_PRINTBOX_END: ;AN000;
710 POP DI ;AN000;
711 POP SI ;AN000;
712 POP CX ;AN000;
713 RET ;AN000;
714 GET_PRINTBOX_ID ENDP ;AN000;
715 ;AN000;
716 CODE ENDS ;AN000;
717 END ;AN000;