]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/DEV/PRINTER/PARSE4E.ASM
1 ;***************************************************************
3 ;** ******** ** ** ******* **
5 ;** ** ******* ***** **
7 ;** ** ** ** ******* **
9 ;** ****** * ****** ****** ******* ****** **
10 ;** ** ** ** ** ** ** ** ** ** ** **
11 ;** ****** ******* ****** ***** ****** ****** **
12 ;** ** ** ** ** ** ** ** ** ** **
13 ;** ** ** ** ** ** ****** ******* ** ** **
15 ;***************************************************************
17 ; File Name: PARSE.ASM
20 ; Description: A command parser for DEVICE command in the CONFIG.SYS file.
23 ; Procedures contained in the file:
24 ; ---------------------------------
25 ; PARSER: Main routine for command processing.
26 ; GET_CHAR: Gets a character from command line.
27 ; IS_ALPH: Checks if character is an alpha character.
28 ; IS_DIGIT: Checks if character is a digit.
29 ; IS_DELIM: Checks if character is a DOS delimiter.
30 ; DEVICE_PARSE: Pulls device name from command line and
32 ; ID_PARSE: Pulls id name from command line and insers in table
33 ; HWCP_PARMS: Extract HWCP number, converts it to binary and
34 ; inserts it in table.
35 ; HWCP_PARSE: Extracts HWCP number if only one number is given.
36 ; MUL_HWCP: Extracts multiple HWCP's numbers, if they are given
38 ; DESG_PARMS: Extracts designate number, converts it to binary
39 ; and inserts it in table.
40 ; DESG_FONT: Extracts the designate and the font if both were
41 ; given in command line.
42 ; DESG_PARSE: Pulls designate number if it is the only one given.
43 ; GET_NUMBER: Converts a number to binary.
44 ; OFFSET_TABLE: Updates the counter in table #1.
45 ; FIND_RIGHT_BR: Looks for a right bracket.
54 ; Establish addressability to parameters.
55 ; Skip until end of path and file name -first delimiter
58 ; Isolate the first non-delimiter or non delimeter characters.
59 ; If End_of_Line_Delimiter then
60 ; return an error_code
62 ; If first non-delimiter is ALPHA then
63 ; (assume a device name)
64 ; Extracts device name
65 ; Update offset counter
67 ; Isolate the first non-delimiter characters after id name.
68 ; If End_of_Line_Delimiter then
69 ; return an error_code
71 ; If first non-delimiter is ALPHA-NUMARIC or
72 ; If character is '(' then
75 ; Update offset counter
78 ; If error flag is set then exit
79 ; Else if end of line flag is set then exit
82 ; If error_flag is set then exit.
83 ; Else if end of line flag is set then exit
84 ; Else if Number of devices is four then Exit
93 ; Load character in AL
94 ; If character less than 20h then
100 ; 'Convert character to upper case'
101 ; If character >=A and <=Z then
109 ; --------- If Character >=0 and <=9 then
114 ; If character a dos delimiter (' ','=',',',';',TAB)
115 ; then turn Z-flag on
119 ; Set device name length counter.
121 ; If a dos delimiter then
122 ; add spaces to name (if require)
123 ; Else if char is ALPHA-NUM then
125 ; If name >8 character thne
131 ; --------- Set id name length counter.
133 ; If a dos delimiter then
134 ; add spaces to name (if require)
135 ; Else if char is ALPHA-NUM then
137 ; If name >8 character then
139 ; Else if char is ')' or '(' then
146 ; Loop: Set flags off
147 ; If char is a DIGIT then
148 ; convert number to binary
150 ; Else if char is ',' then
153 ; Else if char is '(' then
154 ; assume multiple HWCP
155 ; Else if char is ')' then
157 ; Else if not a delimiter then
158 ; error, exit set carry flag set carry flag
162 ; ----------- Increment counter
163 ; Get number and convert to binary
165 ; Set table_5 pointer
169 ; Loop: If char is ')' then
172 ; Get number and convert to binary
174 ; If char is not a delimiter then
175 ; error, exit set carry flag
180 ; Loop: If char is a DIGIT then
181 ; Get number and convert to binary
183 ; If char is a ')' then
185 ; If char is a '(' then
186 ; assume given desg. and font
187 ; If char is a ',' then
190 ; If char is not a delimiter then
191 ; error, exit set carry flag
196 ; Loop: If char is a ',' then
197 ; no desg number was given
199 ; If char is a ')' then
200 ; end of desg-font pair, exit
201 ; If char is a DIGIT then
202 ; Get number and convert to binary
204 ; If char not a delimiter then
205 ; error, exit set carry flag
209 ; ----------- Get number and conver to binary
213 ; ----------- Get ASCII number from parms
219 ; Increment the number of parms
223 ; Loop: If char is ')' then
225 ; If char is not ' ' then
226 ; error, exit set carry flag
229 ;------------------------------------------------------
231 ; The following is the table structure of the parser. All fields are
232 ; two bytes field (accept for the device and id name)
236 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
237 ; ³ N = Number of devices. ³
238 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
239 ; ³ Device # 1 offset ÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
240 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³
241 ; ³ Device # 2 offset ³ ³ Table_1 (a) ³
242 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³
243 ; ³ Device # 3 offset ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
244 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
245 ; ³ Device # 4 offset ³
246 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
249 ; N = 1,2,3 or 4. A two bytes number indicating the number of device specified.
250 ; DEVICE # N OFFSET : a two bytes offset address to table_1. (ie. Device #1 offset
251 ; is a pointer to table_1 (a). Device #2 offset is a pointer to table_1
252 ; (b)...etc.). If an error was detected in the command N is set to zero.
259 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
260 ; ³ N = Number of Offsets. ³ ³ ³
261 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ÚÄÄÄÄÄij Table_2 (a) ³
262 ; ³ Device Name offset ÄÅÄÄÄÄÙ ³ ³
263 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
264 ; ³ Device Id offset ÄÅÄÄÄÄÄÄ¿
265 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
266 ; ³ Device HWCP offset ÄÅÄÄÄÄ¿ ³ ³ ³
267 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ÀÄÄÄij Table_3 (a) ³
268 ; ³ Device Desg offset ÄÅÄÄ¿ ³ ³ ³
269 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
271 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
273 ; ³ ÀÄÄÄÄÄij Table_4 (a) ³
275 ; ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
276 ; ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
278 ; ÀÄÄÄÄÄÄÄij Table_5 (a) ³
280 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
283 ; N=Length of table_1, or the number of offsets contained in table_1.
284 ; The offsets are pointers (two bytes) to the parameters value of the device.
285 ; "Reserved" : a two byte memory reserved for future use of the "PARMS" option.
291 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
292 ; ³ N = Length of devices name ³
293 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
295 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
297 ; N = Length of device name. Device length is always 8 byte long.
298 ; Device Name : the name of the device (eg. LPT1, CON, PRN). The name
299 ; is paded with spaces to make up the rest of the 8 characters.
306 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
307 ; ³ N = Length of Id name. ³
308 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
310 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
312 ; N = Length of id name. Id name length is always 8 byte long.
313 ; Id Name : the name of the id (eg. EGA, VGA, 3812). The name
314 ; is paded with spaces to make up the rest of the 8 character.
321 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
322 ; ³ N = Length of table. ³
323 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
325 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
327 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
331 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
333 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
336 ; N = Length of table in words. Or the number of HWCP's.
337 ; HWCP # N : a hardware code page number converted to binary. The maximum
338 ; number of pages allowed is 10.
345 ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
346 ; ³ N = Length of table. ³
347 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
349 ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
351 ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
353 ; N = Lenght of table. 0 - nothing was specified
354 ; 1 - Only a designate was specified.
355 ; 2 - Designate and font were given. If the Desg field
356 ; was left empty in the DEVICE command then the
357 ; Designate field is filled with 0FFFFH.
358 ; Designate, Font : Are the Desg. and Font binary numbers.
360 ;------------------------------------------------------
375 TABLE_1
DW ?
; Pointer at offsets.
376 TABLE_2
DW ?
; Pointer at device name.
377 TABLE_3
DW ?
; Pointer at id name.
378 TABLE_4
DW ?
; Pointer at hwcp.
379 TABLE_5
DW ?
; Pointer at desg and font.
380 TABLE
DB 290 DUP (?
) ; Table of parsed parms. Max 4 devices.
381 DEVNUM
DW ?
; Counter to number of devices.
382 RIGHT_FLAG
DB ?
; Flag to indicate a left bracket.
383 DEV_ERR_FLG
DB ?
; Device name error flag.
384 ID_ERR_FLG
DB ?
; Id name error flag.
385 ERROR_FLAG
DB ?
; Error flag_terminate program if set to 1.
386 COMMA_FLAG
DB ?
; Indicate the number of commas incounterd.
387 HWCP_FLAG
DB ?
; Flag for multiple hwcps.
388 DESG_FLAG
DB ?
; Flag indicates desg. and font.
390 ;Main part of program-links different sumbroutines together
397 PUSH AX ; ;;;;;;;;;;;;;;;;;;
401 PUSH DS ; ; REGISTERS.
404 PUSH SI ; ;;;;;;;;;;;;;;;;;;
406 ;LES SI,RH.RH0_BPBA ; Point at all after DEVICE=
407 ; in the CONFIG.SYS file.
409 mov di,81h
; ;;;;;;;;;;;;;;;;;;;;;;;;;
410 mov cl,cs:byte ptr [di-1] ; ; ;;
411 xor ch,ch ; ; ERASE THIS ;;
412 add di,cx ; ;;;;;;;; CODE IN ;;
413 mov ds:word ptr[di],0a0dh ; ; CPS ;;
415 MOV SI,0081h ; ;Set SI at parameters. ;;
416 ; ;;;;;;;;;;;;;;;;;;;;;;;;;
418 ;Skip to end of file name, to the first DOS delimiter.
420 MOV DEVNUM
,02H ; Number of devices counter.
422 GET_PARMS_A: CALL GET_CHAR
; Get command character in AL .
423 JZ EXIT_B
; No parms found.
424 CALL IS_DELIM
; If not a delimiter then.
425 JNE GET_PARMS_A
; Check next character.
427 MOV DI,OFFSET TABLE
; Get the table address.
428 ADD DI,02H ; Point at devices offsets.
430 ADD BX,08H ; Point BX at parms offsets.
431 TAB2: CALL UPDATE_TABLE
; Update table pointers value.
433 CLR_DELIM: CALL GET_CHAR
; Get character into AL.
434 JZ EXIT_B
; No parms found.
435 CALL IS_ALPHA
; If alpha then assume.
436 JZ DEVICE
; A device name.
437 CALL IS_DELIM
; Is it a delimiter
438 JNE EXIT_A
; If not then error.
439 JMP CLR_DELIM
; Get next character.
441 DEVICE: MOV DEV_ERR_FLG
,00H ; Set device error flag off;
442 CALL DEVICE_PARSE
; Call routine to parse device name.
443 CMP DEV_ERR_FLG
,01H ; If error flag is
444 JZ EXIT_A
; set then exit.
445 CALL OFFSET_TABLE
; Update table.
447 ID_PARMS: CALL GET_CHAR
; Load a character in AL.
448 JZ EXIT_A
; Exit if end of line (error).
449 CMP AL,'(' ; If AL is a '(' then
450 JE ID
; Parse ID name.
451 CALL IS_ALPHA
; If an Alpha
452 JE ID
; Then parse ID name.
453 CALL IS_DIGIT
; If a digit
454 JE ID
; Then parse ID name.
455 CALL IS_DELIM
; If not a delimiter
456 JNE EXIT_A
; Then error, exit
457 JMP ID_PARMS
; Get another number
459 EXIT_B: CMP DEVNUM
,02H ; If device number above 2 then
460 JA EXIT_C
; Exit parse.
461 JMP EXIT_A
; Else error, exit
463 ID: MOV ID_ERR_FLG
,00H ; Set id error flag off.
464 CALL ID_PARSE
; Parse ID name.
465 CMP ID_ERR_FLG
,01H ; Was error flag set, then
466 JE EXIT_A
; Print error message.
467 CALL OFFSET_TABLE
; Update table of offsets.
469 CALL HWCP_PARMS
; Get code page number
470 CMP ERROR_FLAG
,01H ; If error, then
471 JE EXIT_A
; Print error message and exit
472 CMP ERROR_FLAG
,02H ; If end of string
473 JE EXIT_H
; Then exit.
475 CALL DESG_PARMS
; Get designate number
476 CMP ERROR_FLAG
,01H ; If error, then
477 JE EXIT_A
; Print error message and exit
478 JMP EXIT_H
; Then exit.
480 EXIT_A: MOV DI,OFFSET TABLE
; Load table offset
481 MOV DS:WORD PTR [DI],00H ; Set error to on.
483 JMP EXIT_P
; Exit parse.
485 EXIT_H: MOV DI,OFFSET TABLE
; Load table offset.
486 ADD DS:WORD PTR [DI],01H ; Increment number of devices.
487 CMP DEVNUM
,08H ; If 4 devices loaded
488 JE EXIT_C
; Then exit parse.
489 ADD DEVNUM
,02H ; Increment the number of devices
490 ADD DI,DEVNUM
; Point at next devices offset.
491 MOV BX,TABLE_5
; BX point at
492 ADD BX,06H ; end of previous table.
493 JMP TAB2
; Get next device.
497 EXIT_P: POP SI ; ;;;;;;;;;;;;;;;;;;
501 POP DX ; ; REGISTERS.
504 POP AX ; ;;;;;;;;;;;;;;;;;;
510 ;********************************************************
511 ;** GET_CHAR : a routine to get next character pointed **
512 ;** to by ES:SI into AL. **
513 ;********************************************************
517 MOV AL,ES:BYTE PTR [SI] ; Load character pointed to
518 CMP AL,09H ; by ES:[SI] in AL.
519 JE ZOFF
; If tab then O.K
520 CMP AL,20H
; Turn Z-flag on
521 JL TURN_Z_ON
; if character
522 ZOFF: INC SI ; is below
523 JMP GET_CHAR_X
; 20h.
525 TURN_Z_ON: CMP AL,AL ; delimiters ).
531 ;********************************************************
532 ;** IS_ALPHA : a routine to check the character in **
533 ;** AL if it is an alpha character (a...z,A...Z). **
534 ;** If character is lower case, convert to upper case. **
535 ;********************************************************
539 PUSH AX ; Save value of AL
540 AND AL,0DFH ; Convert to upper case
541 CMP AL,'A' ; If <'A', then
542 JB IS_ALPHA_X
; NZ-flag is set, exit
543 CMP AL,'Z' ; If >'Z', then
544 JA IS_ALPHA_X
; NZ-flag is set, exit
545 CMP AL,AL ; Force Z-flag
546 POP DX ; Discard lower case.
548 IS_ALPHA_X: POP AX ; Restore value of AL
554 ;********************************************************
555 ;** IS_DIGIT : a routine to check if the character in **
556 ;** AL register is a digit (i.e. 1..9). **
557 ;********************************************************
561 CMP AL,'0' ; If < '0' then
562 JB IS_NUM_X
; NZ-flag is set, exit
563 CMP AL,'9' ; If > '9' then
564 JA IS_NUM_X
; NZ-flag is set, exit
565 CMP AL,AL ; Set Z-flag to indecate digit
571 ;********************************************************
572 ;** IS_DELIM : This routine check if the character in **
573 ;** AL is a delimiter. ('+',' ',';',',','=',tab) **
574 ;********************************************************
578 CMP AL,' ' ; Test for space.
579 JE IS_DELIM_X
; Z-flag is set, exit
580 CMP AL,',' ; Test for comma.
581 JE IS_DELIM_X
; Z-flag is set, exit
582 CMP AL,';' ; Test for semicolon.
583 JE IS_DELIM_X
; Z-flag is set, exit
584 CMP AL,'=' ; Test for equal sign.
585 JE IS_DELIM_X
; Z-flag is set, exit
586 CMP AL,09h ; Test for TAB.
588 IS_DELIM_X: RET ; Exit
593 ;********************************************************
594 ;** DEVICE_PARSE : Parse the device driver name and **
595 ;** store in table. Update offset. **
596 ;********************************************************
601 MOV DS:WORD PTR [DI],0008H ; Save dev name size.
602 ADD DI,02H ; Increment DI.
603 MOV CX,9 ; Set counter.
604 NEXT_C: CALL IS_ALPHA
; if Check then.
606 CALL IS_DIGIT
; if Digit then.
608 CMP AL,'-' ; If '-' then.
610 CALL IS_DELIM
; If a delimiter then.
611 JZ ADD_SPACE1
; Pad with spaces.
612 CMP AL,':' ; If a colon
613 JE ADD_SPACE1
; then end device parse
614 JMP ERR_DEV_PAR
; Else an error.
616 SAVE_C: DEC CX ; Decrement counter.
617 CMP CX,0 ; If counter zero then.
618 JE ERR_DEV_PAR
; Error.
619 MOV DS:BYTE PTR [DI],AL ; Save char in table.
620 INC DI ; Increment pointer.
621 CALL GET_CHAR
; Get another char.
623 JMP NEXT_C
; Check char.
625 ERR_DEV_PAR: MOV DEV_ERR_FLG
,01H ; Set error flag.
626 JMP DEV_PAR_X
; Exit.
628 ADD_SPACE1: DEC CX ; Check counter.
630 JL DEV_PAR_X
; Exit if already 8.
631 LL1: MOV DS:BYTE PTR [DI],' ' ; Pad name with spaces.
632 INC DI ; Increment pointer.
633 LOOP LL1
; Loop again.
639 ;********************************************************
640 ;** ID_PARSE : Parse the id driver name and **
641 ;** store in table. Update offset. **
642 ;********************************************************
647 MOV DS:WORD PTR [DI],0008H ; Save dev name size.
648 ADD DI,02H ; Increment DI.
649 MOV RIGHT_FLAG
,00H ; Clear flag.
650 MOV CX,9 ; Set counter.
652 NEXT_I: CALL IS_ALPHA
; If Check then.
654 CALL IS_DIGIT
; if Digit then.
656 CMP AL,'-' ; If '-' then.
658 CMP AL,'(' ; If '(' then.
659 JE RIG_BR_FLG
; Set flag.
660 CMP AL,')' ; If ')' then
661 JE BR_FLG_LEF
; Pad with spaces.
662 CALL IS_DELIM
; If a delimiter then.
663 JZ ADD_SPACE2
; Pad with spaces.
664 JMP ERR_ID_PAR
; Else an error.
666 SAVE_I: DEC CX ; Decrement counter.
667 CMP CX,0 ; If counter zero then.
668 JLE ERR_ID_PAR
; Error.
669 MOV DS:BYTE PTR [DI],AL ; Save char in table.
670 INC DI ; Increment pointer.
671 CALL GET_CHAR
; Get another char.
672 JZ ADD_SPACE2
; Exit routine.
673 JMP NEXT_I
; Check char.
675 ERR_ID_PAR: MOV ID_ERR_FLG
,01H ; Set error falg on.
678 BR_FLG_LEF: CMP RIGHT_FLAG
,01H ; If left bracket was
679 JNE ERR_ID_PAR
; found and no previous
680 JMP ADD_SPACE2
; Bracket found, then error
682 RIG_BR_FLG: CMP RIGHT_FLAG
,01H ; If more than one bracket
683 JE ERR_ID_PAR
; then error.
684 CMP CX,09 ; If '(' and already id
685 JB ERR_ID_PAR
; then error.
686 MOV RIGHT_FLAG
,01H ; Set flag for.
687 CALL GET_CHAR
; Left brackets.
688 JZ ERR_ID_PAR
; If end of line,exit.
689 JMP NEXT_I
; Check character.
691 ADD_SPACE2: DEC CX ; Check counter.
693 JL ID_PAR_X
; Exit if already 8.
695 LL2: MOV DS:BYTE PTR [DI],' ' ; Pad name with spaces.
696 INC DI ; Increment pointer.
697 LOOP LL2
; Loop again.
703 ;********************************************************
704 ;** HWCP_PARMS : Scane for the hardware code page, and **
705 ;** parse it if found. Flag codes set to: **
706 ;** ERROR_FLAG = 0 - parsing completed. No error. **
707 ;** ERROR_FLAG = 1 - error found exit parse. **
708 ;** ERROR_FLAG = 2 - end of line found, exit parse. **
709 ;********************************************************
714 MOV COMMA_FLAG
,00H ; Set the comma flag off.
715 MOV ERROR_FLAG
,00H ; Set the error flag off.
716 DEC SI ; Point at current char in Al.
717 CMP RIGHT_FLAG
,01H ; If no left brackets then
718 JNE LEFT_BR
; Exit parse.
720 HWCP_1: CALL GET_CHAR
; Load character in AL.
721 JZ LEFT_BR
; Exit, if end of line.
722 CALL IS_DIGIT
; Check if digit, then
723 JE HP1
; Parse hwcp parms.
724 CMP AL,',' ; If a comma
725 JE COMMA_1
; Jump to comma_1
726 CMP AL,')' ; If a ')' then
727 JE RIGHT_BR
; end of current dev parms.
728 CMP AL,'(' ; If a '(' then
729 JE HWCP_2
; There are multible hwcp.
730 CALL IS_DELIM
; Else, if not a delimiter
731 JNE EXIT_2
; Then error, exit
732 JMP HWCP_1
; Get another character.
734 LEFT_BR: CMP RIGHT_FLAG
,01H ; If no left bracket
735 JE EXIT_2
; Then error, exit
736 JMP RB1
; Jump to rb1
738 COMMA_1: CMP COMMA_FLAG
,01H ; If comma flag set
739 JE COM_2_HC
; Then exit hwcp parse.
740 MOV COMMA_FLAG
,01H ; Else set comma flag.
741 JMP HWCP_1
; Get another character.
743 HWCP_2: CMP RIGHT_FLAG
,01H ; If left bracket not set
744 JNE EXIT_2
; then error.
745 CALL MUL_HWCP
; else call multiple hwcp
746 ADD DI,02H ; routine. Increment DI
747 MOV TABLE_5
,DI ; Desg. Table starts at end
748 CALL OFFSET_TABLE
; Update table of offsets.
751 HP1: JMP HWCP
; Jump too long.
753 COM_2_HC: MOV DI,TABLE_4
; DI points at hwcp table
754 MOV DS:WORD PTR [DI],0000H ; Set number of pages to
755 MOV COMMA_FLAG
,00H ; Zero and reset comma flag.
756 ADD DI,02H ; Increment DI.
757 MOV TABLE_5
,DI ; Desg. Table starts at end
758 CALL OFFSET_TABLE
; Update table of offsets.
759 JMP HP_X
; of hwcp table. Exit.
761 RIGHT_BR: CMP RIGHT_FLAG
,01H ; If left brackets not
762 JNE EXIT_2
; Found then error.
763 RB1: MOV ERROR_FLAG
,02H ; Set end of line flag.
764 MOV BX,TABLE_4
; Point at hwcp table
765 ADD BX,02H ; Adjust pointer to desg
766 MOV TABLE_5
,BX ; table, and save in table_5
767 MOV DI,TABLE_1
; Point at table of offsets
768 ADD DI,08H ; Set at DESG offset
769 MOV DS:WORD PTR [DI],BX ; Update table.
774 EXIT_2: MOV ERROR_FLAG
,01H ; Set error flag.
777 HWCP: CMP RIGHT_FLAG
,01H ; If left brackets not
778 JNE EXIT_2
; Found then error.
779 CALL HWCP_PARSE
; Call parse one hwcp.
780 CMP ERROR_FLAG
,01H ; If error flag set
781 JE HP_X
; Then exit, else
782 CALL OFFSET_TABLE
; Update table of offsets.
789 ;********************************************************
790 ;** HWCP_PARSE : Parse the hardware code page page **
791 ;** number and change it from hex to binary. **
792 ;********************************************************
796 MOV DI,TABLE_4
; Load address of hwcpages.
797 ADD DS:WORD PTR [DI],0001H ; Set count to 1
799 CALL GET_NUMBER
; Convert number to binary.
800 CMP ERROR_FLAG
,01H ; If error then
802 MOV DS:WORD PTR [DI+2],BX ; Else, save binary page number
803 ADD DI,04H ; Increment counter
804 MOV TABLE_5
,DI ; Set pointer of designate num
811 ;********************************************************
812 ;** MUL_HWCP : Parse multiple hardware code pages **
813 ;** and convert them from hex to binary numbers. **
814 ;********************************************************
818 MOV DI,TABLE_4
; Load offset of table_4
819 MOV BX,DI ; in DI and Bx.
820 MOV HWCP_FLAG
,00H ; Set hwcp flag off.
822 MH1: CALL GET_CHAR
; Load character in AL.
823 JZ MH3
; Exit if end of line.
824 CMP AL,')' ; If ')' then exit
825 JE MH2
; end of parms.
826 CALL IS_DIGIT
; If a digit, then
827 JE MH4
; Convert number to binary.
828 CALL IS_DELIM
; If not a delimiter
829 JNE MH3
; then error, exit
830 JMP MH1
; get another character.
832 MH2: CALL GET_CHAR
; Get next character
835 MH3: MOV ERROR_FLAG
,01H ; Set error flag on.
838 MH4: ADD HWCP_FLAG
,01H ; Set hwcp flag on (0 off)
839 ADD DI,02H ; Increment table pointer
841 CALL GET_NUMBER
; Convert number to binary.
842 MOV DS:WORD PTR [DI],BX ; Add number to table
844 CMP ERROR_FLAG
,01H ; If error then
846 ADD DS:WORD PTR [BX],01H ; Increment hwcp count.
847 DEC SI ; Point at character in AL
848 JMP MH1
; (delimeter or ')').
855 ;********************************************************
856 ;** DESG_PARMS : Scane for the designate numbers, and **
857 ;** parse it if found. Flag codes set to: **
858 ;** ERROR_FLAG = 0 - parsing completed. No error. **
859 ;** ERROR_FLAG = 1 - error found exit parse. **
860 ;** ERROR_FLAG = 2 - end of line found, exit parse. **
861 ;********************************************************
866 MOV DI,TABLE_1
; Get offset of dev in DI
867 MOV BX,TABLE_5
; & offset of desg. in BX.
868 ADD DI,08 ; Location of desg offset in table.
869 MOV DS:WORD PTR [DI],BX ; Update table.
870 MOV COMMA_FLAG
,00H ; Set comma flag off.
881 DESG_PARM1: CALL GET_CHAR
; Get character in AL.
882 JZ EXIT_3
; Error, if end of line
883 CALL IS_DIGIT
; If character is a digit
884 JE DESG
; Then convert to binary.
885 CMP AL,')' ; If a ')', then
886 JE RIGHT_BR2
; end of parameters.
887 CMP AL,'(' ; If a '(' then
888 JE DF ; parse desg and font.
889 CMP AL,',' ; If a comma then
891 CALL IS_DELIM
; If not a delimiter
892 JNE EXIT_3
; then error.
893 JMP DESG_PARM1
; Get another character.
895 RIGHT_BR2: CMP RIGHT_FLAG
,01H ; IF no '(' encountered,
896 JNE EXIT_3
; then error, exit
897 JMP DP_x
; Jump to DP1.
899 EXIT_3: MOV ERROR_FLAG
,01H ; Set error flag on
902 DF: CMP RIGHT_FLAG
,01H ; If no '(' encountered
903 JB EXIT_3
; then error, exit
904 CALL DESG_FONT
; Parse desg and font.
905 JMP DP1
; Jump to DP1.
907 DP2: CALL FIND_RIGHT_BR
; Check for ')'
910 DP3: CMP COMMA_FLAG
,01H ; If comma flag set
912 MOV COMMA_FLAG
,01H ; Else set comma flag on.
913 JMP DESG_PARM1
; Get another character.
915 DESG: MOV ERROR_FLAG
,00H ; Set error flag off.
916 CALL DESG_PARSE
; Parse desg.
917 DP1: CMP ERROR_FLAG
,01H ; If error flag on then
919 CALL FIND_RIGHT_BR
; Else check for ')'
920 CALL OFFSET_TABLE
; Update table
928 ;********************************************************
929 ;** DESG_FONT : Parse the designate and font numbers & **
930 ;** change them from decimal to binary. **
931 ;********************************************************
937 MOV DI,TABLE_5
; Get desg font table.
938 MOV COMMA_FLAG
,00H ; Set comma flag off.
939 DF1: CALL GET_CHAR
; Load a character in AL.
940 JZ DF3
; Error if end of line.
941 CMP AL,',' ; Check if a comma.
943 CALL IS_DIGIT
; If a digit, then
944 JE DF5
; Convert number to binary.
945 CMP AL,')' ; If a ')' then
947 CALL IS_DELIM
; If not a delimiter
948 JNE DF3
; then error, exit
949 JMP DF1
; Get another character.
951 DF2: CMP COMMA_FLAG
,01H ; If comma flag on
952 JE DF3
; then error, exit
953 MOV COMMA_FLAG
,01H ; Set comma flag on
954 ADD DS:WORD PTR [DI],01H ; Increment desg counter.
955 MOV DS:WORD PTR [DI+2],0FFFFH ; Load ffffh for desg empty
958 DF3: MOV ERROR_FLAG
,01H ; Set error flag on.
961 DF4: CMP DESG_FLAG
,00H ; If desg flag off
962 JE DF3
; then error, exit
963 JMP DF_X
; Else exit.
965 DF5: ADD DS:WORD PTR [DI],01H ; Increment desg font count.
966 CMP DESG_FLAG
,01H ; If desg flag is on
967 JE DF6
; then get font.
968 CMP COMMA_FLAG
,01H ; if comma flag is on
969 JE DF6
; then get font.
970 MOV DESG_FLAG
,01H ; Set desg flag on
971 JMP DF7
; Get desg number.
973 DF6: ADD DI,02H ; adjust pointer to font.
974 MOV DESG_FLAG
,02H ; Set desg and font flag.
975 DF7: CALL GET_NUMBER
; Get a number & convert to
976 CMP ERROR_FLAG
,01H ; binary.
977 JE DF_X
; If error flag set, Exit.
978 MOV DS:WORD PTR [DI+2],BX ; Store number in table.
979 CMP DESG_FLAG
,02H ; If desg and font flag
980 JNE DF1
; not set, then get char.
981 CALL FIND_RIGHT_BR
; Check for right bracket.
988 ;********************************************************
989 ;** DESG_PARSE : Parse the designate number and **
990 ;** change it from decimal to binary. **
991 ;********************************************************
995 MOV DI,TABLE_5
; Load designate location
996 ADD DS:WORD PTR [DI],0001H ; Update table count.
998 CALL GET_NUMBER
; Get the ascii number and
999 CMP ERROR_FLAG
,01H ; conver it to binary
1000 JE DESG_X
; If error then exit
1002 MOV DS:WORD PTR [DI+2],BX ; Else, save desg number
1010 ;********************************************************
1011 ;** GET_NUMBER : Convert the number pointed to by SI **
1012 ;** to a binary number and store it in BX **
1013 ;********************************************************
1017 MOV CX,0AH ; Set multiplying factor
1018 XOR BX,BX ; Clear DX
1020 NEXT_NUM: SUB AL,30H
; Conver number to binary
1022 XCHG AX,BX ; Switch ax and bx to mul
1023 MUL CX ; already converted number by 10.
1024 JO ERR_NUM
; On over flow jump to error.
1025 ADD BX,AX ; Add number to total.
1026 JC ERR_NUM
; On over flow jump to error.
1027 XOR AX,AX ; Clear AX (clear if al=0a).
1028 CALL GET_CHAR
; Get next character
1029 JZ GET_NUM_X
; Exit, if end of line.
1030 CALL IS_DIGIT
; Call is digit.
1031 JNZ GET_NUM_X
; Exit if not a number.
1032 JMP NEXT_NUM
; Loop.
1034 ERR_NUM: MOV ERROR_FLAG
,01H ; Set error code to 1.
1041 ;********************************************************
1042 ;** UPDATE_TABLE : This routine set up pointers to the **
1043 ;** different offsets of the different tables **
1044 ;********************************************************
1048 MOV DS:WORD PTR [DI],BX ; Offset of offsets
1049 MOV TABLE_1
,BX ; Table_1 points at offsets
1053 MOV DS:WORD PTR [DI+2],BX ; Offset of DEVICE name.
1054 MOV TABLE_2
,BX ; Table_2 point at device name.
1057 MOV DS:WORD PTR [DI+4],BX ; Offset of ID name.
1058 MOV TABLE_3
,BX ; Table_3 point at ID name.
1061 MOV DS:WORD PTR [DI+6],BX ; Offset of HWCP pages.
1062 MOV TABLE_4
,BX ; Table_4 point at HWCP pages.
1069 ;********************************************************
1070 ;** OFFSET_TABLE : This routine set up pointers of **
1071 ;** tables number one and two. **
1072 ;********************************************************
1076 MOV DI,TABLE_1
; Increment the number
1077 ADD DS:WORD PTR [DI],01H ; of parms foun. (ie. id,hwcp
1083 ;********************************************************
1084 ;** FIND_RIGHT_BR :This routine scane the line for a **
1085 ;** ')' if cannot find it turns error flag on **
1086 ;********************************************************
1090 FBR1: CMP AL,')' ; If a right bracket
1091 JE FBR_X
; then exit.
1092 CMP AL,' ' ; If not a space
1093 JNE FBR2
; Then error.
1094 CALL GET_CHAR
; Get a character
1095 JZ FBR2
; If end of line then exit.
1096 JMP FBR1
; Else get another character.
1098 FBR2: MOV ERROR_FLAG
,01H ; Set error flag on
1099 FBR_X: MOV AL,20H
; Erase character from AL.