diff options
Diffstat (limited to 'v4.0/src/DEV/PRINTER/PARSER.ASM')
| -rw-r--r-- | v4.0/src/DEV/PRINTER/PARSER.ASM | 668 |
1 files changed, 668 insertions, 0 deletions
diff --git a/v4.0/src/DEV/PRINTER/PARSER.ASM b/v4.0/src/DEV/PRINTER/PARSER.ASM new file mode 100644 index 0000000..f299838 --- /dev/null +++ b/v4.0/src/DEV/PRINTER/PARSER.ASM | |||
| @@ -0,0 +1,668 @@ | |||
| 1 | PAGE ,132 | ||
| 2 | TITLE PARSE CODE AND CONTROL BLOCKS FOR PRINTER.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 | ; PRINTER.SYS | ||
| 10 | ; | ||
| 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. | ||
| 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 | ; | ||
| 30 | ; EXTERNAL REFERENCES: | ||
| 31 | ; | ||
| 32 | ; ROUTINES: N/A | ||
| 33 | ; | ||
| 34 | ; DATA AREAS: TABLE - TO CONTAIN VALUES FOUND IN DEVICE= LINE | ||
| 35 | ; | ||
| 36 | ; NOTES: | ||
| 37 | ; | ||
| 38 | ; REVISION HISTORY: | ||
| 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. | ||
| 42 | ; | ||
| 43 | ; Label: "DOS DISPLAY.SYS Device Driver" | ||
| 44 | ; "Version 4.00 (C) Copyright 1988 Microsoft | ||
| 45 | ; "Licensed Material - Program Property of Microsoft" | ||
| 46 | ; | ||
| 47 | ; | ||
| 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 | ;****************************************************************************** | ||
| 53 | |||
| 54 | |||
| 55 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 56 | ; | ||
| 57 | ; The following is the table structure of the parser. All fields are | ||
| 58 | ; two bytes field (accept for the device and id name) | ||
| 59 | ; | ||
| 60 | ; TABLE HEADER : | ||
| 61 | ; ÍÍÍÍÍÍÍÍÍÍÍÍÍÍ | ||
| 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 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 73 | ; | ||
| 74 | ; | ||
| 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. | ||
| 79 | ; | ||
| 80 | ; | ||
| 81 | ; | ||
| 82 | ; TABLE_1 : | ||
| 83 | ; ÍÍÍÍÍÍÍÍÍ | ||
| 84 | ; | ||
| 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 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 96 | ; ³ "Reserved" ³ ³ ³ | ||
| 97 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 98 | ; ³ ³ ³ ³ | ||
| 99 | ; ³ ÀÄÄÄÄÄij Table_4 (a) ³ | ||
| 100 | ; ³ ³ ³ | ||
| 101 | ; ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 102 | ; ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 103 | ; ³ ³ ³ | ||
| 104 | ; ÀÄÄÄÄÄÄÄij Table_5 (a) ³ | ||
| 105 | ; ³ ³ | ||
| 106 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 107 | ; | ||
| 108 | ; | ||
| 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. | ||
| 112 | ; | ||
| 113 | ; | ||
| 114 | ; TABLE_2 : | ||
| 115 | ; ÍÍÍÍÍÍÍÍÍ | ||
| 116 | ; | ||
| 117 | ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 118 | ; ³ N = Length of devices name ³ | ||
| 119 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 120 | ; ³ Device name ³ | ||
| 121 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 122 | ; | ||
| 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. | ||
| 126 | ; | ||
| 127 | ; | ||
| 128 | ; | ||
| 129 | ; TABLE_3 : | ||
| 130 | ; ÍÍÍÍÍÍÍÍÍ | ||
| 131 | ; | ||
| 132 | ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 133 | ; ³ N = Length of Id name. ³ | ||
| 134 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 135 | ; ³ Id Name ³ | ||
| 136 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 137 | ; | ||
| 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. | ||
| 141 | ; | ||
| 142 | ; | ||
| 143 | ; | ||
| 144 | ; TABLE_4 : | ||
| 145 | ; ÍÍÍÍÍÍÍÍÍ | ||
| 146 | ; | ||
| 147 | ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 148 | ; ³ N = Length of table. ³ | ||
| 149 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 150 | ; ³ HWCP # 1 ³ | ||
| 151 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 152 | ; ³ HWCP # 2 ³ | ||
| 153 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 154 | ; ³ . ³ | ||
| 155 | ; ³ . ³ | ||
| 156 | ; ³ . ³ | ||
| 157 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 158 | ; ³ HWCP # 10 ³ | ||
| 159 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 160 | ; | ||
| 161 | ; | ||
| 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. | ||
| 165 | ; | ||
| 166 | ; | ||
| 167 | ; | ||
| 168 | ; TABLE_5 : | ||
| 169 | ; ÍÍÍÍÍÍÍÍÍ | ||
| 170 | ; | ||
| 171 | ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 172 | ; ³ N = Length of table. ³ | ||
| 173 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 174 | ; ³ Designate ³ | ||
| 175 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 176 | ; ³ Font ³ | ||
| 177 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 178 | ; | ||
| 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. | ||
| 185 | ; | ||
| 186 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 187 | |||
| 188 | |||
| 189 | .XLIST | ||
| 190 | INCLUDE STRUC.INC ; Structured macros ;AN000; | ||
| 191 | .LIST | ||
| 192 | |||
| 193 | INCLUDE CPSPEQU.INC ;AN000; | ||
| 194 | |||
| 195 | PUBLIC PARSER ; near procedure for parsing DEVICE= statement ;AN000; | ||
| 196 | |||
| 197 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 198 | ; | ||
| 199 | ; Set assemble switches for parse code | ||
| 200 | ; | ||
| 201 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 202 | |||
| 203 | DateSW EQU 0 ;AN000; | ||
| 204 | DrvSW EQU 0 ;AN000; | ||
| 205 | SwSW EQU 0 ;AN000; | ||
| 206 | Val1SW EQU 1 ;;AN002; ;AN000; | ||
| 207 | Val2SW EQU 0 ;AN000; | ||
| 208 | Val3SW EQU 0 ;AN000; | ||
| 209 | |||
| 210 | |||
| 211 | CSEG SEGMENT PARA PUBLIC 'CODE' ;AN000; | ||
| 212 | ASSUME CS:CSEG,DS:NOTHING,ES:NOTHING ;AN000; | ||
| 213 | |||
| 214 | |||
| 215 | EXTRN TABLE:WORD ; table for variable storage used by INIT module. ;AN000; | ||
| 216 | EXTRN DEVICE_NUM:WORD ;AN000; | ||
| 217 | |||
| 218 | .XLIST | ||
| 219 | INCLUDE PARSE.ASM ; Parsing code ;AN000; | ||
| 220 | .LIST | ||
| 221 | |||
| 222 | |||
| 223 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 224 | ; | ||
| 225 | ; PARM control block for parsing PRINTER.SYS - DEVICE= command statement. | ||
| 226 | ; Command line looks like: | ||
| 227 | ; | ||
| 228 | ; DEVICE=[d:][path]PRINTER.SYS LPT#[:]=(type[,[hwcp][,n]]) | ||
| 229 | ; or | ||
| 230 | ; DEVICE=[d:][path]PRINTER.SYS LPT#[:]=(type[,[(hwcp1,hwcp2,...)][,n]]) | ||
| 231 | ; | ||
| 232 | ; The command line will be parsed from left to right, taking care of the | ||
| 233 | ; nesting of complex lists as they occur. | ||
| 234 | ; | ||
| 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 | ||
| 238 | ; blocks. | ||
| 239 | ; | ||
| 240 | ; d:\path\PRINTER.SYS lpt#=(complex list) | ||
| 241 | ; | ||
| 242 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 243 | |||
| 244 | PARMS1 LABEL WORD ;AN000; | ||
| 245 | DW PARMSX1 ;AN000; | ||
| 246 | DB 0 ; no extra delimeters or EOLs. ;AN000; | ||
| 247 | |||
| 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; | ||
| 254 | |||
| 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; | ||
| 261 | |||
| 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; | ||
| 276 | |||
| 277 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 278 | ; | ||
| 279 | ; PARM control block for second level of nesting. | ||
| 280 | ; ie. complex list from first level of nesting | ||
| 281 | ; | ||
| 282 | ; (type, hwcp or complex list, n) | ||
| 283 | ; | ||
| 284 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 285 | |||
| 286 | PARMS2 LABEL WORD ;AN000; | ||
| 287 | DW PARMSX2 ;AN000; | ||
| 288 | DB 0 ; no extra delimeters or EOLs. ;AN000; | ||
| 289 | |||
| 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; | ||
| 297 | |||
| 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; | ||
| 304 | |||
| 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; | ||
| 311 | |||
| 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; | ||
| 318 | |||
| 319 | |||
| 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 | ||
| 325 | |||
| 326 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 327 | ; | ||
| 328 | ; PARM control block for third level of nesting. | ||
| 329 | ; ie. complex list from second nesting level | ||
| 330 | ; | ||
| 331 | ; (hwcp1,hwcp2,...) | ||
| 332 | ; | ||
| 333 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 334 | |||
| 335 | PARMS3 LABEL WORD ;AN000; | ||
| 336 | DW PARMSX3 ;AN000; | ||
| 337 | DB 0 ; no extra delimeters or EOLs. ;AN000; | ||
| 338 | |||
| 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; | ||
| 344 | |||
| 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; | ||
| 351 | |||
| 352 | |||
| 353 | ; Null VALUE LIST and RESULT BUFFER for all PARSE control blocks | ||
| 354 | |||
| 355 | |||
| 356 | NOVALS LABEL BYTE ;AN000; | ||
| 357 | DB 0 ; no value checking done ;AN000; | ||
| 358 | |||
| 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; | ||
| 364 | |||
| 365 | |||
| 366 | OK_FLAG DB ON ; FLAG INDICATING PARSE STATUS ;AN000; | ||
| 367 | NUM_LOOP DB ZERO ;AN000; | ||
| 368 | |||
| 369 | |||
| 370 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 371 | ; | ||
| 372 | ; PROCEDURE_NAME: PARSER | ||
| 373 | ; | ||
| 374 | ; FUNCTION: | ||
| 375 | ; THIS PROCEDURE PARSES THE DEVICE= PARAMETERS FROM THE INIT REQUEST | ||
| 376 | ; BLOCK. | ||
| 377 | ; | ||
| 378 | ; AT ENTRY: ES:DI POINTS TO REQUEST HEADER | ||
| 379 | ; | ||
| 380 | ; AT EXIT: | ||
| 381 | ; NORMAL: TABLE SET UP WITH VALUES FOUND | ||
| 382 | ; | ||
| 383 | ; ERROR: 0 LOADED IN FIRST WORD OF TABLE | ||
| 384 | ; | ||
| 385 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 386 | |||
| 387 | PARSER PROC NEAR ;AN000; | ||
| 388 | PUSH DX ;AN000; | ||
| 389 | PUSH DI ;AN000; | ||
| 390 | PUSH ES ;AN000; | ||
| 391 | PUSH BX ;AN000; | ||
| 392 | PUSH DS ; ;AN000; | ||
| 393 | PUSH SI ; ;AN000; | ||
| 394 | CLD ; ;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; | ||
| 408 | .ELSE ; ;AN000; | ||
| 409 | .SELECT ; ;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; | ||
| 413 | INC BX ; ;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; | ||
| 417 | PUSH BX ; ;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; | ||
| 422 | POP BX ; ;AN000; | ||
| 423 | .ENDIF ; ;AN000; | ||
| 424 | .OTHERWISE ; not a complex string so.. ;AN000; | ||
| 425 | MOV OK_FLAG,OFF ; we have a problem...reset flag ;AN000; | ||
| 426 | .ENDSELECT ; ;AN000; | ||
| 427 | .ENDIF ; ;AN000; | ||
| 428 | PUSH BX ; ;AN000; | ||
| 429 | CALL SYSPARSE ; continue parsing.. ;AN000; | ||
| 430 | POP BX ; ;AN000; | ||
| 431 | .ENDWHILE ; ;AN000; | ||
| 432 | .IF <OK_FLAG EQ OFF> ; flag indicating error? ;AN000; | ||
| 433 | MOV DEVICE_NUM,ZERO ; yes...set device number to 0 ;AN000; | ||
| 434 | STC ; ;AN000; | ||
| 435 | .ELSE ; ;AN000; | ||
| 436 | CLC ; ;AN000; | ||
| 437 | .ENDIF ; ;AN000; | ||
| 438 | POP SI ; ;AN000; | ||
| 439 | POP DS ; ;AN000; | ||
| 440 | POP BX ; ;AN000; | ||
| 441 | POP ES ; ;AN000; | ||
| 442 | POP DI ; ;AN000; | ||
| 443 | POP DX ; ;AN000; | ||
| 444 | RET ; ;AN000; | ||
| 445 | PARSER ENDP ;AN000; | ||
| 446 | |||
| 447 | |||
| 448 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 449 | ; | ||
| 450 | ; PROCEDURE_NAME: PARSE_MAIN | ||
| 451 | ; | ||
| 452 | ; FUNCTION: | ||
| 453 | ; THIS PROCEDURE PARSES THE LPT=( ) COMPLEX LIST DEVICE= LINE FOUND | ||
| 454 | ; IN CONFIG.SYS | ||
| 455 | ; | ||
| 456 | ; AT ENTRY: RESULT BUFFER CONTAINS POINTER TO COMPLEX STRING | ||
| 457 | ; | ||
| 458 | ; AT EXIT: | ||
| 459 | ; NORMAL: TABLE SET UP WITH VALUES FOUND | ||
| 460 | ; | ||
| 461 | ; ERROR: OK_FLAG = 0 | ||
| 462 | ; | ||
| 463 | ; | ||
| 464 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 465 | |||
| 466 | PARSE_MAIN PROC NEAR ;AN000; | ||
| 467 | PUSH BX ; ;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; | ||
| 471 | PUSH CX ; ;AN000; | ||
| 472 | XOR CX,CX ; ;AN000; | ||
| 473 | LEA DI,PARMS2 ; next control block.. ;AN000; | ||
| 474 | LDS SI,RESULT_VAL ; point to stored string ;AN000; | ||
| 475 | PUSH BX ; ;AN000; | ||
| 476 | CALL SYSPARSE ; ;AN000; | ||
| 477 | POP BX ; ;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; | ||
| 484 | PUSH BX ; ;AN000; | ||
| 485 | .SELECT ; ;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; | ||
| 492 | .ELSE ; ;AN000; | ||
| 493 | MOV BX,CS:[BX].DD_OFFSET ;AN000; | ||
| 494 | .ENDIF ; ;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; | ||
| 499 | .ENDIF ;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; | ||
| 505 | .ENDSELECT ; ;AN000; | ||
| 506 | CALL SYSPARSE ; continue parsing ;AN000; | ||
| 507 | POP BX ; ;AN000; | ||
| 508 | .ENDIF ; ;AN000; | ||
| 509 | .ENDWHILE ; ;AN000; | ||
| 510 | POP CX ; restore original parse.. ;AN000; | ||
| 511 | POP SI ; registers. ;AN000; | ||
| 512 | POP DS ; ;AN000; | ||
| 513 | POP DI ; ;AN000; | ||
| 514 | POP BX ; ;AN000; | ||
| 515 | RET ; ;AN000; | ||
| 516 | PARSE_MAIN ENDP ;AN000; | ||
| 517 | ;AN000; | ||
| 518 | |||
| 519 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 520 | ; | ||
| 521 | ; PROCEDURE_NAME: PARSE_COMP | ||
| 522 | ; | ||
| 523 | ; FUNCTION: | ||
| 524 | ; THIS PROCEDURE PARSES A COMPLEX LIST FOUND WITHIN THE LPT=( ) | ||
| 525 | ; COMPLEX LIST. | ||
| 526 | ; | ||
| 527 | ; AT ENTRY: RESULT BUFFER CONTAINS POINTER TO COMPLEX STRING | ||
| 528 | ; | ||
| 529 | ; AT EXIT: | ||
| 530 | ; NORMAL: TABLE SET UP WITH VALUES FOUND | ||
| 531 | ; | ||
| 532 | ; ERROR: OK_FLAG = 0 | ||
| 533 | ; | ||
| 534 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 535 | |||
| 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; | ||
| 540 | PUSH CX ; ;AN000; | ||
| 541 | MOV DI,BX ; ;AN000; | ||
| 542 | PUSH DI ; ;AN000; | ||
| 543 | XOR CX,CX ; ;AN000; | ||
| 544 | LEA DI,PARMS3 ; next control block ;AN000; | ||
| 545 | LDS SI,RESULT_VAL ; point to stored string. ;AN000; | ||
| 546 | PUSH BX ; ;AN000; | ||
| 547 | CALL SYSPARSE ; ;AN000; | ||
| 548 | POP BX ; ;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; | ||
| 557 | POP DI ; ;AN000; | ||
| 558 | MOV AX,WORD PTR RESULT_VAL ; get numeric value into word ;AN000; | ||
| 559 | MOV WORD PTR CS:[DI+2],AX ; ;AN000; | ||
| 560 | INC DI ; ;AN000; | ||
| 561 | INC DI ; ;AN000; | ||
| 562 | PUSH DI ; ;AN000; | ||
| 563 | PUSH BX ; ;AN000; | ||
| 564 | LEA DI,PARMS3 ; ;AN000; | ||
| 565 | CALL SYSPARSE ; continue parsing ;AN000; | ||
| 566 | POP BX ; ;AN000; | ||
| 567 | .ELSE ; ;AN000; | ||
| 568 | MOV OK_FLAG,OFF ; ;AN000; | ||
| 569 | .ENDIF ; ;AN000; | ||
| 570 | .ENDIF ; ;AN000; | ||
| 571 | .ENDWHILE ; ;AN000; | ||
| 572 | POP DI ; ;AN000; | ||
| 573 | POP CX ; restore previous parse.. ;AN000; | ||
| 574 | POP SI ; registers. ;AN000; | ||
| 575 | POP DS ; ;AN000; | ||
| 576 | POP DI ; ;AN000; | ||
| 577 | RET ; ;AN000; | ||
| 578 | PARSE_COMP ENDP ;AN000; | ||
| 579 | |||
| 580 | |||
| 581 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 582 | ; | ||
| 583 | ; PROCEDURE_NAME: PARSE_STR | ||
| 584 | ; | ||
| 585 | ; FUNCTION: | ||
| 586 | ; THIS PROCEDURE PARSES A STRING FOUND WITHIN THE LPT=( ) STATEMENT | ||
| 587 | ; | ||
| 588 | ; AT ENTRY: RESULT BUFFER POINTS TO ASCIIZ STRING | ||
| 589 | ; | ||
| 590 | ; AT EXIT: | ||
| 591 | ; NORMAL: TABLE SET UP WITH VALUES FOUND | ||
| 592 | ; | ||
| 593 | ; ERROR: STRING > 8 - OK_FLAG SET OFF | ||
| 594 | ; | ||
| 595 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 596 | |||
| 597 | PARSE_STR PROC NEAR ;AN000; | ||
| 598 | PUSH DI ; get source and.. ;AN000; | ||
| 599 | PUSH DS ; destination registers.. ;AN000; | ||
| 600 | PUSH SI ; setup. ;AN000; | ||
| 601 | PUSH CX ; ;AN000; | ||
| 602 | LDS SI,RESULT_VAL ; ;AN000; | ||
| 603 | MOV DI,BX ; ;AN000; | ||
| 604 | MOV CS:[DI].N_LENGTH,EIGHT ; ;AN000; | ||
| 605 | INC DI ; ;AN000; | ||
| 606 | INC DI ; ;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; | ||
| 613 | DEC CX ; ;AN000; | ||
| 614 | .ENDWHILE ; ;AN000; | ||
| 615 | .IF <CX EQ ZERO> ;AN000; | ||
| 616 | MOV OK_FLAG,OFF ;AN000; | ||
| 617 | .ENDIF ;AN000; | ||
| 618 | POP CX ; value found. ;AN000; | ||
| 619 | POP SI ; restore registers. ;AN000; | ||
| 620 | POP DS ; ;AN000; | ||
| 621 | POP DI ; ;AN000; | ||
| 622 | RET ;AN000; | ||
| 623 | PARSE_STR ENDP ;AN000; | ||
| 624 | |||
| 625 | |||
| 626 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 627 | ; | ||
| 628 | ; PROCEDURE_NAME: COPY_NAME | ||
| 629 | ; | ||
| 630 | ; FUNCTION: | ||
| 631 | ; THIS PROCEDURE COPIES THE FOUND STRING VALUE INTO THE TABLE. | ||
| 632 | ; | ||
| 633 | ; AT ENTRY: N/A | ||
| 634 | ; | ||
| 635 | ; AT EXIT: | ||
| 636 | ; NORMAL: TABLE UPDATED | ||
| 637 | ; | ||
| 638 | ; ERROR: N/A | ||
| 639 | ; | ||
| 640 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 641 | |||
| 642 | COPY_NAME PROC NEAR ;AN000; | ||
| 643 | PUSH DI ; get source and.. ;AN000; | ||
| 644 | PUSH DS ; destination registers.. ;AN000; | ||
| 645 | PUSH SI ; setup. ;AN000; | ||
| 646 | PUSH CS ; ;AN000; | ||
| 647 | POP DS ; ;AN000; | ||
| 648 | MOV SI,SYN_PTR ; ;AN000; | ||
| 649 | MOV DI,CS:[BX].DN_OFFSET ; ;AN000; | ||
| 650 | MOV CS:[DI].N_LENGTH,EIGHT ; ;AN000; | ||
| 651 | INC DI ; ;AN000; | ||
| 652 | INC DI ; ;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; | ||
| 658 | .ENDIF ; ;AN000; | ||
| 659 | LODSB ; load next character.. ;AN000; | ||
| 660 | .ENDWHILE ; ;AN000; | ||
| 661 | POP SI ; restore registers. ;AN000; | ||
| 662 | POP DS ; ;AN000; | ||
| 663 | POP DI ; ;AN000; | ||
| 664 | RET ;AN000; | ||
| 665 | COPY_NAME ENDP ;AN000; | ||
| 666 | |||
| 667 | CSEG ENDS | ||
| 668 | END | ||