Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-1


					PAGE	,132			;AN000;
					TITLE	TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;
				;****************** START OF SPECIFICATIONS *****************************
				; MODULE NAME: TREEPAR.SAL
				;
				; DESCRIPTIVE NAME: Handle the definition of the DOS command line parameters
				;		    and the interface to the DOS system PARSER.
				;
				;FUNCTION: The static data areas are prescribed by the DOS system PARSER
				;	   to define the several parameters presented to TREE.	These
				;	   data areas are passed to the PARSER, and its responses checked
				;	   to determine the nature of the user's specifications.  Any errors
				;	   found in the user's parameters are defined in messages back
				;	   to the user.
				;
				; ENTRY POINT: PARSER, near
				;
				; INPUT: (DOS COMMAND LINE PARAMETERS)
				;
				;	      [d:][path] TREE [D:][path] [/F] [/A]
				
				;	 WHERE
				;	      [d:][path] - Path where the TREE command resides.
				
				;	      [D:][path] - Display of subdirectories starts with this
				;			   specified subdirectory.  If this is not
				;			   specified, the default is the drive root directory.
				
				;	      [/F]	 - This requests the files in each subdirectory
				;			   in addition to the subdirectories themselves
				;			   are to be listed.
				;
				;	      [/A]	  -This requests use of alternate char in place of graphics.
				;
				;	Upon entry to PARSER in this module,
				;	"CURRENT_PARM" = offset to start of parm text in command string
				;	"ORDINAL" = initialized to zero
				;	PSP+81H = text of DOS command line parms string
				
				; EXIT-NORMAL: Carry flag is clear.
				
				; EXIT-ERROR: Carry flag is set.  Parse error msg has been displayed.
				
				; INTERNAL REFERENCES:
				;    ROUTINES:
				;	PARSE_ERROR:NEAR Display the appropriate Parse error message.
				
				;    DATA AREAS:
				;	The several parameter control blocks, defined by the System
				;	PARSER interface, defining the TREE parameters.
				;	INCLUDE PATHMAC.INC - PATHGEN MACRO
				
				; EXTERNAL REFERENCES:
				;    ROUTINES:
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-2


				;	SENDMSG:NEAR	Uses Msg Descriptor to drive message handler.
				;	SYSPARSE:NEAR	System Command Line Common Parser.
				;
				;    DATA AREAS:
				;	EXITFL:BYTE	Errorlevel return code.
				;	MSGNUM_PARSE:WORD Message descriptor for all parse errors.
				;
				; NOTES:
				;	 This module should be processed with the SALUT preprocessor
				;	 with the re-alignment not requested, as:
				;
				;		SALUT TREEPAR,NUL
				;
				;	 To assemble these modules, the alphabetical or sequential
				;	 ordering of segments may be used.
				;
				;	 For LINK instructions, refer to the PROLOG of the main module,
				;	 TREE.SAL.
				;
				;
				;****************** END OF SPECIFICATIONS *****************************
					HEADER	<LOCAL MACROS, EQUATES> ;AN000;
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-3
LOCAL MACROS, EQUATES			;                                   

					INCLUDE PATHMAC.INC		;AN012;
			     C	;;***********************************************************************
			     C	;; NAME: pathlabl
			     C	;; DESC: creates a public label at the spot it is placed, using the name
			     C	;;       given.
			     C	;; INPUT: either module name or procedure name
			     C	;; OUTPUT: public label
			     C	;; LOGIC: LBL-parameter-name will have four values -
			     C	;;            - one for each pass (2)
			     C	;;            - one for start and one for stop
			     C	;;        if LBL is not defined, it is first pass, at beginning label
			     C	;;              - set it to 1 and create the start label
			     C	;;        if LBL = 1, it is first pass, at end label
			     C	;;              - set it to 2 and create stop label
			     C	;;        if LBL = 2, it is second pass, at beginning label
			     C	;;              - set it to 3 and create the start label
			     C	;;        if LBL = 3, it is second pass, at end label
			     C	;;              - set it to 4 and create stop label
			     C	;;        if LBL = 4, it is second pass,
			     C	;;              - this macro has been invoked more than twice with same parm
			     C	;;              - issue error message
			     C	;;***********************************************************************
			     C	
			     C	pathlabl MACRO pnam
			     C	IFNDEF LBL_&pnam                        ;;IF THIS IS THE FIRST TIME,
			     C	    LBL_&pnam = 0                       ;;DEFINE IT, INITIALLY ZERO
			     C	ELSE                                    ;;SINCE IT IS DEFINED
			     C	    IF (LBL_&pnam GT 3)                 ;;IF USED TOO MANY TIMES,
			     C	        .ERR NON-UNIQUE OPERAND ON PATHLABL
			     C	        EXITM                           ;;ABORT THIS GENERATION
			     C	    ENDIF
			     C	ENDIF
			     C	
			     C	IF (LBL_&pnam EQ 0) OR (LBL_&pnam EQ 2) ;;ready for START?
			     C	    $$A_START_&pnam:                    ;;create START label
			     C	    PUBLIC $$A_START_&pnam              ;;make it public
			     C	ELSE                                    ;;SINCE SWITCH MAY BE 1 OR 3,
			     C	    $$A_STOP_&pnam:                     ;;create STOP label
			     C	    PUBLIC $$A_STOP_&pnam               ;;make it public
			     C	ENDIF
			     C	LBL_&pnam = LBL_&pnam + 1               ;;INCREMENT SWITCH
			     C	ENDM
				; =  =	=  =  =  =  =  =  =  =	=  =
				HEADER	MACRO	TEXT			;;AN000;
				.XLIST					;;AN000;
					SUBTTL	&TEXT			;;AN000;
				.LIST					;;AN000;
					PAGE				;;AN000;
					ENDM				;;AN000;
				; =  =	=  =  =  =  =  =  =  =	=  =
					EXTRN	MAX_PATH:ABS		;AN000;MAX LENGTH OF PATH PERMITTED
				
				;		      $SALUT (4,23,28,36) ;AN004;
				MSG_DESC	      STRUC	   ;AN004;
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-4
LOCAL MACROS, EQUATES			;                                   

 0000  0000			MSG_NUM 	      DW   ?	   ;AN004;MESSAGE NUMBER (TO AX)
 0002  0000			MSG_HANDLE	      DW   ?	   ;AN004;HANDLE OF OUTPUT DEVICE (TO BX)
 0004  0000			MSG_SUBLIST	      DW   ?	   ;AN004;POINTER TO SUBLIST (TO SI)
 0006  0000			MSG_COUNT	      DW   ?	   ;AN004;SUBSTITUTION COUNT (TO CX)
 0008  0000			MSG_CLASS	      DW   ?	   ;AN004;MESSAGE CLASS (IN HIGH BYTE, TO DH)
								   ; LOW BYTE HAS 0 (FUNCTION "NO INPUT", TO DL);AN004;
 000A				MSG_DESC	      ENDS	   ;AN004;
				
 = 0001				ONE_SUBS	      EQU  1	   ;AN004;NUMBER OF VARIABLES
				
				SUBLIST 	      STRUC	   ;AN000;
 0000  00			SUB_SIZE	      DB   ?	   ;AN004;SUBLIST SIZE (POINTER TO NEXT SUBLIST)
 0001  00			SUB_RES 	      DB   ?	   ;AN004;RESERVED
								   ;NEXT FIELD IS TO BE USED AS A DOUBLE WORD	   ;AN004;
 0002  0000			SUB_VALUE	      DW   ?	   ;AN004;TIME, DATE, OR PTR TO DATA ITEM
 0004  0000			SUB_VALUE_SEG	      DW   ?	   ;AN004;SEG ID OF PTR
								   ;(ABOVE FIELD MUST BE FILLED AT EXECUTION TIME  ;AN004;
								   ; IF THIS IS A .COM FILE)			   ;AN004;
 0006  00			SUB_ID		      DB   ?	   ;AN004;N OF %N
 0007  00			SUB_FLAGS	      DB   ?	   ;AN004;DATA TYPE FLAGS
 0008  00			SUB_MAX_WIDTH	      DB   ?	   ;AN004;MAXIMUM FIELD WIDTH (0=UNLIMITED)
 0009  00			SUB_MIN_WIDTH	      DB   ?	   ;AN004;MINIMUM FIELD WIDTH
 000A  00			SUB_PAD_CHAR	      DB   ?	   ;AN004;CHARACTER FOR PAD FIELD
								   ; CAN BE " ", "0" OR ",".			   ;AN004;
								   ; "," CAUSES INSERTION OF THE ACTIVE 	   ;AN004;
								   ; THOUSANDS SEPARATOR BETWEEN EVERY 3 DIGITS.   ;AN004;
 000B				SUBLIST 	      ENDS	   ;AN004;
				
				;		LOCAL EQUATES
				
 = 007F				CMD_BUF_SIZE	      EQU  127	   ;AN000;NUMBER BYTES IN DOS COMMAND LINE BUFFER
 = 0000				ZERO		      EQU  0	   ;AN000;COMPARAND FOR CLEARED REG
 = 003A				COLON		      EQU  ":"	   ;AN000;FOLLOWS DRIVE LETTER IN FULL FILESPEC
 = 0000				NUL		      EQU  0	   ;AN000;DELIMITER FOR ASCIIZ STRINGS
 = 005C				BACK_SLASH	      EQU  "\"	   ;AN000;PATH DELIMITER
 = 0020				BLANK		      EQU  " "	   ;AN003;WIPE OUT SWITCH, AVOIDS DUPLICATES
				
				;		EXIT CODES FROM SYSPARSE (WHEN CY=0)
				
 = 0000				SYSPRM_EX_OK	      EQU  0	   ;AN000; no error
 = 0001				SYSPRM_EX_MANY	      EQU  1	   ;AN000; too many operands
 = 0002				SYSPRM_EX_MISSING     EQU  2	   ;AN000; required operand missing
 = 0003				SYSPRM_EX_NOT_SWLIST  EQU  3	   ;AN000; not in switch list provided
 = 0004				SYSPRM_EX_NOT_KEYLIST EQU  4	   ;AN000; not in keyword list provided
 = 0006				SYSPRM_EX_RANGE       EQU  6	   ;AN000; out of range specified
 = 0007				SYSPRM_EX_VALUE       EQU  7	   ;AN000; not in value list provided
 = 0008				SYSPRM_EX_STRING      EQU  8	   ;AN000; not in string list provided
 = 0009				SYSPRM_EX_SYNTAX      EQU  9	   ;AN000; syntax error
 =-0001				SYSPRM_EX_EOL	      EQU  -1	   ;AN000; end of command line
						      HEADER <EXTRN REFERENCES, LOCAL VARIABLES> ;AN000;
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-5
EXTRN REFERENCES, LOCAL VARIABLES			;                       

						      EXTRN F_SWITCH:ABS ;AN000;BIT FLAGS TO TURN ON IF /F SPECIFIED
				
				;	      $SALUT (4,15,20,28) ;AN000;
 0000				CSEG	      SEGMENT PARA PUBLIC 'CODE' ;AN000;
					      ASSUME CS:CSEG,DS:CSEG,ES:CSEG,SS:CSEG ;AN000;ESTABLISHED BY CALLER
				
				;WHERE THE PARMS COME FROM:
					      EXTRN COMMAND:BYTE ;AN000;DOS INPUT COMMAND LINE PARMS
				
				;WHERE THE PARMS GO:
					      EXTRN FLAGS:BYTE ;AN000;HAS INDICATOR FOR /F
							   ; WHERE F_SWITCH BIT GOES
					      EXTRN START_DRIVE:BYTE ;AN000;LETTER OF DRIVE BEING RESEARCHED
					      EXTRN START_PATH:BYTE ;AN000;PATH OF START OF CHAIN BEING RESEARCHED
					      EXTRN GRAF_TABLE:BYTE ;AN002;TABLE OF GRAPHIC CHARACTERS
					      EXTRN GRAF_TABLE_ALT:BYTE ;AN002;ALTERNATE SET OF GRAPHIC CHARACTERS
				
				;MESSAGES USED:
					      EXTRN MSGNUM_PARSE:WORD ;AN000;MSG DESCRIPTOR FOR PARSE ERRORS
					      EXTRN SUBLIST_PARSE:WORD ;AN004;POINTS TO INVALID PARM
					      EXTRN MSGNUM_INVPATH:WORD ;AN000;"INVALID PATH" COMMON MESSAGE
				
				;EXTERNAL SUBROUTINES USED:
					      EXTRN SYSPARSE:NEAR ;AN000;COMMAND LINE PARM PARSER
					      EXTRN SENDMSG:NEAR ;AN000;USES MSG DESCRIPTOR TO DRIVE MESSAGE HANDLR
					      EXTRN SCAN_DBCS:NEAR ;AN012;GET LAST TWO CHARS OF STRING
				
 0000  0000			CURRENT_PARM  DW   ?	   ;AN000;POINTER INTO COMMAND OF NEXT OPERAND
					      PUBLIC CURRENT_PARM ;AN000;
				
 0002  0000			ORDINAL       DW   ?	   ;AN000;ORDINAL NUMBER OF WHICH PARM TO PARSE
					      PUBLIC ORDINAL ;AN000;
				
				
				; INPUT: (DOS COMMAND LINE PARAMETERS)
				
				;	      [d:][path] TREE [D:][path] [/F] [/A]
				
				;	 WHERE
				;	      [d:][path] - Path where the TREE command resides.
				
				;	      [D:][path] - Display of subdirectories starts with this
				;			   specified subdirectory.  If this is not
				;			   specified, the default is the drive root directory.
				
				;	      [/F]	 - This requests the files in each subdirectory
				;			   in addition to the subdirectories themselves
				;			   are to be listed.
				
				;	      [/A]	 - This requests use of alternate graphic chars
				; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
					      HEADER <PARSE CONTROL BLOCKS DEFINING PARMS> ;AN000;
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-6
PARSE CONTROL BLOCKS DEFINING PARMS			;                     

				;INPUT PARAMETERS CONTROL BLOCK, POINTED TO BY ES:DI WHEN CALLING PARSER
				
 0004				PARMS	      LABEL BYTE   ;AN000;PARMS CONTROL BLOCK
 0004  0007 R				      DW   PARMSX  ;AN000;POINTER TO PARMS EXTENSION
 0006  00				      DB   0	   ;AN000; NUMBER OF STRINGS (0, 1, 2)
							   ; NEXT LIST WOULD BE EXTRA DELIM LIST
							   ;  (,& WHITESPACE ALWAYS)
							   ; NEXT LIST WOULD BE EXTRA END OF LINE LIST
							   ;  (CR,LF,0 ALWAYS)
				
 0007				PARMSX	      LABEL BYTE   ;AN000;PARMS EXTENSION CONTROL BLOCK
 0007  00 01				      DB   0,1	   ;AN000; MIN, MAX POSITIONAL OPERANDS ALLOWED
 0009  000F R				      DW   CONTROL_POS ;AN000; DESCRIPTION OF POSITIONAL 1
				
 000B  01				      DB   1	   ;AN000; MAX SWITCH OPERANDS ALLOWED
 000C  0021 R				      DW   CONTROL_SW ;AN000; DESCRIPTION OF SWITCH 1
				
 000E  00				      DB   0	   ;AN000; MAX KEYWORD OPERANDS ALLOWED
							   ; THERE IS NO CONTROL BLOCK
							   ;  DEFINING KEYWORDS
				
				; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
				
				;PARSER CONTROL BLOCK DEFINING THE ONLY POSITIONAL PARAMETER, OPTIONAL
				
				;FIRST POSITIONAL PARAMETER IS:
				;	[D:][PATH]
				
 000F				CONTROL_POS   LABEL BYTE   ;AN000;FIRST POSITIONAL DESCRIPTOR FOR FILESPEC,
							   ; OPTIONAL
 000F  0201				      DW   0201H   ;AN000; CONTROLS TYPE MATCHED
							   ; SELECTED BITS: "FILE SPEC" AND "OPTIONAL"
				
							   ; 8000H=NUMERIC VALUE, (VALUE LIST WILL BE CHECKED)
							   ; 4000H=SIGNED NUMERIC VALUE (VALUE LIST WILL BE
							   ;   CHECKED)
							   ; 2000H=SIMPLE STRING(VALUE LIST WILL BE CHECKED)
							   ; 1000H=DATE STRING (VALUE LIST WON'T BE CHECKED)
							   ; 0800H=TIME STRING (VALUE LIST WON'T BE CHECKED)
							   ; 0400H=COMPLEX LIST (VALUE LIST WON'T BE CHECKED)
							   ; 0200H=FILE SPEC (VALUE LIST WON'T BE CHECKED)
							   ; 0100H=DRIVE ONLY (VALUE LIST WON'T BE CHECKED)
							   ; 0080H=QUOTED STRING (VALUE LIST WON'T BE CHECKED)
							   ; 0010H=IGNORE ":" AT END IN MATCH
							   ; 0002H=REPEATS ALLOWED
							   ; 0001H=OPTIONAL
				
 0011  0001				      DW   0001H   ;AN000;FUNCTION_FLAGS
							   ; 0001H=CAP RESULT BY FILE TABLE
							   ; 0002H=CAP RESULT BY CHAR TABLE
							   ; 0010H=REMOVE ":" AT END
 0013  0019 R				      DW   RESULT1 ;AN000; RESULT BUFFER
 0015  0018 R				      DW   NOVALS  ;AN000; VALUE LISTS
 0017  00				      DB   0	   ;AN000; NUMBER OF KEYWORD/SWITCH SYNONYMS
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-7
PARSE CONTROL BLOCKS DEFINING PARMS			;                     

							   ;   IN FOLLOWING LIST
				
				
 0018				NOVALS	      LABEL BYTE   ;AN000;
 0018  00				      DB   0	   ;AN000; NUMBER OF VALUE DEFINITIONS (0 - 3)
				
 0019				RESULT1       LABEL BYTE   ;AN000; BELOW FILLED IN FOR DEFAULTS
 0019  05				      DB   5	   ;AN000; TYPE RETURNED: 0=RESERVED,
							   ;	   1=NUMBER, 2=LIST INDEX,
							   ;	   3=STRING, 4=COMPLEX,
							   ;	   5=FILESPEC, 6=DRIVE
							   ;	   7=DATE, 8=TIME
							   ;	   9=QUOTED STRING
 001A  FF				      DB   0FFH    ;AN000; MATCHED ITEM TAG
 001B  0000				      DW   0	   ;AN000;POINTER TO SYNONYM
				
 001D  00000000			RESULT_PTR1   DD   ?	   ;AN000; OFFSET OF STRING VALUE
				
				
				; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
				
				;PARSER CONTROL BLOCK DEFINING THE SWITCHES, OPTIONAL
				
				;THE SWITCH IS "/F".  WHEN REQUESTED, IT MEANS TO LIST ALL FILE
				;NAMES IN EVERY DIRECTORY BEING TRACED.
				;THE OTHER SWITCH IS "/A". IT MEANS TO USE THE ALTERNATE SET OF GRAPHIC CHARS.
				
 0021				CONTROL_SW    LABEL BYTE   ;AN000;SWITCH DESCRIPTOR
 0021  0000				      DW   0000H   ;AN000; CONTROLS TYPE MATCHED
							   ; 8000H=NUMERIC VALUE, (VALUE LIST WILL BE CHECKED)
							   ; 4000H=SIGNED NUMERIC VALUE (VALUE LIST WILL BE
							   ;   CHECKED)
							   ; 2000H=SIMPLE STRING(VALUE LIST WILL BE CHECKED)
							   ; 1000H=DATE STRING (VALUE LIST WON'T BE CHECKED)
							   ; 0800H=TIME STRING (VALUE LIST WON'T BE CHECKED)
							   ; 0400H=COMPLEX LIST (VALUE LIST WON'T BE CHECKED)
							   ; 0200H=FILE SPEC (VALUE LIST WON'T BE CHECKED)
							   ; 0100H=DRIVE ONLY (VALUE LIST WON'T BE CHECKED)
							   ; 0080H=QUOTED STRING (VALUE LIST WON'T BE CHECKED)
							   ; 0010H=IGNORE ":" AT END IN MATCH
							   ; 0002H=REPEATS ALLOWED
							   ; 0001H=OPTIONAL
				
 0023  0002				      DW   0002H   ;AN000;FUNCTION_FLAGS
							   ; 0001H=CAP RESULT BY FILE TABLE
							   ; 0002H=CAP RESULT BY CHAR TABLE
							   ; 0010H=REMOVE ":" AT END
				
 0025  0030 R				      DW   RESULTSW1 ;AN000; RESULT BUFFER
 0027  0018 R				      DW   NOVALS  ;AN000; VALUE LISTS
 0029  02				      DB   2	   ;AN002; NUMBER OF KEYWORD/SWITCH SYNONYMS
							   ;   IN FOLLOWING LIST
 002A  2F 46 00			F_SW	      DB   "/F",0  ;AN000; IF n >0, KEYWORD 1
 002D  2F 41 00			A_SW	      DB   "/A",0  ;AN002; IF n >0, KEYWORD 2
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-8
PARSE CONTROL BLOCKS DEFINING PARMS			;                     

				
				
				
 0030				RESULTSW1     LABEL BYTE   ;AN000; BELOW FILLED IN FOR DEFAULTS
 0030  03				      DB   3	   ;AN000; TYPE RETURNED: 0=RESERVED,
							   ;	   1=NUMBER, 2=LIST INDEX,
							   ;	   3=STRING, 4=COMPLEX,
							   ;	   5=FILESPEC, 6=DRIVE
							   ;	   7=DATE, 8=TIME
							   ;	   9=QUOTED STRING
 0031  FF				      DB   0FFh    ;AN000; MATCHED ITEM TAG
				
 0032  0000			SYNONYM       DW   0	   ;AN000; SYNONYM POINTER (BASED ON ES:)
 0034  00000000			RESULT_PTR2   DD   ?	   ;AN000; OFFSET OF STRING VALUE
					      PATHLABL TREEPAR ;AN013;
 0038                        1	    $$A_START_TREEPAR:                    ; 
				; =  =	=  =  =  =  =  =  =  =	=  =
					      HEADER <PARSER - DRIVE SYSPARSE, VERIFY RESULTS> ;AN000;
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-9
PARSER - DRIVE SYSPARSE, VERIFY RESULTS			;                 

				;  $SALUT (4,4,9,36)		   ;AN000;
 0038				PARSER PROC NEAR		   ;AN000;
				   PUBLIC PARSER		   ;AN000;
				
				;INPUT: "CURRENT_PARM" = OFFSET TO NEXT PARM IN COMMAND STRING
				;	"ORDINAL" = COUNT OF NEXT PARM TO PARSE
				;	"COMMAND" = TEXT OF DOS COMMAND LINE PARMS STRING
				;OUTPUT: CARRY IS SET IF THERE WAS A PROBLEM, AX HAS PARSE RET CODE.
				;	 CARRY IS CLEAR IF ALL OK WITH THE PARMS
				;THE PSP IS NOT REFERENCED, SINCE THE PARMS HAVE BEEN MOVED OUT OF THERE.
				; =  =	=  =  =  =  =  =  =  =	=  =
				
				;  $SEARCH COMPLEX		   ;AN000;LOOP THRU COMMAND LINE
 0038  EB 18			   JMP SHORT $$SS1
 003A				$$DO1:
 003A  89 0E 0002 R		       MOV  ORDINAL,CX		   ;AN000;SAVE UPDATED COUNT
				
								   ;LOOKING AT RETURN CODE IN AX,
								   ; JUST PRODUCED BY SYSPARSE...
 003E  3D 0000			       CMP  AX,ZERO		   ;AN000;WERE THERE ANY ERRORS?
				;      $IF  NE			   ;AN000;HAD A PROBLEM FOUND BY SYSPARSE
 0041  74 06			       JE $$IF2
 0043  E8 00E5 R			   CALL PARSE_ERROR	   ;AN000;DISPLAY REASON FOR ERROR
				
 0046  F9				   STC			   ;AN000;SET CARRY TO INDICATE ERROR
				;      $ELSE			   ;AN000;SINCE OK BY SYSPARSE
 0047  EB 07			       JMP SHORT $$EN2
 0049				$$IF2:
 0049  89 36 0000 R			   MOV	CURRENT_PARM,SI    ;AN000;REMEMBER HOW FAR I GOT
 004D  E8 006A R			   CALL CHECK_PATH	   ;AN000;SEE IF A GOOD PATH WAS SPECIFIED
								   ;OUTPUT: CY SET IF ERROR
				;      $ENDIF			   ;AN000;
 0050				$$EN2:
				;  $EXITIF C,NUL		   ;AN000;HAD A PROBLEM WITH THE PARMS
 0050  72 17			   JC $$SR1
				
								   ;SINCE ALL OK SO FAR, CONTINUE
				;  $STRTSRCH			   ;AN000;ENTRY POINT INTO THE SEARCH LOOP
 0052				$$SS1:
 0052  8D 3E 0004 R		       LEA  DI,PARMS		   ;AN000; ES:DI = PARSE CONTROL DEFINITON
 0056  8B 36 0000 R		       MOV  SI,CURRENT_PARM	   ;AN000; DS:SI = COMMAND STRING, NEXT PARM
 005A  33 D2			       XOR  DX,DX		   ;AN000; RESERVED, INIT TO ZERO
 005C  8B 0E 0002 R		       MOV  CX,ORDINAL		   ;AN000; OPERAND ORDINAL, INITIALLY ZERO
 0060  E8 0000 E		       CALL SYSPARSE		   ;AN000;
								   ; AX=EXIT CODE
								   ; BL=TERMINATED DELIMITER CODE
								   ; CX=NEW OPERAND ORDINAL
								   ; SI=SET TO PAST SCANNED OPERAND
								   ; DX=SELECTED RESULT BUFFER
 0063  3D FFFF			       CMP  AX,SYSPRM_EX_EOL	   ;AN000; IS THAT THE END OF THE PARMS?
								   ;IF NOT, LOOP BACK AND FIND OUT
								   ; WHAT THAT PARM IS
				;  $ENDLOOP E			   ;AN000;END OF LIST
 0066  75 D2			   JNE $$DO1
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-10
PARSER - DRIVE SYSPARSE, VERIFY RESULTS			;                 

 0068  F8			       CLC			   ;AN000;SAY ALL OK
				;  $ENDSRCH			   ;AN000;
 0069				$$SR1:
 0069  C3			   RET				   ;AN000;RETURN TO CALLER
 006A				PARSER ENDP			   ;AN000;
				; =  =	=  =  =  =  =  =  =  =	=  =
				   HEADER <CHECK_PATH - SEE IF THE PATH IS OK> ;AN000;
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-11
CHECK_PATH - SEE IF THE PATH IS OK			;                      

				;MOVE THE PATH STRING FROM RESULT BUFFER TO "START_DRIVE" AND "START_PATH",
				;VERIFY THE LENGTH OF THE PATH AS BEING WITHIN LIMITS.
				;CHECK FOR THE /F SWITCH, SETTING "FLAGS" (F_SWITCH BIT ON) IF /F SPECIFIED.
				
				;INPUT: DX AS SET BY SYSPARSE, POINTS TO RESULT BUFFER
				;OUTPUT: CY SET IF PROBLEM, CY CLEAR IF ALL OK
				; =  =	=  =  =  =  =  =  =  =	=  =
				
 006A				CHECK_PATH PROC NEAR		   ;AN000;
				   PUBLIC CHECK_PATH		   ;AN000;
				
 006A  8B DA			   MOV	BX,DX			   ;AN000;SET DATA BASE REG TO POINT TO THIS OPERAND
 006C  81 FB 0019 R		   CMP	BX,OFFSET RESULT1	   ;AN000;WAS PATH SPECIFIED?
				;  $IF	E			   ;AN000;IF PATH SPECIFIED,
 0070  75 4C			   JNE $$IF9
 0072  8B 36 001D R		       MOV  SI,WORD PTR RESULT_PTR1 ;AN000;GET WHERE THE STRING IS
 0076  80 7C 01 3A		       CMP  BYTE PTR [SI]+1,COLON ;AN000;DOES PATH START WITH DRIVE?
				;      $IF  E			   ;AN000;STARTS WITH DRIVE
 007A  75 0A			       JNE $$IF10
 007C  8D 3E 0000 E			   LEA	DI,START_DRIVE	   ;AN000;MOVE PARM TO STARTUP FILESPEC
 0080  AC				   LODSB		   ;AN000;MOVE THE DRIVE ID
 0081  AA				   STOSB		   ;AN000; INTO "START_DRIVE"
 0082  46				   INC	SI		   ;AN000;STEP SOURCE INDEX OVER COLON
 0083  47				   INC	DI		   ;AN000;STEP DEST INDEX OVER COLON
				;      $ELSE			   ;AN000;DOES NOT START WITH DRIVE
 0084  EB 04			       JMP SHORT $$EN10
 0086				$$IF10:
 0086  8D 3E 0000 E			   LEA	DI,START_PATH	   ;AN000;MOVE PARM TO STARTUP FILESPEC
				;      $ENDIF			   ;AN000;PATH HAVE DRIVE?
 008A				$$EN10:
				
 008A  56			       PUSH SI			   ;AN012;SAVE WHERE STRING STARTS
 008B  E8 0000 E		       CALL SCAN_DBCS		   ;AN012;SCAN STRING FOR DBCS
								   ;DL=LAST CHAR, DH=NEXT TO LAST CHAR
 008E  5E			       POP  SI			   ;AN012;RESTORE POINTER TO START OF STRING
								   ;NOW TO GET THE PATH ITSELF
				
 008F  B9 0000 E		       MOV  CX,MAX_PATH 	   ;AN000;SET THE LIMIT OF PATH LENGTH
 0092  41			       INC  CX			   ;AN000; INCLUDING THE NUL AT THE END
				;      $SEARCH COMPLEX		   ;AN000;
 0093  EB 01			       JMP SHORT $$SS13
 0095				$$DO13:
 0095  AA				   STOSB		   ;AN000;PUT THIS CHAR INTO "START_PATH"
				;      $STRTSRCH		   ;AN000;
 0096				$$SS13:
 0096  AC				   LODSB		   ;AN000;GET A CHAR FROM PARSED STRING
 0097  3C 00				   CMP	AL,NUL		   ;AN000;IS THIS THE DELIMITER?
				;      $EXITIF E		   ;AN000;NORMAL END OF STRING FOUND
 0099  75 17			       JNE $$IF13
 009B  80 FA 5C				   CMP	DL,BACK_SLASH	   ;AN012;IS PREV CHAR A BACKSLASH?
				;	   $IF	E,AND		   ;AN012;YES, PREV CHAR WAS A BACKSLASH
 009E  75 0F				   JNE $$IF16
 00A0  80 FE 5C				   CMP	DH,BACK_SLASH	   ;AN012;IS CHAR BEFORE THAT A BACKSLASH?
				;	   $IF	NE,AND		   ;AN012;NO, CHAR BEFORE THAT WAS NOT A BACKSLASH
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-12
CHECK_PATH - SEE IF THE PATH IS OK			;                      

 00A3  74 0A				   JE $$IF16
 00A5  81 F9 0000 E			   CMP	CX,MAX_PATH	   ;AN000;WAS THIS THE ONLY CHAR?
				;	   $IF	NE		   ;AN000;NO, NOT THE ONLY ONE
 00A9  74 04				   JE $$IF16
 00AB  C6 45 FF 00			       MOV  BYTE PTR [DI-1],NUL ;AN000;CHANGE IT TO A "NUL"
				;	   $ENDIF		   ;AN000;
 00AF				$$IF16:
 00AF  F8				   CLC			   ;AN000;FLAG NO ERROR
				;      $ORELSE			   ;AN000;CHECK OUT THIS NEW CHAR
 00B0  EB 0A			       JMP SHORT $$SR13
 00B2				$$IF13:
				;      $ENDLOOP LOOP		   ;AN000;GO BACK AND SAVE IT, IF ROOM
 00B2  E2 E1			       LOOP $$DO13
 00B4  8D 3E 0000 E			   LEA	DI,MSGNUM_INVPATH  ;AN000;"INVALID PATH"
 00B8  E8 0000 E			   CALL SENDMSG 	   ;AN000;DISPLAY THE MESSAGE
				
 00BB  F9				   STC			   ;AN000;FLAG AN ERROR
				;      $ENDSRCH 		   ;AN000;
 00BC				$$SR13:
				
				;  $ELSE			   ;AN000;FILESPEC NOT SPECIFIED
 00BC  EB 26			   JMP SHORT $$EN9
 00BE				$$IF9:
 00BE  A1 0032 R		       MOV  AX,SYNONYM		   ;AN002;GET SYNONYM POINTER
 00C1  3D 002A R		       CMP  AX,OFFSET F_SW	   ;AN002;WAS THE SWITCH /F?
				;      $IF  E			   ;AN002;IF /F
 00C4  75 0D			       JNE $$IF22
 00C6  C6 06 002A R 20			   MOV	F_SW,BLANK	   ;AN003;STRIKE THE /F FROM THE LIST OF SWITCHES
 00CB  80 0E 0000 E 00 E		   OR	FLAGS,F_SWITCH	   ;AN000;REQUEST LISTING OF FILENAMES
 00D0  F8				   CLC			   ;AN000;NO ERROR
				;      $ELSE			   ;AN002;SINCE NOT /F, MUST BE /A
 00D1  EB 11			       JMP SHORT $$EN22
 00D3				$$IF22:
 00D3  C6 06 002D R 20			   MOV	A_SW,BLANK	   ;AN003;STRIKE THE /A FROM THE LIST OF SWITCHES
 00D8  A1 0000 E			   MOV	AX,WORD PTR GRAF_TABLE_ALT ;AN002;PICK UP THE ALTERNATE SET
 00DB  A3 0000 E			   MOV	WORD PTR GRAF_TABLE,AX ;AN002; OF GRAPHICS CHARACTERS
 00DE  A1 0002 E			   MOV	AX,WORD PTR GRAF_TABLE_ALT+WORD ;AN002; AND MOVE THEM TO
 00E1  A3 0002 E			   MOV	WORD PTR GRAF_TABLE+WORD,AX ;AN002; THE TABLE OF GRAPHICS TO BE USED
				;      $ENDIF			   ;AN002;
 00E4				$$EN22:
				;  $ENDIF			   ;AN000;FILESPEC?
 00E4				$$EN9:
 00E4  C3			   RET				   ;AN000;RETURN TO CALLER
 00E5				CHECK_PATH ENDP 		   ;AN000;
				; =  =	=  =  =  =  =  =  =  =	=  =
				   HEADER <PARSE_ERROR - DISPLAY ERROR MSG FOR PARSER> ;AN000;
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Page     1-13
PARSE_ERROR - DISPLAY ERROR MSG FOR PARSER			;              

 00E5				PARSE_ERROR PROC NEAR		   ;AN000;
				   PUBLIC PARSE_ERROR		   ;AN000;
				
				;INPUT: AX - ERROR NUMBER RETURNED FROM PARSE.
				;	SI - OFFSET INTO COMMAND OF FIRST BYTE BEYOND PARM IN ERROR
				;	"CURRENT_PARM" - OFFSET INTO COMMAND OF WHERE TO START LOOKING FOR PARM
				; =  =	=  =  =  =  =  =  =  =	=  =
				
 00E5  A3 0000 E		   MOV	MSGNUM_PARSE,AX 	   ;AN000;SET THE ERROR NUMBER
 00E8  A1 0000 R		   MOV	AX,CURRENT_PARM 	   ;AN004;GET POINTER TO START OF BAD PARM
 00EB  3B F0			   CMP	SI,AX			   ;AN004;HAS THE INDEX TO COMMAND LINE MOVED?
				;  $IF	NE			   ;AN004;YES, THERE IS A FAULTY PARM
 00ED  74 12			   JE $$IF26
 00EF  C6 04 00			       MOV  BYTE PTR [SI],NUL	   ;AN004;DELIMIT THE BAD PARM
 00F2  A3 0002 E		       MOV  SUBLIST_PARSE.SUB_VALUE,AX ;AN000;POINT SUBLIST TO BAD PARM
				
 00F5  C7 06 0004 E 0000 E	       MOV  MSGNUM_PARSE.MSG_SUBLIST,OFFSET SUBLIST_PARSE ;AN004;POINT TO SUBLIST
 00FB  C7 06 0006 E 0001	       MOV  MSGNUM_PARSE.MSG_COUNT,ONE_SUBS ;AN004;SET COUNT OF SUBLISTS TO ONE
				;  $ENDIF			   ;AN004;INDEX MOVED?
 0101				$$IF26:
 0101  8D 3E 0000 E		   LEA	DI,MSGNUM_PARSE 	   ;AN000;PASS MESSAGE DESCRIPTOR
 0105  E8 0000 E		   CALL SENDMSG 		   ;AN000;DISPLAY ERROR MESSAGE
				
 0108  C3			   RET				   ;AN000;RETURN TO CALLER
 0109				PARSE_ERROR ENDP		   ;AN000;
				; =  =	=  =  =  =  =  =  =  =	=  =
				   PATHLABL TREEPAR		   ;AN013;
 0109                        1	    $$A_STOP_TREEPAR:                     ; 
 0109				CSEG ENDS			   ;AN000;
				   END				   ;AN000;

Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Symbols-1


Macros:

		N a m e			Lines

HEADER . . . . . . . . . . . . .  	   4
PATHLABL . . . . . . . . . . . .  	  16

Structures and Records:

                N a m e                 Width   # fields
                                        Shift   Width   Mask    Initial

MSG_DESC . . . . . . . . . . . .  	000A	0005
  MSG_NUM  . . . . . . . . . . .  	0000
  MSG_HANDLE . . . . . . . . . .  	0002
  MSG_SUBLIST  . . . . . . . . .  	0004
  MSG_COUNT  . . . . . . . . . .  	0006
  MSG_CLASS  . . . . . . . . . .  	0008
SUBLIST  . . . . . . . . . . . .  	000B	0009
  SUB_SIZE . . . . . . . . . . .  	0000
  SUB_RES  . . . . . . . . . . .  	0001
  SUB_VALUE  . . . . . . . . . .  	0002
  SUB_VALUE_SEG  . . . . . . . .  	0004
  SUB_ID . . . . . . . . . . . .  	0006
  SUB_FLAGS  . . . . . . . . . .  	0007
  SUB_MAX_WIDTH  . . . . . . . .  	0008
  SUB_MIN_WIDTH  . . . . . . . .  	0009
  SUB_PAD_CHAR . . . . . . . . .  	000A

Segments and Groups:

                N a m e         	Length	 Align	Combine Class

CSEG . . . . . . . . . . . . . .  	0109	PARA	PUBLIC	'CODE'

Symbols:            

                N a m e         	Type	 Value	 Attr

A_SW . . . . . . . . . . . . . .  	L BYTE	002D	CSEG

BACK_SLASH . . . . . . . . . . .  	NUMBER	005C	
BLANK  . . . . . . . . . . . . .  	NUMBER	0020	

CHECK_PATH . . . . . . . . . . .  	N PROC	006A	CSEG	Global	Length = 007B
CMD_BUF_SIZE . . . . . . . . . .  	NUMBER	007F	
COLON  . . . . . . . . . . . . .  	NUMBER	003A	
COMMAND  . . . . . . . . . . . .  	V BYTE	0000	CSEG	External
CONTROL_POS  . . . . . . . . . .  	L BYTE	000F	CSEG
CONTROL_SW . . . . . . . . . . .  	L BYTE	0021	CSEG
CURRENT_PARM . . . . . . . . . .  	L WORD	0000	CSEG	Global

FLAGS  . . . . . . . . . . . . .  	V BYTE	0000	CSEG	External
F_SW . . . . . . . . . . . . . .  	L BYTE	002A	CSEG
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Symbols-2


F_SWITCH . . . . . . . . . . . .  	NUMBER	0000		Communal

GRAF_TABLE . . . . . . . . . . .  	V BYTE	0000	CSEG	External
GRAF_TABLE_ALT . . . . . . . . .  	V BYTE	0000	CSEG	External

LBL_TREEPAR  . . . . . . . . . .  	NUMBER	0004	

MAX_PATH . . . . . . . . . . . .  	NUMBER	0000		Communal
MSGNUM_INVPATH . . . . . . . . .  	V WORD	0000	CSEG	External
MSGNUM_PARSE . . . . . . . . . .  	V WORD	0000	CSEG	External

NOVALS . . . . . . . . . . . . .  	L BYTE	0018	CSEG
NUL  . . . . . . . . . . . . . .  	NUMBER	0000	

ONE_SUBS . . . . . . . . . . . .  	NUMBER	0001	
ORDINAL  . . . . . . . . . . . .  	L WORD	0002	CSEG	Global

PARMS  . . . . . . . . . . . . .  	L BYTE	0004	CSEG
PARMSX . . . . . . . . . . . . .  	L BYTE	0007	CSEG
PARSER . . . . . . . . . . . . .  	N PROC	0038	CSEG	Global	Length = 0032
PARSE_ERROR  . . . . . . . . . .  	N PROC	00E5	CSEG	Global	Length = 0024

RESULT1  . . . . . . . . . . . .  	L BYTE	0019	CSEG
RESULTSW1  . . . . . . . . . . .  	L BYTE	0030	CSEG
RESULT_PTR1  . . . . . . . . . .  	L DWORD	001D	CSEG
RESULT_PTR2  . . . . . . . . . .  	L DWORD	0034	CSEG

SCAN_DBCS  . . . . . . . . . . .  	L NEAR	0000	CSEG	External
SENDMSG  . . . . . . . . . . . .  	L NEAR	0000	CSEG	External
START_DRIVE  . . . . . . . . . .  	V BYTE	0000	CSEG	External
START_PATH . . . . . . . . . . .  	V BYTE	0000	CSEG	External
SUBLIST_PARSE  . . . . . . . . .  	V WORD	0000	CSEG	External
SYNONYM  . . . . . . . . . . . .  	L WORD	0032	CSEG
SYSPARSE . . . . . . . . . . . .  	L NEAR	0000	CSEG	External
SYSPRM_EX_EOL  . . . . . . . . .  	NUMBER	-0001	
SYSPRM_EX_MANY . . . . . . . . .  	NUMBER	0001	
SYSPRM_EX_MISSING  . . . . . . .  	NUMBER	0002	
SYSPRM_EX_NOT_KEYLIST  . . . . .  	NUMBER	0004	
SYSPRM_EX_NOT_SWLIST . . . . . .  	NUMBER	0003	
SYSPRM_EX_OK . . . . . . . . . .  	NUMBER	0000	
SYSPRM_EX_RANGE  . . . . . . . .  	NUMBER	0006	
SYSPRM_EX_STRING . . . . . . . .  	NUMBER	0008	
SYSPRM_EX_SYNTAX . . . . . . . .  	NUMBER	0009	
SYSPRM_EX_VALUE  . . . . . . . .  	NUMBER	0007	

ZERO . . . . . . . . . . . . . .  	NUMBER	0000	

$$A_START_TREEPAR  . . . . . . .  	L NEAR	0038	CSEG	Global
$$A_STOP_TREEPAR . . . . . . . .  	L NEAR	0109	CSEG	Global
$$DO1  . . . . . . . . . . . . .  	L NEAR	003A	CSEG
$$DO13 . . . . . . . . . . . . .  	L NEAR	0095	CSEG
$$EN10 . . . . . . . . . . . . .  	L NEAR	008A	CSEG
$$EN2  . . . . . . . . . . . . .  	L NEAR	0050	CSEG
$$EN22 . . . . . . . . . . . . .  	L NEAR	00E4	CSEG
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:25
TREEPAR.SAL - PARSE THE DOS COMMAND LINE ;AN000;            Symbols-3


$$EN9  . . . . . . . . . . . . .  	L NEAR	00E4	CSEG
$$IF10 . . . . . . . . . . . . .  	L NEAR	0086	CSEG
$$IF13 . . . . . . . . . . . . .  	L NEAR	00B2	CSEG
$$IF16 . . . . . . . . . . . . .  	L NEAR	00AF	CSEG
$$IF2  . . . . . . . . . . . . .  	L NEAR	0049	CSEG
$$IF22 . . . . . . . . . . . . .  	L NEAR	00D3	CSEG
$$IF26 . . . . . . . . . . . . .  	L NEAR	0101	CSEG
$$IF9  . . . . . . . . . . . . .  	L NEAR	00BE	CSEG
$$SR1  . . . . . . . . . . . . .  	L NEAR	0069	CSEG
$$SR13 . . . . . . . . . . . . .  	L NEAR	00BC	CSEG
$$SS1  . . . . . . . . . . . . .  	L NEAR	0052	CSEG
$$SS13 . . . . . . . . . . . . .  	L NEAR	0096	CSEG
@CPU . . . . . . . . . . . . . .  	TEXT  0101h		
@FILENAME  . . . . . . . . . . .  	TEXT  treepar		
@VERSION . . . . . . . . . . . .  	TEXT  510		


    553 Source  Lines
    609 Total   Lines
     93 Symbols

  47042 + 213288 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors
