summaryrefslogtreecommitdiff
path: root/v4.0/src/DEV/DISPLAY/PARSER.ASM
diff options
context:
space:
mode:
authorGravatar Mark Zbikowski2024-04-25 21:24:10 +0100
committerGravatar Microsoft Open Source2024-04-25 22:32:27 +0000
commit2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch)
tree80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/DEV/DISPLAY/PARSER.ASM
parentMerge pull request #430 from jpbaltazar/typoptbr (diff)
downloadms-dos-main.tar.gz
ms-dos-main.tar.xz
ms-dos-main.zip
MZ is back!HEADmain
Diffstat (limited to 'v4.0/src/DEV/DISPLAY/PARSER.ASM')
-rw-r--r--v4.0/src/DEV/DISPLAY/PARSER.ASM809
1 files changed, 809 insertions, 0 deletions
diff --git a/v4.0/src/DEV/DISPLAY/PARSER.ASM b/v4.0/src/DEV/DISPLAY/PARSER.ASM
new file mode 100644
index 0000000..d72a40e
--- /dev/null
+++ b/v4.0/src/DEV/DISPLAY/PARSER.ASM
@@ -0,0 +1,809 @@
1PAGE ,132
2TITLE PARSE CODE AND CONTROL BLOCKS FOR DISPLAY.SYS
3
4;****************** START OF SPECIFICATIONS **************************
5;
6; MODULE NAME: PARSER.ASM
7;
8; DESCRIPTIVE NAME: PARSES THE DEVICE= STATEMENT IN CONFIG.SYS FOR
9; DISPLAY.SYS
10;
11; FUNCTION: THE COMMAND LINE PASSED TO DISPLAY.SYS IN THE CONFIG.SYS
12; STATEMENT IS PARSED TO CHECK FOR CORRECT SYNTAX. A TABLE
13; IS SETUP CONTAINING THE VALUES FOUND.
14;
15; ENTRY POINT: PARSER
16;
17; INPUT: ES:DI POINTS TO REQUEST HEADER
18;
19; AT EXIT:
20; NORMAL: TABLE SET UP WITH VALUES FOUND.
21;
22; ERROR: 0 RETURNED IN FIRST WORD OF TABLE.
23;
24; INTERNAL REFERENCES:
25;
26; ROUTINES: SYSPARSE - PARSING CODE
27;
28; DATA AREAS: PARMSx - PARSE CONTROL BLOCK FOR SYSPARSE
29; TABLE - TO CONTAIN VALUES FOUND IN DEVICE= LINE
30;
31; EXTERNAL REFERENCES:
32;
33; ROUTINES: N/A
34;
35; DATA AREAS: N/A
36;
37; NOTES:
38;
39; REVISION HISTORY:
40; AN000; - DOS Version 4.00
41; AN001 - GHG P897 - Changes to the parser forced the inclusion
42; of the '=' in the device ID.
43;
44; Label: "The DOS DISPLAY.SYS Device Driver"
45; "Version 4.00 (C) Copyright 1988 Microsoft
46; "Licensed Material - Program Property of Microsoft"
47;
48;****************** END OF SPECIFICATIONS ****************************
49;Modification history *********************************************************
50;AN002; P1895 DISPLAY.SYS rejects command CON=(cga,(437),(0,0)) 10/22/87 J.K.
51;******************************************************************************
52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
53;
54; The following is the table structure of the parser. All fields are
55; two bytes field (accept for the device and id name)
56;
57; TABLE HEADER :
58; ÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
59; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
60; ³ N = Number of devices. ³
61; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
62; ³ Device # 1 offset ÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
63; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³
64; ³ Device # 2 offset ³ ³ Table_1 (a) ³
65; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³
66; ³ Device # 3 offset ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
67; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
68; ³ Device # 4 offset ³
69; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
70;
71;
72; N = 1,2,3 or 4. A two bytes number indicating the number of device specified.
73; DEVICE # N OFFSET : a two bytes offset address to table_1. (ie. Device #1 offset
74; is a pointer to table_1 (a). Device #2 offset is a pointer to table_1
75; (b)...etc.). If an error was detected in the command N is set to zero.
76;
77;
78;
79; TABLE_1 :
80; ÍÍÍÍÍÍÍÍÍ
81;
82; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
83; ³ N = Number of Offsets. ³ ³ ³
84; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ÚÄÄÄÄÄij Table_2 (a) ³
85; ³ Device Name offset ÄÅÄÄÄÄÙ ³ ³
86; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
87; ³ Device Id offset ÄÅÄÄÄÄÄÄ¿
88; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
89; ³ Device HWCP offset ÄÅÄÄÄÄ¿ ³ ³ ³
90; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ÀÄÄÄij Table_3 (a) ³
91; ³ Device Desg offset ÄÅÄÄ¿ ³ ³ ³
92; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
93; ³ "Reserved" ³ ³ ³
94; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
95; ³ ³ ³ ³
96; ³ ÀÄÄÄÄÄij Table_4 (a) ³
97; ³ ³ ³
98; ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
99; ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
100; ³ ³ ³
101; ÀÄÄÄÄÄÄÄij Table_5 (a) ³
102; ³ ³
103; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
104;
105;
106; N=Length of table_1, or the number of offsets contained in table_1.
107; The offsets are pointers (two bytes) to the parameters value of the device.
108; "Reserved" : a two byte memory reserved for future use of the "PARMS" option.
109;
110;
111; TABLE_2 :
112; ÍÍÍÍÍÍÍÍÍ
113;
114; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
115; ³ N = Length of devices name ³
116; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
117; ³ Device name ³
118; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
119;
120; N = Length of device name. Device length is always 8 byte long.
121; Device Name : the name of the device (eg. LPT1, CON, PRN). The name
122; is paded with spaces to make up the rest of the 8 characters.
123;
124;
125;
126; TABLE_3 :
127; ÍÍÍÍÍÍÍÍÍ
128;
129; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
130; ³ N = Length of Id name. ³
131; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
132; ³ Id Name ³
133; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
134;
135; N = Length of id name. Id name length is always 8 byte long.
136; Id Name : the name of the id (eg. EGA, VGA). The name
137; is paded with spaces to make up the rest of the 8 character.
138;
139;
140;
141; TABLE_4 :
142; ÍÍÍÍÍÍÍÍÍ
143;
144; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
145; ³ N = Length of table. ³
146; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
147; ³ HWCP # 1 ³
148; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
149; ³ HWCP # 2 ³
150; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
151; ³ . ³
152; ³ . ³
153; ³ . ³
154; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
155; ³ HWCP # 10 ³
156; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
157;
158;
159; N = Length of table in words. Or the number of HWCP's.
160; HWCP # N : a hardware code page number converted to binary. The maximum
161; number of pages allowed is 10.
162;
163;
164;
165; TABLE_5 :
166; ÍÍÍÍÍÍÍÍÍ
167;
168; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
169; ³ N = Length of table. ³
170; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
171; ³ Designate ³
172; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
173; ³ Font ³
174; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
175;
176; N = Lenght of table. 0 - nothing was specified
177; 1 - Only a designate was specified.
178; 2 - Designate and font were given. If the Desg field
179; was left empty in the DEVICE command then the
180; Designate field is filled with 0FFFFH.
181; Designate, Font : Are the Desg. and Font binary numbers.
182;
183;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
184
185INCLUDE DEF-EQU.INC ; structures and equates ;AN000;
186
187.XLIST
188INCLUDE STRUC.INC ; Structured macros ;AN000;
189.LIST
190
191PUBLIC PARSER ; near procedure for parsing DEVICE= statement ;AN000;
192PUBLIC TABLE ; table for variable storage used by INIT module. ;AN000;
193PUBLIC GET_DEVICE_ID ; procedure to determine device adapter ;AN000;
194
195;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
196;
197; Set assemble switches for parse code
198;
199;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
200
201DateSW EQU 0 ;AN000;
202DrvSW EQU 0 ;AN000;
203SwSW EQU 0 ;AN000;
204Val1SW EQU 0 ;AN000;
205Val2SW EQU 0 ;AN000;
206Val3SW EQU 0 ;AN000;
207
208
209CODE SEGMENT PUBLIC BYTE 'CODE'
210 ASSUME CS:CODE
211
212
213.XLIST
214INCLUDE PARSE.ASM ; Parsing code ;AN000;
215.LIST
216
217
218;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
219;
220; PARM control block for DISPLAY.SYS - DEVICE= command statement.
221; Command line looks like:
222;
223; DEVICE=[d:][path]DISPLAY.SYS CON[:]=(type[,[hwcp][,n]])
224; or
225; DEVICE=[d:][path]DISPLAY.SYS CON[:]=(type[,[hwcp][,(n,m)]])
226; or, for compatibility with DOS 3.3; PTM P1895
227; DEVICE=[d:][path]DISPLAY.SYS CON[:]=(type[,[(hwcp)][,n|(n,m)]])
228;
229; The command line will be parsed from left to right, taking care of the
230; nesting of complex lists as they occur.
231;
232; The first level of control blocks is shown below.
233; Complex list control blocks follow.
234; Null VALUE LIST and RESULT BUFFER are placed after all other PARSE control
235; blocks.
236;
237; d:\path\DISPLAY.SYS CON=(complex list)
238;
239;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
240
241PARMS1 LABEL WORD ;AN000;
242 DW PARMSX1 ;AN000;
243 DB 0 ; no extra delimeters or EOLs. ;AN000;
244
245PARMSX1 LABEL BYTE ;AN000;
246 DB 1,1 ; min,max positional operands ;AN000;
247 DW D_NAME ; pointer to control block ;AN000;
248 DB 0 ; no switches ;AN000;
249 DB 1 ; 1 keywords ;AN000;
250 DW DSP_LIST ; pointer to control block ;AN000;
251
252D_NAME LABEL WORD ;AN000;
253 DW 0200H ; file spec ;AN000;
254 DW 0001H ; cap result by file table ;AN000;
255 DW RESULT_BUF ; result ;AN000;
256 DW NOVALS ; no value checking done ;AN000;
257 DB 0 ; no keyword/switch synonyms ;AN000;
258
259DSP_LIST LABEL WORD ;AN000;
260 DW 0400H ; complex list, ignore colon ;AN000;
261 DW 0012H ; cap result by char table ;AN000;
262 DW RESULT_BUF ; result ;AN000;
263 DW NOVALS ; no value checking done ;AN000;
264 DB 2 ; 1 keyword ;AN000;
265 DB "CON=",0 ;GHG CON[:]= keyword ;AN001;
266 DB "CON:=",0 ;GHG ;AN001;
267
268;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
269;
270; PARM control block for second level of nesting.
271; ie. complex list from first level of nesting
272;
273; (type, hwcp, n or complex list)
274;or,
275; (type, (hwcp), n or complex list)
276;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
277
278PARMS2 LABEL WORD ;AN000;
279 DW PARMSX2 ;AN000;
280 DB 0 ; no extra delimeters or EOLs. ;AN000;
281
282PARMSX2 LABEL BYTE ;AN000;
283 DB 0,3 ; min,max positional operands ;AN000;
284 DW DSP_TYPE ; pointer to control block ;AN000;
285 DW HWCP ; pointer to control block ;AN000;
286 DW CP_PREPS ; pointer to control block ;AN000;
287 DB 0 ; no switches ;AN000;
288 DB 0 ; no keywords ;AN000;
289
290DSP_TYPE LABEL BYTE ;AN000;
291 DW 2001H ; sstring (optional) ;AN000;
292 DW 0002H ; cap by char table ;AN000;
293 DW RESULT_BUF ; result ;AN000;
294 DW NOVALS ; value list ;AN000;
295 DB 0 ; no keyword/switch synonyms ;AN000;
296
297
298HWCP LABEL BYTE ;AN000;
299 DW 8401H ;AN002; numeric or complex list (optional)
300 DW 0 ; no functions ;AN000;
301 DW RESULT_BUF ; result ;AN000;
302 DW NOVALS ; no value checking done ;AN000;
303 DB 0 ; no keyword/switch synonyms ;AN000;
304
305CP_PREPS 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 ; value list ;AN000;
310 DB 0 ; no keyword/switch synonyms ;AN000;
311
312
313;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
314;
315; PARM control block for third level of nesting.
316; ie. complex list from second nesting level
317;
318; (hwcp)
319;
320;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
321
322PARMS3_X LABEL WORD ;AN002;
323 DW PARMSX3_X ;AN002;
324 DB 0 ;AN002; no extra delimeters or EOLs.
325
326PARMSX3_X LABEL BYTE ;AN002;
327 DB 1,1 ;AN002; min,max positional operands
328 DW PREPS ;AN002; pointer to control block
329 DB 0 ;AN002; no switches
330 DB 0 ;AN002; no keywords
331
332;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
333;
334; PARM control block for third level of nesting.
335; ie. complex list from second nesting level
336;
337; (n,m)
338;
339;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
340
341PARMS3 LABEL WORD ;AN000;
342 DW PARMSX3 ;AN000;
343 DB 0 ; no extra delimeters or EOLs. ;AN000;
344
345PARMSX3 LABEL BYTE ;AN000;
346 DB 1,2 ; min,max positional operands ;AN000;
347 DW PREPS ; pointer to control block ;AN000;
348 DW SUBFONTS ; pointer to control block ;AN000;
349 DB 0 ; no switches ;AN000;
350 DB 0 ; no keywords ;AN000;
351
352PREPS LABEL BYTE ;AN000;
353 DW 8000H ; numeric ;AN000;
354 DW 0 ; no functions ;AN000;
355 DW RESULT_BUF ; result ;AN000;
356 DW NOVALS ; value list ;AN000;
357 DB 0 ; no keyword/switch synonyms ;AN000;
358
359SUBFONTS LABEL BYTE ;AN000;
360 DW 8001H ; numeric (optional) ;AN000;
361 DW 0 ; no functions ;AN000;
362 DW RESULT_BUF ; result ;AN000;
363 DW NOVALS ; no value checking done ;AN000;
364 DB 0 ; no keyword/switch synonyms ;AN000;
365
366; Null VALUE LIST and RESULT BUFFER for all PARSE control blocks ;AN000;
367
368NOVALS LABEL BYTE ;AN000;
369 DB 0 ; no value checking done ;AN000;
370
371RESULT_BUF LABEL BYTE ;AN000;
372RESULT_TYPE DB ? ; type returned (number, string, etc.) ;AN000;
373 DB ? ; matched item tag (if applicable) ;AN000;
374 DW ? ; synonym ptr (if applicable) ;AN000;
375RESULT_VAL DD ? ; value ;AN000;
376
377;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
378;
379; TABLE STRUCTURE FOR RETURNING VALUES TO THE INIT MODULE
380; (ADAPTED FROM VERSION 1.0 DISPLAY.SYS)
381;
382;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
383
384TABLE LABEL BYTE ; table header ;AN000;
385DEVICE_NUM DW ONE ; should only be one device ;AN000;
386TABLE2_PTR DW TABLE2 ; pointer to table 2 ;AN000;
387
388TABLE2 LABEL WORD ;AN000;
389OFFSET_NUM DW FOUR ; 4 pointer follow ;AN000;
390TABLE3_PTR DW TABLE3 ; pointer to table 3 (device name) ;AN000;
391TABLE4_PTR DW TABLE4 ; pointer to table 4 (device id) ;AN000;
392TABLE5_PTR DW TABLE5 ; pointer to table 5 (hwcp's) ;AN000;
393TABLE6_PTR DW TABLE6 ; pointer to table 6 (num desg's and fonts) ;AN000;
394
395TABLE3 LABEL WORD ; device name (ie. CON) ;AN000;
396T3_LENGTH DW EIGHT ; length ;AN000;
397T3_NAME DB "CON " ; value ;AN000;
398
399TABLE4 LABEL WORD ; device id. (eg. EGA,MONO...) ;AN000;
400T4_LENGTH DW ZERO ; length ;AN000;
401T4_NAME DB " " ; value ;AN000;
402
403TABLE5 LABEL WORD ; hardware code pages ;AN000;
404T5_NUM DW ZERO ; only 1 for CON ;AN000;
405T5_VALUE DW ? ; value ;AN000;
406
407TABLE6 LABEL WORD ; Designates and fonts ;AN000;
408T6_NUM DW ZERO ; values given (0 - 2 valid) ;AN000;
409T6_DESG DW ? ; n value ;AN000;
410T6_FONT DW ? ; m value ;AN000;
411
412
413OK_FLAG DB ON ; FLAG INDICATING PARSE STATUS ;AN000;
414LOOP1 DB ZERO ;AN000;
415LOOP2 DB ZERO ;AN000;
416
417;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
418;
419; PROCEDURE_NAME: PARSER
420;
421; FUNCTION:
422; THIS PROCEDURE PARSES THE DEVICE= PARAMETERS FROM THE INIT REQUEST
423; BLOCK.
424;
425; AT ENTRY: ES:DI POINTS TO REQUEST HEADER
426;
427; AT EXIT:
428; NORMAL: TABLE SET UP WITH VALUES FOUND
429;
430; ERROR: 0 LOADED IN FIRST WORD OF TABLE
431;
432; AUTHOR: WGR
433;
434;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
435
436PARSER PROC NEAR ;AN000;
437 PUSH ES ;AN000;
438 PUSH BX ;AN000;
439 PUSH DS ; ;AN000;
440 PUSH SI ; ;AN000;
441 LDS SI,RH.RH0_BPBA ; ;AN000;
442 PUSH CS ; establish ES .. ;AN000;
443 POP ES ; addressability to data ;AN000;
444 LEA DI,PARMS1 ; point to PARMS control block ;AN000;
445 XOR CX,CX ; clear both CX and DX for ;AN000;
446 XOR DX,DX ; SYSPARSE ;AN000;
447 CALL SYSPARSE ; move pointer past file spec ;AN000;
448 CALL SYSPARSE ; do first parse ;AN000;
449 .WHILE <AX NE RC_EOL> AND ; EOL?...then end parse...and.. ;AN000;
450 .WHILE <OK_FLAG EQ ON> ; make sure that flag still ok.. ;AN000;
451 .IF <AX NE RC_NO_ERROR> ; parse error? ;AN000;
452 MOV OK_FLAG,OFF ; yes...reset flag ;AN000;
453 .ELSE ; no...process.. ;AN000;
454 .SELECT ; ;AN000;
455 .WHEN <RESULT_TYPE EQ COMPLEX> ; complex string found? ;AN000;
456 INC LOOP1 ; increment count ;AN000;
457 .IF <LOOP1 GT ONE> ; more than one? ;AN000;
458 MOV OK_FLAG,OFF ; yes....we have an error ;AN000;
459 .ELSE ; no .. ;AN000;
460 CALL PARSE_MAIN ; process complex string.. ;AN000;
461 .ENDIF ; ;AN000;
462 .OTHERWISE ; not a complex string so.. ;AN000;
463 MOV OK_FLAG,OFF ; we have a problem...reset flag ;AN000;
464 .ENDSELECT ; ;AN000;
465 CALL SYSPARSE ; continue parsing.. ;AN000;
466 .ENDIF ; ;AN000;
467 .ENDWHILE ; ;AN000;
468 .IF <OK_FLAG EQ OFF> OR ; flag indicating error? ;AN000;
469 .IF <LOOP1 EQ ZERO> ; or no parameters specified? ;AN000;
470 MOV DEVICE_NUM,ZERO ; yes...set device number to 0 ;AN000;
471 STC ; ;AN000;
472 .ELSE ; ;AN000;
473 CLC ; ;AN000;
474 .ENDIF ; ;AN000;
475 POP SI ; ;AN000;
476 POP DS ; ;AN000;
477 POP BX ; ;AN000;
478 POP ES ; ;AN000;
479 RET ; ;AN000;
480PARSER ENDP ;AN000;
481
482
483;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
484;
485; PROCEDURE_NAME: PARSE_MAIN
486;
487; FUNCTION:
488; THIS PROCEDURE PARSES THE CON=( ) COMPLEX LIST DEVICE= LINE FOUND
489; IN CONFIG.SYS
490;
491; AT ENTRY: RESULT BUFFER CONTAINS POINTER TO COMPLEX STRING
492;
493; AT EXIT:
494; NORMAL: TABLE SET UP WITH VALUES FOUND
495;
496; ERROR: OK_FLAG = 0
497;
498;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
499
500PARSE_MAIN PROC NEAR ;AN000;
501 PUSH DI ; setup to parse the nested.. ;AN000;
502 PUSH DS ; complex string...but save.. ;AN000;
503 PUSH SI ; current parsing status. ;AN000;
504 PUSH CX ; ;AN000;
505 XOR CX,CX ; ;AN000;
506 LEA DI,PARMS2 ; next control block.. ;AN000;
507 LDS SI,RESULT_VAL ; point to stored string ;AN000;
508 CALL SYSPARSE ; ;AN000;
509 .WHILE <AX NE RC_EOL> AND ; not EOL? and.. ;AN000;
510 .WHILE <OK_FLAG EQ ON> ; error flag still ok? ;AN000;
511 .IF <AX NE RC_NO_ERROR> ; check for parse errors ;AN000;
512 MOV OK_FLAG,OFF ; yes....reset error flag ;AN000;
513 .ELSE ; no...process ;AN000;
514 INC LOOP2 ; ;AN000;
515 .SELECT ; ;AN000;
516 .WHEN <RESULT_TYPE EQ STRING> ; simple string ;AN000;
517 CALL PARSE_STR ; yes...process ;AN000;
518 .WHEN <RESULT_TYPE EQ NUMBER> ; number?.. ;AN000;
519 CALL PARSE_NUM ; yes...process ;AN000;
520 .WHEN <RESULT_TYPE EQ COMPLEX> ; complex string? ;AN000;
521 CALL PARSE_COMPLEX ;AN002;
522 .OTHERWISE ; anything else is.. ;AN000;
523 MOV OK_FLAG,OFF ; an error...reset flag. ;AN000;
524 .ENDSELECT ; ;AN000;
525 CALL SYSPARSE ; continue parsing ;AN000;
526 .ENDIF ; ;AN000;
527 .ENDWHILE ; ;AN000;
528 POP CX ; restore original parse.. ;AN000;
529 POP SI ; registers. ;AN000;
530 POP DS ; ;AN000;
531 POP DI ; ;AN000;
532 RET ; ;AN000;
533PARSE_MAIN ENDP
534
535;
536PARSE_COMPLEX PROC ;AN002;
537 .IF <LOOP2 EQ TWO> ;AN002; Should be for HWCP
538 CALL PARSE_COMP_X ;AN002; for (hwcp)
539 .ELSE ;AN002;
540 CALL PARSE_COMP ; yes...process for (n,m) ;AN000;
541 .ENDIF ;AN002;
542 ret ;AN002;
543PARSE_COMPLEX ENDP
544
545;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
546;
547; PROCEDURE_NAME: PARSE_COMP_X
548;
549; FUNCTION:
550; THIS PROCEDURE PARSES A COMPLEX LIST FOUND WITHIN THE CON=( )
551; COMPLEX LIST for (hwcp).
552;
553; AT ENTRY: RESULT BUFFER CONTAINS POINTER TO COMPLEX STRING
554;
555; AT EXIT:
556; NORMAL: TABLE SET UP WITH VALUES FOUND
557;
558; ERROR: OK_FLAG = 0
559;
560;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
561
562PARSE_COMP_X PROC NEAR ;AN002;
563 PUSH DI ;AN002; setup ro parse the nested..
564 PUSH DS ;AN002; complex string..saving the..
565 PUSH SI ;AN002; current parse status.
566 PUSH CX ;AN002;
567 XOR CX,CX ;AN002;
568 LEA DI,PARMS3_X ;AN002; next control block
569 LDS SI,RESULT_VAL ;AN002; point to stored string.
570 CALL SYSPARSE ;AN002;
571 .WHILE <AX NE RC_EOL> AND ;AN002; not EOL?...and..
572 .WHILE <OK_FLAG EQ ON> ;AN002; error flag still okay?
573 .IF <AX NE RC_NO_ERROR> OR ;AN002; parse error?...or..
574 .IF <RESULT_TYPE NE NUMBER> ;AN002; something other than a number..
575 MOV OK_FLAG,OFF ;AN002; found?....yes..reset flag.
576 .ELSE ;AN002; no...process..
577 INC T5_NUM ;AN002; increment counter
578 MOV AX,WORD PTR RESULT_VAL ;AN002; get numeric value into word
579 MOV T5_VALUE,AX ;AN002; yes...number of designates.
580 CALL SYSPARSE ;AN002; continue parsing
581 .ENDIF ;AN002;
582 .ENDWHILE ;AN002;
583 POP CX ;AN002; restore previous parse..
584 POP SI ;AN002; registers.
585 POP DS ;AN002;
586 POP DI ;AN002;
587 RET ;AN002;
588PARSE_COMP_X ENDP ;AN002;
589
590
591;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
592;
593; PROCEDURE_NAME: PARSE_COMP
594;
595; FUNCTION:
596; THIS PROCEDURE PARSES A COMPLEX LIST FOUND WITHIN THE CON=( )
597; COMPLEX LIST for (n,m).
598;
599; AT ENTRY: RESULT BUFFER CONTAINS POINTER TO COMPLEX STRING
600;
601; AT EXIT:
602; NORMAL: TABLE SET UP WITH VALUES FOUND
603;
604; ERROR: OK_FLAG = 0
605;
606;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
607
608PARSE_COMP PROC NEAR ;AN000;
609 PUSH DI ; setup ro parse the nested.. ;AN000;
610 PUSH DS ; complex string..saving the.. ;AN000;
611 PUSH SI ; current parse status. ;AN000;
612 PUSH CX ; ;AN000;
613 XOR CX,CX ; ;AN000;
614 LEA DI,PARMS3 ; next control block ;AN000;
615 LDS SI,RESULT_VAL ; point to stored string. ;AN000;
616 CALL SYSPARSE ; ;AN000;
617 .WHILE <AX NE RC_EOL> AND ; not EOL?...and.. ;AN000;
618 .WHILE <OK_FLAG EQ ON> ; error flag still okay? ;AN000;
619 .IF <AX NE RC_NO_ERROR> OR ; parse error?...or.. ;AN000;
620 .IF <RESULT_TYPE NE NUMBER> ; something other than a number.. ;AN000;
621 MOV OK_FLAG,OFF ; found?....yes..reset flag. ;AN000;
622 .ELSE ; no...process.. ;AN000;
623 INC T6_NUM ; increment counter ;AN000;
624 MOV AX,WORD PTR RESULT_VAL ; get numeric value into word ;AN000;
625 .IF <T6_NUM EQ ONE> ; first value found? ;AN000;
626 MOV T6_DESG,AX ; yes...number of designates. ;AN000;
627 .ELSE ; else.. ;AN000;
628 MOV T6_FONT,AX ; second number...number of fonts. ;AN000;
629 .ENDIF ; ;AN000;
630 CALL SYSPARSE ; continue parsing ;AN000;
631 .ENDIF ; ;AN000;
632 .ENDWHILE ; ;AN000;
633 POP CX ; restore previous parse.. ;AN000;
634 POP SI ; registers. ;AN000;
635 POP DS ; ;AN000;
636 POP DI ; ;AN000;
637 RET ; ;AN000;
638PARSE_COMP ENDP
639
640
641;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
642;
643; PROCEDURE_NAME: PARSE_STR
644;
645; FUNCTION:
646; THIS PROCEDURE PARSES A STRING FOUND WITHIN THE CON=( ) STATEMENT
647;
648; AT ENTRY: RESULT BUFFER POINTS TO ASCIIZ STRING
649;
650; AT EXIT:
651; NORMAL: TABLE SET UP WITH VALUES FOUND
652;
653; ERROR: N/A
654;
655;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
656
657PARSE_STR PROC NEAR ;AN000;
658 PUSH DI ; get source and.. ;AN000;
659 PUSH DS ; destination registers.. ;AN000;
660 PUSH SI ; setup. ;AN000;
661 LDS SI,RESULT_VAL ; ;AN000;
662 .IF <<BYTE PTR DS:[SI]> NE ZERO> ; check for null string ;AN000;
663 LEA DI,T4_NAME ; ;AN000;
664 LODSB ; load first character. ;AN000;
665 .WHILE <AL NE ZERO> ; while not at end of ASCIIZ do.. ;AN000;
666 STOSB ; store.. ;AN000;
667 LODSB ; load next character.. ;AN000;
668 .ENDWHILE ; ;AN000;
669 MOV T4_LENGTH,EIGHT ; value found. ;AN000;
670 .ENDIF ; ;AN000;
671 POP SI ; restore registers. ;AN000;
672 POP DS ; ;AN000;
673 POP DI ; ;AN000;
674 RET ;AN000;
675PARSE_STR ENDP
676
677
678;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
679;
680; PROCEDURE_NAME: PARSE_NUM
681;
682; FUNCTION:
683; THIS PROCEDURE PARSES NUMBERS FOUND IN THE CON=( ) STATEMENT
684; BLOCK.
685;
686; AT ENTRY: RESULT BUFFER CONTAINS A DWORD NUMBER VALUE
687;
688; AT EXIT:
689; NORMAL: TABLE SET UP WITH VALUES FOUND
690;
691; ERROR: N/A
692;
693;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
694
695PARSE_NUM PROC NEAR ;AN000;
696 MOV AX,WORD PTR RESULT_VAL ; get value into word form ;AN000;
697 .IF <LOOP2 EQ TWO> ; if this is the code page then.. ;AN000;
698 MOV T5_VALUE,AX ; load that value. ;AN000;
699 INC T5_NUM ; ;AN000;
700 .ELSEIF <LOOP2 EQ THREE> ; ;AN000;
701 MOV T6_DESG,AX ; must be number of designates.. ;AN000;
702 INC T6_NUM ; load and increment count ;AN000;
703 .ENDIF ; ;AN000;
704 RET ; ;AN000;
705PARSE_NUM ENDP ;AN000;
706
707
708 ASSUME CS:CODE,DS:CODE
709
710;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
711;
712; PROCEDURE_NAME: GET_DEVICE_ID
713;
714; FUNCTION:
715; THIS PROCEDURE RETURNS THE DISPLAY DEVICE TO THE INIT ROUTINE WHEN
716; A DEVICE ID IS NOT SUPPLIED.
717;
718; AT ENTRY: N/A
719;
720; AT EXIT:
721; NORMAL: DEVICE ID PLACED WITHIN THE TABLE. (EGA OR LCD)
722; CARRY IS CLEARED.
723;
724; ERROR: DEVICE ID IS MONO OR CGA
725; CARRY IS SET.
726;
727;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
728
729FUNC_INFO INFO_BLOCK <> ;AN000;
730
731DEVICE_N_LENGTH EQU EIGHT ;AN000;
732
733DEVICE_TYPES DB "EGA " ;AN000;
734 DB "LCD " ;AN000;
735
736NUM_DEVICE_TYPES EQU ($-DEVICE_TYPES)/DEVICE_N_LENGTH ;AN000;
737
738DEVICE_FLAG DB 00000000B ;AN000;
739
740
741GET_DEVICE_ID PROC NEAR ;AN000;
742 PUSH AX ;AN000;
743 PUSH BX ; ;AN000;
744 PUSH CX ; s ;AN000;
745 PUSH DX ; a r ;AN000;
746 PUSH DI ; v e ;AN000;
747 PUSH SI ; e g ;AN000;
748 PUSH ES ; i ;AN000;
749 PUSH DS ; s ;AN000;
750 PUSH CS ; t ;AN000;
751 POP DS ; e ;AN000;
752 PUSH CS ; r ;AN000;
753 POP ES ; s ;AN000;
754 XOR AX,AX ; ;AN000;
755 MOV AH,FUNC_CALL ; ;AN000;
756 LEA DI,FUNC_INFO ; ;AN000;
757 XOR BX,BX ; ;AN000;
758 INT 10H ; try VGA functionality call ;AN000;
759 .IF <AL EQ FUNC_CALL> ; worked?....then ;AN000;
760 OR DEVICE_FLAG,VGA_FOUND ; VGA found. ;AN000;
761 .ELSE ; no VGA...try EGA ;AN000;
762 MOV AH,ALT_SELECT ; ;AN000;
763 MOV BL,EGA_INFO_CALL ; ;AN000;
764 INT 10H ; ;AN000;
765 .IF <BL NE EGA_INFO_CALL> ; if changed then EGA present.. ;AN000;
766 OR DEVICE_FLAG,EGA_FOUND ; mark as found. ;AN000;
767 .ELSE ; no EGA...try LCD. ;AN000;
768 MOV AH,GET_SYS_ID ; get system id.. ;AN000;
769 INT 15H ; yup....its a convertible..so ;AN000;
770 .IF <ES:[BX].MODEL_BYTE EQ LCD_MODEL> AND ;AN000;
771 MOV AH,GET_STATUS ; check for LCD.. ;AN000;
772 INT 15H ; ;AN000;
773 .IF <BIT AL NAND ON> ; yes....bit says LCD..so.. ;AN000;
774 OR DEVICE_FLAG,LCD_FOUND ; mark as LCD. ;AN000;
775 .ENDIF ; ;AN000;
776 .ENDIF ; ;AN000;
777 .ENDIF ; ;AN000;
778 .IF <DEVICE_FLAG NE ZERO> ; nothing found?..then exit (eg. MONO) ;AN000;
779 LEA SI,DEVICE_TYPES ; start of new id's ;AN000;
780 SAR DEVICE_FLAG,ONE ; shift flag into carry bit ;AN000;
781 .WHILE NC ; carry not set yet.. ;AN000;
782 ADD SI,DEVICE_N_LENGTH ; next id ;AN000;
783 SAR DEVICE_FLAG,ONE ; next flag... ;AN000;
784 .ENDWHILE ; ;AN000;
785 PUSH CS ; found....transfer id.. ;AN000;
786 POP ES ; into the table.. ;AN000;
787 LEA DI,T4_NAME ; ;AN000;
788 MOV CX,DEVICE_N_LENGTH ; ;AN000;
789 REP MOVSB ; ;AN000;
790 MOV T4_LENGTH,EIGHT ; ;AN000;
791 CLC ; clear error flag ;AN000;
792 .ELSE ; ;AN000;
793 STC ; set error (ie. MONO or CGA found) ;AN000;
794 .ENDIF ; ;AN000;
795 POP DS ; r ;AN000;
796 POP ES ; e r ;AN000;
797 POP SI ; s e ;AN000;
798 POP DI ; t g ;AN000;
799 POP DX ; o i ;AN000;
800 POP CX ; r s ;AN000;
801 POP BX ; e t ;AN000;
802 POP AX ; e ;AN000;
803 RET ; r ;AN000;
804GET_DEVICE_ID ENDP ; s
805
806
807
808CODE ENDS
809 END