2 TITLE PARSE
CODE AND CONTROL BLOCKS FOR PRINTER
.SYS
4 ;****************** START OF SPECIFICATIONS **************************
6 ; MODULE NAME: PARSER.ASM
8 ; DESCRIPTIVE NAME: PARSES THE DEVICE= STATEMENT IN CONFIG.SYS FOR
11 ; FUNCTION: THE COMMAND LINE PASSED TO PRINTER.SYS IN THE CONFIG.SYS
12 ; STATEMENT IS PARSED TO CHECK FOR CORRECT SYNTAX. A TABLE
13 ; IS SETUP CONTAINING THE VALUES FOUND.
17 ; INPUT: ES:DI POINTS TO REQUEST HEADER
20 ; NORMAL: TABLE SET UP WITH VALUES FOUND.
22 ; ERROR: 0 RETURNED IN FIRST WORD OF TABLE.
24 ; INTERNAL REFERENCES:
26 ; ROUTINES: SYSPARSE - PARSING CODE
28 ; DATA AREAS: PARMSx - PARSE CONTROL BLOCK FOR SYSPARSE
30 ; EXTERNAL REFERENCES:
34 ; DATA AREAS: TABLE - TO CONTAIN VALUES FOUND IN DEVICE= LINE
39 ; AN000; - DOS Version 4.00
40 ; AN001 - GHG Changes had to made for P897. The PARSER was
41 ; changed to need the '=' in the keywords.
43 ; Label: "DOS DISPLAY.SYS Device Driver"
44 ; "Version 4.00 (C) Copyright 1988 Microsoft
45 ; "Licensed Material - Program Property of Microsoft"
48 ;****************** END OF SPECIFICATIONS ****************************
49 ;*Modification history ********************************************************
50 ;AN001; p1482 - PRINTER.SYS refused to initialize 10/6/87 J.K.
51 ;AN002; p2686 No range checking on n parameter for printer.sys 12/11/87 J.K.
52 ;******************************************************************************
55 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57 ; The following is the table structure of the parser. All fields are
58 ; two bytes field (accept for the device and id name)
62 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
63 ; ³ N = Number of devices. ³
64 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
65 ; ³ Device # 1 offset ÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
66 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³
67 ; ³ Device # 2 offset ³ ³ Table_1 (a) ³
68 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³
69 ; ³ Device # 3 offset ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
70 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
71 ; ³ Device # 4 offset ³
72 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
75 ; N = 1,2,3 or 4. A two bytes number indicating the number of device specified.
76 ; DEVICE # N OFFSET : a two bytes offset address to table_1. (ie. Device #1 offset
77 ; is a pointer to table_1 (a). Device #2 offset is a pointer to table_1
78 ; (b)...etc.). If an error was detected in the command N is set to zero.
85 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
86 ; ³ N = Number of Offsets. ³ ³ ³
87 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ÚÄÄÄÄÄij Table_2 (a) ³
88 ; ³ Device Name offset ÄÅÄÄÄÄÙ ³ ³
89 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
90 ; ³ Device Id offset ÄÅÄÄÄÄÄÄ¿
91 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
92 ; ³ Device HWCP offset ÄÅÄÄÄÄ¿ ³ ³ ³
93 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ÀÄÄÄij Table_3 (a) ³
94 ; ³ Device Desg offset ÄÅÄÄ¿ ³ ³ ³
95 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
97 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
99 ; ³ ÀÄÄÄÄÄij Table_4 (a) ³
101 ; ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
102 ; ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
104 ; ÀÄÄÄÄÄÄÄij Table_5 (a) ³
106 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
109 ; N=Length of table_1, or the number of offsets contained in table_1.
110 ; The offsets are pointers (two bytes) to the parameters value of the device.
111 ; "Reserved" : a two byte memory reserved for future use of the "PARMS" option.
117 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
118 ; ³ N = Length of devices name ³
119 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
121 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
123 ; N = Length of device name. Device length is always 8 byte long.
124 ; Device Name : the name of the device (eg. LPT1, CON, PRN). The name
125 ; is paded with spaces to make up the rest of the 8 characters.
132 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
133 ; ³ N = Length of Id name. ³
134 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
136 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
138 ; N = Length of id name. Id name length is always 8 byte long.
139 ; Id Name : the name of the id (eg. EGA, VGA). The name
140 ; is paded with spaces to make up the rest of the 8 character.
147 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
148 ; ³ N = Length of table. ³
149 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
151 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
153 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
157 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
159 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
162 ; N = Length of table in words. Or the number of HWCP's.
163 ; HWCP # N : a hardware code page number converted to binary. The maximum
164 ; number of pages allowed is 10.
171 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
172 ; ³ N = Length of table. ³
173 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
175 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
177 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
179 ; N = Lenght of table. 0 - nothing was specified
180 ; 1 - Only a designate was specified.
181 ; 2 - Designate and font were given. If the Desg field
182 ; was left empty in the DEVICE command then the
183 ; Designate field is filled with 0FFFFH.
184 ; Designate, Font : Are the Desg. and Font binary numbers.
186 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
190 INCLUDE STRUC.INC ; Structured macros ;AN000;
193 INCLUDE CPSPEQU
.INC ;AN000;
195 PUBLIC PARSER
; near procedure for parsing DEVICE= statement ;AN000;
197 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
199 ; Set assemble switches for parse code
201 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
206 Val1SW EQU
1 ;;AN002; ;AN000;
211 CSEG
SEGMENT PARA
PUBLIC 'CODE' ;AN000;
212 ASSUME
CS:CSEG
,DS:NOTHING
,ES:NOTHING
;AN000;
215 EXTRN TABLE
:WORD ; table for variable storage used by INIT module. ;AN000;
216 EXTRN DEVICE_NUM
:WORD ;AN000;
219 INCLUDE PARSE
.ASM
; Parsing code ;AN000;
223 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
225 ; PARM control block for parsing PRINTER.SYS - DEVICE= command statement.
226 ; Command line looks like:
228 ; DEVICE=[d:][path]PRINTER.SYS LPT#[:]=(type[,[hwcp][,n]])
230 ; DEVICE=[d:][path]PRINTER.SYS LPT#[:]=(type[,[(hwcp1,hwcp2,...)][,n]])
232 ; The command line will be parsed from left to right, taking care of the
233 ; nesting of complex lists as they occur.
235 ; The first level of control blocks is shown below.
236 ; Complex list control blocks follow.
237 ; Null VALUE LIST and RESULT BUFFER are placed after all other PARSE control
240 ; d:\path\PRINTER.SYS lpt#=(complex list)
242 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
244 PARMS1
LABEL WORD ;AN000;
246 DB 0 ; no extra delimeters or EOLs. ;AN000;
248 PARMSX1
LABEL BYTE ;AN000;
249 DB 1,1 ; min,max positional operands ;AN000;
250 DW D_NAME
; pointer to control block ;AN000;
251 DB 0 ; no switches ;AN000;
252 DB 1 ; 1 or more keywords ;AN000;
253 DW PRT_LIST
; pointer to control block ;AN000;
255 D_NAME
LABEL WORD ;AN000;
256 DW 0200H ; file spec ;AN000;
257 DW 0001H ; cap result by file table ;AN000;
258 DW RESULT_BUF
; result ;AN000;
259 DW NOVALS
; no value checking done ;AN000;
260 DB 0 ; no keyword/switch synonyms ;AN000;
262 PRT_LIST
LABEL WORD ;AN000;
263 DW 0402H ; complex list, repeats allowed ;AN000;
264 DW 0002H ; cap result by char table ;AN000;
265 DW RESULT_BUF
; result ;AN000;
266 DW NOVALS
; no value checking done ;AN000;
267 DB 8 ; 4 keywords ;AN000;
268 DB "PRN=",0 ;GHG Ŀ ;AN001;
269 DB "LPT1=",0 ;GHG ³ 4 possible keywords ;AN001;
270 DB "LPT2=",0 ;GHG ³ ;AN001;
271 DB "LPT3=",0 ;GHG ÄÙ ;AN001;
272 DB "PRN:=",0 ;GHG Ŀ ;AN001;
273 DB "LPT1:=",0 ;GHG ³ 4 possible keywords ;AN001;
274 DB "LPT2:=",0 ;GHG ³ with colon ;AN001;
275 DB "LPT3:=",0 ;GHG ÄÙ ;AN001;
277 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
279 ; PARM control block for second level of nesting.
280 ; ie. complex list from first level of nesting
282 ; (type, hwcp or complex list, n)
284 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
286 PARMS2
LABEL WORD ;AN000;
288 DB 0 ; no extra delimeters or EOLs. ;AN000;
290 PARMSX2
LABEL BYTE ;AN000;
291 DB 1,3 ; min,max positional operands ;AN000;
292 DW PRT_TYPE
; pointer to control block ;AN000;
293 DW HWCP
; pointer to control block ;AN000;
294 DW CP_PREPS
; pointer to control block ;AN000;
295 DB 0 ; no switches ;AN000;
296 DB 0 ; no keywords ;AN000;
298 PRT_TYPE
LABEL BYTE ;AN000;
299 DW 2000H
; sstring ;AN000;
300 DW 0002H ; cap by char table ;AN000;
301 DW RESULT_BUF
; result ;AN000;
302 DW NOVALS
; value list ;AN000;
303 DB 0 ; no keyword/switch synonyms ;AN000;
305 HWCP
LABEL BYTE ;AN000;
306 DW 8401H
; numeric or complex list (optional) ;AN000;
307 DW 0 ; no functions ;AN000;
308 DW RESULT_BUF
; result ;AN000;
309 DW NOVALS
; no value checking done ;AN000;
310 DB 0 ; no keyword/switch synonyms ;AN000;
312 CP_PREPS
LABEL BYTE ;AN000;
313 DW 8001H
; numeric (optional) ;AN000;
314 DW 0 ; no functions ;AN000;
315 DW RESULT_BUF
; result ;AN000;
316 DW N_Val_Range
;AN002; value list ;AN000;
317 DB 0 ; no keyword/switch synonyms ;AN000;
320 N_Val_Range
label byte
321 db 1 ;AN002; Range defintion
322 db 1 ;AN002; Number of ranges
323 db 1 ;AN002; item tag
324 dd 0, 12 ;AN002; 0 - 12
326 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
328 ; PARM control block for third level of nesting.
329 ; ie. complex list from second nesting level
333 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
335 PARMS3
LABEL WORD ;AN000;
337 DB 0 ; no extra delimeters or EOLs. ;AN000;
339 PARMSX3
LABEL BYTE ;AN000;
340 DB 1,1 ; min,max positional operands ;AN000;
341 DW HWCPS
; pointer to control block ;AN000;
342 DB 0 ; no switches ;AN000;
343 DB 0 ; no keywords ;AN000;
345 HWCPS
LABEL BYTE ;AN000;
346 DW 8003H
; numeric, repeats allowed ;AN000;
347 DW 0 ; no functions ;AN000;
348 DW RESULT_BUF
; result ;AN000;
349 DW NOVALS
; no value checking done ;AN000;
350 DB 0 ; no keyword/switch synonyms ;AN000;
353 ; Null VALUE LIST and RESULT BUFFER for all PARSE control blocks
356 NOVALS
LABEL BYTE ;AN000;
357 DB 0 ; no value checking done ;AN000;
359 RESULT_BUF
LABEL BYTE ;AN000;
360 RESULT_TYPE
DB ?
; type returned (number, string, etc.) ;AN000;
361 DB ?
; matched item tag (if applicable) ;AN000;
362 SYN_PTR
DW ?
; synonym ptr (if applicable) ;AN000;
363 RESULT_VAL
DD ?
; value ;AN000;
366 OK_FLAG
DB ON ; FLAG INDICATING PARSE STATUS ;AN000;
367 NUM_LOOP
DB ZERO
;AN000;
370 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
372 ; PROCEDURE_NAME: PARSER
375 ; THIS PROCEDURE PARSES THE DEVICE= PARAMETERS FROM THE INIT REQUEST
378 ; AT ENTRY: ES:DI POINTS TO REQUEST HEADER
381 ; NORMAL: TABLE SET UP WITH VALUES FOUND
383 ; ERROR: 0 LOADED IN FIRST WORD OF TABLE
385 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
387 PARSER PROC
NEAR ;AN000;
395 LDS SI,RH
.RH0_BPBA
; ;AN000;
396 PUSH CS ; establish ES .. ;AN000;
397 POP ES ; addressability to data ;AN000;
398 LEA DI,PARMS1
; point to PARMS control block ;AN000;
399 XOR CX,CX ; clear both CX and DX for ;AN000;
400 XOR DX,DX ; SYSPARSE ;AN000;
401 CALL SYSPARSE
; move pointer past file spec ;AN000;
402 CALL SYSPARSE
; do first parse ;AN000;
403 LEA BX,TABLE
; ;AN000;
404 .WHILE <AX NE RC_EOL
> AND ; EOL?...then end parse...and.. ;AN000;
405 .WHILE <OK_FLAG
EQ ON> ; make sure that flag still ok.. ;AN000;
406 .IF <AX NE RC_NO_ERROR
> ; parse error? ;AN000;
407 MOV OK_FLAG
,OFF
; yes...reset flag ;AN000;
410 .WHEN
<RESULT_TYPE
EQ COMPLEX
>; complex string found? ;AN000;
411 INC DEVICE_NUM
; increment count ;AN000;
412 INC BX ; point to next device table ;AN000;
414 .IF <DEVICE_NUM GT FOUR
> ; more than one? ;AN000;
415 MOV OK_FLAG
,OFF
; yes....we have an error ;AN000;
416 .ELSE ; no .. ;AN000;
418 MOV BX,CS:[BX] ; ;AN000;
419 CALL COPY_NAME
; ;AN000;
420 MOV NUM_LOOP
,ZERO
; ;AN000;
421 CALL PARSE_MAIN
; process complex string.. ;AN000;
424 .OTHERWISE
; not a complex string so.. ;AN000;
425 MOV OK_FLAG
,OFF
; we have a problem...reset flag ;AN000;
429 CALL SYSPARSE
; continue parsing.. ;AN000;
432 .IF <OK_FLAG
EQ OFF
> ; flag indicating error? ;AN000;
433 MOV DEVICE_NUM
,ZERO
; yes...set device number to 0 ;AN000;
448 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
450 ; PROCEDURE_NAME: PARSE_MAIN
453 ; THIS PROCEDURE PARSES THE LPT=( ) COMPLEX LIST DEVICE= LINE FOUND
456 ; AT ENTRY: RESULT BUFFER CONTAINS POINTER TO COMPLEX STRING
459 ; NORMAL: TABLE SET UP WITH VALUES FOUND
464 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
466 PARSE_MAIN PROC
NEAR ;AN000;
468 PUSH DI ; setup to parse the nested.. ;AN000;
469 PUSH DS ; complex string...but save.. ;AN000;
470 PUSH SI ; current parsing status. ;AN000;
473 LEA DI,PARMS2
; next control block.. ;AN000;
474 LDS SI,RESULT_VAL
; point to stored string ;AN000;
476 CALL SYSPARSE
; ;AN000;
478 .WHILE <AX NE RC_EOL
> AND ; not EOL? and.. ;AN000;
479 .WHILE <OK_FLAG
EQ ON> ; error flag still ok? ;AN000;
480 INC NUM_LOOP
; ;AN000;
481 .IF <AX NE RC_NO_ERROR
> ; check for parse errors ;AN000;
482 MOV OK_FLAG
,OFF
; yes....reset error flag ;AN000;
483 .ELSE ; no...process ;AN000;
486 .WHEN
<RESULT_TYPE
EQ STRING
> ; simple string ;AN000;
487 MOV BX,CS:[BX].DI_OFFSET
; ;AN000;
488 CALL PARSE_STR
; yes...process ;AN000;
489 .WHEN
<RESULT_TYPE
EQ NUMBER
> ; number?.. ;AN000;
490 .IF <NUM_LOOP
EQ TWO
> ; ;AN000;
491 MOV BX,CS:[BX].DCP_OFFSET
;AN000;
493 MOV BX,CS:[BX].DD_OFFSET
;AN000;
495 MOV AX,WORD PTR RESULT_VAL
; get value into word form ;AN000;
496 .IF <AX NE ZERO
> ;AN000;
497 INC WORD PTR CS:[BX] ; ;AN000;
498 MOV WORD PTR CS:[BX+2],AX ; load that value. ;AN000;
500 .WHEN
<RESULT_TYPE
EQ COMPLEX
> ; complex string? ;AN000;
501 MOV BX,CS:[BX].DCP_OFFSET
; ;AN000;
502 CALL PARSE_COMP
; yes...process ;AN000;
503 .OTHERWISE
; anything else is.. ;AN000;
504 MOV OK_FLAG
,OFF
; an error...reset flag. ;AN000;
506 CALL SYSPARSE
; continue parsing ;AN000;
510 POP CX ; restore original parse.. ;AN000;
511 POP SI ; registers. ;AN000;
516 PARSE_MAIN ENDP
;AN000;
519 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
521 ; PROCEDURE_NAME: PARSE_COMP
524 ; THIS PROCEDURE PARSES A COMPLEX LIST FOUND WITHIN THE LPT=( )
527 ; AT ENTRY: RESULT BUFFER CONTAINS POINTER TO COMPLEX STRING
530 ; NORMAL: TABLE SET UP WITH VALUES FOUND
534 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
536 PARSE_COMP PROC
NEAR ;AN000;
537 PUSH DI ; setup ro parse the nested.. ;AN000;
538 PUSH DS ; complex string..saving the.. ;AN000;
539 PUSH SI ; current parse status. ;AN000;
544 LEA DI,PARMS3
; next control block ;AN000;
545 LDS SI,RESULT_VAL
; point to stored string. ;AN000;
547 CALL SYSPARSE
; ;AN000;
549 .WHILE <AX NE RC_EOL
> AND ; not EOL?...and.. ;AN000;
550 .WHILE <OK_FLAG
EQ ON> AND ; error flag still okay? ;AN000;
551 .WHILE <AX NE RC_OP_MISSING
> ; ;AN000;
552 .IF <AX NE RC_NO_ERROR
> ; parse error?...or.. ;AN000;
553 MOV OK_FLAG
,OFF
; found?....yes..reset flag. ;AN000;
554 .ELSE ; no...process.. ;AN000;
555 INC WORD PTR CS:[BX] ; increment counter ;AN000;
556 .IF <<WORD PTR CS:[BX]> LE TEN
> ;AN000;
558 MOV AX,WORD PTR RESULT_VAL
; get numeric value into word ;AN000;
559 MOV WORD PTR CS:[DI+2],AX ; ;AN000;
564 LEA DI,PARMS3
; ;AN000;
565 CALL SYSPARSE
; continue parsing ;AN000;
568 MOV OK_FLAG
,OFF
; ;AN000;
573 POP CX ; restore previous parse.. ;AN000;
574 POP SI ; registers. ;AN000;
578 PARSE_COMP ENDP
;AN000;
581 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
583 ; PROCEDURE_NAME: PARSE_STR
586 ; THIS PROCEDURE PARSES A STRING FOUND WITHIN THE LPT=( ) STATEMENT
588 ; AT ENTRY: RESULT BUFFER POINTS TO ASCIIZ STRING
591 ; NORMAL: TABLE SET UP WITH VALUES FOUND
593 ; ERROR: STRING > 8 - OK_FLAG SET OFF
595 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
597 PARSE_STR PROC
NEAR ;AN000;
598 PUSH DI ; get source and.. ;AN000;
599 PUSH DS ; destination registers.. ;AN000;
600 PUSH SI ; setup. ;AN000;
602 LDS SI,RESULT_VAL
; ;AN000;
604 MOV CS:[DI].N_LENGTH
,EIGHT
; ;AN000;
607 MOV CX,EIGHT
; ;AN000;
608 LODSB ; load first character. ;AN000;
609 .WHILE <AL NE ZERO
> AND ; while not at end of ASCIIZ do.. ;AN000;
610 .WHILE <CX NE ZERO
> ; ;AN000;
611 STOSB ; store.. ;AN000;
612 LODSB ; load next character.. ;AN000;
615 .IF <CX EQ ZERO
> ;AN000;
616 MOV OK_FLAG
,OFF
;AN000;
618 POP CX ; value found. ;AN000;
619 POP SI ; restore registers. ;AN000;
623 PARSE_STR ENDP
;AN000;
626 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
628 ; PROCEDURE_NAME: COPY_NAME
631 ; THIS PROCEDURE COPIES THE FOUND STRING VALUE INTO THE TABLE.
636 ; NORMAL: TABLE UPDATED
640 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
642 COPY_NAME PROC
NEAR ;AN000;
643 PUSH DI ; get source and.. ;AN000;
644 PUSH DS ; destination registers.. ;AN000;
645 PUSH SI ; setup. ;AN000;
648 MOV SI,SYN_PTR
; ;AN000;
649 MOV DI,CS:[BX].DN_OFFSET
; ;AN000;
650 MOV CS:[DI].N_LENGTH
,EIGHT
; ;AN000;
653 LODSB ; load first character. ;AN000;
654 .WHILE <AL NE ZERO
> ; while not at end of ASCIIZ do.. ;AN000;
655 .IF <AL NE
':'> AND ;ignore colon ;AN001;
656 .IF <AL NE
'='> ; or = ;AN001;
657 STOSB ; store.. ;AN000;
659 LODSB ; load next character.. ;AN000;
661 POP SI ; restore registers. ;AN000;
665 COPY_NAME ENDP
;AN000;