     1                                  ;	PAGE	,132		       ;
     2                                  ;	SCCSID = @(#)sysconf.asm       0.0 86/10/20
     3                                  ;TITLE	BIOS SYSTEM INITIALIZATION
     4                                  %warning out: ...SYSCONF
     4          ******************       warning: out: ...SYSCONF [-w+user]
     5                                  
     6                                  ;==============================================================================
     7                                  ;REVISION HISTORY:
     8                                  ;AN000 - New for DOS Version 4.00 - J.K.
     9                                  ;AC000 - Changed for DOS Version 4.00 - J.K.
    10                                  ;AN00x - PTM number for DOS Version 4.00 - J.K.
    11                                  ;==============================================================================
    12                                  ;AN001; P132 Multiple character device installation problem.	   06/27/87 J.K.
    13                                  ;AN002; D24  MultiTrack= command added. 			   06/29/87 J.K.
    14                                  ;AN003; D41  REM command in CONFIG.SYS. 			   07/6/87  J.K.
    15                                  ;AN004; D184 Set DEVMARK for MEM command			   08/25/87 J.K.
    16                                  ;AN005; P568 CONFIG.SYS parsing error with FCBS=10,15		   08/31/87 J.K.
    17                                  ;AN006; P887 STACKS=0 does not show "ERROR in CONFIG.SYS..."	   09/09/87 J.K.
    18                                  ;AN007; D246, P976 Show "Bad command or parameters - ..." msg	   09/22/87 J.K.
    19                                  ;AN008; P1299 Set the second entry of DEVMARK for MEM command	   09/25/87 J.K.
    20                                  ;AN009; P1326 New Extended attribute				   09/28/87 J.K.
    21                                  ;AN010; P1820 New message SKL file				   10/20/87 J.K.
    22                                  ;AN011; P1970 AUTOTEST FCBS= command error msg inconsistent	   10/23/87 J.K.
    23                                  ;AN012; P2211 Setting the EA=7 for ANSI.SYS hangs the system	   11/02/87 J.K.
    24                                  ;AN013; P2342 REM not allowed after INSTALL command		   11/09/87 J.K.
    25                                  ;AN014; P2546 DEVICE= command still allowed after IFS=		   11/17/87 J.K.
    26                                  ;AN015; D358  New device driver INIT function package		   12/03/87 J.K.
    27                                  ;AN016; D285 Undo the extended error handling			   12/17/87 J.K.
    28                                  ;AN017; P3170 Do not call block device driver when drive # > 26    01/20/88 J.K.
    29                                  ;AN018; P3111 Take out the order dependency of the INSTALL=	   01/25/88 J.K.
    30                                  ;AN019; D479  New option to disable extended INT 16h function call 02/12/88 J.K.
    31                                  ;AN020; P3607 MEM does not give correct filename		   02/24/88 J.K.
    32                                  ;AN021; D493 Undo D358 & do not show error message for device driv 02/24/88 J.K.
    33                                  ;AN022; P3807 Single buffer unprotected - System hangs		   03/10/88 J.K.
    34                                  ;AN023; P3797 An INSTALL cmd right after Bad cmd is not executed   03/10/88 J.K.
    35                                  ;AN024; D503 Version change to 4.0 - IBMCACHE.SYS is an exception  03/15/88 J.K.
    36                                  ;AN025; D474 Change BUFFERS= /E option to /X for expanded memory   03/16/88 J.K.
    37                                  ;AN026; D506 Take out the order dependency of the IFS=		   03/28/88 J.K.
    38                                  ;AN027; P3957 Undo D503 - IBMCACHE.SYS version check problem	   03/30/88 J.K.
    39                                  ;AN028; P4086 Memory allocation error when loading share.exe	   03/31/88 J.K.
    40                                  ;AN029; D528 Install XMAEM.SYS first before everything else	   04/29/88 J.K.
    41                                  ;AN030; P4759 INT2f, INT 67h handlers for XMA			   05/11/88 J.K.
    42                                  ;AN031; P4889 Should check the validity of INT 67h call 	   05/17/88 G.A.
    43                                  ;AN032; P4934 P4759 INT 2fh number should be changed to 1Bh	   05/20/88 J.K.
    44                                  ;AN033; P5002 EMS w/single page allocated now works		   05/20/88 G.A.
    45                                  ;AN034; P5128 EMS INT 2FH HANDLER BUG				   06/24/88
    46                                  ;==============================================================================
    47                                  
    48                                  TRUE	    EQU 0FFFFh
    49                                  FALSE	    EQU 0
    50                                  LF	equ	10
    51                                  CR	equ	13
    52                                  TAB	equ	 9
    53                                  SEMICOLON equ	';'
    54                                  
    55                                  IBMVER	   EQU	   TRUE
    56                                  IBM	   EQU	   IBMVER
    57                                  STACKSW    EQU	   TRUE 		;Include Switchable Hardware Stacks
    58                                  IBMJAPVER  EQU	   FALSE		;If TRUE set KANJI true also
    59                                  %iassign MSVER FALSE
    60                                  ALTVECT    EQU	   FALSE		;Switch to build ALTVECT version
    61                                  KANJI	   EQU	   FALSE
    62                                  
    63                                  HAVE_INSTALL_CMD      equ     00000001b ;AN018; CONFIG.SYS has INSTALL= commands
    64                                  HAS_INSTALLED	      equ     00000010b ;AN018; SYSINIT_BASE installed.
    65                                  
    66                                  IS_IFS		      equ   00000001b	;IFS command?
    67                                  NOT_IFS 	      equ   11111110b
    68                                  ;
    69                                  ;AN016; Undo the extended attribute handling
    70                                  ;;Extended attribute value
    71                                  ;EA_UNSPECIFIED 	 equ	 0	 ;AN009;
    72                                  ;EA_DEVICE_DRIVER	 equ	 6	 ;AN009;
    73                                  ;EA_IFS_DRIVER		 equ	 7	 ;AN009;
    74                                  
    75                                  DEFAULT_FILENUM equ 8
    76                                  ;
    77                                  	%IF	IBMJAPVER
    78                                  NOEXEC	EQU	TRUE
    79                                  	%ELSE
    80                                  NOEXEC	EQU	FALSE
    81                                  	%ENDIF
    82                                  
    83                                  ;DOSSIZE EQU	0A000H
    84                                  ;dossize equ	 0C000H 	;J.K. for the debugging version of IBMDOS.
    85                                  
    86                                  [list -]
    86          ******************       warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi]
    14                              <3> [list -]
    14                              <2> [list -]
     6                              <1> %include "entrysw.mac"
     1                              <2> 
     2                              <2> %ifndef __ENTRYSW_MAC__
     3                              <2>  %assign __ENTRYSW_MAC__ 1
     4                              <2> 
     5                              <2> %assign _DOSCODEHMA		1
     6                              <2> %assign _RELOCATEDOSCODE	1
     7                              <2> 
     8                              <2> 		; Write a label "%1" (only if DOSCODE isn't relocated) and
     9                              <2> 		; "relocated%1" (always).
    10                              <2> 	%imacro relocated 1-2.nolist
    11                              <2> %ifnidni %2, device
    12                              <2>  %ifnidni %2, amis
    13                              <2>   %ifn _RELOCATEDOSCODE
    14                              <2> %1:
    15                              <2> 	global %1
    16                              <2>   %endif
    17                              <2>  %endif
    18                              <2> %endif
    19                              <2> relocated%1:				; always used for local labels
    20                              <2> 	global relocated%1
    21                              <2> 	%endmacro
    22                              <2> 
    23                              <2> %if _RELOCATEDOSCODE
    24                              <2> DOSENTRYADJUSTSEGMENT equ 60h - 26h
    25                              <2> %else
    26                              <2> DOSENTRYADJUSTSEGMENT equ 0
    27                              <2> %endif
    28                              <2> DOSENTRYADJUSTOFFSET equ DOSENTRYADJUSTSEGMENT * 16
    29                              <2> 
    30                              <2> DOSENTRYDEVICEBASE equ 10h
    31                              <2> 
    32                              <2> %endif
     7                              <1> [list -]
    39                              <1> usesection DOSENTRY
    40                              <1> 
    41                              <1> %endif
    88                                  	%include "msgroup.mac"
     1                              <1> EVBOUND equ 1  ;THIS VALUE BEING 0 DOES NO BOUNDARY ALLIGNMENT, VALUE 1	  ;3.30
     2                              <1> 	     ; ALIGNS TO EVEN						  ;3.30
     3                              <1> 
     4                              <1> ; NASM original macros
     5                              <1> 
     6                              <1> %include "dcodeseg.nas"
     1                              <2> 
     2                              <2> %ifndef DCODESEGNAS
     3                              <2> %assign DCODESEGNAS 1
     4                              <2> 
     5                              <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE
     6                              <2> ; (no prior section) ; DOSCODETABLE		ENDS
     7                              <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE
     8                              <2> ; (no prior section) ; DOSCODECODE		ENDS
     9                              <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE
    10                              <2> section BIOCODE	align=2 PUBLIC class=DOSCODE
    11                              <2> 
    12                              <2> %ifnidni DOSENTRYGROUP, DOSCODEGROUP
    13                              <2>  group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE
    14                              <2> %endif
    15                              <2> 
    16                              <2> %endif
     7                              <1> 
     8                              <1> 	%if EVBOUND	;;IF EVEN (WORD) ALLIGNMENT IS REQUESTED,	  ;3.30
     9                              <1> 
    10                              <1> %imacro EVENB 0.nolist
    11                              <1> 	EVEN	;;ADJUST TO EVEN BOUNDARY
    12                              <1> %endmacro
    13                              <1> 
    14                              <1> %imacro ODD 0.nolist
    15                              <1> %if (($ - $$) % 2) == 0
    16                              <1> 	db ?
    17                              <1> %endif
    18                              <1> %endmacro
    19                              <1> 
    20                              <1> 	%else	;;SINCE EVEN ALLIGNMENT IS NOT DESIRED, JUST USE BYTE ALLI;3.30 GNMENT
    21                              <1> 
    22                              <1> %imacro EVENB 0.nolist
    23                              <1> ;;REQUEST FOR WORD ALLIGNMENT DOES NOTHING				  ;3.30
    24                              <1> %endmacro
    25                              <1> 
    26                              <1> %imacro ODD 0.nolist
    27                              <1> ;;REQUEST FOR ODD ALLIGNMENT DOES NOTHING				  ;3.30
    28                              <1> %endmacro
    29                              <1> 
    30                              <1> 	%endif								  ;3.30
    31                              <1> 
    32                              <1> %imacro CODE_SEGMENT 0.nolist
    33                              <1> 	section BIOCODE
    34                              <1> %endmacro
    35                              <1> 
    36                              <1> ; end of NASM original macros
    37                              <1> 
    38                              <1> 	CODE_SEGMENT							  ;3.30
    39                              <1> 	ASSUME	CS:BIOCODE 						  ;3.30
    40                              <1> 									  ;3.30
    89                                  ;	INCLUDE dossym.INC
    90                                  	%include "smdossym.mac"	;J.K. Reduced version of DOSSYM.INC
     1                              <1> ;	SCCSID = @(#)dossym.asm 1.1 85/04/10
     2                              <1> ;	SCCSID = @(#)dossym.asm 1.1 85/04/10
     3                              <1> ;	PAGE 80,132
     4                              <1> TRUE	    EQU 0FFFFh
     5                              <1> FALSE	    EQU 0
     6                              <1> 
     7                              <1> Installed   equ TRUE
     8                              <1> %IFNDEF	DEBUG
     9                              <1>     DEBUG	equ FALSE
    10                              <1> %ENDIF
    11                              <1> %IFNDEF	debug
    12                              <1>     debug	equ DEBUG
    13                              <1> %ENDIF
    14                              <1> 
    15                              <1> %include "dosmac.mac"
     1                              <2> ;	SCCSID = @(#)dosmac.asm	1.1 85/04/10
     2                              <2> ;	SCCSID = @(#)dosmac.asm	1.1 85/04/10
     3                              <2> ;
     4                              <2> ; Macro file for MSDOS.
     5                              <2> ;
     6                              <2> 
     7                              <2> %ifndef __DOSMAC_MAC__
     8                              <2>  %assign __DOSMAC_MAC__ 1
     9                              <2> 
    10                              <2> TRUE    EQU 0FFFFh
    11                              <2> FALSE   EQU 0
    12                              <2> 
    13                              <2> 
    14                              <2> ; NASM original macros (comment for fixmem.pl)
    15                              <2> 
    16                              <2> ;SUBTTL BREAK a listing into pages and give new subtitles
    17                              <2> ;PAGE
    18                              <2> %imacro BREAK 0-1+.nolist
    19                              <2> 	;SUBTTL  subtitle
    20                              <2> 	;PAGE
    21                              <2> %endmacro
    22                              <2> ;.xcref  break
    23                              <2> 
    24                              <2> BREAK   <ASMVAR - handle assembly variables once and for all>
    25                              <2> 
    26                              <2> %if 0
    27                              <2> AsmVars Macro   varlist
    28                              <2> IRP     var,<varlist>
    29                              <2> AsmVar  var
    30                              <2> ENDM
    31                              <2> ENDM
    32                              <2> 
    33                              <2> AsmVar  Macro   var
    34                              <2> IFNDEF  var
    35                              <2> var = FALSE
    36                              <2> ENDIF
    37                              <2> ENDM
    38                              <2> %endif
    39                              <2> 
    40                              <2> BREAK <I_NEED: declare a variable external, if necessary, and allocate a size>
    41                              <2> 
    42                              <2> ;
    43                              <2> ; declare a variable external and allocate a size
    44                              <2> ;
    45                              <2> ;AsmVar  InstalledData
    46                              <2> %ifndef InstalledData
    47                              <2>  %define InstalledData 0
    48                              <2> %endif
    49                              <2> 
    50                              <2> %imacro I_NEED 1-2.nolist
    51                              <2> %ifn InstalledData
    52                              <2> 	[section DATA]
    53                              <2>     %IFIDNi   %2, WORD
    54                              <2> 	EXTRN   %1:WORD
    55                              <2>     %ELSE
    56                              <2> 	%IFIDNi   %2, DWORD
    57                              <2> 	EXTRN   %1:DWORD
    58                              <2> 	%ELSE
    59                              <2> 	EXTRN   %1:BYTE
    60                              <2> 	%ENDIF
    61                              <2>     %ENDIF
    62                              <2> 	__SECT__
    63                              <2> %ENDIF
    64                              <2> %endmacro
    65                              <2> 	;.xcref I_need
    66                              <2> 
    67                              <2> ;
    68                              <2> ; call a procedure that may be external.  The call will be short.
    69                              <2> ;
    70                              <2> %imacro invoke 1.nolist
    71                              <2> ;.xcref
    72                              <2> 	EXTRN   %1:NEAR
    73                              <2> ;.cref
    74                              <2> 	CALL    %1
    75                              <2> %endmacro
    76                              <2> ;.xcref  invoke
    77                              <2> 
    78                              <2> ;PAGE
    79                              <2> ;
    80                              <2> ; jump to a label that may be external.  The jump will be near.
    81                              <2> ;
    82                              <2> %imacro transfer 1.nolist
    83                              <2> ;.xcref
    84                              <2> 	EXTRN   %1:NEAR
    85                              <2> ;.cref
    86                              <2> 	JUMP    %1
    87                              <2> %endmacro
    88                              <2> ;.xcref  transfer
    89                              <2> 
    90                              <2> ;
    91                              <2> ; get a short address in a word
    92                              <2> ;
    93                              <2> %imacro short_addr 1.nolist
    94                              <2>     %ifnidn %1, ?
    95                              <2> 	EXTRN   %1:NEAR
    96                              <2> 	DW  OFFSET %1
    97                              <2>     %ELSE
    98                              <2> 	DW  ?
    99                              <2>     %ENDIF
   100                              <2> %endmacro
   101                              <2> ;.xcref  short_addr
   102                              <2> 
   103                              <2> ;
   104                              <2> ; get a long address in a dword
   105                              <2> ;
   106                              <2> %imacro long_addr 1.nolist
   107                              <2> 	EXTRN   %1:NEAR
   108                              <2> 	DD  %1
   109                              <2> %endmacro
   110                              <2> ;.xcref  long_addr
   111                              <2> 
   112                              <2> ;
   113                              <2> ; declare a PROC near or far but PUBLIC nonetheless
   114                              <2> ;
   115                              <2> ;.xcref ?frame
   116                              <2> ;.xcref ?aframe
   117                              <2> ;.xcref ?stackdepth
   118                              <2> ;.xcref ?initstack
   119                              <2> %assign ?frame           0                     ; initial
   120                              <2> %assign ?aframe          0                     ; initial
   121                              <2> %assign ?stackdepth      0                     ; initial stack size
   122                              <2> %assign ?initstack       0                     ; initial stack size
   123                              <2> 
   124                              <2> %imacro procedure 1-2.nolist
   125                              <2> 	%assign ?frame     0
   126                              <2> 	%assign ?aframe    2                   ;; remember the pushed BP
   127                              <2> 	%warning proc %1...
   128                              <2> %1    PROC    %2
   129                              <2> 	PUBLIC  %1
   130                              <2> 	%assign ?initstack     ?stackdepth     ;; beginning of procedure
   131                              <2> %endmacro
   132                              <2> ;.xcref  procedure
   133                              <2> 
   134                              <2> ;
   135                              <2> ; end a procedure and check that stack depth is preserved
   136                              <2> ;
   137                              <2> %imacro EndProc 1-2.nolist
   138                              <2> 	%ifnidni   %2, NoCheck        ;; check the stack size
   139                              <2> 	%if ?initstack != ?stackdepth    ;; is it different?
   140                              <2> 	%warning    ***** Possible stack size error in %1 *****
   141                              <2> 	%endif
   142                              <2> 	%endif
   143                              <2> %1    ENDP
   144                              <2> %endmacro
   145                              <2> ;.xcref  endproc
   146                              <2> ;PAGE
   147                              <2> ;
   148                              <2> ; define a data item to be public and of an appropriate size/type
   149                              <2> ;
   150                              <2> 
   151                              <2> %imacro stripangles 2.nolist
   152                              <2> %defstr %%param %2
   153                              <2> %rep 16
   154                              <2>  %substr %%opening %%param 1
   155                              <2>  %ifidn %%opening, '<'
   156                              <2>   %substr %%param %%param 2,-1
   157                              <2>  %endif
   158                              <2> %endrep
   159                              <2> %rep 16
   160                              <2>  %strlen %%length %%param
   161                              <2>  %substr %%closing %%param %%length
   162                              <2>  %ifidn %%closing, '>'
   163                              <2>   %substr %%param %%param 1,-2
   164                              <2>  %endif
   165                              <2> %endrep
   166                              <2> %deftok %%token %%param
   167                              <2> %1 %%token
   168                              <2> %endmacro
   169                              <2> 
   170                              <2> %imacro I_AM 2-*.nolist
   171                              <2> ;I_AM    MACRO   name,size,init
   172                              <2> %xdefine %%name %1
   173                              <2> ;; declare the type of the object
   174                              <2>     %IFIDNi %2, WORD
   175                              <2> %1    LABEL WORD
   176                              <2> 	%assign I_AM_SIZE      1
   177                              <2> 	%assign I_AM_LEN       2
   178                              <2>     %ELSE
   179                              <2> 	%IFIDNi %2, DWORD
   180                              <2> %1    LABEL DWORD
   181                              <2> 	%assign I_AM_SIZE      2
   182                              <2> 	%assign I_AM_LEN       2
   183                              <2> 	%ELSE
   184                              <2> 	    %IFIDNi %2, BYTE
   185                              <2> %1    LABEL BYTE
   186                              <2> 	%assign I_AM_SIZE      1
   187                              <2> 	%assign I_AM_LEN       1
   188                              <2> 	    %ELSE
   189                              <2> %1    LABEL BYTE
   190                              <2> %undef I_AM_SIZE
   191                              <2> 	stripangles %assign I_AM_SIZE, %2
   192                              <2> 	%assign I_AM_LEN       1
   193                              <2> 	    %ENDIF
   194                              <2> 	%ENDIF
   195                              <2>     %ENDIF
   196                              <2> ;; declare the object public
   197                              <2> 	PUBLIC  %%name
   198                              <2> ;; if no initialize then allocate blank storage
   199                              <2>     %IF %0 == 2
   200                              <2> 	DB  I_AM_SIZE*I_AM_LEN DUP (?)
   201                              <2>     %ELSE
   202                              <2> %ifn InstalledData
   203                              <2>  %rotate 2
   204                              <2>  %rep %0 - 2
   205                              <2> 	    %IF I_AM_LEN == 1
   206                              <2> 		stripangles db, %1
   207                              <2> 	    %ELSE
   208                              <2> 		stripangles dw, %1
   209                              <2> 	    %ENDIF
   210                              <2> 	    %assign I_AM_SIZE I_AM_SIZE - 1
   211                              <2> 	    %rotate 1
   212                              <2>  %endrep
   213                              <2> 	%IF I_AM_SIZE != 0
   214                              <2> 	    %error    ***** initialization of %%name not complete *****
   215                              <2> 	%ENDIF
   216                              <2> %ELSE
   217                              <2> 	DB  I_AM_SIZE*I_AM_LEN DUP (?)
   218                              <2> %ENDIF
   219                              <2>     %ENDIF
   220                              <2> %endmacro
   221                              <2> 
   222                              <2> %imacro I_AM_NOBITS 2-*.nolist
   223                              <2> ;I_AM    MACRO   name,size,init
   224                              <2> %xdefine %%name %1
   225                              <2> ;; declare the type of the object
   226                              <2>     %IFIDNi %2, WORD
   227                              <2> %1    LABEL WORD
   228                              <2> 	%assign I_AM_SIZE      1
   229                              <2> 	%assign I_AM_LEN       2
   230                              <2>     %ELSE
   231                              <2> 	%IFIDNi %2, DWORD
   232                              <2> %1    LABEL DWORD
   233                              <2> 	%assign I_AM_SIZE      2
   234                              <2> 	%assign I_AM_LEN       2
   235                              <2> 	%ELSE
   236                              <2> 	    %IFIDNi %2, BYTE
   237                              <2> %1    LABEL BYTE
   238                              <2> 	%assign I_AM_SIZE      1
   239                              <2> 	%assign I_AM_LEN       1
   240                              <2> 	    %ELSE
   241                              <2> %1    LABEL BYTE
   242                              <2> %undef I_AM_SIZE
   243                              <2> 	stripangles %assign I_AM_SIZE, %2
   244                              <2> 	%assign I_AM_LEN       1
   245                              <2> 	    %ENDIF
   246                              <2> 	%ENDIF
   247                              <2>     %ENDIF
   248                              <2> ;; declare the object public
   249                              <2> 	PUBLIC  %%name
   250                              <2> ;; if no initialize then allocate blank storage
   251                              <2>     %IF %0 == 2
   252                              <2> 	resb  I_AM_SIZE*I_AM_LEN
   253                              <2>     %ELSE
   254                              <2> %ifn InstalledData
   255                              <2>  %rotate 2
   256                              <2>  %rep %0 - 2
   257                              <2> 	    %IF I_AM_LEN == 1
   258                              <2> 		resb 1
   259                              <2> 	    %ELSE
   260                              <2> 		resw 1
   261                              <2> 	    %ENDIF
   262                              <2> 	    %assign I_AM_SIZE I_AM_SIZE - 1
   263                              <2> 	    %rotate 1
   264                              <2>  %endrep
   265                              <2> 	%IF I_AM_SIZE != 0
   266                              <2> 	    %error    ***** initialization of %%name not complete *****
   267                              <2> 	%ENDIF
   268                              <2> %ELSE
   269                              <2> 	resb  I_AM_SIZE*I_AM_LEN
   270                              <2> %ENDIF
   271                              <2>     %ENDIF
   272                              <2> %endmacro
   273                              <2> 
   274                              <2> ;.xcref  I_AM
   275                              <2> ;.xcref  I_AM_SIZE
   276                              <2> ;.xcref  I_AM_LEN
   277                              <2> %assign I_AM_SIZE 0
   278                              <2> %assign I_AM_LEN  0
   279                              <2> 
   280                              <2> ;PAGE
   281                              <2> 
   282                              <2> ;
   283                              <2> ; define an entry in a procedure
   284                              <2> ;
   285                              <2> %imacro entry 1-2.nolist
   286                              <2> %1:
   287                              <2> 	PUBLIC  %1
   288                              <2> %endmacro
   289                              <2> ;.xcref  entry
   290                              <2> 
   291                              <2> BREAK <ERROR - store an error code then jump to a label>
   292                              <2> 
   293                              <2> %imacro error 1.nolist
   294                              <2> ;.xcref
   295                              <2> 	MOV AL, %1
   296                              <2> 	transfer    SYS_RET_ERR
   297                              <2> ;.cref
   298                              <2> %endmacro
   299                              <2> ;.xcref  error
   300                              <2> 
   301                              <2> BREAK <JUMP - real jump that links up shortwise>
   302                              <2> ;
   303                              <2> ; given a label <lbl> either 2 byte jump to another label <lbl>_J
   304                              <2> ; if it is near enough or 3 byte jump to <lbl>
   305                              <2> ;
   306                              <2> 
   307                              <2> %imacro jump 1.nolist
   308                              <2> ;.xcref
   309                              <2> 
   310                              <2>     %ifndef %1_J                       ;; is this the first invocation
   311                              <2> %%a:      JMP %1
   312                              <2>     %ELSE
   313                              <2> 	%IF (%1_J >= $) || ($-%1_J > 126)
   314                              <2> %%a:      JMP %1                         ;; is the jump too far away?
   315                              <2> 	%ELSE
   316                              <2> %%a:      JMP %1_J                      ;; do the short one...
   317                              <2> 	%ENDIF
   318                              <2>     %ENDIF
   319                              <2>     %ixdefine %1_j %%a
   320                              <2> ;.cref
   321                              <2> %endmacro
   322                              <2> ;.xcref  jump
   323                              <2> 
   324                              <2> BREAK <RETURN - return from a function>
   325                              <2> 
   326                              <2> %imacro return 0.nolist
   327                              <2> %%a:
   328                              <2> 	RET
   329                              <2> %xdefine ret_l %%a
   330                              <2> %endmacro
   331                              <2> ;.xcref  return
   332                              <2> 
   333                              <2> BREAK <CONDRET - conditional return>
   334                              <2> 
   335                              <2> %imacro condret 2.nolist
   336                              <2> %assign %%exit 0
   337                              <2>     %ifdef   ret_l                       ;; if ret_l is defined
   338                              <2> 	%if (($ - ret_l) <= 126) && ($ > ret_l)
   339                              <2> 					;;     if ret_l is near enough then
   340                              <2> 	    %%a:  j%1    ret_l           ;;         a: j<CC> to ret_l
   341                              <2> 	    %xdefine ret_%1 %%a                 ;;         define ret_<CC> to be a:
   342                              <2> 	    %assign %%exit 1
   343                              <2> 	%endif
   344                              <2>     %endif
   345                              <2>     %ifn %%exit
   346                              <2>     %ifdef   ret_%1                     ;; if ret_<CC> defined
   347                              <2> 	%if (($ - ret_%1) <= 126) && ($ > ret_%1)
   348                              <2> 					;;     if ret_<CC> is near enough
   349                              <2> 	    %%a:  j%1    ret_%1         ;;         a: j<CC> to ret_<CC>
   350                              <2> 	    %xdefine ret_%1 %%a                 ;;         define ret_<CC> to be a:
   351                              <2> 	    %assign %%exit 1
   352                              <2> 	%endif
   353                              <2>     %endif
   354                              <2>     %endif
   355                              <2>     %ifn %%exit
   356                              <2>     j%2   %%a                           ;; j<NCC> a:
   357                              <2>     return                              ;; return
   358                              <2>     %%a:                                  ;; a:
   359                              <2>     %xdefine ret_%1 ret_l                     ;; define ret_<CC> to be ret_l
   360                              <2>     %endif
   361                              <2> %endmacro
   362                              <2> ;.xcref  condret
   363                              <2> 
   364                              <2> BREAK <RETZ - return if zero, links up shortwise if necessary>
   365                              <2> 
   366                              <2> %imacro retz 0.nolist
   367                              <2>     condret z,nz
   368                              <2> %endmacro
   369                              <2> ;.xcref  retz
   370                              <2> 
   371                              <2> BREAK <RETNZ - return if not zero, links up shortwise if necessary>
   372                              <2> 
   373                              <2> %imacro retnz 0.nolist
   374                              <2>     condret nz,z
   375                              <2> %endmacro
   376                              <2> ;.xcref  retnz
   377                              <2> 
   378                              <2> BREAK <RETC - return if carry set, links up shortwise if necessary>
   379                              <2> 
   380                              <2> %imacro retc 0.nolist
   381                              <2>     condret c,nc
   382                              <2> %endmacro
   383                              <2> ;.xcref  retc
   384                              <2> 
   385                              <2> BREAK <RETNC - return if not carry, links up shortwise if necessary>
   386                              <2> 
   387                              <2> %imacro retnc 0.nolist
   388                              <2>     condret nc,c
   389                              <2> %endmacro
   390                              <2> ;.xcref  retnc
   391                              <2> 
   392                              <2> BREAK <CONTEXT - set the DOS context to a particular register>
   393                              <2> 
   394                              <2> %imacro context 1.nolist
   395                              <2> 	PUSH    SS
   396                              <2> 	stripangles POP, %1
   397                              <2> 	; ASSUME  %1:DOSGROUP
   398                              <2> %endmacro
   399                              <2> ;.xcref  context
   400                              <2> 
   401                              <2> BREAK <SaveReg - save a set of registers>
   402                              <2> 
   403                              <2> %imacro SaveReg 0-*.nolist                 ;; push those registers
   404                              <2>  %rep %0
   405                              <2> 	%assign ?stackdepth ?stackdepth + 1
   406                              <2> 	stripangles push, %1
   407                              <2> 	%rotate 1
   408                              <2>  %endrep
   409                              <2> %endmacro
   410                              <2> ;.xcref  SaveReg
   411                              <2> 
   412                              <2> BREAK <RestoreReg - unsave some registers>
   413                              <2> 
   414                              <2> %imacro RestoreReg 0-*.nolist             ;; pop those registers
   415                              <2>  %rep %0
   416                              <2> 	%assign ?stackdepth ?stackdepth - 1
   417                              <2> 	stripangles pop, %1
   418                              <2> 	%rotate 1
   419                              <2>  %endrep
   420                              <2> %endmacro
   421                              <2> ;.xcref  RestoreReg
   422                              <2> 
   423                              <2> BREAK <Critical section macros>
   424                              <2> 
   425                              <2> %imacro EnterCrit 1.nolist
   426                              <2> 	Invoke  E%1
   427                              <2> %endmacro
   428                              <2> 
   429                              <2> %imacro LeaveCrit 1.nolist
   430                              <2> 	Invoke  L%1
   431                              <2> %endmacro
   432                              <2> 
   433                              <2> Break   <message - display a message>
   434                              <2> 
   435                              <2> ;AsmVars <ShareF,Cargs,Redirector>
   436                              <2> %ifndef ShareF
   437                              <2>  %idefine ShareF 0
   438                              <2> %endif
   439                              <2> %ifndef Cargs
   440                              <2>  %idefine Cargs 0
   441                              <2> %endif
   442                              <2> %ifndef Redirector
   443                              <2>  %idefine Redirector 0
   444                              <2> %endif
   445                              <2> %ifndef debug
   446                              <2>  %idefine debug 0
   447                              <2> %endif
   448                              <2> 
   449                              <2> %if debug
   450                              <2> %imacro fmt 3-*.nolist
   451                              <2> ;fmt     MACRO   typ,lev,fmts,args
   452                              <2> ;local   a,b,c
   453                              <2> 	PUSHF
   454                              <2> %IFNempty %1
   455                              <2> 	TEST    word [BugTyp],%1
   456                              <2> 	JZ      %%c
   457                              <2> 	CMP     word [BugLev],%2
   458                              <2> 	JB      %%c
   459                              <2> %ENDIF
   460                              <2> 	PUSH    AX
   461                              <2> 	PUSH    BP
   462                              <2> 	MOV     BP,SP
   463                              <2> %If (! sharef) && (! redirector)
   464                              <2> 	[section Table]
   465                              <2> %%a:       db      %3,0
   466                              <2> 	__SECT__
   467                              <2> 	MOV     AX,OFFSET %%a wrt DOSGROUP
   468                              <2> %else
   469                              <2> 	jmp     short %%b
   470                              <2> %%a:       db      %3,0
   471                              <2> %if sharef
   472                              <2> %%b:      mov     ax,offset %%a wrt share
   473                              <2> %else
   474                              <2> %%b:      mov     ax,offset %%a wrt netwrk
   475                              <2> %endif
   476                              <2> %endif
   477                              <2> 	PUSH    AX
   478                              <2> %iassign cargs 2
   479                              <2> %rotate 3
   480                              <2> %rep %0 - 3
   481                              <2>  %ifidni ax, %1
   482                              <2> 	MOV     AX,[BP+2]
   483                              <2>  %ELSE
   484                              <2> 	MOV     AX, %1
   485                              <2>  %ENDIF
   486                              <2> 	PUSH    AX
   487                              <2>  %iassign cargs cargs + 2
   488                              <2>  %rotate 1
   489                              <2> %endrep
   490                              <2> 	invoke  PFMT
   491                              <2> 	ADD     SP, Cargs
   492                              <2> 	POP     BP
   493                              <2> 	POP     AX
   494                              <2> %%c:
   495                              <2> 	POPF
   496                              <2> %endmacro
   497                              <2> %else
   498                              <2> %imacro fmt 3-*.nolist
   499                              <2> %endmacro
   500                              <2> %endif
   501                              <2> 
   502                              <2> Break   <DOSAssume - validate assumes>
   503                              <2> 
   504                              <2> ;AsmVar  Debug,$temp
   505                              <2> 
   506                              <2> %imacro detectstripangles 4.nolist
   507                              <2> %defstr %%param %4
   508                              <2> %assign ?%2 0
   509                              <2> %assign ?%3 0
   510                              <2> %rep 16
   511                              <2>  %substr %%opening %%param 1
   512                              <2>  %ifidn %%opening, '<'
   513                              <2>   %substr %%param %%param 2,-1
   514                              <2>   %assign ?%2 ?%2 + 1
   515                              <2>  %endif
   516                              <2> %endrep
   517                              <2> %rep 16
   518                              <2>  %strlen %%length %%param
   519                              <2>  %substr %%closing %%param %%length
   520                              <2>  %ifidn %%closing, '>'
   521                              <2>   %substr %%param %%param 1,-2
   522                              <2>   %assign ?%3 ?%3 + 1
   523                              <2>  %endif
   524                              <2> %endrep
   525                              <2> %deftok %%token %%param
   526                              <2> %define ?%1 %%token
   527                              <2> %endmacro
   528                              <2> 
   529                              <2> 
   530                              <2> %IF debug
   531                              <2> %imacro DOSAssume 3-*.nolist
   532                              <2> ;DOSAssume   Macro   reg,reglist,message
   533                              <2>  %ifidni %1, CS
   534                              <2>   %assign %%temp 1
   535                              <2>  %else
   536                              <2>   %ifidni %1, SS
   537                              <2>    %assign %%temp 0
   538                              <2>   %else
   539                              <2>    %error ***** Invalid DOS register %1 in DOSAssume *****
   540                              <2>   %endif
   541                              <2>  %endif
   542                              <2>  %rotate 1
   543                              <2>  %assign %%level 0
   544                              <2>  %assign %%amount %0 - 1
   545                              <2>  %rep 16
   546                              <2>   detectstripangles %%token, %%opening, %%closing, %1
   547                              <2>   %assign %%level %%level + ? %+ %%opening
   548                              <2>   %assign %%level %%level - ? %+ %%closing
   549                              <2>   %ifidni ? %+ %%token, DS
   550                              <2>    %assign %%temp %%temp | 2
   551                              <2>   %else
   552                              <2>    %ifidni ? %+ %%token, ES
   553                              <2>     %assign %%temp %%temp | 4
   554                              <2>    %else
   555                              <2>     %error ***** Invalid register reg in DOSAssume *****
   556                              <2>    %endif
   557                              <2>   %endif
   558                              <2>   %assign %%amount %%amount - 1
   559                              <2>   %rotate 1
   560                              <2>   %if %%level <= 0
   561                              <2>    %exitrep
   562                              <2>   %endif
   563                              <2>  %endrep
   564                              <2> 
   565                              <2> 	PUSH    AX
   566                              <2> 	MOV     AX, %%temp
   567                              <2> 	PUSH    AX
   568                              <2> %IF SHAREF
   569                              <2> 	MOV     AX,OFFSET %%a
   570                              <2> %ELSE
   571                              <2> 	MOV     AX,OFFSET %%a wrt DOSGroup
   572                              <2> %ENDIF
   573                              <2> 	PUSH    AX
   574                              <2> 	Invoke  SegCheck
   575                              <2> 	POP     AX
   576                              <2> %IFN SHAREF
   577                              <2> 	[section Table]
   578                              <2> %ELSE
   579                              <2> 	JMP     SHORT %%b
   580                              <2> %ENDIF
   581                              <2> %%a:
   582                              <2>  %rep %%amount
   583                              <2>         DB      %1
   584                              <2>   %rotate 1
   585                              <2>  %endrep
   586                              <2> 	db 0
   587                              <2> %IFN SHAREF
   588                              <2> 	__SECT__
   589                              <2> %ELSE
   590                              <2> %%b:
   591                              <2> %ENDIF
   592                              <2> ;IRP r,<reglist>
   593                              <2> ;    ASSUME  r:DOSGroup
   594                              <2> ;ENDM
   595                              <2> %endmacro
   596                              <2> %ELSE
   597                              <2> %imacro DOSAssume 3-*.nolist
   598                              <2> ;DOSAssume   Macro   reg,reglist,message
   599                              <2> ;IRP r,<reglist>
   600                              <2> ;    ASSUME  r:DOSGroup
   601                              <2> ;ENDM
   602                              <2> %endmacro
   603                              <2> %ENDIF
   604                              <2> 
   605                              <2> BREAK   <ASSERT - make assertions about registers>
   606                              <2> 
   607                              <2> %if 0
   608                              <2> ;IF DEBUG
   609                              <2> Assert  MACRO   kind, objs, message
   610                              <2> 	LOCAL   a,b
   611                              <2>     IFIDN   <kind>,<Z>
   612                              <2> 	CMP     objs,0
   613                              <2> 	JZ      a
   614                              <2> 	fmt <>,<>,<message>
   615                              <2> a:
   616                              <2>     ELSE
   617                              <2> 	IFIDN   <kind>,<NZ>
   618                              <2> 	CMP     objs,0
   619                              <2> 	JNZ     a
   620                              <2> 	fmt <>,<>,<message>
   621                              <2> a:
   622                              <2> 	ELSE
   623                              <2>     PUSH    AX
   624                              <2> 	    IRP obj,<objs>
   625                              <2> 	PUSH    obj
   626                              <2> 	    ENDM
   627                              <2> 	    IF SHAREF
   628                              <2>     MOV     AX,OFFSET b
   629                              <2> 	    ELSE
   630                              <2>     MOV     AX,OFFSET DOSGroup:b
   631                              <2> 	    ENDIF
   632                              <2>     PUSH    AX
   633                              <2> 	    IFIDN   <kind>,<ISBUF>
   634                              <2> 	Invoke  BUFCheck
   635                              <2> 	    ENDIF
   636                              <2> 	    IFIDN   <kind>,<ISSFT>
   637                              <2> 	Invoke  SFTCheck
   638                              <2> 	    ENDIF
   639                              <2> 	    IFIDN   <kind>,<ISDPB>
   640                              <2> 	Invoke  DPBCheck
   641                              <2> 	    ENDIF
   642                              <2>     POP     AX
   643                              <2> 	    IF SHAREF
   644                              <2>     JMP SHORT a
   645                              <2> b   DB  Message,0
   646                              <2> a:
   647                              <2> 	    ELSE
   648                              <2> Table   segment
   649                              <2> b   db  Message,0
   650                              <2> Table   ends
   651                              <2> 	    ENDIF
   652                              <2> 	ENDIF
   653                              <2>     ENDIF
   654                              <2> ENDM
   655                              <2> %ELSE
   656                              <2> %imacro Assert 0-*.nolist
   657                              <2> %endmacro
   658                              <2> %ENDIF
   659                              <2> 
   660                              <2> %ifndef Installed
   661                              <2>  %idefine Installed 1
   662                              <2> %endif
   663                              <2> 
   664                              <2> Break   <CallInstall - hook to installable pieces>
   665                              <2> 
   666                              <2> %imacro CallInstall 3-*.nolist
   667                              <2> ;CallInstall MACRO   name,mpx,fn,save,restore
   668                              <2> %define %%name %1
   669                              <2> %assign %%mpx %2
   670                              <2> %assign %%fn %3
   671                              <2> %IF Installed
   672                              <2>  %rotate 3
   673                              <2>  %assign %%level 0
   674                              <2>  %assign %%amountsaved 0
   675                              <2>  %rep %0 - 3
   676                              <2>   %ifnempty %1
   677                              <2>    detectstripangles %%token, %%opening, %%closing, %1
   678                              <2>    %assign %%level %%level + ? %+ %%opening
   679                              <2>    %assign %%level %%level - ? %+ %%closing
   680                              <2>    SaveReg ? %+ %%token
   681                              <2>   %endif
   682                              <2>   %assign %%amountsaved %%amountsaved + 1
   683                              <2>   %rotate 1
   684                              <2>   %if %%level <= 0
   685                              <2>    %exitrep
   686                              <2>   %endif
   687                              <2>  %endrep
   688                              <2> 	MOV     AX,(%%mpx << 8) + %%fn
   689                              <2> 	INT     2Fh
   690                              <2>  %assign %%level 0
   691                              <2>  %assign %%amountrestored 0
   692                              <2>  %rep %0 - 3 - %%amountsaved
   693                              <2>   %ifnempty %1
   694                              <2>    detectstripangles %%token, %%opening, %%closing, %1
   695                              <2>    %assign %%level %%level + ? %+ %%opening
   696                              <2>    %assign %%level %%level - ? %+ %%closing
   697                              <2>    RestoreReg ? %+ %%token
   698                              <2>   %endif
   699                              <2>   %assign %%amountrestored %%amountrestored + 1
   700                              <2>   %rotate 1
   701                              <2>   %if %%level <= 0
   702                              <2>    %exitrep
   703                              <2>   %endif
   704                              <2>  %endrep
   705                              <2>  %if %%level > 0 || %0 != 3 + %%amountsaved + %%amountrestored
   706                              <2>   %error Wrong amount saved or restored
   707                              <2>  %endif
   708                              <2> %ELSE
   709                              <2> 	Invoke  %%name
   710                              <2> %ENDIF
   711                              <2> %endmacro
   712                              <2> 
   713                              <2> Break   <Stack frame manipulators>
   714                              <2> 
   715                              <2> %imacro localvar 2.nolist
   716                              <2> %ifidni %2, BYTE
   717                              <2>  %assign ?frame ?frame + 1
   718                              <2>  %assign %%a ?frame
   719                              <2>  labelsize %1, byte, bp - %%a
   720                              <2> %else
   721                              <2>  %ifidni %2, WORD
   722                              <2>   %assign ?frame ?frame + 2
   723                              <2>   %assign %%a ?frame
   724                              <2>   labelsize %1, word, bp - %%a
   725                              <2>  %else
   726                              <2>   %ifidni %2, DWORD
   727                              <2>    %assign ?frame ?frame + 4
   728                              <2>    %assign %%a ?frame
   729                              <2>    labelsize %1 %+ l, word, bp - %%a
   730                              <2>    labelsize %1 %+ h, word, bp - %%a + 2
   731                              <2>    labelsize %1, dword, bp - %%a
   732                              <2>   %else
   733                              <2>    %assign ?frame ?frame + %2
   734                              <2>    %assign %%a ?frame
   735                              <2>    labelsize %1, byte, bp - %%a
   736                              <2>   %endif
   737                              <2>  %endif
   738                              <2> %endif
   739                              <2> %endmacro
   740                              <2> 
   741                              <2> %imacro enter 0.nolist
   742                              <2> 	push    bp
   743                              <2> 	mov     bp,sp
   744                              <2> 	sub     sp,?frame
   745                              <2> %endmacro
   746                              <2> 
   747                              <2> %imacro leave 0.nolist
   748                              <2> 	mov     sp,bp
   749                              <2> 	pop     bp
   750                              <2> %endmacro
   751                              <2> 
   752                              <2> 
   753                              <2> %imacro argvar 2.nolist
   754                              <2> %ifidni %2, BYTE
   755                              <2>  %assign %%a ?aframe
   756                              <2>  %assign ?aframe ?aframe + 1
   757                              <2>  labelsize %1, byte, bp + %%a
   758                              <2> %else
   759                              <2>  %ifidni %2, WORD
   760                              <2>   %assign %%a ?aframe
   761                              <2>   %assign ?aframe ?aframe + 2
   762                              <2>   labelsize %1, word, bp + %%a
   763                              <2>  %else
   764                              <2>   %ifidni %2, DWORD
   765                              <2>    %assign %%a ?aframe
   766                              <2>    %assign ?aframe ?aframe + 4
   767                              <2>    labelsize %1 %+ l, word, bp + %%a
   768                              <2>    labelsize %1 %+ h, word, bp + %%a + 2
   769                              <2>    labelsize %1, dword, bp + %%a
   770                              <2>   %else
   771                              <2>    %assign %%a ?aframe
   772                              <2>    %assign ?aframe ?aframe + %2
   773                              <2>    labelsize %1, byte, bp + %%a
   774                              <2>   %endif
   775                              <2>  %endif
   776                              <2> %endif
   777                              <2> %endmacro
   778                              <2> 
   779                              <2> BREAK   <errnz - generate compilation errors>
   780                              <2> 
   781                              <2> %imacro errnz 1.nolist
   782                              <2> detectstripangles %%token, %%opening, %%closing, %1
   783                              <2> %if ? %+ %%token
   784                              <2>     %error %1 <> 0
   785                              <2> %endif
   786                              <2> %endmacro
   787                              <2> 
   788                              <2> %endif
    16                              <1> %include "versiona.mac"		;DEFINE THE MAJOR AND MINOR VERSION NUMBERS
     1                              <2> 
     2                              <2> major_version	    equ     4	    ;Major DOS version
     3                              <2> minor_version	    equ     00	    ;Minor DOS Version
     4                              <2> 
     5                              <2> MINOR_VERSION equ minor_version	; NASM port equate
     6                              <2> MAJOR_VERSION equ major_version	; NASM port equate
     7                              <2> expected_version    equ     (MINOR_VERSION << 8)+MAJOR_VERSION
     8                              <2> 
     9                              <2> alt_major_version    equ     5	    ;Major DOS version
    10                              <2> alt_minor_version    equ     26	    ;Minor DOS Version
    11                              <2> 
    12                              <2> alt_expected_version    equ     (alt_minor_version << 8) + alt_major_version
    13                              <2> 
    14                              <2> new_major_version    equ     5	    ;Major DOS version
    15                              <2> new_minor_version    equ     38	    ;Minor DOS Version
    16                              <2> new_expected_version    equ     (new_minor_version << 8) + new_major_version
    17                              <2> 
    18                              <2>        %warning out: ... for DOS Version 4.00 ...
    18          ******************  <2>  warning: out: ... for DOS Version 4.00 ... [-w+user]
    19                              <2> 
    20                              <2>        ;******************************
    21                              <2>        ;Each assembler program should:
    22                              <2>        ;  mov ah,030h			;DOS Get Version function
    23                              <2>        ;  int 021h			;Version ret. in AX,minor version first
    24                              <2>        ;  cmp ax,expected_version	;ALL utilities should check for an
    25                              <2>        ;  jne error_handler		; EXACT version match.
    26                              <2>        ;******************************
    27                              <2> 
    17                              <1> 
    18                              <1> BREAK <Control character definitions>
    19                              <1> 
    20                              <1> c_DEL	    EQU     7Fh 		;    ASCII rubout or delete previous char
    21                              <1> c_BS	    EQU     08h 		; ^H ASCII backspace
    22                              <1> c_CR	    EQU     0Dh 		; ^M ASCII carriage return
    23                              <1> c_LF	    EQU     0Ah 		; ^J ASCII linefeed
    24                              <1> c_ETB	    EQU     17h 		; ^W ASCII end of transmission
    25                              <1> c_NAK	    EQU     15h 		; ^U ASCII negative acknowledge
    26                              <1> c_ETX	    EQU     03h 		; ^C ASCII end of text
    27                              <1> c_HT	    EQU     09h 		; ^I ASCII tab
    28                              <1> 
    29                              <1> BREAK <Read This and Weep>
    30                              <1> 
    31                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    32                              <1> ;									   ;
    33                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    34                              <1> ;									   ;
    35                              <1> ; Certain structures, constants and system  calls  below  are  private	to ;
    36                              <1> ; the DOS  and	are  extremely	version-dependent.  They may change at any ;
    37                              <1> ; time at  the	implementors'  whim.   As  a  result,  they  must  not  be ;
    38                              <1> ; documented to  the  general  public.	 If  an  extreme case arises, they ;
    39                              <1> ; must be documented with this warning. 				   ;
    40                              <1> ;									   ;
    41                              <1> ; Those structures and constants that are subject to  the  above  will	be ;
    42                              <1> ; marked and bracketed with the flag:					   ;
    43                              <1> ;									   ;
    44                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    45                              <1> ;									   ;
    46                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    47                              <1> 
    48                              <1> %include "bpb.mac"
     1                              <2> 	%warning out: BPB.INC...
     1          ******************  <2>  warning: out: BPB.INC... [-w+user]
     2                              <2> ;	SCCSID = @(#)BPB.ASM	1.1 85/04/29
     3                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     4                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     5                              <2> ;									   ;
     6                              <2> 
     7                              <2> ; BIOS PARAMETER BLOCK DEFINITION
     8                              <2> ; THIS STRUCTURE IS USED TO BUILD A FULL DPB
     9                              <2> 
    10                              <2> BPBLOCK STRUC
    11 00000000 ????                <2> BPSECSZ DW	?			; SIZE IN BYTES OF PHYSICAL SECTOR
    12 00000002 ??                  <2> BPCLUS	DB	?			; SECTORS/ALLOC UNIT
    13 00000003 ????                <2> BPRES	DW	?			; NUMBER OF RESERVED SECTORS
    14 00000005 ??                  <2> BPFTCNT DB	?			; NUMBER OF FATS
    15 00000006 ????                <2> BPDRCNT DW	?			; NUMBER OF DIRECTORY ENTRIES
    16 00000008 ????                <2> BPSCCNT DW	?			; TOTAL NUMBER OF SECTORS
    17 0000000A ??                  <2> BPMEDIA DB	?			; MEDIA DESCRIPTOR BYTE
    18 0000000B ????                <2> BPFTSEC DW	?			; NUMBER OF SECTORS TAKEN UP BY ONE FAT
    19                              <2> BPBLOCK ENDS
    20                              <2> 
    21                              <2> A_BPB			STRUC
    22 00000000 ????                <2> BPB_BYTESPERSECTOR	DW	?
    23 00000002 ??                  <2> BPB_SECTORSPERCLUSTER	DB	?
    24 00000003 ????                <2> BPB_RESERVEDSECTORS	DW	?
    25 00000005 ??                  <2> BPB_NUMBEROFFATS	DB	?
    26 00000006 ????                <2> BPB_ROOTENTRIES 	DW	?
    27 00000008 ????                <2> BPB_TOTALSECTORS	DW	?
    28 0000000A ??                  <2> BPB_MEDIADESCRIPTOR	DB	?
    29 0000000B ????                <2> BPB_SECTORSPERFAT	DW	?
    30 0000000D ????                <2> BPB_SECTORSPERTRACK	DW	?
    31 0000000F ????                <2> BPB_HEADS		DW	?
    32 00000011 ????                <2> BPB_HIDDENSECTORS	DW	?
    33 00000013 ????                <2> 			DW	?
    34 00000015 ????                <2> BPB_BIGTOTALSECTORS	DW	?
    35 00000017 ????                <2> 			DW	?
    36 00000019 ????????????        <2> 			DB	6 DUP(?)
    37                              <2> A_BPB			ENDS
    38                              <2> ;									   ;
    39                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    40                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    49                              <1> 
    50                              <1> %include "buffer.mac"
     1                              <2> %include "buf2sw.mac"
     1                              <3> %define BUF2 1
     2                              <2> 
     3                              <2> ;	SCCSID = @(#)buffer.asm 1.1 85/04/09
     4                              <2> BREAK <Disk I/O Buffer Header>
     5                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     6                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     7                              <2> ;									   ;
     8                              <2> 
     9                              <2> %ifdef BUF2
    10                              <2> 
    11                              <2> ; Field definition for I/O buffer information
    12                              <2> 
    13                              <2> BUFFINFO        STRUC
    14 00000000 ????????            <2> NEXTBUF         DD      ?       ; Pointer to next buffer in list
    15                              <2> ; The next two items are often refed as a word
    16                              <2> buf_ID:
    17 00000004 ??                  <2> BUFDRV          DB      ?       ; Logical drive # assoc with buffer FF = free
    18                              <2> buf_flags:
    19 00000005 ??                  <2> BUFDATAFLAG	db	?
    20 00000006 ??                  <2> BUFPRI          DB      ?       ; Buffer selection priority (see EQUs below)
    21 00000007 ??                  <2> 	alignb 2
    22                              <2> buf_sector:
    23 00000008 ????????            <2> BUFSECNO        dd      ?       ; Sector number of buffer
    24                              <2> 	alignb 2
    25 0000000C ????????            <2> BUFDRVDP        DD      ?       ; Pointer to drive parameters
    26                              <2> BUFFINFO        ENDS
    27                              <2> 
    28                              <2> BUFINSIZ        EQU     BUFFINFO_struc_size
    29                              <2>                                 ; Size of structure in bytes
    30                              <2> BUFINSIZE equ BUFINSIZ
    31                              <2> 
    32                              <2> FREEPRI EQU     0
    33                              <2> LBRPRI  EQU     2               ; Last byte of buffer read
    34                              <2> LBWPRI  EQU     4               ; Last byte written
    35                              <2> RPRI    EQU     6               ; Read but not last byte
    36                              <2> WPRI    EQU     8               ; Written but not last byte
    37                              <2> DIRPRI  EQU     15              ; Directory Sector
    38                              <2> FATPRI  EQU     30              ; FAT sector
    39                              <2> 
    40                              <2> buf_dirty	EQU	01000000B
    41                              <2> buf_isDATA	EQU	00001000B
    42                              <2> buf_isDIR	EQU	00000100B
    43                              <2> buf_isFAT	EQU	00000010B
    44                              <2> buf_type_0	EQU	11110001B	; AND sets type to "none"
    45                              <2> 
    46                              <2> %else
    47                              <2> 
    48                              <2> ; Field definition for I/O buffer information
    49                              <2> 
    50                              <2> BUFFINFO	STRUC
    51                              <2> buf_next	DW	?		; Pointer to next buffer in list
    52                              <2> buf_prev	DW	?		; Pointer to prev buffer in list
    53                              <2> buf_ID		DB	?		; Drive of buffer (bit 7 = 0)
    54                              <2> 					; SFT table index (bit 7 = 1)
    55                              <2> 					; = FFH if buffer free
    56                              <2> buf_flags	DB	?		; Bit 7 = 1 if Remote file buffer
    57                              <2> 					;	= 0 if Local device buffer
    58                              <2> 					; Bit 6 = 1 if buffer dirty
    59                              <2> 					; Bit 5 = Reserved
    60                              <2> 					; Bit 4 = Search bit (bit 7 = 1)
    61                              <2> 					; Bit 3 = 1 if buffer is DATA
    62                              <2> 					; Bit 2 = 1 if buffer is DIR
    63                              <2> 					; Bit 1 = 1 if buffer is FAT
    64                              <2> 					; Bit 0 = Reserved
    65                              <2> buf_sector	DD	?		; Sector number of buffer (bit 7 = 0)
    66                              <2> ; The next two items are often refed as a word (bit 7 = 0)
    67                              <2> buf_wrtcnt	DB	?		; For FAT sectors, # times sector written out
    68                              <2> buf_wrtcntinc	DW	?		; "   "     "   , # sectors between each write
    69                              <2> buf_DPB 	DD	?		; Pointer to drive parameters
    70                              <2> buf_fill	DW	?		; How full buffer is (bit 7 = 1)
    71                              <2> buf_reserved	DB	?		; make DWORD boundary for 386
    72                              <2> BUFFINFO	ENDS
    73                              <2> 
    74                              <2> labelsize buf_offset, dword, buf_sector
    75                              <2> 					;For bit 7 = 1, this is the byte
    76                              <2> 					;offset of the start of the buffer in
    77                              <2> 					;the file pointed to by buf_ID.  Thus
    78                              <2> 					;the buffer starts at location
    79                              <2> 					;buf_offset in the file and contains
    80                              <2> 					;buf_fill bytes.
    81                              <2> 
    82                              <2> BUFINSIZ	EQU	BUFFINFO_struc_size
    83                              <2> 					; Size of structure in bytes
    84                              <2> 
    85                              <2> buf_Free	EQU	0FFh		; buf_id of free buffer
    86                              <2> 
    87                              <2> ;Flag byte masks
    88                              <2> buf_isnet	EQU	10000000B
    89                              <2> buf_dirty	EQU	01000000B
    90                              <2> 
    91                              <2> buf_isDATA	EQU	00001000B
    92                              <2> buf_isDIR	EQU	00000100B
    93                              <2> buf_isFAT	EQU	00000010B
    94                              <2> buf_type_0	EQU	11110001B	; AND sets type to "none"
    95                              <2> 
    96                              <2> buf_NetID	EQU	BUFINSIZ
    97                              <2> 
    98                              <2> ;
    99                              <2> ; Buffer Hash Entry Structure
   100                              <2> 
   101                              <2> BUFFER_HASH_ENTRY	STRUC		; DOS 4.00
   102                              <2> EMS_PAGE_NUM	DW	?		; logical page number for EMS handle
   103                              <2> BUFFER_BUCKET	DD	 ?		; pointer to buffers
   104                              <2> DIRTY_COUNT	DB	 ?		; number of dirty buffers
   105                              <2> BUFFER_RESERVED DB	 ?		; reserved
   106                              <2> BUFFER_HASH_ENTRY	ENDS
   107                              <2> 
   108                              <2> MaxBuffinBucket EQU	15		; Max number of buffers per bucket
   109                              <2> MaxBucketinPage EQU	 2		; Max number of buckets per 16kb page
   110                              <2> 
   111                              <2> %endif
   112                              <2> 
   113                              <2> ;									   ;
   114                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   115                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    51                              <1> 
    52                              <1> BREAK <User stack inside of system call and SysVars>
    53                              <1> ; Location of user registers relative user stack pointer
    54                              <1> 
    55                              <1> user_environ	STRUC
    56 00000000 ????                <1> user_AX     DW	    ?
    57 00000002 ????                <1> user_BX     DW	    ?
    58 00000004 ????                <1> user_CX     DW	    ?
    59 00000006 ????                <1> user_DX     DW	    ?
    60 00000008 ????                <1> user_SI     DW	    ?
    61 0000000A ????                <1> user_DI     DW	    ?
    62 0000000C ????                <1> user_BP     DW	    ?
    63 0000000E ????                <1> user_DS     DW	    ?
    64 00000010 ????                <1> user_ES     DW	    ?
    65 00000012 ????                <1> user_IP     DW	    ?
    66 00000014 ????                <1> user_CS     DW	    ?
    67 00000016 ????                <1> user_F	    DW	    ?
    68                              <1> user_environ	ENDS
    69                              <1> 
    70                              <1> %include "sysvar.mac"
     1                              <2> ;	SCCSID = @(#)sysvar.asm 1.1 85/04/10
     2                              <2> %include "version.mac"
     1                              <3> ; Some modules really want TRUE to be 0FFH.  Best to let them have their way.
     2                              <3> 	TRUE	   EQU	   0FFFFh
     3                              <3> 	TRUEBYTE   EQU     0FFh
     4                              <3> 	FALSE	   EQU	   0
     5                              <3> 
     6                              <3> ;
     7                              <3> ; Use the following switches to control cmacros.inc
     8                              <3> ;
     9                              <3> ?PLM       equ       0
    10                              <3> ?WIN       equ       0
    11                              <3> 
    12                              <3> memS       EQU     1			; Small model
    13                              <3> ;
    14                              <3> ; Use the switches below to produce the standard Microsoft version or the IBM
    15                              <3> ; version of the operating system
    16                              <3> ;
    17                              <3> ; The below chart will indicate how to set the switches to build the various
    18                              <3> ; versions
    19                              <3> ;
    20                              <3> ;                     IBMVER          IBMCOPYRIGHT
    21                              <3> ; --------------------------------------------------------
    22                              <3> ;  IBM Version   |     TRUE              TRUE
    23                              <3> ; --------------------------------------------------------
    24                              <3> ;  MS Version    |     FALSE             FALSE
    25                              <3> ; --------------------------------------------------------
    26                              <3> ;  Clone Version |     TRUE              FALSE
    27                              <3> ;
    28                              <3> IBMVER     EQU     TRUE
    29                              <3> IBMCOPYRIGHT EQU   FALSE
    30                              <3> 
    31                              <3> BUFFERFLAG	EQU	~ IBMCOPYRIGHT
    32                              <3> 
    33                              <3> %ifndef	MSVER	
    34                              <3> MSVER      EQU     ~ IBMVER
    35                              <3> %endif
    36                              <3> IBM	   EQU	   IBMVER
    37                              <3> ;
    38                              <3> ;
    39                              <3> 	%IF IBMVER
    40                              <3> 	    %IF IBMCOPYRIGHT
    41                              <3>               %warning out: ... IBM version build switch on ...
    42                              <3> 	    %ELSE
    43                              <3> 	      %warning out: ... CLONE version build switch on ...
    43          ******************  <3>  warning: out: ... CLONE version build switch on ... [-w+user]
    44                              <3> 	    %ENDIF
    45                              <3> 	%ELSE
    46                              <3> 	    %IFN IBMCOPYRIGHT
    47                              <3> 	      %warning out: ... MS version build switch on ...
    48                              <3> 	    %ELSE
    49                              <3> 	      %warning out: !!!!!!!!!  VERSION SWITCHES SET INCORECTLY  !!!!!!!!!
    50                              <3> 	      %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!!
    51                              <3> 	    %ENDIF
    52                              <3> 	%ENDIF   
    53                              <3> ;
    54                              <3> ;
    55                              <3> ;***************************************************************************
    56                              <3> ;*          The following switches are for DBCS or SBCS support            *
    57                              <3> ;*                                                                         *
    58                              <3> ;*                     Set INTERNAT EQU TRUE FOR DBCS                      *
    59                              <3> ;*                     Set INTERNAT EQU FALSE FOR SBCS                     *
    60                              <3> ;*                                                                         *
    61                              <3> ;***************************************************************************
    62                              <3> ;
    63                              <3> IBMJAPVER  EQU	   FALSE		;If TRUE set KANJI true also
    64                              <3> 
    65                              <3> ;
    66                              <3> ; Switch INTERNAT for DBCS support
    67                              <3> ;
    68                              <3> INTERNAT   EQU	   FALSE
    69                              <3> ;
    70                              <3> 	%IF INTERNAT
    71                              <3> %ifndef KANJI
    72                              <3> KANJI	   EQU	   TRUE
    73                              <3> %endif
    74                              <3> IBMJAPAN   EQU	   TRUE
    75                              <3> 	%ELSE
    76                              <3> %ifndef KANJI
    77                              <3> KANJI	   EQU	   FALSE
    78                              <3> %endif
    79                              <3> IBMJAPAN   EQU	   FALSE
    80                              <3> 	%ENDIF
    81                              <3> 
    82                              <3> %ifndef altvect				; avoid jerking off vector.inc
    83                              <3> ALTVECT    EQU	   FALSE		;Switch to build ALTVECT version
    84                              <3> %endif
    85                              <3> 
    86                              <3> ;
    87                              <3> ; Country code switches
    88                              <3> ; The default contry code is assumed as USA.
    89                              <3> ;
    90                              <3> 	%IF INTERNAT
    91                              <3>  KOREA	   EQU	   TRUE
    92                              <3>  JAPAN	   EQU	   FALSE
    93                              <3> 	%ELSE
    94                              <3>  KOREA	   EQU	   FALSE
    95                              <3>  JAPAN	   EQU	   FALSE
    96                              <3> 	%ENDIF
    97                              <3> ;
    98                              <3> 		%IF INTERNAT
    99                              <3> %warning out: Internat(ECS) version build switch on
   100                              <3> 		%ENDIF
     3                              <2> 
     4                              <2> SysInitVars STRUC
     5 00000000 ????????            <2> SYSI_DPB	    DD	    ?		; DPB chain
     6 00000004 ????????            <2> SYSI_SFT	    DD	    ?		; SFT chain
     7 00000008 ????????            <2> SYSI_CLOCK	    DD	    ?		; CLOCK device
     8 0000000C ????????            <2> SYSI_CON	    DD	    ?		; CON device
     9 00000010 ????                <2> SYSI_MAXSEC	    DW	    ?		; maximum sector size
    10 00000012 ????????            <2> SYSI_BUF	    DD	    ?		; points to Hashinitvar
    11 00000016 ????????            <2> SYSI_CDS	    DD	    ?		; CDS list
    12 0000001A ????????            <2> SYSI_FCB	    DD	    ?		; FCB chain
    13 0000001E ????                <2> SYSI_Keep	    DW	    ?		; keep count
    14 00000020 ??                  <2> SYSI_NUMIO	    DB	    ?		; Number of block devices
    15 00000021 ??                  <2> SYSI_NCDS	    DB	    ?		; number of CDS's
    16 00000022 ????????            <2> SYSI_DEV	    DD	    ?		; device list
    17 00000026 ????                <2> SYSI_ATTR	    DW	    ?		; null device attribute word
    18 00000028 ????                <2> SYSI_STRAT	    DW	    ?		; null device strategy entry point
    19 0000002A ????                <2> SYSI_INTER	    DW	    ?		; null device interrupt entry point
    20 0000002C ????????????????    <2> SYSI_NAME	    DB	 8 DUP(?)	; null device name
    21 00000034 ??                  <2> SYSI_SPLICE	    DB	    ?		; TRUE -> splicees being done
    22 00000035 ????                <2> SYSI_IBMDOS_SIZE    DW	    ?		; DOS size in paragraphs
    23 00000037 ????????            <2> SYSI_IFS_DOSCALL@   DD	    ?		; IFS DOS service rountine entry
    24 0000003B ????????            <2> SYSI_IFS	    DD	    ?		; IFS header chain
    25 0000003F ????????            <2> SYSI_BUFFERS	    DW	    ?,? 	; BUFFERS= values (m,n)
    26 00000043 ??                  <2> SYSI_BOOT_DRIVE     DB	    ?		; boot drive A=1 B=2,..
    27 00000044 ??                  <2> SYSI_DWMOVE	    DB	    ?		; 1 if 386 machine
    28 00000045 ????                <2> SYSI_EXT_MEM	    DW	    ?		; Extended memory size in KB.
    29                              <2> SysInitVars ENDS
    30                              <2> 
    31                              <2> ;This is added for more information exchage between DOS, BIOS.
    32                              <2> ;DOS will give the pointer to SysInitTable in ES:DI. - J.K. 5/29/86
    33                              <2> SysInitVars_Ext struc
    34 00000000 ????????            <2> SYSI_InitVars		DD	?	; Points to the above structure.
    35 00000004 ????????            <2> SYSI_Country_Tab	DD	?	; DOS_Country_cdpg_info
    36                              <2> SysInitVars_Ext ends
    37                              <2> 
    38                              <2> ;The SYSI_BUF of SysInitVars points to the follwong structure
    39                              <2> EMS_MAP_BUFF_SIZE      EQU	12	; EMS map buffer size
    40                              <2> 
    41                              <2> Buffinfo    STRUC
    42 00000000 ????????            <2> Hash_ptr	 DD	 ?		     ; pointer to Hash table
    43 00000004 ????                <2> Hash_count	 DW	 ?		     ; number of Hash entries
    44 00000006 ????????            <2> Cache_ptr	 DD	 ?		     ; pointer to secondary cache
    45 0000000A ????                <2> Cache_count	 DW	 ?		     ; number of secondary cache entries
    46                              <2> 
    47                              <2> %IF	BUFFERFLAG
    48                              <2> 
    49 0000000C ??                  <2> EMS_SAFE_FLAG	DB	?
    50 0000000D ????????            <2> EMS_LAST_PAGE	DW	?, ?
    51 00000011 ????????            <2> EMS_FIRST_PAGE	DW	?, ?
    52 00000015 ????                <2> EMS_NPA640	DW	?
    53                              <2> 
    54                              <2> %ENDIF
    55                              <2> 
    56 00000017 ??                  <2> EMS_mode	 DB	 ?		     ; no EMS = -1
    57 00000018 ????                <2> EMS_handle	 DW	 ?		     ; EMS handle for buffers
    58 0000001A ????                <2> EMS_PageFrame_Number	DW   ?		     ; EMS page frame number
    59 0000001C ????                <2> EMS_Seg_Cnt	 DW	 ?		     ; EMS segment count
    60 0000001E ????                <2> EMS_Page_Frame	 DW	 ?		     ; EMS page frame segment address
    61 00000020 ????                <2> EMS_reserved	 DW	 ?		     ; EMS segment count
    62                              <2> 
    63                              <2> %IF	BUFFERFLAG
    64 00000022 ??                  <2> EMS_Map_Buff	 DB	 ?  ; map buffer
    65                              <2> %ELSE
    66                              <2> EMS_Map_Buff	DB	12 dup(?)
    67                              <2> %ENDIF
    68                              <2> 
    69                              <2> Buffinfo    ENDS
    70                              <2> 
    71                              <2> 
    72                              <2> 
    73                              <2> 
    74                              <2> 
    75                              <2> 
    76                              <2> 
    77                              <2> 
    71                              <1> 
    72                              <1> %include "vector.mac"
     1                              <2> ;	SCCSID = @(#)vector.asm	1.1 85/04/10
     2                              <2> BREAK <interrupt definitions>
     3                              <2> 
     4                              <2> ;Asmvar	AltVect
     5                              <2> %ifndef AltVect
     6                              <2>  %iassign AltVect 0
     7                              <2> %endif
     8                              <2> 
     9                              <2> INTTAB		EQU	20H
    10                              <2> inttab equ INTTAB	; NASM port equate
    11                              <2> INTBASE 	EQU	4 * inttab
    12                              <2> ENTRYPOINT	EQU	INTBASE+40H
    13                              <2> 
    14                              <2> 	%IF	ALTVECT
    15                              <2> ALTTAB	EQU	0F0H
    16                              <2> ALTBASE EQU	4 * ALTTAB
    17                              <2> 	%ENDIF
    18                              <2> 
    19                              <2> ;
    20                              <2> ; interrupt assignments
    21                              <2> ;
    22                              <2> 	%IFN ALTVECT
    23                              <2> int_abort	    EQU     INTTAB	; abort process
    24                              <2> int_command	    EQU     int_abort+1 ; call MSDOS
    25                              <2> int_terminate	    EQU     int_abort+2 ; int to terminate address
    26                              <2> int_ctrl_c	    EQU     int_abort+3 ; ^c trapper
    27                              <2> int_fatal_abort     EQU     int_abort+4 ; hard disk error
    28                              <2> int_disk_read	    EQU     int_abort+5 ; logical sector disk read
    29                              <2> int_disk_write	    EQU     int_abort+6 ; logical sector disk write
    30                              <2> int_keep_process    EQU     int_abort+7 ; terminate program and stay
    31                              <2> 					; resident
    32                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    33                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    34                              <2> ;									   ;
    35                              <2> int_spooler	    EQU     int_abort+8 ; spooler call
    36                              <2> int_fastcon	    EQU     int_abort+9 ; fast CON interrupt
    37                              <2> int_IBM 	    EQU     int_abort+10; critical section maintenance
    38                              <2> ;									   ;
    39                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    40                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    41                              <2> 	%ELSE
    42                              <2> int_abort	    EQU     INTTAB	; abort process
    43                              <2> int_command	    EQU     int_abort+1 ; call MSDOS
    44                              <2> int_terminate	    EQU     ALTTAB	; int to terminate address
    45                              <2> int_ctrl_c	    EQU     int_terminate+1 ; ^c trapper
    46                              <2> int_fatal_abort     EQU     int_terminate+2 ; hard disk error
    47                              <2> int_disk_read	    EQU     int_abort+5 ; logical sector disk read
    48                              <2> int_disk_write	    EQU     int_abort+6 ; logical sector disk write
    49                              <2> int_keep_process    EQU     int_abort+7 ; terminate program and stay resident
    50                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    51                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    52                              <2> ;									   ;
    53                              <2> int_spooler	    EQU     int_terminate+3 ; spooler call
    54                              <2> int_fastcon	    EQU     int_abort+9 ; fast CON interrupt
    55                              <2> ;									   ;
    56                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    57                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    58                              <2> 	%ENDIF
    59                              <2> 
    60                              <2> addr_int_abort		EQU    4 * int_abort
    61                              <2> addr_int_command	EQU    4 * int_command
    62                              <2> addr_int_terminate	EQU    4 * int_terminate
    63                              <2> addr_int_ctrl_c 	EQU    4 * int_ctrl_c
    64                              <2> addr_int_fatal_abort	EQU    4 * int_fatal_abort
    65                              <2> addr_int_disk_read	EQU    4 * int_disk_read
    66                              <2> addr_int_disk_write	EQU    4 * int_disk_write
    67                              <2> addr_int_keep_process	EQU    4 * int_keep_process
    68                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    69                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    70                              <2> ;									   ;
    71                              <2> addr_int_spooler	EQU    4 * int_spooler
    72                              <2> addr_int_fastcon	EQU    4 * int_fastcon
    73                              <2> addr_int_IBM		EQU    4 * int_IBM
    74                              <2> ;									   ;
    75                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    76                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    73                              <1> 
    74                              <1> ;include mult.INC
    75                              <1> 
    76                              <1> BREAK <Disk map>
    77                              <1> ;  MSDOS partitions the disk into 4 sections:
    78                              <1> ;
    79                              <1> ;  phys sector 0:   +-------------------+
    80                              <1> ;	|	    | boot/reserved	|
    81                              <1> ;	|	    +-------------------+
    82                              <1> ;	|	    |  File allocation	|
    83                              <1> ;	v	    |	   table(s)	|
    84                              <1> ;		    |  (multiple copies |
    85                              <1> ;		    |	  are kept)	|
    86                              <1> ;		    +-------------------+
    87                              <1> ;		    |	  Directory	|
    88                              <1> ;		    +-------------------+
    89                              <1> ;		    |	  File space	|
    90                              <1> ;		    +-------------------+
    91                              <1> ;		    |	Unaddressable	|
    92                              <1> ;		    |  (to end of disk) |
    93                              <1> ;		    +-------------------+
    94                              <1> ;
    95                              <1> ; All partition boundaries are sector boundaries.  The size of the FAT is
    96                              <1> ; adjusted to maximize the file space addressable.
    97                              <1> 
    98                              <1> %include "dirent.mac"
     1                              <2> ;	SCCSID = @(#)dirent.asm 1.1 85/04/10
     2                              <2> ;	SCCSID = @(#)dirent.asm 1.1 85/04/10
     3                              <2> Break <Directory entry>
     4                              <2> 
     5                              <2> ;
     6                              <2> ;	+---------------------------+
     7                              <2> ;	|  (12 BYTE) filename/ext   |	    0	    0
     8                              <2> ;	+---------------------------+
     9                              <2> ;	|     (BYTE) attributes     |	    11	    B
    10                              <2> ;	+---------------------------+
    11                              <2> ;	|    (10 BYTE) reserved     |	    12	    C
    12                              <2> ;	+---------------------------+
    13                              <2> ;	| (WORD) time of last write |	    22	    16
    14                              <2> ;	+---------------------------+
    15                              <2> ;	| (WORD) date of last write |	    24	    18
    16                              <2> ;	+---------------------------+
    17                              <2> ;	|   (WORD) First cluster    |	    26	    1A
    18                              <2> ;	+---------------------------+
    19                              <2> ;	|     (DWORD) file size     |	    28	    1C
    20                              <2> ;	+---------------------------+
    21                              <2> ;
    22                              <2> ;   First byte of filename  = E5 -> free directory entry
    23                              <2> ;			    = 00 -> end of allocated directory
    24                              <2> ;   Time:   Bits 0-4=seconds/2, bits 5-10=minute, 11-15=hour
    25                              <2> ;   Date:   Bits 0-4=day, bits 5-8=month, bits 9-15=year-1980
    26                              <2> ;
    27                              <2> 
    28                              <2> dir_entry   STRUC
    29 00000000 <res Bh>            <2> dir_name    DB	    11 DUP (?)		; file name
    30 0000000B ??                  <2> dir_attr    DB	    ?			; attribute bits
    31 0000000C ????                <2> dir_codepg  dw	    ?			; code page DOS 4.00
    32 0000000E ????                <2> dir_extcluster dw   ?			; extended attribute starting cluster
    33 00000010 ??                  <2> dir_attr2   db	    ?			; reserved
    34 00000011 ??????????          <2> dir_pad     DB	    5  DUP (?)		; reserved for expansion
    35 00000016 ????                <2> dir_time    DW	    ?			; time of last write
    36 00000018 ????                <2> dir_date    DW	    ?			; date of last write
    37 0000001A ????                <2> dir_first   DW	    ?			; first allocation unit of file
    38 0000001C ????                <2> dir_size_l  DW	    ?			; low 16 bits of file size
    39 0000001E ????                <2> dir_size_h  DW	    ?			; high 16 bits of file size
    40                              <2> dir_entry   ENDS
    41                              <2> 
    42                              <2> attr_read_only	    EQU      1h
    43                              <2> attr_hidden	    EQU      2h
    44                              <2> attr_system	    EQU      4h
    45                              <2> attr_volume_id	    EQU      8h
    46                              <2> attr_directory	    EQU     10h
    47                              <2> attr_archive	    EQU     20h
    48                              <2> attr_device	    EQU     40h 	; This is a VERY special bit.
    49                              <2> 					;   NO directory entry on a disk EVER
    50                              <2> 					;   has this bit set. It is set non-zero
    51                              <2> 					;   when a device is found by GETPATH
    52                              <2> 
    53                              <2> attr_all	    EQU     attr_hidden+attr_system+attr_directory
    54                              <2> 					; OR of hard attributes for FINDENTRY
    55                              <2> 
    56                              <2> attr_ignore	    EQU     attr_read_only+attr_archive+attr_device
    57                              <2> 					; ignore this(ese) attribute(s) during
    58                              <2> 					; search first/next
    59                              <2> 
    60                              <2> attr_changeable     EQU     attr_read_only+attr_hidden+attr_system+attr_archive
    61                              <2> 					; changeable via CHMOD
    99                              <1> 
   100                              <1> BREAK <File allocation Table information>
   101                              <1> ;
   102                              <1> ; The File Allocation Table uses a 12-bit entry for each allocation unit on
   103                              <1> ; the disk.  These entries are packed, two for every three bytes.  The contents
   104                              <1> ; of entry number N is found by 1) multiplying N by 1.5; 2) adding the result
   105                              <1> ; to the base address of the Allocation Table; 3) fetching the 16-bit word
   106                              <1> ; at this address; 4) If N was odd (so that N*1.5 was not an integer), shift
   107                              <1> ; the word right four bits; 5) mask to 12 bits (AND with 0FFF hex).  Entry
   108                              <1> ; number zero is used as an end-of-file trap in the OS and is passed to the
   109                              <1> ; BIOS to help determine disk format.  Entry 1 is reserved for future use.
   110                              <1> ; The first available allocation unit is assigned entry number two, and even
   111                              <1> ; though it is the first, is called cluster 2.	Entries greater than 0FF8H
   112                              <1> ; (12-bit fats) or 0FFF8H (16-bit fats) are end of file marks; entries of zero
   113                              <1> ; are unallocated.  Otherwise, the contents of a FAT entry is the number of
   114                              <1> ; the next cluster in the file.
   115                              <1> ;
   116                              <1> ; Clusters with bad sectors are tagged with FF7H.  Any non-zero number would
   117                              <1> ; do because these clusters show as allocated, but are not part of any
   118                              <1> ; allocation chain and thus will never be allocated to a file.	A particular
   119                              <1> ; number is selected so that disk checking programs know what to do (ie.  a
   120                              <1> ; cluster with entry FF7H which is not in a chain is not an error).
   121                              <1> 
   122                              <1> %include "dpb.mac"
     1                              <2> ;	SCCSID = @(#)dpb.asm	1.1 85/04/10
     2                              <2> ;	SCCSID = @(#)dpb.asm	1.1 85/04/10
     3                              <2> BREAK <DPB structure>
     4                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     5                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     6                              <2> ;									   ;
     7                              <2> dpb	STRUC
     8 00000000 ??                  <2> dpb_drive	    DB	    ?		; Logical drive # assoc with DPB (A=0,B=1,...)
     9 00000001 ??                  <2> dpb_UNIT	    DB	    ?		; Driver unit number of DPB
    10 00000002 ????                <2> dpb_sector_size     DW	    ?		; Size of physical sector in bytes
    11 00000004 ??                  <2> dpb_cluster_mask    DB	    ?		; Sectors/cluster - 1
    12 00000005 ??                  <2> dpb_cluster_shift   DB	    ?		; Log2 of sectors/cluster
    13 00000006 ????                <2> dpb_first_FAT	    DW	    ?		; Starting record of FATs
    14 00000008 ??                  <2> dpb_FAT_count	    DB	    ?		; Number of FATs for this drive
    15 00000009 ????                <2> dpb_root_entries    DW	    ?		; Number of directory entries
    16 0000000B ????                <2> dpb_first_sector    DW	    ?		; First sector of first cluster
    17 0000000D ????                <2> dpb_max_cluster     DW	    ?		; Number of clusters on drive + 1
    18 0000000F ????                <2> dpb_FAT_size	    DW	    ?		;;Number of records occupied by FAT
    19 00000011 ????                <2> dpb_dir_sector	    DW	    ?		; Starting record of directory
    20 00000013 ????????            <2> dpb_driver_addr     DD	    ?		; Pointer to driver
    21 00000017 ??                  <2> dpb_media	    DB	    ?		; Media byte
    22 00000018 ??                  <2> dpb_first_access    DB	    ?		; This is initialized to -1 to force a media
    23                              <2> 					; check the first time this DPB is used
    24 00000019 ????????            <2> dpb_next_dpb	    DD	    ?		; Pointer to next Drive parameter block
    25 0000001D ????                <2> dpb_next_free	    DW	    ?		; Cluster # of last allocated cluster
    26 0000001F ????                <2> dpb_free_cnt	    DW	    ?		; Count of free clusters, -1 if unknown
    27                              <2> dpb	ENDS
    28                              <2> 
    29                              <2> DPBSIZ	EQU	dpb_struc_size		; Size of the structure in bytes
    30                              <2> 
    31                              <2> DSKSIZ	equ	dpb_max_cluster 	; Size of disk (temp used during init only)
    32                              <2> ;									   ;
    33                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    34                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   123                              <1> 
   124                              <1> %include "curdir.mac"
     1                              <2> ;	SCCSID = @(#)curdir.asm 1.1 85/04/10
     2                              <2> ;	SCCSID = @(#)curdir.asm 1.1 85/04/10
     3                              <2> BREAK <Current directory list structure>
     4                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     5                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     6                              <2> ;									   ;
     7                              <2> ; CDS items are used bu the internal routines to store cluster numbers and ;
     8                              <2> ; network identifiers for each logical name.  The ID field is used dually, ;
     9                              <2> ; both as net ID and for a cluster number for local devices.  In the case  ;
    10                              <2> ; of local devices, the cluster number will be -1 if there is a potential  ;
    11                              <2> ; of the disk being changed or if the path must be recracked.  The END	   ;
    12                              <2> ; field is the location of the end of the definition.  No .. is allowed    ;
    13                              <2> ; past this point							   ;
    14                              <2> 
    15                              <2> DIRSTRLEN	EQU	64+3		; Max length in bytes of directory strings
    16                              <2> TEMPLEN 	EQU	DIRSTRLEN*2
    17                              <2> 
    18                              <2> curdir_list	STRUC
    19 00000000 <res 43h>           <2> curdir_text	DB	DIRSTRLEN DUP (?)   ; text of assignment and curdir
    20 00000043 ????                <2> curdir_flags	DW	?		; various flags
    21 00000045 ????????            <2> curdir_devptr	DD	?		; local pointer to DPB or net device
    22 00000049 ????                <2> curdir_ID	DW	?		; cluster of current dir (net ID)
    23 0000004B ????                <2> 		DW	?
    24 0000004D ????                <2> curdir_user_word DW	?
    25 0000004F ????                <2> curdir_end	DW	?		; end of assignment
    26 00000051 ??                  <2> curdir_type	DB	?		; IFS drive (2=ifs, 4=netuse)
    27 00000052 ????????            <2> curdir_ifs_hdr	DD	?		; Ptr to File System Header
    28 00000056 ????                <2> curdir_fsda	DB	2 DUP (?)	; File System Dependent Data Area
    29                              <2> curdir_list	ENDS
    30                              <2> 
    31                              <2> curdirLen	EQU	curdir_list_struc_size	; Needed for screwed up
    32                              <2> 						; ASM87 which doesn't allow
    33                              <2> 						; Size directive as a macro
    34                              <2> 						; argument
    35                              <2> labelsize curdir_netID, dword, curdir_ID
    36                              <2> 
    37                              <2> ;Flag word masks
    38                              <2> curdir_isnet	EQU	1000000000000000B
    39                              <2> curdir_isifs	EQU	1000000000000000B	; DOS 4.00
    40                              <2> curdir_inuse	EQU	0100000000000000B
    41                              <2> curdir_splice	EQU	0010000000000000B
    42                              <2> curdir_local	EQU	0001000000000000B
    43                              <2> ;									   ;
    44                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    45                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   125                              <1> 
   126                              <1> ;include cpmfcb.INC
   127                              <1> 
   128                              <1> ;include find.INC
   129                              <1> 
   130                              <1> %include "pdb.mac"
     1                              <2> ;	SCCSID = @(#)pdb.asm	1.1 85/04/10
     2                              <2> BREAK <Process data block>
     3                              <2> 
     4                              <2> ;
     5                              <2> ; Process data block (otherwise known as program header)
     6                              <2> ;
     7                              <2> 
     8                              <2> FilPerProc	    EQU     20
     9                              <2> 
    10                              <2> Process_data_block  STRUC
    11 00000000 ????                <2> PDB_Exit_Call	    DW	    ?		; INT int_abort system terminate
    12 00000002 ????                <2> PDB_block_len	    DW	    ?		; size of execution block
    13 00000004 ??                  <2> 		    DB	    ?
    14 00000005 ??????????          <2> PDB_CPM_Call	    DB	5 DUP (?)	; ancient call to system
    15 0000000A ????????            <2> PDB_Exit	    DD	    ?		; pointer to exit routine
    16 0000000E ????????            <2> PDB_Ctrl_C	    DD	    ?		; pointer to ^C routine
    17 00000012 ????????            <2> PDB_Fatal_abort     DD	    ?		; pointer to fatal error
    18                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    19                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    20                              <2> ;									   ;
    21 00000016 ????                <2> PDB_Parent_PID	    DW	    ?		; PID of parent (terminate PID)
    22 00000018 <res 14h>           <2> PDB_JFN_Table	    DB	FilPerProc DUP (?)
    23                              <2> 					; indices into system table
    24                              <2> ;									   ;
    25                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    26                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    27 0000002C ????                <2> PDB_environ	    DW	    ?		; seg addr of environment
    28                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    29                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    30                              <2> ;									   ;
    31 0000002E ????????            <2> PDB_User_stack	    DD	    ?		; stack of self during system calls
    32 00000032 ????                <2> PDB_JFN_Length	    DW	    ?		; number of handles allowed
    33 00000034 ????????            <2> PDB_JFN_Pointer     DD	    ?		; pointer to JFN table
    34 00000038 ????????            <2> PDB_Next_PDB	    DD	    ?		; pointer to nested PDB's
    35 0000003C <res 14h>           <2> PDB_PAD1	    DB	    14h DUP (?)
    36                              <2> ;									   ;
    37                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    38                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    39 00000050 ??????????          <2> PDB_Call_system     DB	    5 DUP (?)	; portable method of system call
    40                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    41                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    42                              <2> ;									   ;
    43 00000055 ??????????????      <2> PDB_PAD2	    DB	    7h DUP (?)
    44                              <2> ;									   ;
    45                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    46                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    47                              <2> Process_data_block  ENDS
    48                              <2> 
    49                              <2> labelsize PDB_InterCon, byte, PDB_PAD1	; 2/12/KK
    50                              <2> labelsize PDB_Append, byte, PDB_PAD1+1	; 2/12/KK
   131                              <1> 
   132                              <1> %include "exe.mac"
     1                              <2> ;	SCCSID = @(#)exe.asm	1.1 85/04/10
     2                              <2> ;	SCCSID = @(#)exe.asm	1.1 85/04/10
     3                              <2> BREAK <EXEC and EXE file structures>
     4                              <2> ;
     5                              <2> ; EXEC arg block - load/go program
     6                              <2> ;
     7                              <2> 
     8                              <2> ;
     9                              <2> ; The following get used as arguments to the EXEC system call.	They indicate
    10                              <2> ; whether or not the program is executed or whether or not a program header
    11                              <2> ; gets created.
    12                              <2> ;
    13                              <2> exec_func_no_execute	EQU 1		; no execute bit
    14                              <2> exec_func_overlay	EQU 2		; overlay bit
    15                              <2> 
    16                              <2> Exec0		STRUC
    17 00000000 ????                <2> Exec0_environ	DW	?		; seg addr of environment
    18 00000002 ????????            <2> Exec0_com_line	DD	?		; pointer to asciz command line
    19 00000006 ????????            <2> Exec0_5C_FCB	DD	?		; default fcb at 5C
    20 0000000A ????????            <2> Exec0_6C_FCB	DD	?		; default fcb at 6C
    21                              <2> Exec0		ENDS
    22                              <2> 
    23                              <2> Exec1		STRUC
    24 00000000 ????                <2> Exec1_environ	DW	?		; seg addr of environment
    25 00000002 ????????            <2> Exec1_com_line	DD	?		; pointer to asciz command line
    26 00000006 ????????            <2> Exec1_5C_FCB	DD	?		; default fcb at 5C
    27 0000000A ????????            <2> Exec1_6C_FCB	DD	?		; default fcb at 6C
    28 0000000E ????                <2> Exec1_SP	DW	?		; stack pointer of program
    29 00000010 ????                <2> Exec1_SS	DW	?		; stack seg register of program
    30 00000012 ????                <2> Exec1_IP	DW	?		; entry point IP
    31 00000014 ????                <2> Exec1_CS	DW	?		; entry point CS
    32                              <2> Exec1		ENDS
    33                              <2> 
    34                              <2> Exec3		STRUC
    35 00000000 ????                <2> Exec3_load_addr DW	?		; seg address of load point
    36 00000002 ????                <2> Exec3_reloc_fac DW	?		; relocation factor
    37                              <2> Exec3		ENDS
    38                              <2> 
    39                              <2> ;
    40                              <2> ; Exit codes in upper byte
    41                              <2> ;
    42                              <2> Exit_terminate	    EQU     0
    43                              <2> Exit_abort	    EQU     0
    44                              <2> Exit_Ctrl_C	    EQU     1
    45                              <2> Exit_Hard_Error     EQU     2
    46                              <2> Exit_Keep_process   EQU     3
    47                              <2> 
    48                              <2> ;
    49                              <2> ; EXE file header
    50                              <2> ;
    51                              <2> 
    52                              <2> EXE_file    STRUC
    53 00000000 ????                <2> exe_signature	DW  ?			; must contain 4D5A  (yay zibo!)
    54 00000002 ????                <2> exe_len_mod_512 DW  ?			; low 9 bits of length
    55 00000004 ????                <2> exe_pages	DW  ?			; number of 512b pages in file
    56 00000006 ????                <2> exe_rle_count	DW  ?			; count of reloc entries
    57 00000008 ????                <2> exe_par_dir	DW  ?			; number of paragraphs before image
    58 0000000A ????                <2> exe_min_BSS	DW  ?			; minimum number of para of BSS
    59 0000000C ????                <2> exe_max_BSS	DW  ?			; max number of para of BSS
    60 0000000E ????                <2> exe_SS		DW  ?			; stack of image
    61 00000010 ????                <2> exe_SP		DW  ?			; SP of image
    62 00000012 ????                <2> exe_chksum	DW  ?			; checksum  of file (ignored)
    63 00000014 ????                <2> exe_IP		DW  ?			; IP of entry
    64 00000016 ????                <2> exe_CS		DW  ?			; CS of entry
    65 00000018 ????                <2> exe_rle_table	DW  ?			; byte offset of reloc table
    66 0000001A ????                <2> exe_iov 	DW  ?			; overlay number (0 for root)
    67 0000001C ????????            <2> exe_sym_tab	DD  ?			; offset of symbol table in file
    68                              <2> EXE_file    ENDS
    69                              <2> 
    70                              <2> exe_valid_signature	EQU 5A4Dh
    71                              <2> exe_valid_old_signature EQU 4D5Ah
    72                              <2> 
    73                              <2> symbol_entry	STRUC
    74 00000000 ????????            <2> sym_value	DD  ?
    75 00000004 ????                <2> sym_type	DW  ?
    76 00000006 ??                  <2> sym_len 	DB  ?
    77 00000007 <res FFh>           <2> sym_name	DB  255 dup (?)
    78                              <2> symbol_entry	ENDS
   133                              <1> 
   134                              <1> %include "sf.mac"
     1                              <2> ;	SCCSID = @(#)sf.asm	1.1 85/04/10
     2                              <2> BREAK <Internal system file table format>
     3                              <2> ;
     4                              <2> ;   AN000   version 4.00   Jan. 1988
     5                              <2> ;   AN003   PTM 3680 --  make NAME offset the same as before (<=3.30)
     6                              <2> ;   AN009   PTM 3839	 reorder SFT for MS WINDOWS
     7                              <2> 
     8                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     9                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    10                              <2> ;									   ;
    11                              <2> ;
    12                              <2> ; system file table
    13                              <2> ;
    14                              <2> 
    15                              <2> SF		STRUC
    16 00000000 ????????            <2> SFLink		DD	?
    17 00000004 ????                <2> SFCount 	DW	?		; number of entries
    18 00000006 ????                <2> SFTable 	DW	?		; beginning of array of the following
    19                              <2> SF		ENDS
    20                              <2> 
    21                              <2> ;
    22                              <2> ; system file table entry
    23                              <2> ;
    24                              <2> 
    25                              <2> sf_entry	STRUC
    26 00000000 ????                <2> sf_ref_count	DW	?		; number of processes sharing entry
    27                              <2> 					;   if FCB then ref count
    28 00000002 ????                <2> sf_mode 	DW	?		; mode of access or high bit on if FCB
    29 00000004 ??                  <2> sf_attr 	DB	?		; attribute of file
    30 00000005 ????                <2> sf_flags	DW	?		;Bits 8-15
    31                              <2> 					; Bit 15 = 1 if remote file
    32                              <2> 					;	 = 0 if local file or device
    33                              <2> 					; Bit 14 = 1 if date/time is not to be
    34                              <2> 					;   set from clock at CLOSE.  Set by
    35                              <2> 					;   FILETIMES and FCB_CLOSE.  Reset by
    36                              <2> 					;   other reseters of the dirty bit
    37                              <2> 					;   (WRITE)
    38                              <2> 					; Bit 13 = Pipe bit (reserved)
    39                              <2> 					;
    40                              <2> 					; Bits 0-7 (old FCB_devid bits)
    41                              <2> 					; If remote file or local file, bit
    42                              <2> 					; 6=0 if dirty Device ID number, bits
    43                              <2> 					; 0-5 if local file.
    44                              <2> 					; bit 7=0 for local file, bit 7
    45                              <2> 					;      =1 for local I/O device
    46                              <2> 					; If local I/O device, bit 6=0 if EOF (input)
    47                              <2> 					;		Bit 5=1 if Raw mode
    48                              <2> 					;		Bit 0=1 if console input device
    49                              <2> 					;		Bit 1=1 if console output device
    50                              <2> 					;		Bit 2=1 if null device
    51                              <2> 					;		Bit 3=1 if clock device
    52 00000007 ????????            <2> sf_devptr	DD	?		; Points to DPB if local file, points
    53                              <2> 					; to device header if local device,
    54                              <2> 					; points to net device header if
    55                              <2> 					; remote
    56 0000000B ????                <2> sf_firclus	DW	?		; First cluster of file (bit 15 = 0)
    57 0000000D ????                <2> sf_time 	DW	?		; Time associated with file
    58 0000000F ????                <2> sf_date 	DW	?		; Date associated with file
    59 00000011 ????????            <2> sf_size 	DD	?		; Size associated with file
    60 00000015 ????????            <2> sf_position	DD	?		; Read/Write pointer or LRU count for FCBs
    61                              <2> ;
    62                              <2> ; Starting here, the next 7 bytes may be used by the file system to store an
    63                              <2> ; ID
    64                              <2> ;
    65 00000019 ????                <2> sf_cluspos	DW	?		; Position of last cluster accessed
    66 0000001B ????????            <2> sf_dirsec	DD	?		; Sector number of directory sector for
    67                              <2> 					; for this file
    68 0000001F ??                  <2> sf_dirpos	DB	?		; Offset of this entry in the above
    69                              <2> ;
    70                              <2> ; End of 7 bytes of file-system specific info.
    71                              <2> ;
    72 00000020 <res Bh>            <2> sf_name 	DB	11 DUP (?)	; 11 character name that is in the
    73                              <2> 					; directory entry.  This is used by
    74                              <2> 					; close to detect file deleted and
    75                              <2> 					; disk changed errors.
    76                              <2> 
    77                              <2> ; SHARING INFO
    78 0000002B ????????            <2> sf_chain	DD	?		; link to next SF
    79 0000002F ????                <2> sf_UID		DW	?
    80 00000031 ????                <2> sf_PID		DW	?
    81 00000033 ????                <2> sf_MFT		DW	?
    82 00000035 ????                <2> sf_lstclus	DW	?		;AN009; Last cluster accessed
    83 00000037 ????????            <2> sf_IFS_HDR	DD	?
    84                              <2> sf_entry	ENDS
    85                              <2> 
    86                              <2> labelsize sf_fsda, byte, sf_cluspos	     ;DOS 4.00
    87                              <2> labelsize sf_serial_ID, word, sf_firclus	     ;DOS 4.00
    88                              <2> labelsize sf_netid, byte, sf_cluspos
    89                              <2> labelsize sf_OpenAge, word, sf_position+2
    90                              <2> labelsize sf_LRU, word, sf_position
    91                              <2> 
    92                              <2> sf_default_number   EQU     5h
    93                              <2> 
    94                              <2> ;
    95                              <2> ; Note that we need to mark an SFT as being busy for OPEN/CREATE.  This is
    96                              <2> ; because an INT 24 may prevent us from 'freeing' it.  We mark this as such
    97                              <2> ; by placing a -1 in the ref_count field.
    98                              <2> ;
    99                              <2> 
   100                              <2> sf_busy EQU -1
   101                              <2> 
   102                              <2> 
   103                              <2> ; mode mask for FCB detection
   104                              <2> sf_isfcb		EQU	1000000000000000B
   105                              <2> 
   106                              <2> ; Flag word masks
   107                              <2> sf_isnet		EQU	1000000000000000B
   108                              <2> sf_close_nodate 	EQU	0100000000000000B
   109                              <2> sf_pipe 		EQU	0010000000000000B
   110                              <2> sf_no_inherit		EQU	0001000000000000B
   111                              <2> sf_net_spool		EQU	0000100000000000B
   112                              <2> Handle_Fail_I24 	EQU	0000000100000000B  ;BIT 8 - DISK FULL I24 ERROR
   113                              <2> 
   114                              <2> ; Local file/device flag masks
   115                              <2> devid_file_clean	EQU	40h	; true if file and not written
   116                              <2> devid_file_mask_drive	EQU	3Fh	; mask for drive number
   117                              <2> 
   118                              <2> devid_device		EQU	80h	; true if a device
   119                              <2> devid_device_EOF	EQU	40h	; true if end of file reached
   120                              <2> devid_device_raw	EQU	20h	; true if in raw mode
   121                              <2> devid_device_special	EQU	10h	; true if special device
   122                              <2> devid_device_clock	EQU	08h	; true if clock device
   123                              <2> devid_device_null	EQU	04h	; true if null device
   124                              <2> devid_device_con_out	EQU	02h	; true if console output
   125                              <2> devid_device_con_in	EQU	01h	; true if consle input
   126                              <2> ;									   ;
   127                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   128                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   129                              <2> 
   130                              <2> ;
   131                              <2> ; structure of devid field as returned by IOCTL is:
   132                              <2> ;
   133                              <2> ;	BIT	7   6	5   4	3   2	1   0
   134                              <2> ;	      |---|---|---|---|---|---|---|---|
   135                              <2> ;	      | I | E | R | S | I | I | I | I |
   136                              <2> ;	      | S | O | A | P | S | S | S | S |
   137                              <2> ;	      | D | F | W | E | C | N | C | C |
   138                              <2> ;	      | E |   |   | C | L | U | O | I |
   139                              <2> ;	      | V |   |   | L | K | L | T | N |
   140                              <2> ;	      |---|---|---|---|---|---|---|---|
   141                              <2> ;	ISDEV = 1 if this channel is a device
   142                              <2> ;	      = 0 if this channel is a disk file
   143                              <2> ;
   144                              <2> ;	If ISDEV = 1
   145                              <2> ;
   146                              <2> ;	      EOF = 0 if End Of File on input
   147                              <2> ;	      RAW = 1 if this device is in Raw mode
   148                              <2> ;		  = 0 if this device is cooked
   149                              <2> ;	      ISCLK = 1 if this device is the clock device
   150                              <2> ;	      ISNUL = 1 if this device is the null device
   151                              <2> ;	      ISCOT = 1 if this device is the console output
   152                              <2> ;	      ISCIN = 1 if this device is the console input
   153                              <2> ;
   154                              <2> ;	If ISDEV = 0
   155                              <2> ;	      EOF = 0 if channel has been written
   156                              <2> ;	      Bits 0-5	are  the  block  device  number  for
   157                              <2> ;		  the channel (0 = A, 1 = B, ...)
   158                              <2> ;
   159                              <2> devid_ISDEV	EQU	80h
   160                              <2> devid_EOF	EQU	40h
   161                              <2> devid_RAW	EQU	20h
   162                              <2> devid_SPECIAL	EQU	10H
   163                              <2> devid_ISCLK	EQU	08h
   164                              <2> devid_ISNUL	EQU	04h
   165                              <2> devid_ISCOT	EQU	02h
   166                              <2> devid_ISCIN	EQU	01h
   167                              <2> 
   168                              <2> devid_block_dev EQU	1Fh		; mask for block device number
   135                              <1> 
   136                              <1> %include "arena.mac"
     1                              <2> ;	SCCSID = @(#)arena.asm	1.1 85/04/09
     2                              <2> ;BREAK <Memory arena structure>
     3                              <2> 
     4                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     5                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     6                              <2> ;									   ;
     7                              <2> ;
     8                              <2> ; arena item
     9                              <2> ;
    10                              <2> arena	STRUC
    11 00000000 ??                  <2> arena_signature     DB	?		; 4D for valid item, 5A for last item
    12 00000001 ????                <2> arena_owner	    DW	?		; owner of arena item
    13 00000003 ????                <2> arena_size	    DW	?		; size in paragraphs of item
    14 00000005 ??????              <2> arena_reserved	    DB	3 DUP(?)	; reserved
    15 00000008 ????????????????    <2> arena_name	    DB	8 DUP(?)	; owner file name
    16                              <2> arena	ENDS
    17                              <2> 
    18                              <2> ;
    19                              <2> ; CAUTION: The routines in ALLOC.ASM rely on the fact that arena_signature
    20                              <2> ; and arena_owner_system are all equal to zero and are contained in DI.  Change
    21                              <2> ; them and change ALLOC.ASM.
    22                              <2> 
    23                              <2> arena_owner_system  EQU 0		; free block indication
    24                              <2> 
    25                              <2> arena_signature_normal	EQU 4Dh 	; valid signature, not end of arena
    26                              <2> arena_signature_end	EQU 5Ah 	; valid signature, last block in arena
    27                              <2> ;									   ;
    28                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    29                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    30                              <2> 
   137                              <1> 
   138                              <1> %include "intnat.mac"
     1                              <2> ;	SCCSID = @(#)intnat.asm	1.1 85/04/10
     2                              <2> BREAK <International data structure format>
     3                              <2> 
     4                              <2> ;
     5                              <2> ; Current structure of the data returned by the international call
     6                              <2> ;
     7                              <2> internat_block STRUC
     8 00000000 ????                <2> Date_tim_format DW	?		; 0-USA, 1-EUR, 2-JAP
     9 00000002 ??                  <2> Currency_sym	DB	?		; Currency Symbol 5 bytes
    10 00000003 ??                  <2> 		DB	?
    11 00000004 ??                  <2> 		DB	?
    12 00000005 ??                  <2> 		DB	?
    13 00000006 ??                  <2> 		DB	?
    14 00000007 ??                  <2> Thous_sep	DB	?		; Thousands separator 2 bytes
    15 00000008 ??                  <2> 		DB	?
    16 00000009 ??                  <2> Decimal_sep	DB	?		; Decimal separator 2 bytes
    17 0000000A ??                  <2> 		DB	?
    18 0000000B ??                  <2> Date_sep	DB	?		; Date separator 2 bytes
    19 0000000C ??                  <2> 		DB	?
    20 0000000D ??                  <2> Time_sep	DB	?		; Decimal separator 2 bytes
    21 0000000E ??                  <2> 		DB	?
    22 0000000F ??                  <2> Bit_field	DB	?		; Bit values
    23                              <2> 					;   Bit 0 = 0 if currency symbol first
    24                              <2> 					;	  = 1 if currency symbol last
    25                              <2> 					;   Bit 1 = 0 if No space after currency symbol
    26                              <2> 					;	  = 1 if space after currency symbol
    27 00000010 ??                  <2> Currency_cents	DB	?		; Number of places after currency dec point
    28 00000011 ??                  <2> Time_24 	DB	?		; 1 if 24 hour time, 0 if 12 hour time
    29 00000012 ????                <2> Map_call	DW	?		; Address of case mapping call (DWORD)
    30 00000014 ????                <2> 		DW	?		; THIS IS TWO WORDS SO IT CAN BE INITIALIZED
    31                              <2> 					;  in pieces.
    32 00000016 ??                  <2> Data_sep	DB	?		; Data list separator character
    33 00000017 ??                  <2> 		DB	?
    34                              <2> internat_block ENDS
    35                              <2> 
    36                              <2> ;
    37                              <2> ; Max size of the block returned by the INTERNATIONAL call
    38                              <2> ;
    39                              <2> internat_block_max	EQU	32
   139                              <1> 
   140                              <1> %include "mi.mac"
     1                              <2> ;	SCCSID = @(#)mi.asm	1.1 85/04/10
     2                              <2> BREAK <Machine instruction, flag definitions and character types>
     3                              <2> 
     4                              <2> mi_INT		EQU	0CDh
     5                              <2> mi_Long_JMP	EQU	0EAh
     6                              <2> mi_Long_CALL	EQU	09Ah
     7                              <2> mi_Long_RET	EQU	0CBh
     8                              <2> mi_Near_RET	EQU	0C3h
     9                              <2> 
    10                              <2> ;			xxxxoditszxaxpxc
    11                              <2> f_Overflow	EQU	0000100000000000B
    12                              <2> f_Direction	EQU	0000010000000000B
    13                              <2> f_Interrupt	EQU	0000001000000000B
    14                              <2> f_Trace 	EQU	0000000100000000B
    15                              <2> f_Sign		EQU	0000000010000000B
    16                              <2> f_Zero		EQU	0000000001000000B
    17                              <2> f_Aux		EQU	0000000000010000B
    18                              <2> f_Parity	EQU	0000000000000100B
    19                              <2> f_Carry 	EQU	0000000000000001B
   141                              <1> 
   142                              <1> fChk	equ 1
   143                              <1> fDelim	equ 2
   144                              <1> fSpChk	equ 4
   145                              <1> fFCB	equ 8
   146                              <1> 
   147                              <1> ;include filemode.INC
   148                              <1> 
   149                              <1> ;include error.INC
   150                              <1> 
   151                              <1> %include "syscall.mac"
     1                              <2> ;	SCCSID = @(#)syscall.asm	1.1 85/04/10
     2                              <2> ;BREAK <system call definitions>
     3                              <2> ;SUBTTL	system call definitions
     4                              <2> ;PAGE
     5                              <2> 
     6                              <2> Abort				EQU 0	;  0	  0
     7                              <2> Std_Con_Input			EQU 1	;  1	  1
     8                              <2> Std_Con_Output			EQU 2	;  2	  2
     9                              <2> Std_Aux_Input			EQU 3	;  3	  3
    10                              <2> Std_Aux_Output			EQU 4	;  4	  4
    11                              <2> Std_Printer_Output		EQU 5	;  5	  5
    12                              <2> Raw_Con_IO			EQU 6	;  6	  6
    13                              <2> Raw_Con_Input			EQU 7	;  7	  7
    14                              <2> Std_Con_Input_No_Echo		EQU 8	;  8	  8
    15                              <2> Std_Con_String_Output		EQU 9	;  9	  9
    16                              <2> Std_Con_String_Input		EQU 10	; 10	  A
    17                              <2> Std_Con_Input_Status		EQU 11	; 11	  B
    18                              <2> Std_Con_Input_Flush		EQU 12	; 12	  C
    19                              <2> Disk_Reset			EQU 13	; 13	  D
    20                              <2> Set_Default_Drive		EQU 14	; 14	  E
    21                              <2> FCB_Open			EQU 15	; 15	  F
    22                              <2> FCB_Close			EQU 16	; 16	 10
    23                              <2> Dir_Search_First		EQU 17	; 17	 11
    24                              <2> Dir_Search_Next 		EQU 18	; 18	 12
    25                              <2> FCB_Delete			EQU 19	; 19	 13
    26                              <2> FCB_Seq_Read			EQU 20	; 20	 14
    27                              <2> FCB_Seq_Write			EQU 21	; 21	 15
    28                              <2> FCB_Create			EQU 22	; 22	 16
    29                              <2> FCB_Rename			EQU 23	; 23	 17
    30                              <2> Get_Default_Drive		EQU 25	; 25	 19
    31                              <2> Set_DMA 			EQU 26	; 26	 1A
    32                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    33                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    34                              <2> ;									   ;
    35                              <2> Get_Default_DPB 		EQU 31	; 31	 1F
    36                              <2> ;									   ;
    37                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    38                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    39                              <2> FCB_Random_Read 		EQU 33	; 33	 21
    40                              <2> FCB_Random_Write		EQU 34	; 34	 22
    41                              <2> Get_FCB_File_Length		EQU 35	; 35	 23
    42                              <2> Get_FCB_Position		EQU 36	; 36	 24
    43                              <2> Set_Interrupt_Vector		EQU 37	; 37	 25
    44                              <2> Create_Process_Data_Block	EQU 38	; 38	 26
    45                              <2> FCB_Random_Read_Block		EQU 39	; 39	 27
    46                              <2> FCB_Random_Write_Block		EQU 40	; 40	 28
    47                              <2> Parse_File_Descriptor		EQU 41	; 41	 29
    48                              <2> Get_Date			EQU 42	; 42	 2A
    49                              <2> Set_Date			EQU 43	; 43	 2B
    50                              <2> Get_Time			EQU 44	; 44	 2C
    51                              <2> Set_Time			EQU 45	; 45	 2D
    52                              <2> Set_Verify_On_Write		EQU 46	; 46	 2E
    53                              <2> ; Extended functionality group
    54                              <2> Get_DMA 			EQU 47	; 47	 2F
    55                              <2> Get_Version			EQU 48	; 48	 30
    56                              <2> Keep_Process			EQU 49	; 49	 31
    57                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    58                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    59                              <2> ;									   ;
    60                              <2> Get_DPB 			EQU 50	; 50	 32
    61                              <2> ;									   ;
    62                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    63                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    64                              <2> Set_CTRL_C_Trapping		EQU 51	; 51	 33
    65                              <2> Get_InDOS_Flag			EQU 52	; 52	 34
    66                              <2> Get_Interrupt_Vector		EQU 53	; 53	 35
    67                              <2> Get_Drive_Freespace		EQU 54	; 54	 36
    68                              <2> Char_Oper			EQU 55	; 55	 37
    69                              <2> International			EQU 56	; 56	 38
    70                              <2> ;   Directory Group
    71                              <2> MKDir				EQU 57	; 57	 39
    72                              <2> RMDir				EQU 58	; 58	 3A
    73                              <2> CHDir				EQU 59	; 59	 3B
    74                              <2> ;   File Group
    75                              <2> Creat				EQU 60	; 60	 3C
    76                              <2> Open				EQU 61	; 61	 3D
    77                              <2> Close				EQU 62	; 62	 3E
    78                              <2> Read				EQU 63	; 63	 3F
    79                              <2> Write				EQU 64	; 64	 40
    80                              <2> Unlink				EQU 65	; 65	 41
    81                              <2> LSeek				EQU 66	; 66	 42
    82                              <2> CHMod				EQU 67	; 67	 43
    83                              <2> IOCtl				EQU 68	; 68	 44
    84                              <2> XDup				EQU 69	; 69	 45
    85                              <2> XDup2				EQU 70	; 70	 46
    86                              <2> Current_Dir			EQU 71	; 71	 47
    87                              <2> ;    Memory Group
    88                              <2> Alloc				EQU 72	; 72	 48
    89                              <2> Dealloc 			EQU 73	; 73	 49
    90                              <2> Setblock			EQU 74	; 74	 4A
    91                              <2> ;    Process Group
    92                              <2> Exec				EQU 75	; 75	 4B
    93                              <2> Exit				EQU 76	; 76	 4C
    94                              <2> WaitProcess			EQU 77	; 77	 4D
    95                              <2> Find_First			EQU 78	; 78	 4E
    96                              <2> ;   Special Group
    97                              <2> Find_Next			EQU 79	; 79	 4F
    98                              <2> ; SPECIAL SYSTEM GROUP
    99                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   100                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   101                              <2> ;									   ;
   102                              <2> Set_Current_PDB 		EQU 80	; 80	 50
   103                              <2> Get_Current_PDB 		EQU 81	; 81	 51
   104                              <2> Get_In_Vars			EQU 82	; 82	 52
   105                              <2> SetDPB				EQU 83	; 83	 53
   106                              <2> ;									   ;
   107                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   108                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   109                              <2> Get_Verify_On_Write		EQU 84	; 84	 54
   110                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   111                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   112                              <2> ;									   ;
   113                              <2> Dup_PDB 			EQU 85	; 85	 55
   114                              <2> ;									   ;
   115                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   116                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   117                              <2> Rename				EQU 86	; 86	 56
   118                              <2> File_Times			EQU 87	; 87	 57
   119                              <2> AllocOper			EQU 88	; 88	 58
   120                              <2> ; Network extention system calls
   121                              <2> GetExtendedError		EQU 89	; 89	 59
   122                              <2> CreateTempFile			EQU 90	; 90	 5A
   123                              <2> CreateNewFile			EQU 91	; 91	 5B
   124                              <2> LockOper			EQU 92	; 92	 5C Lock and Unlock
   125                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   126                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   127                              <2> ;									   ;
   128                              <2> ServerCall			EQU 93	; 93	 5D CommitAll, ServerDOSCall,
   129                              <2> 					;	    CloseByName, CloseUser,
   130                              <2> 					;	    CloseUserProcess,
   131                              <2> 					;	    GetOpenFileList
   132                              <2> ;									   ;
   133                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   134                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   135                              <2> UserOper			EQU 94	; 94	 5E Get and Set
   136                              <2> AssignOper			EQU 95	; 95	 5F On, Off, Get, Set, Cancel
   137                              <2> xNameTrans			EQU 96	; 96	 60
   138                              <2> PathParse			EQU 97	; 97	 61
   139                              <2> GetCurrentPSP			EQU 98	; 98	 62
   140                              <2> Hongeul 			EQU 99	; 99	 63
   141                              <2> ECS_CALL			EQU 99	; 99	 63  ;; DBCS support
   142                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   143                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   144                              <2> ;									   ;
   145                              <2> Set_Printer_Flag		EQU 100 ; 100	 64
   146                              <2> ;									   ;
   147                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   148                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   149                              <2> GetExtCntry			EQU 101 ; 101	 65
   150                              <2> GetSetCdPg			EQU 102 ; 102	 66
   151                              <2> ExtHandle			EQU 103 ; 103	 67
   152                              <2> Commit				EQU 104 ; 104	 68
   153                              <2> GetSetMediaID			EQU 105 ; 105	 69
   154                              <2> IFS_IOCTL			EQU 107 ; 107	 6B
   155                              <2> ExtOpen 			EQU 108 ; 108	 6C
   156                              <2> ;
   157                              <2> ;
   158                              <2> Set_Oem_Handler 		EQU 248 ; 248	 F8
   159                              <2> OEM_C1				EQU 249 ; 249	 F9
   160                              <2> OEM_C2				EQU 250 ; 250	 FA
   161                              <2> OEM_C3				EQU 251 ; 251	 FB
   162                              <2> OEM_C4				EQU 252 ; 252	 FC
   163                              <2> OEM_C5				EQU 253 ; 253	 FD
   164                              <2> OEM_C6				EQU 254 ; 254	 FE
   165                              <2> OEM_C7				EQU 255 ; 255	 FF
   152                              <1> 
   153                              <1> %include "doscntry.mac"		;J.K. 5/26/86
     1                              <2> ;
     2                              <2> ;Equates for COUNTRY INFORMATION.
     3                              <2> SetCountryInfo		EQU	1	;country info
     4                              <2> SetUcase		EQU	2	;uppercase table
     5                              <2> SetLcase		EQU	3	;lowercase table (Reserved)
     6                              <2> SetUcaseFile		EQU	4	;uppercase file spec table
     7                              <2> SetFileList		EQU	5	;valid file character list
     8                              <2> SetCollate		EQU	6	;collating sequence
     9                              <2> SetDBCS 		EQU	7	;double byte character set
    10                              <2> SetALL			EQU	-1	;all the entries
    11                              <2> 
    12                              <2> 
    13                              <2> ;DOS country and code page information table structure.
    14                              <2> ;Internally, DOS gives a pointer to this table.
    15                              <2> ;IBMBIO, MODE and NLSFUNC modules communicate with DOS through
    16                              <2> ;this structure.
    17                              <2> DOS_country_cdpg_info struc
    18 00000000 ????????????????    <2> ccInfo_reserved 	db	8 dup (?) ;reserved for internal use
    19 00000008 <res 40h>           <2> ccPath_CountrySys	db	64 dup (?);path and filename for country info
    20 00000048 ????                <2> ccSysCodePage		dw	? ;0	;system code page id
    21 0000004A ????                <2> ccNumber_of_entries	dw	? ;6	; 6 entries
    22 0000004C ??                  <2> ccSetUcase		db	? ;SetUcase
    23 0000004D ????????            <2> ccUcase_ptr		dd	?	;pointer to Ucase table
    24                              <2> 
    25 00000051 ??                  <2> ccSetUcaseFile		db	? ;SetUcaseFile
    26 00000052 ????????            <2> ccFileUcase_ptr 	dd	?	;pointer to File Ucase table
    27                              <2> 
    28 00000056 ??                  <2> ccSetFileList		db	? ;SetFileList
    29 00000057 ????????            <2> ccFileChar_ptr		dd	?	;pointer to File char list table
    30                              <2> 
    31 0000005B ??                  <2> ccSetCollate		db	? ;SetCollate
    32 0000005C ????????            <2> ccCollate_ptr		dd	?	;pointer to collate table
    33                              <2> 
    34 00000060 ??                  <2> ccSetDBCS		db	? ;SetDBCS
    35 00000061 ????????            <2> ccDBCS_ptr		dd	?	;pointer to DBCS  table
    36                              <2> 
    37 00000065 ??                  <2> ccSetCountryInfo	db	?; SetCountryInfo
    38 00000066 ????                <2> ccCountryInfoLen	dw	?	;length of country info
    39 00000068 ????                <2> ccDosCountry		dw	?	;active country code id
    40 0000006A ????                <2> ccDosCodePage		dw	?	;active code page id
    41 0000006C ????                <2> ccDFormat		dw	?	;date format
    42 0000006E ??????????          <2> ccCurSymbol		db	5 dup (?) ;"    ",0;5 byte of (currency symbol+0)
    43 00000073 ????                <2> cc1000Sep		db	?,? ;" ",0   ;2 byte of (1000 sep. + 0)
    44 00000075 ????                <2> ccDecSep		db	?,? ;" ",0   ;2 byte of (Decimal sep. + 0)
    45 00000077 ????                <2> ccDateSep		db	?,? ;" ",0   ;2 byte of (date sep. + 0)
    46 00000079 ????                <2> ccTimeSep		db	?,? ;" ",0   ;2 byte of (time sep. + 0)
    47 0000007B ??                  <2> ccCFormat		db	?	;currency format flags
    48 0000007C ??                  <2> ccCSigDigits		db	?	;# of digits in currency
    49 0000007D ??                  <2> ccTFormat		db	?	;time format
    50 0000007E ????????            <2> ccMono_Ptr		dd	?	;monocase routine entry point
    51 00000082 ????                <2> ccListSep		db	?,? ;" ",0   ;data list separator
    52 00000084 <res Ah>            <2> ccReserved_area 	dw	5 dup(?);reserved
    53                              <2> 
    54                              <2> DOS_country_cdpg_info ends
    55                              <2> 
    56                              <2> ;Ucase table
    57                              <2> CC_UCASE_TAB	struc
    58 00000000 ????                <2> ccUcase_leng	       dw	? ;128
    59 00000002 <res 80h>           <2> ccUcase_data	       db	128 dup (?)
    60                              <2> CC_UCASE_TAB	ends
    61                              <2> 
    62                              <2> ;File Ucase table
    63                              <2> CC_FILE_UCASE_TAB	struc
    64 00000000 ????                <2> ccFileucase_leng	dw	? ;128
    65 00000002 <res 80h>           <2> ccFileucase_data	db	128 dup (?)
    66                              <2> CC_FILE_UCASE_TAB	ends
    67                              <2> 
    68                              <2> ;File char list
    69                              <2> CC_FILE_CHAR_TAB	struc
    70 00000000 ????                <2> ccFilechar_leng 	dw	?
    71 00000002 <res 2Eh>           <2> ccFilechar_data 	db	46 dup (?)
    72                              <2> CC_FILE_CHAR_TAB	ends
    73                              <2> 
    74                              <2> ;collate table
    75                              <2> CC_COLLATE_TAB	struc
    76 00000000 ????                <2> ccCollate_leng		dw	? ;256
    77 00000002 <res 100h>          <2> ccCollate_data		db	256 dup (?)
    78                              <2> CC_COLLATE_TAB	ends
    79                              <2> 
    80                              <2> ;DBCS table -  for DOS 4.00
    81                              <2> CC_DBCS_TAB	struc
    82 00000000 ????                <2> ccDBCS_leng	       dw      ? ;6
    83 00000002 ????????????        <2> ccDBCS_data	       db      6 dup (?)
    84                              <2> CC_DBCS_TAB	ends
    85                              <2> 
    86                              <2> ;						2/12/KK
    87                              <2> ; Define subfunctions of ECS_call ( 63H )	2/12/KK
    88                              <2> ;						2/12/KK
    89                              <2> GetLeadBTBL	EQU	0	;		2/12/KK
    90                              <2> SetInterimMode	EQU	1	;		2/12/KK
    91                              <2> GetInterimMode	EQU	2	;		2/12/KK
    92                              <2> 				;		2/12/KK
    93                              <2> NonInterimMode	EQU	0	;		2/12/KK
    94                              <2> InterimMode	EQU	1	;		2/12/KK
    95                              <2> 
    96                              <2> OLD_COUNTRY_SIZE    equ     (DOS_country_cdpg_info_struc_size - ccDFormat - 10)
    97                              <2> NEW_COUNTRY_SIZE    equ     (DOS_country_cdpg_info_struc_size - ccDosCountry)
    98                              <2> 
    99                              <2> ;CAPITALIZATION equates
   100                              <2> CAP_ONE_CHAR	    equ      20H
   101                              <2> CAP_STRING	    equ      21H
   102                              <2> CAP_ASCIIZ	    equ      22H
   103                              <2> CHECK_YES_NO	    equ      23H
   104                              <2> UPPER_TABLE	    equ      80H
   105                              <2> 
   106                              <2> ;NLS_YES	     equ      59H
   107                              <2> ;NLS_yes2	     equ      79H
   108                              <2> ;NLS_NO 	     equ      4EH
   109                              <2> ;NLS_no2	     equ      6EH
   154                              <1> 
   155                              <1> ;SUBTTL
   156                              <1> 
    91                                  	%include "devsym.mac"
     1                              <1> 	%warning out: DEVSYM.INC...
     1          ******************  <1>  warning: out: DEVSYM.INC... [-w+user]
     2                              <1> ;	SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04
     3                              <1> ;	SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04
     4                              <1> 
     5                              <1> ; THE DEVICE TABLE LIST HAS THE FORM:
     6                              <1> SYSDEV	       STRUC
     7 00000000 ????????            <1> SDEVNEXT       DD    ?		    ;POINTER TO NEXT DEVICE HEADER
     8 00000004 ????                <1> SDEVATT        DW    ?		    ;ATTRIBUTES OF THE DEVICE
     9 00000006 ????                <1> SDEVSTRAT      DW    ?		    ;STRATEGY ENTRY POINT
    10 00000008 ????                <1> SDEVINT        DW    ?		    ;INTERRUPT ENTRY POINT
    11 0000000A ????????????????    <1> SDEVNAME       DB    8 DUP (?)	    ;NAME OF DEVICE (ONLY FIRST BYTE USED FOR BLOCK)
    12                              <1> SYSDEV	       ENDS
    13                              <1> 
    14                              <1> ;
    15                              <1> ; ATTRIBUTE BIT MASKS
    16                              <1> ;
    17                              <1> ; CHARACTER DEVICES:
    18                              <1> ;
    19                              <1> ; BIT 15 -> MUST BE 1
    20                              <1> ;     14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS
    21                              <1> ;     13 -> 1 IF THE DEVICE SUPPORTS OUTPUT-UNTIL-BUSY
    22                              <1> ;     12 -> UNUSED
    23                              <1> ;     11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE
    24                              <1> ;     10 -> MUST BE 0
    25                              <1> ;      9 -> MUST BE 0
    26                              <1> ;      8 -> UNUSED
    27                              <1> ;      7 -> UNUSED
    28                              <1> ;      6 -> UNUSED
    29                              <1> ;      5 -> UNUSED
    30                              <1> ;      4 -> 1 IF DEVICE IS RECIPIENT OF INT 29H
    31                              <1> ;      3 -> 1 IF DEVICE IS CLOCK DEVICE
    32                              <1> ;      2 -> 1 IF DEVICE IS NULL DEVICE
    33                              <1> ;      1 -> 1 IF DEVICE IS CONSOLE OUTPUT
    34                              <1> ;      0 -> 1 IF DEVICE IS CONSOLE INPUT
    35                              <1> ;
    36                              <1> ; BLOCK DEVICES:
    37                              <1> ;
    38                              <1> ; BIT 15 -> MUST BE 0
    39                              <1> ;     14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS
    40                              <1> ;     13 -> 1 IF THE DEVICE DETERMINES MEDIA BY EXAMINING THE FAT ID BYTE.
    41                              <1> ;	    THIS REQUIRES THE FIRST SECTOR OF THE FAT TO *ALWAYS* RESIDE IN
    42                              <1> ;	    THE SAME PLACE.
    43                              <1> ;     12 -> UNUSED
    44                              <1> ;     11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE/REMOVABLE MEDIA
    45                              <1> ;     10 -> MUST BE 0
    46                              <1> ;      9 -> MUST BE 0
    47                              <1> ;      8 -> UNUSED
    48                              <1> ;      7 -> UNUSED
    49                              <1> ;      6 -> IF DEVICE HAS SUPPORT FOR GETMAP/SETMAP OF LOGICAL DRIVES.
    50                              <1> ;	    IF THE DEVICE UNDERSTANDS GENERIC IOCTL FUNCTION CALLS.
    51                              <1> ;      5 -> UNUSED
    52                              <1> ;      4 -> UNUSED
    53                              <1> ;      3 -> UNUSED
    54                              <1> ;      2 -> UNUSED
    55                              <1> ;      1 -> UNUSED
    56                              <1> ;      0 -> UNUSED
    57                              <1> ;
    58                              <1> 
    59                              <1> DEVTYP	       EQU   8000H	    ; BIT 15 - 1  IF CHAR, 0 IF BLOCK
    60                              <1> CHARDEV        EQU   8000H
    61                              <1> DEVIOCTL       EQU   4000H	    ; BIT 14 - CONTROL MODE BIT
    62                              <1> ISFATBYDEV     EQU   2000H	    ; BIT 13 - DEVICE USES FAT ID BYTES,
    63                              <1> 				    ;  COMP MEDIA.
    64                              <1> OUTTILBUSY     EQU   2000H	    ; OUTPUT UNTIL BUSY IS ENABLED
    65                              <1> ISNET	       EQU   1000H	    ; BIT 12 - 1 IF A NET DEVICE, 0 IF
    66                              <1> 				    ;  NOT.  CURRENTLY BLOCK ONLY.
    67                              <1> DEVOPCL        EQU   0800H	    ; BIT 11 - 1 IF THIS DEVICE HAS
    68                              <1> 				    ;  OPEN,CLOSE AND REMOVABLE MEDIA
    69                              <1> 				    ;  ENTRY POINTS, 0 IF NOT
    70                              <1> 
    71                              <1> EXTENTBIT      EQU   0400H	    ; BIT 10 - CURRENTLY 0 ON ALL DEVS
    72                              <1> 				    ;  THIS BIT IS RESERVED FOR FUTURE USE
    73                              <1> 				    ;  TO EXTEND THE DEVICE HEADER BEYOND
    74                              <1> 				    ;  ITS CURRENT FORM.
    75                              <1> 
    76                              <1> ; NOTE BIT 9 IS CURRENTLY USED ON IBM SYSTEMS TO INDICATE "DRIVE IS SHARED".
    77                              <1> ;    SEE IOCTL FUNCTION 9. THIS USE IS NOT DOCUMENTED, IT IS USED BY SOME
    78                              <1> ;    OF THE UTILITIES WHICH ARE SUPPOSED TO FAIL ON SHARED DRIVES ON SERVER
    79                              <1> ;    MACHINES (FORMAT,CHKDSK,RECOVER,..).
    80                              <1> 
    81                              <1> DEV320	       EQU   0040H	    ;BIT 6 - FOR BLOCK DEVICES, THIS
    82                              <1> 				    ;DEVICE SUPPORTS SET/GET MAP OF
    83                              <1> 				    ;LOGICAL DRIVES, AND SUPPORTS
    84                              <1> 				    ;GENERIC IOCTL CALLS.
    85                              <1> 				    ;FOR CHARACTER DEVICES, THIS
    86                              <1> 				    ;DEVICE SUPPORTS GENERIC IOCTL.
    87                              <1> 				    ;THIS IS A DOS 3.2 DEVICE DRIVER.
    88                              <1> ISSPEC	       EQU   0010H	    ;BIT 4 - THIS DEVICE IS SPECIAL
    89                              <1> ISCLOCK        EQU   0008H	    ;BIT 3 - THIS DEVICE IS THE CLOCK DEVICE.
    90                              <1> ISNULL	       EQU   0004H	    ;BIT 2 - THIS DEVICE IS THE NULL DEVICE.
    91                              <1> ISCOUT	       EQU   0002H	    ;BIT 1 - THIS DEVICE IS THE CONSOLE OUTPUT.
    92                              <1> ISCIN	       EQU   0001H	    ;BIT 0 - THIS DEVICE IS THE CONSOLE INPUT.
    93                              <1> EXTDRVR        EQU   0002H	    ;BIT 1 - BLOCK DEVICE EXTNDED DRIVER
    94                              <1> 
    95                              <1> ;STATIC REQUEST HEADER
    96                              <1> SRHEAD	       STRUC
    97 00000000 ??                  <1> REQLEN	       DB    ?		    ;LENGTH IN BYTES OF REQUEST BLOCK
    98 00000001 ??                  <1> REQUNIT        DB    ?		    ;DEVICE UNIT NUMBER
    99 00000002 ??                  <1> REQFUNC        DB    ?		    ;TYPE OF REQUEST
   100 00000003 ????                <1> REQSTAT        DW    ?		    ;STATUS WORD
   101 00000005 ????????????????    <1> 	       DB    8 DUP(?)	    ;RESERVED FOR QUEUE LINKS
   102                              <1> SRHEAD	       ENDS
   103                              <1> 
   104                              <1> ;STATUS WORD MASKS
   105                              <1> STERR	       EQU   8000H	    ;BIT 15 - ERROR
   106                              <1> STBUI	       EQU   0200H	    ;BIT 9 - BUISY
   107                              <1> STDON	       EQU   0100H	    ;BIT 8 - DONE
   108                              <1> STECODE        EQU   00FFH	    ;ERROR CODE
   109                              <1> ;						  2/12/KK
   110                              <1> ; Interim  character identifier 		  2/12/KK
   111                              <1> Ddkey		EQU	0000010000000000B	; 2/12/KK
   112                              <1> 
   113                              <1> ;FUNCTION CODES
   114                              <1> DEVINIT        EQU   0		    ;INITIALIZATION
   115                              <1> DINITHL        EQU   26 	    ;SIZE OF INIT HEADER
   116                              <1> DEVMDCH        EQU   1		    ;MEDIA CHECK
   117                              <1> DMEDHL	       EQU   15 	    ;SIZE OF MEDIA CHECK HEADER
   118                              <1> DEVBPB	       EQU   2		    ;GET BPB
   119                              <1> DEVRDIOCTL     EQU   3		    ;IOCTL READ
   120                              <1> DBPBHL	       EQU   22 	    ;SIZE OF GET BPB HEADER
   121                              <1> DEVRD	       EQU   4		    ;READ
   122                              <1> DRDWRHL        EQU   22 	    ;SIZE OF RD/WR HEADER
   123                              <1> DEVRDND        EQU   5		    ;NON DESTRUCTIVE READ NO WAIT (CHARACTER DEVS)
   124                              <1> DRDNDHL        EQU   14 	    ;SIZE OF NON DESTRUCTIVE READ HEADER
   125                              <1> DEVIST	       EQU   6		    ;INPUT STATUS
   126                              <1> DSTATHL        EQU   13 	    ;SIZE OF STATUS HEADER
   127                              <1> DEVIFL	       EQU   7		    ;INPUT FLUSH
   128                              <1> DFLSHL	       EQU   15 	    ;SIZE OF FLUSH HEADER
   129                              <1> DEVWRT	       EQU   8		    ;WRITE
   130                              <1> DEVWRTV        EQU   9		    ;WRITE WITH VERIFY
   131                              <1> DEVOST	       EQU   10 	    ;OUTPUT STATUS
   132                              <1> DEVOFL	       EQU   11 	    ;OUTPUT FLUSH
   133                              <1> DEVWRIOCTL     EQU   12 	    ;IOCTL WRITE
   134                              <1> DEVOPN	       EQU   13 	    ;DEVICE OPEN
   135                              <1> DEVCLS	       EQU   14 	    ;DEVICE CLOSE
   136                              <1> DOPCLHL        EQU   13 	    ;SIZE OF OPEN/CLOSE HEADER
   137                              <1> DEVRMD	       EQU   15 	    ;REMOVABLE MEDIA
   138                              <1> REMHL	       EQU   13 	    ;SIZE OF REMOVABLE MEDIA HEADER
   139                              <1> GENIOCTL       EQU   19
   140                              <1> ; THE NEXT THREE ARE USED IN DOS 4.0
   141                              <1> ;		     20
   142                              <1> ;		     21
   143                              <1> ;		     22
   144                              <1> DEVGETOWN      EQU   23 	    ;GET DEVICE OWNER
   145                              <1> DEVSETOWN      EQU   24 	    ;SET DEVICE OWNER
   146                              <1> QUERYGENIOCTL equ 25		; query generic IOCTL support (MS-DOS v5+)
   147                              <1> OWNHL	       EQU   13 	    ;SIZE OF DEVICE OWNER HEADER
   148                              <1> 
   149                              <1> DEVOUT	       EQU   16 	    ; OUTPUT UNTIL BUSY.
   150                              <1> DEVOUTL        EQU   DEVWRT	    ; LENGTH OF OUTPUT UNTIL BUSY
   151                              <1> 
   152                              <1> ; GENERIC IOCTL REQUEST STRUCTURE
   153                              <1> ;	SEE THE DOS 4.0 DEVICE DRIVER SPEC FOR FURTHER ELABORATION.
   154                              <1> ;
   155                              <1> IOCTL_REQ      STRUC
   156 00000000 <res Dh>            <1> 	       DB    (SRHEAD_struc_size) DUP(?)
   157                              <1> 				    ; GENERIC IOCTL ADDITION.
   158 0000000D ??                  <1> MAJORFUNCTION  DB    ?		    ;FUNCTION CODE
   159 0000000E ??                  <1> MINORFUNCTION  DB    ?		    ;FUNCTION CATEGORY
   160 0000000F ????                <1> REG_SI	       DW    ?
   161 00000011 ????                <1> REG_DI	       DW    ?
   162 00000013 ????????            <1> GENERICIOCTL_PACKET DD ?	    ; POINTER TO DATA BUFFER
   163                              <1> IOCTL_REQ      ENDS
   164                              <1> 
   165                              <1> ;	DEFINITIONS FOR IOCTL_REQ.MINORFUNCTION
   166                              <1> GEN_IOCTL_WRT_TRK   EQU   40H
   167                              <1> GEN_IOCTL_RD_TRK    EQU   60H
   168                              <1> GEN_IOCTL_FN_TST    EQU   20H	    ; USED TO DIFF. BET READS AND WRTS
   169                              <1> 
   170                              <1> ;; 32-bit absolute read/write input list structure
   171                              <1> 
   172                              <1> ABS_32RW	 STRUC
   173 00000000 ????????            <1> SECTOR_RBA	 DD	 ?	    ; relative block address
   174 00000004 ????                <1> ABS_RW_COUNT	 DW	 ?	    ; number of sectors to be transferred
   175 00000006 ????????            <1> BUFFER_ADDR	 DD	 ?	    ; data addrress
   176                              <1> ABS_32RW	 ENDS
   177                              <1> 
   178                              <1> ;; media ID info
   179                              <1> 
   180                              <1> MEDIA_ID_INFO	 STRUC
   181 00000000 ????                <1> MEDIA_level	 DW	 ?	    ; info level
   182 00000002 ????????            <1> MEDIA_Serial	 DD	 ?	    ; serial #
   183 00000006 <res Bh>            <1> MEDIA_Label	 DB	 11 dup (?) ;volume label
   184 00000011 ????????????????    <1> MEDIA_System	 DB	 8  dup (?) ;system type
   185                              <1> MEDIA_ID_INFO	 ENDS
   186                              <1> 
   187                              <1> ;; equates for DOS34_FLAG
   188                              <1> 
   189                              <1> IFS_ABSRW	      EQU   00001H	   ;IFS absolute read/write
   190                              <1> NO_IFS_ABSRW	      EQU   0FFFEH	   ;no IFS absolute read/write
   191                              <1> IFS_DRIVE_RESET       EQU   00002H	   ;IFS drvive reset
   192                              <1> NO_IFS_DRIVE_RESET    EQU   0FFFDH	   ;no IFS drive reset
   193                              <1> FROM_DISK_RESET       EQU   00004H	   ;from disk reset
   194                              <1> NO_FROM_DISK_RESET    EQU   0FFFBH	   ;not from disk reset
   195                              <1> From_String_Output    EQU   00008H	   ;from con string output
   196                              <1> NO_From_String_Output EQU   0FFF7H	   ;not from con string output
   197                              <1> From_DOS_WRITE	      EQU   00010H	   ;from dos_write
   198                              <1> NO_From_DOS_WRITE     EQU   0FFEFH	   ;not from dos_write
   199                              <1> Force_I24_Fail	      EQU   00020H	   ;form IFS CALL BACK
   200                              <1> NO_Force_I24_Fail     EQU   0FFDFH	   ;not form IFS CALL BACK
   201                              <1> Disable_EOF_I24       EQU   00040H	   ;disable EOF int24 for input status
   202                              <1> NO_Disable_EOF_I24    EQU   0FFBFH	   ;disable EOF int24 for input status
   203                              <1> DBCS_VOLID	      EQU   00080H	   ;indicate from volume id
   204                              <1> DBCS_VOLID2	      EQU   00100H	   ;indicate 8th char is DBCS
   205                              <1> CTRL_BREAK_FLAG       EQU   00200H	   ;indicate control break is input
   206                              <1> NO_CTRL_BREAK_FLAG    EQU   0FDFFH	   ;reset control break
   207                              <1> SEARCH_FASTOPEN       EQU   00400H	   ;set fastopen flag for search
   208                              <1> X25_special	      EQU   00800H	   ;flag for X25 driver
    92                                  	%include "ioctl.mac"
     1                              <1> 
     2                              <1> %warning out: IOCTL.INC...
     2          ******************  <1>  warning: out: IOCTL.INC... [-w+user]
     3                              <1> ; THESE ARE ALL THE IMPORTANT STRUCTURES AND EQUATES FOR IOCTL
     4                              <1> ;==============================================================================
     5                              <1> ;REVISION HISTORY:
     6                              <1> ;AN000 - New for DOS Version 4.00 - J.K.
     7                              <1> ;AC000 - Changed for DOS Version 4.00 - J.K.
     8                              <1> ;AN00x - PTM number for DOS Version 4.00 - J.K.
     9                              <1> ;==============================================================================
    10                              <1> ;AN001; D241 Provide support of Multi-track Format/Verify	   9/23/87 J.K.
    11                              <1> ;AN002; P1535 Unformatted hard file problem			  10/15/87 J.K.
    12                              <1> ;AN003; D490 IOCTL subfunction 63h,43h,64h,44h conflicts with OS2  2/26/88 J.K.
    13                              <1> ;==============================================================================
    14                              <1> 
    15                              <1> ;*** J.K.
    16                              <1> ;General Guide -
    17                              <1> ;Category Code:
    18                              <1> ; 0... .... DOS Defined
    19                              <1> ; 1... .... User defined
    20                              <1> ; .xxx xxxx Code
    21                              <1> 
    22                              <1> ;Function Code:
    23                              <1> ; 0... .... Return error if unsupported
    24                              <1> ; 1... .... Ignore if unsupported
    25                              <1> ; .0.. .... Intercepted by DOS
    26                              <1> ; .1.. .... Passed to driver
    27                              <1> ; ..0. .... Sends data/commands to device
    28                              <1> ; ..1. .... Quries data/info from device
    29                              <1> ; ...x .... Subfunction
    30                              <1> ;
    31                              <1> ; Note that "Sends/queries" data bit is intended only to regularize the
    32                              <1> ; function set.  It plays no critical role; some functions may contain both
    33                              <1> ; command and query elements. The convention is that such commands are
    34                              <1> ; defined as "sends data".
    35                              <1> 
    36                              <1> ;*****************************;*
    37                              <1> ; BLOCK DRIVERS 	      ;*
    38                              <1> ;*****************************;*
    39                              <1> 
    40                              <1> ; IOCTL SUB-FUNCTIONS
    41                              <1> IOCTL_GET_DEVICE_INFO	EQU	0
    42                              <1> IOCTL_SET_DEVICE_INFO	EQU	1
    43                              <1> IOCTL_READ_HANDLE	EQU	2
    44                              <1> IOCTL_WRITE_HANDLE	EQU	3
    45                              <1> IOCTL_READ_DRIVE	EQU	4
    46                              <1> IOCTL_WRITE_DRIVE	EQU	5
    47                              <1> IOCTL_GET_INPUT_STATUS	EQU	6
    48                              <1> IOCTL_GET_OUTPUT_STATUS EQU	7
    49                              <1> IOCTL_CHANGEABLE?	EQU	8
    50                              <1> IOCTL_DeviceLocOrRem?	EQU	9
    51                              <1> IOCTL_HandleLocOrRem?	EQU	0Ah   ;10
    52                              <1> IOCTL_SHARING_RETRY	EQU	0Bh   ;11
    53                              <1> GENERIC_IOCTL_HANDLE	EQU	0Ch   ;12
    54                              <1> GENERIC_IOCTL		EQU	0Dh   ;13
    55                              <1> 
    56                              <1> ; GENERIC IOCTL CATEGORY CODES
    57                              <1> IOC_OTHER		EQU	0	; Other device control J.K. 4/29/86
    58                              <1> IOC_SE			EQU	1	; SERIAL DEVICE CONTROL
    59                              <1> IOC_TC			EQU	2	; TERMINAL CONTROL
    60                              <1> IOC_SC			EQU	3	; SCREEN CONTROL
    61                              <1> IOC_KC			EQU	4	; KEYBOARD CONTROL
    62                              <1> IOC_PC			EQU	5	; PRINTER CONTROL
    63                              <1> IOC_DC			EQU	8	; DISK CONTROL (SAME AS RAWIO)
    64                              <1> 
    65                              <1> ; GENERIC IOCTL SUB-FUNCTIONS
    66                              <1> RAWIO			EQU	8
    67                              <1> 
    68                              <1> ; RAWIO SUB-FUNCTIONS
    69                              <1> GET_DEVICE_PARAMETERS	EQU	60H
    70                              <1> SET_DEVICE_PARAMETERS	EQU	40H
    71                              <1> READ_TRACK		EQU	61H
    72                              <1> WRITE_TRACK		EQU	41H
    73                              <1> VERIFY_TRACK		EQU	62H
    74                              <1> FORMAT_TRACK		EQU	42H
    75                              <1> GET_MEDIA_ID		EQU	66h		;AN000;AN003;changed from 63h
    76                              <1> SET_MEDIA_ID		EQU	46h		;AN000;AN003;changed from 43h
    77                              <1> GET_ACCESS_FLAG 	EQU	67h		;AN002;AN003;Unpublished function.Changed from 64h
    78                              <1> SET_ACCESS_FLAG 	EQU	47h		;AN002;AN003;Unpublished function.Changed from 44h
    79                              <1> 
    80                              <1> ; SPECIAL FUNCTION FOR GET DEVICE PARAMETERS
    81                              <1> BUILD_DEVICE_BPB	EQU	000000001B
    82                              <1> 
    83                              <1> ; SPECIAL FUNCTIONS FOR SET DEVICE PARAMETERS
    84                              <1> INSTALL_FAKE_BPB	EQU	000000001B
    85                              <1> ONLY_SET_TRACKLAYOUT	EQU	000000010B
    86                              <1> TRACKLAYOUT_IS_GOOD	EQU	000000100B
    87                              <1> 
    88                              <1> ; SPECIAL FUNCTION FOR FORMAT TRACK
    89                              <1> STATUS_FOR_FORMAT		EQU	000000001B
    90                              <1> DO_FAST_FORMAT			equ	000000010B	;AN001;
    91                              <1> ; CODES RETURNED FROM FORMAT STATUS CALL
    92                              <1> FORMAT_NO_ROM_SUPPORT		EQU	000000001B
    93                              <1> FORMAT_COMB_NOT_SUPPORTED	EQU	000000010B
    94                              <1> 
    95                              <1> ; DEVICETYPE VALUES
    96                              <1> MAX_SECTORS_IN_TRACK	EQU	63	; MAXIMUM SECTORS ON A DISK.(Was 40 in DOS 3.2)
    97                              <1> DEV_5INCH		EQU	0
    98                              <1> DEV_5INCH96TPI		EQU	1
    99                              <1> DEV_3INCH720KB		EQU	2
   100                              <1> DEV_8INCHSS		EQU	3
   101                              <1> DEV_8INCHDS		EQU	4
   102                              <1> DEV_HARDDISK		EQU	5
   103                              <1> DEV_OTHER		EQU	7
   104                              <1> 
   105                              <1> MAX_DEV_TYPE		EQU	7	; MAXIMUM DEVICE TYPE THAT WE
   106                              <1> 					; CURRENTLY SUPPORT.
   107                              <1> 
   108                              <1> %include "bpb.mac"
     1                              <2> 	%warning out: BPB.INC...
     1          ******************  <2>  warning: out: BPB.INC... [-w+user]
     2                              <2> ;	SCCSID = @(#)BPB.ASM	1.1 85/04/29
     3                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     4                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     5                              <2> ;									   ;
     6                              <2> 
     7                              <2> ; BIOS PARAMETER BLOCK DEFINITION
     8                              <2> ; THIS STRUCTURE IS USED TO BUILD A FULL DPB
     9                              <2> 
    10                              <2> BPBLOCK STRUC
    11 00000000 ????                <2> BPSECSZ DW	?			; SIZE IN BYTES OF PHYSICAL SECTOR
    12 00000002 ??                  <2> BPCLUS	DB	?			; SECTORS/ALLOC UNIT
    13 00000003 ????                <2> BPRES	DW	?			; NUMBER OF RESERVED SECTORS
    14 00000005 ??                  <2> BPFTCNT DB	?			; NUMBER OF FATS
    15 00000006 ????                <2> BPDRCNT DW	?			; NUMBER OF DIRECTORY ENTRIES
    16 00000008 ????                <2> BPSCCNT DW	?			; TOTAL NUMBER OF SECTORS
    17 0000000A ??                  <2> BPMEDIA DB	?			; MEDIA DESCRIPTOR BYTE
    18 0000000B ????                <2> BPFTSEC DW	?			; NUMBER OF SECTORS TAKEN UP BY ONE FAT
    19                              <2> BPBLOCK ENDS
    20                              <2> 
    21                              <2> A_BPB			STRUC
    22 00000000 ????                <2> BPB_BYTESPERSECTOR	DW	?
    23 00000002 ??                  <2> BPB_SECTORSPERCLUSTER	DB	?
    24 00000003 ????                <2> BPB_RESERVEDSECTORS	DW	?
    25 00000005 ??                  <2> BPB_NUMBEROFFATS	DB	?
    26 00000006 ????                <2> BPB_ROOTENTRIES 	DW	?
    27 00000008 ????                <2> BPB_TOTALSECTORS	DW	?
    28 0000000A ??                  <2> BPB_MEDIADESCRIPTOR	DB	?
    29 0000000B ????                <2> BPB_SECTORSPERFAT	DW	?
    30 0000000D ????                <2> BPB_SECTORSPERTRACK	DW	?
    31 0000000F ????                <2> BPB_HEADS		DW	?
    32 00000011 ????                <2> BPB_HIDDENSECTORS	DW	?
    33 00000013 ????                <2> 			DW	?
    34 00000015 ????                <2> BPB_BIGTOTALSECTORS	DW	?
    35 00000017 ????                <2> 			DW	?
    36 00000019 ????????????        <2> 			DB	6 DUP(?)
    37                              <2> A_BPB			ENDS
    38                              <2> ;									   ;
    39                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    40                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   109                              <1> 
   110                              <1> A_SECTORTABLE	    STRUC
   111 00000000 ????                <1> ST_SECTORNUMBER 	DW	?
   112 00000002 ????                <1> ST_SECTORSIZE		DW	?
   113                              <1> A_SECTORTABLE	    ENDS
   114                              <1> 
   115                              <1> A_DEVICEPARAMETERS  STRUC
   116 00000000 ??                  <1> DP_SPECIALFUNCTIONS	DB	?
   117 00000001 ??                  <1> DP_DEVICETYPE		DB	?
   118 00000002 ????                <1> DP_DEVICEATTRIBUTES	DW	?
   119 00000004 ????                <1> DP_CYLINDERS		DW	?
   120 00000006 ??                  <1> DP_MEDIATYPE		DB	?
   121 00000007 <res 1Fh>           <1> DP_BPB			DB	A_BPB_struc_size DUP (?)
   122 00000026 ????                <1> DP_TRACKTABLEENTRIES	DW	?
   123 00000028 <res FCh>           <1> DP_SECTORTABLE		DB MAX_SECTORS_IN_TRACK * A_SECTORTABLE_struc_size DUP (?)
   124                              <1> A_DEVICEPARAMETERS  ENDS
   125                              <1> 
   126                              <1> A_TRACKREADWRITEPACKET STRUC
   127 00000000 ??                  <1> TRWP_SPECIALFUNCTIONS	DB	?
   128 00000001 ????                <1> TRWP_HEAD		DW	?
   129 00000003 ????                <1> TRWP_CYLINDER		DW	?
   130 00000005 ????                <1> TRWP_FIRSTSECTOR	DW	?
   131 00000007 ????                <1> TRWP_SECTORSTOREADWRITE DW	?
   132 00000009 ????????            <1> TRWP_TRANSFERADDRESS	DD	?
   133                              <1> A_TRACKREADWRITEPACKET ENDS
   134                              <1> 
   135                              <1> ;AN001; - FP_TRACKCOUNT is only meaningful when FP_SPECIALFUNCTIONS bit 1 = 1.
   136                              <1> A_FORMATPACKET	    STRUC
   137 00000000 ??                  <1> FP_SPECIALFUNCTIONS	DB	?
   138 00000001 ????                <1> FP_HEAD 		DW	?
   139 00000003 ????                <1> FP_CYLINDER		DW	?
   140 00000005 ????                <1> FP_TRACKCOUNT		DW	? ;1
   141                              <1> A_FORMATPACKET	    ENDS
   142                              <1> 
   143                              <1> A_VERIFYPACKET	    STRUC
   144 00000000 ??                  <1> VP_SPECIALFUNCTIONS	DB	?
   145 00000001 ????                <1> VP_HEAD 		DW	?
   146 00000003 ????                <1> VP_CYLINDER		DW	?
   147                              <1> A_VERIFYPACKET	    ENDS
   148                              <1> 
   149                              <1> A_MEDIA_ID_INFO     STRUC
   150 00000000 ????                <1> MI_LEVEL		DW	? ;0		;J.K. 87 Info. level
   151 00000002 ????????            <1> MI_SERIAL		DD	?		;J.K. 87 Serial #
   152 00000006 <res Bh>            <1> MI_LABEL		DB     11 DUP (?) ;(' ')     ;J.K. 87 volume label
   153 00000011 ????????????????    <1> MI_SYSTEM		DB	8 DUP (?) ;(' ')     ;J.K. 87 File system type
   154                              <1> A_MEDIA_ID_INFO     ENDS
   155                              <1> 
   156                              <1> A_DISKACCESS_CONTROL	STRUC			;AN002; Unpublished function. Only for Hard file.
   157 00000000 ??                  <1> DAC_SPECIALFUNCTIONS	DB	? ;0		;AN002; Always 0
   158 00000001 ??                  <1> DAC_ACCESS_FLAG 	DB	? ;0		;AN002; Non Zero - allow disk I/O to unformatted hard file
   159                              <1> A_DISKACCESS_CONTROL	ENDS			;AN002; 0 - Disallow disk I/O to unformatted hard file
   160                              <1> 
   161                              <1> ;********************************;*
   162                              <1> ; CHARACTER DEVICES (PRINTERS)	 ;*
   163                              <1> ;********************************;*
   164                              <1> 
   165                              <1> ;RAWIO SUB-FUNCTIONS
   166                              <1> GET_RETRY_COUNT 	EQU	65H
   167                              <1> SET_RETRY_COUNT 	EQU	45H
   168                              <1> 
   169                              <1> A_RETRYCOUNT	    STRUC
   170 00000000 ????                <1> RC_COUNT		DW	?
   171                              <1> A_RETRYCOUNT	    ENDS
   172                              <1> 
   173                              <1> ;********************************;*		;J.K. 4/29/86
   174                              <1> ; CHARACTER DEVICES (SCREEN)	 ;*
   175                              <1> ;********************************;*		;J.K. 4/29/86
   176                              <1> ;
   177                              <1> ;SC_MODE_INFO	 struc
   178                              <1> ;SC_INFO_LENGTH 	 DW	 9
   179                              <1> ;SC_MODE		 DB	 0
   180                              <1> ;SC_COLORS		 DW	 0
   181                              <1> ;SC_WIDTH		 DW	 0
   182                              <1> ;SC_LENGTH		 DW	 0
   183                              <1> ;SC_MODE_INFO	 ends
   184                              <1> ;
   185                              <1> ;SC_INFO_PACKET_LENGTH	 EQU	 9		 ;LENGTH OF THE INFO PACKET.
   186                              <1> 
   187                              <1> ;SUBFUNCTIONS FOR CON$GENIOCTL
   188                              <1> ;GET_SC_MODE		 EQU	 60h
   189                              <1> ;SET_SC_MODE		 EQU	 40h
   190                              <1> ;The following subfunctions are reserved for installable CODE PAGE switch
   191                              <1> ;console devices. - J.K. 4/29/86
   192                              <1> ;Get_active_codepage	 equ	 6Ah
   193                              <1> ;Invoke_active_codepage  equ	 4Ah
   194                              <1> ;Start_designate_codepage equ	 4Ch
   195                              <1> ;End_designate_codepage  equ	 4Dh
   196                              <1> ;Get_list_of_designated_codepage equ 6Bh
   197                              <1> ;J.K. 4/29/86 *** End of Con$genioctl equates & structures
    93                                  	%include "biostruc.mac"
     1                              <1> %warning out: BIOSTRUC.INC...
     1          ******************  <1>  warning: out: BIOSTRUC.INC... [-w+user]
     2                              <1> ;	SCCSID = @(#)BIOSTRUC.INC 1.0 86/09/30
     3                              <1> ; ROM BIOS CALL PACKET STRUCTURES
     4                              <1> 
     5                              <1> ;*******************************
     6                              <1> ;System Service call ( Int 15h )
     7                              <1> ;*******************************
     8                              <1> ;Function AH = 0C0h, Return system configuration
     9                              <1> ;For PC and PCJR on return:
    10                              <1> ;	(AH)	= 80h
    11                              <1> ;	(CY)	= 1
    12                              <1> ;For PCXT, PC PORTABLE and PCAT on return:
    13                              <1> ;	(AH)	= 86h
    14                              <1> ;	(CY)	= 1
    15                              <1> ;For all others:
    16                              <1> ;	(AH)	= 0
    17                              <1> ;	(CY)	= 0
    18                              <1> ;	(ES:BX) = pointer to system descriptor vector in ROS
    19                              <1> ; System descriptor :
    20                              <1> ;	DW	xxxx		length of descriptor in bytes,
    21                              <1> ;				minimum length = 8
    22                              <1> ;	DB	xx		model byte
    23                              <1> ;				0FFh	= PC
    24                              <1> ;				0FEh	= PC/XT, Portable
    25                              <1> ;				0FDh	= PC/JR
    26                              <1> ;				0FCh	= PC/AT, 6Mhz PC/AT,
    27                              <1> ;					  6Mhz PC/AT running coprocessor(?),
    28                              <1> ;					  PS/2 Model 50, 50 z
    29                              <1> ;				0FAh	= PS/2 Model 25, 30
    30                              <1> ;				0F9h	= PC Convertible
    31                              <1> ;				0F8h	= PS/2 Model 80
    32                              <1> ;				0F7h	= Nova
    33                              <1> ;				0E0 thru 0EFh = reserved
    34                              <1> ;
    35                              <1> ;	DB	xx		secondary model byte
    36                              <1> ;				000h	= PC1
    37                              <1> ;				000h	= PC/XT, Portable
    38                              <1> ;				000h	= PC/JR
    39                              <1> ;				000h	= PC/AT
    40                              <1> ;				001h	= 6Mhz PC/AT
    41                              <1> ;				003h	= 6Mhz PC/AT running coprocessor(?)
    42                              <1> ;				004h	= PS/2 Model 50, 50z
    43                              <1> ;				001h	= PS/2 Model 25
    44                              <1> ;				000h	= PC Convertible
    45                              <1> ;				000h	= PS/2 Model 80
    46                              <1> ;				000h	= Nova
    47                              <1> ;
    48                              <1> ;	DB	xx		bios revision level
    49                              <1> ;				00 for first release, subsequent release
    50                              <1> ;				of code with same model byte and
    51                              <1> ;				secondary model byte require revison level
    52                              <1> ;				to increase by one.
    53                              <1> ;
    54                              <1> ;	DB	xx		feature information byte 1
    55                              <1> ;				X0000000 = 1, bios use DMA channel 3
    56                              <1> ;					 = 0, DMA channel 3 not used
    57                              <1> ;
    58                              <1> ;				0X000000 = 1, 2nd Interrupt chip present
    59                              <1> ;					 = 0, 2nd Interrupt chip not present
    60                              <1> ;
    61                              <1> ;				00X00000 = 1, Real Time Clock present
    62                              <1> ;					 = 0, Real Time Clock not present
    63                              <1> ;
    64                              <1> ;				000X0000 = 1, Keyboard escape sequence(INT15h)
    65                              <1> ;						called in keyboard interrupt
    66                              <1> ;						(Int 09h).
    67                              <1> ;					 = 0, Keyboard escape sequence not
    68                              <1> ;						called.
    69                              <1> ;				0000XXXX reserved
    70                              <1> ;
    71                              <1> ;	DB	xx		feature information byte 2 - reserved
    72                              <1> ;
    73                              <1> ;	DB	xx		feature information byte 2 - reserved
    74                              <1> ;
    75                              <1> ;	DB	xx		feature information byte 2 - reserved
    76                              <1> ;
    77                              <1> ;	DB	xx		feature information byte 2 - reserved
    78                              <1> ;
    79                              <1> 
    80                              <1> BIOS_SYSTEM_DESCRIPTOR	struc
    81 00000000 ????                <1> bios_SD_leng		dw	?
    82 00000002 ??                  <1> bios_SD_modelbyte	db	?
    83 00000003 ??                  <1> bios_SD_scnd_modelbyte	db	?
    84 00000004 ??                  <1> 			db	?
    85 00000005 ??                  <1> bios_SD_featurebyte1	db	?
    86 00000006 ????????            <1> 			db   4 dup (?)
    87                              <1> BIOS_SYSTEM_DESCRIPTOR ends
    88                              <1> 
    89                              <1> ;FeatureByte1	bit map equates
    90                              <1> DMAchannel3		equ 10000000b
    91                              <1> ScndIntController	equ 01000000b
    92                              <1> RealTimeClock		equ 00100000b
    93                              <1> KeyEscapeSeq		equ 00010000b
    94                              <1> ;
    95                              <1> ;Model Byte
    96                              <1> MDL_PC1 	EQU	0FFH
    97                              <1> MDL_XT		EQU	0FEH
    98                              <1> MDL_JR		EQU	0FDH
    99                              <1> MDL_AT		EQU	0FCH
   100                              <1> MDL_CONVERT	EQU	0F9H
   101                              <1> 
   102                              <1> mdl_ps2_30	equ	0fah
   103                              <1> mdl_ps2_80	equ	0f8h
    94                                  	%include "smifssym.mac"	;AN000; Reduced version of IFSSYM.INC.
     1                              <1> 
     2                              <1> ;	PAGE	60,132
     3                              <1> ;	SCCSID = @(#)smifssym.inc 1.0 87/05/11
     4                              <1> ;
     5                              <1> ;   Modification history:
     6                              <1> ;	Created: May 11 1987 
     7                              <1> ;
     8                              <1> ;	SMifssym is only for IBMBIO.  It will only has definitions
     9                              <1> ;	for IFSHEADER, IFSRH of INIT function.
    10                              <1> ;	When ifssym.inc is Revised, make sure that SMifssym.inc
    11                              <1> ;	is also correct. - JK.
    12                              <1> ;
    13                              <1> 
    14                              <1> ;==================
    15                              <1> ;IFS drive header
    16                              <1> ;=================
    17                              <1> 
    18                              <1>     IFSDEVICE	EQU	8000H	;  Supports single device/file functions
    19                              <1>     IFSDISK	EQU	4000H	;  Supports multi-file functions
    20                              <1>     IFSUNC	EQU	2000H	;  Support UNC (nameless) connection
    21                              <1>     IFSREMOTE	EQU	0800H	;  File system is remote
    22                              <1>     IFSFILTER	EQU	0400H	;  FS will filter (if off, use DOS
    23                              <1> 				;    standard, cap & 8.3)
    24                              <1>     IFSIOCTL	EQU	0002H	;  Supports IOCTL functions
    25                              <1>     IFSUSESHARE EQU	0001H	;  Uses DOS share support (vs own share)
    26                              <1> 
    27                              <1> IFSHEADER	STRUC
    28 00000000 ????????            <1> IFS_NEXT	DD	? ;-1	; Next header in list (-1=end)
    29 00000004 ????????????????    <1> IFS_NAME	DB	8 dup (?) ;"        " ; IFS name
    30 0000000C ????                <1> IFS_ATTRIBUTE	DW	?	; Attributes
    31 0000000E ????                <1> IFS_VERSION	DW	? ;0	; Request level supported
    32 00000010 ????????            <1> IFS_DOSCALL@	DD	?	; DOS interface routine
    33                              <1> 				;   (set by TUPPER before the init call)
    34 00000014 ????                <1> IFS_CALL@	DW	?	; Function entry point
    35                              <1> IFSHEADER	ENDS
    36                              <1> 
    37                              <1> ;=====================
    38                              <1> ; IFS Request Header
    39                              <1> ;=====================
    40                              <1> 
    41                              <1> IFSRH		STRUC
    42 00000000 ????                <1> IFSR_LENGTH	DW    ? 		; Total length of request
    43 00000002 ??                  <1> IFSR_FUNCTION	DB    ? 		; Requested function
    44 00000003 ??                  <1> IFSR_RETCODE	DB    ? 		; Explicit error
    45 00000004 ??                  <1> IFSR_RETCLASS	DB    ? 		; Error class
    46 00000005 <res 11h>           <1> IFSR_RESV1	DB    17 DUP (?) ;(0) 	; DOS reserved
    47 00000016 <res 26h>           <1> IFSR_FCN_PARMS	DB    38 DUP (?) ;(0) 	; Additional parameters
    48                              <1> IFSRH		ENDS
    49                              <1> 
    50                              <1> ; IFSR_FUNCTION codes
    51                              <1> ;	Control requests:
    52                              <1> IFSINIT        EQU     1
    53                              <1> IFSATTSTART    EQU     2
    54                              <1> IFSATTEND      EQU     3
    55                              <1> IFSEXECAPI     EQU     4
    56                              <1> IFSCRITMSG     EQU     5
    57                              <1> IFSCBUPDATE    EQU     6
    58                              <1> ; INIT function.
    59                              <1> labelsize IFSR_PARMS@, dword, IFSR_FCN_PARMS    ; command parameters
    60                              <1> labelsize IFSR_RESSIZE, word, IFSR_FCN_PARMS+4  ; driver total size
    61                              <1> LENGTH_INIT	   EQU IFSR_RESSIZE-IFSRH+2
    62                              <1> 
    95                                  	%include "devmark.mac"	;AN004;
     1                              <1> ;Structure, Equtes for DEVMARK for MEM command.
     2                              <1> 
     3                              <1> DEVMARK struc
     4 00000000 ??                  <1> DEVMARK_ID	  db	  ?
     5 00000001 ????                <1> DEVMARK_SEG	  dw	  ?
     6 00000003 ????                <1> DEVMARK_SIZE	  dw	  ?
     7 00000005 ??????              <1> DEVMARK_DUM	  db	  3 dup (?)
     8 00000008 ????????????????    <1> DEVMARK_FILENAME  db	  8 dup (?) ; (' ')
     9                              <1> DEVMARK ends
    10                              <1> 
    11                              <1> DEVMARK_STK	equ	'S'
    12                              <1> DEVMARK_DEVICE	equ	'D'
    13                              <1> DEVMARK_IFS	equ	'I'
    14                              <1> DEVMARK_BUF	equ	'B'
    15                              <1> DEVMARK_CDS	equ	'L' ;lastdrive
    16                              <1> DEVMARK_FILES	equ	'F'
    17                              <1> DEVMARK_FCBS	equ	'X'
    18                              <1> DEVMARK_INST	equ	'T' ;used for SYSINIT BASE for INSTALL= command.
    19                              <1> DEVMARK_EMS_STUB equ	'E'
    20                              <1> 
    21                              <1> SETBRKDONE	equ	00000001b
    22                              <1> FOR_DEVMARK	equ	00000010b
    23                              <1> NOT_FOR_DEVMARK equ	11111101b
    96                                  	%include "version.mac"
     1                              <1> ; Some modules really want TRUE to be 0FFH.  Best to let them have their way.
     2                              <1> 	TRUE	   EQU	   0FFFFh
     3                              <1> 	TRUEBYTE   EQU     0FFh
     4                              <1> 	FALSE	   EQU	   0
     5                              <1> 
     6                              <1> ;
     7                              <1> ; Use the following switches to control cmacros.inc
     8                              <1> ;
     9                              <1> ?PLM       equ       0
    10                              <1> ?WIN       equ       0
    11                              <1> 
    12                              <1> memS       EQU     1			; Small model
    13                              <1> ;
    14                              <1> ; Use the switches below to produce the standard Microsoft version or the IBM
    15                              <1> ; version of the operating system
    16                              <1> ;
    17                              <1> ; The below chart will indicate how to set the switches to build the various
    18                              <1> ; versions
    19                              <1> ;
    20                              <1> ;                     IBMVER          IBMCOPYRIGHT
    21                              <1> ; --------------------------------------------------------
    22                              <1> ;  IBM Version   |     TRUE              TRUE
    23                              <1> ; --------------------------------------------------------
    24                              <1> ;  MS Version    |     FALSE             FALSE
    25                              <1> ; --------------------------------------------------------
    26                              <1> ;  Clone Version |     TRUE              FALSE
    27                              <1> ;
    28                              <1> IBMVER     EQU     TRUE
    29                              <1> IBMCOPYRIGHT EQU   FALSE
    30                              <1> 
    31                              <1> BUFFERFLAG	EQU	~ IBMCOPYRIGHT
    32                              <1> 
    33                              <1> %ifndef	MSVER	
    34                              <1> MSVER      EQU     ~ IBMVER
    35                              <1> %endif
    36                              <1> IBM	   EQU	   IBMVER
    37                              <1> ;
    38                              <1> ;
    39                              <1> 	%IF IBMVER
    40                              <1> 	    %IF IBMCOPYRIGHT
    41                              <1>               %warning out: ... IBM version build switch on ...
    42                              <1> 	    %ELSE
    43                              <1> 	      %warning out: ... CLONE version build switch on ...
    43          ******************  <1>  warning: out: ... CLONE version build switch on ... [-w+user]
    44                              <1> 	    %ENDIF
    45                              <1> 	%ELSE
    46                              <1> 	    %IFN IBMCOPYRIGHT
    47                              <1> 	      %warning out: ... MS version build switch on ...
    48                              <1> 	    %ELSE
    49                              <1> 	      %warning out: !!!!!!!!!  VERSION SWITCHES SET INCORECTLY  !!!!!!!!!
    50                              <1> 	      %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!!
    51                              <1> 	    %ENDIF
    52                              <1> 	%ENDIF   
    53                              <1> ;
    54                              <1> ;
    55                              <1> ;***************************************************************************
    56                              <1> ;*          The following switches are for DBCS or SBCS support            *
    57                              <1> ;*                                                                         *
    58                              <1> ;*                     Set INTERNAT EQU TRUE FOR DBCS                      *
    59                              <1> ;*                     Set INTERNAT EQU FALSE FOR SBCS                     *
    60                              <1> ;*                                                                         *
    61                              <1> ;***************************************************************************
    62                              <1> ;
    63                              <1> IBMJAPVER  EQU	   FALSE		;If TRUE set KANJI true also
    64                              <1> 
    65                              <1> ;
    66                              <1> ; Switch INTERNAT for DBCS support
    67                              <1> ;
    68                              <1> INTERNAT   EQU	   FALSE
    69                              <1> ;
    70                              <1> 	%IF INTERNAT
    71                              <1> %ifndef KANJI
    72                              <1> KANJI	   EQU	   TRUE
    73                              <1> %endif
    74                              <1> IBMJAPAN   EQU	   TRUE
    75                              <1> 	%ELSE
    76                              <1> %ifndef KANJI
    77                              <1> KANJI	   EQU	   FALSE
    78                              <1> %endif
    79                              <1> IBMJAPAN   EQU	   FALSE
    80                              <1> 	%ENDIF
    81                              <1> 
    82                              <1> %ifndef altvect				; avoid jerking off vector.inc
    83                              <1> ALTVECT    EQU	   FALSE		;Switch to build ALTVECT version
    84                              <1> %endif
    85                              <1> 
    86                              <1> ;
    87                              <1> ; Country code switches
    88                              <1> ; The default contry code is assumed as USA.
    89                              <1> ;
    90                              <1> 	%IF INTERNAT
    91                              <1>  KOREA	   EQU	   TRUE
    92                              <1>  JAPAN	   EQU	   FALSE
    93                              <1> 	%ELSE
    94                              <1>  KOREA	   EQU	   FALSE
    95                              <1>  JAPAN	   EQU	   FALSE
    96                              <1> 	%ENDIF
    97                              <1> ;
    98                              <1> 		%IF INTERNAT
    99                              <1> %warning out: Internat(ECS) version build switch on
   100                              <1> 		%ENDIF
    97                                  	%include "mzheader.mac"
     1                              <1> 
     2                              <1> %if 0
     3                              <1> 
     4                              <1> lDebug MZ .EXE header macros
     5                              <1> 
     6                              <1> Copyright (C) 1995-2003 Paul Vojta
     7                              <1> Copyright (C) 2008-2023 E. C. Masloch
     8                              <1> 
     9                              <1> Usage of the works is permitted provided that this
    10                              <1> instrument is retained with the works, so that any entity
    11                              <1> that uses the works is notified of this instrument.
    12                              <1> 
    13                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    14                              <1> 
    15                              <1> %endif
    16                              <1> 
    17                              <1> 
    18                              <1> 	struc EXEHEADER
    19 00000000 ????                <1> exact_struc_at 00h, exeSignature:	resw 1
    20 00000002 ????                <1> exact_struc_at 02h, exeExtraBytes:	resw 1	; bytes in last page
    21 00000004 ????                <1> exact_struc_at 04h, exePages:		resw 1	; number of 512-byte pages. includes the header!
    22 00000006 ????                <1> exact_struc_at 06h, exeRelocItems:	resw 1	; number of relocation items
    23 00000008 ????                <1> exact_struc_at 08h, exeHeaderSize:	resw 1	; header size in 16-byte paragraphs
    24 0000000A ????                <1> exact_struc_at 0Ah, exeMinAlloc:	resw 1	; minimum (bss) allocation in paragraphs
    25 0000000C ????                <1> exact_struc_at 0Ch, exeMaxAlloc:	resw 1	; maximum (bss) allocation in paragraphs
    26 0000000E ????                <1> exact_struc_at 0Eh, exeInitSS:		resw 1	; init ss (is relocated)
    27 00000010 ????                <1> exact_struc_at 10h, exeInitSP:		resw 1	; init sp
    28 00000012 ????                <1> exact_struc_at 12h, exeChecksum:	resw 1
    29                              <1> exact_struc_at 14h, exeInitCSIP:
    30 00000014 ????                <1> exact_struc_at 14h, exeInitIP:		resw 1	; init ip
    31 00000016 ????                <1> exact_struc_at 16h, exeInitCS:		resw 1	; init cs (is relocated)
    32 00000018 ????                <1> exact_struc_at 18h, exeRelocTable:	resw 1	; byte offset of relocation table
    33                              <1> 		; Each relocation item is a word offset and a word segment.
    34                              <1> 		;  The segment of the item itself is relocated as well.
    35 0000001A ????                <1> exact_struc_at 1Ah, exeOverlayNum:	resw 1
    36                              <1> exact_struc_at 1Ch
    37                              <1> 	endstruc
    98                                  	%include "lstruct.mac"
     1                              <1> [list -]
    13                              <1> [list -]
    99                                  	%include "memsw.mac"
     1                              <1> %define LDOSMEM 1
   100                                  [list +]
   101                                  
   102                                  	%IFN IBMJAPVER
   103                                  	EXTRN	RE_INIT:FAR
   104                                  	%ENDIF
   105                                  
   106                                  ;
   107                                  
   108                                  ;J.K. 6/29/87 External variable defined in IBMBIO module for Multi-track
   109                                  MULTRK_ON	EQU	10000000B	;User spcified Mutitrack=on, or System turns
   110                                  					; it on after handling CONFIG.SYS file as a
   111                                  					; default value, if MulTrk_flag = MULTRK_OFF1.
   112                                  MULTRK_OFF1	EQU	00000000B	;initial value. No "Multitrack=" command entered.
   113                                  MULTRK_OFF2	EQU	00000001B	;User specified Multitrack=off.
   114                                  
   115                                  section DOSENTRY
   116                                  	EXTRN	MulTrk_flag:word	;AN002;
   117                                  	extrn	KEYRD_Func:byte 	;AN019;
   118                                  	extrn	KEYSTS_Func:byte	;AN019;
   119                                  ; (no prior section) ; CODE ends
   120                                  ;J.K. 6/29/87 End of Multi-track definition.
   121                                  
   122                                  section SYSINITSEG PUBLIC class=INIT
   123                                  section SYSINITSEG
   124                                  	align 16, db 0
   125                                  
   126                                  ASSUME	CS:SYSINITSEG,DS:NOTHING,ES:NOTHING,SS:NOTHING
   127                                  
   128                                  	extern alloc_initconfig, alloc_dpb_no_hma
   129                                  	extern allocate_relocate_block
   130                                  	extern allocate_temporary_block
   131                                  	extern allocate_temporary_block.large_allow_error
   132                                  	extern ParaRound, alloc_init
   133                                  	extern sysinit_get_ds_dosbiodata
   134                                  
   135                                  	EXTRN	BADOPM:BYTE,CRLFM:BYTE,BADCOM:BYTE,BADMEM:BYTE,BADBLOCK:BYTE
   136                                  	EXTRN	BADSIZ_PRE:BYTE,BADLD_PRE:BYTE
   137                                  ;	 EXTRN	 BADSIZ_POST:BYTE,BADLD_POST:BYTE
   138                                  	EXTRN	BADSTACK:BYTE,BADCOUNTRYCOM:BYTE
   139                                  	EXTRN	SYSSIZE:BYTE,BADCOUNTRY:BYTE,INSUFMEMORY:BYTE
   140                                  	extern config_overflow
   141                                  	EXTRN	CONDEV:BYTE,AUXDEV:BYTE,PRNDEV:BYTE,COMMND:BYTE,CONFIG:BYTE
   142                                  	EXTRN	Cntry_Drv:BYTE,Cntry_Root:BYTE,Cntry_Path:BYTE
   143                                  	EXTRN	DeviceParameters:byte
   144                                  	EXTRN	MEMORY_SIZE:word
   145                                  	EXTRN	BUFFERS:word
   146                                  	EXTRN	FILES:byte,NUM_CDS:byte
   147                                  	EXTRN	DOSINFO:dword,ENTRY_POINT:dword
   148                                  	EXTRN	FCBS:byte,KEEP:byte
   149                                  	EXTRN	config_block:word,COMMAND_LINE:byte
   150                                  	EXTRN	ZERO:byte,SEPCHR:byte
   151                                  	EXTRN	COUNT:word,CHRPTR:word,CNTRYFILEHANDLE:word
   152                                  	EXTRN	MEMLO:word,MEMHI:word,PRMBLK:word
   153                                  	EXTRN	PACKET:byte,UNITCOUNT:byte,BREAK_ADDR:dword
   154                                  	EXTRN	BPB_ADDR:dword,DRIVENUMBER:byte,SYSI_COUNTRY:dword
   155                                  	extrn	Config_Size:word		;AN000;
   156                                  	extrn	Install_Flag:word		;AN000;
   157                                  	extrn	BadOrder:byte			;AN000;
   158                                  	extrn	Errorcmd:byte			;AN000;
   159                                  	extrn	LineCount:word			;AN000;
   160                                  	extrn	ShowCount:byte			;AN000;
   161                                  	extrn	Buffer_LineNum:word		;AN000;
   162                                  	extrn	IFS_Flag:word			;AN000;
   163                                  	extrn	IFS_RH:byte			;AN000;
   164                                  	extrn	H_Buffers:word			;AN000;
   165                                  	extrn	Buffer_Slash_X:byte		;AN000;AN025;
   166                                  	extrn	Badparm:byte			;AN007;
   167                                  	extrn	ConfigMsgFlag:Word		;AN015;
   168                                  	extrn	Org_Count:Word			;AN018;
   169                                  	extrn	Multi_Pass_Id:byte		;AN026;
   170                                  
   171                                  	EXTRN	MEM_ERR:NEAR,SetDOSCountryInfo:NEAR
   172                                  	EXTRN	PARAROUND:NEAR,TEMPCDS_after_block_device:NEAR
   173                                  	EXTRN	Set_Country_Path:NEAR,Move_ASCIIZ:NEAR,DELIM:NEAR
   174                                  	EXTRN	BADFIL:NEAR,ROUND:NEAR
   175                                  	extrn	Do_Install_Exec:NEAR		;AN018;
   176                                  	extrn	SetDevMark:NEAR 		;AN030;
   177                                  	extern init2_SNextMCB
   178                                  
   179                                  ;AN016; Undo the extended attribute handling
   180                                  ;	 extrn	 Get_Ext_Attribute:near 	 ;AN009;
   181                                  
   182                                  	%IF	STACKSW
   183                                  
   184                                  ; Internal Stack Parameters
   185                                  	EntrySize		equ	8
   186                                  
   187                                  	MinCount		equ	8
   188                                  	DefaultCount		equ	9
   189                                  	MaxCount		equ	64
   190                                  
   191                                  	MinSize 		equ	32
   192                                  	DefaultSize		equ	128
   193                                  	MaxSize 		equ	512
   194                                  
   195                                  	extrn  stack_count:word
   196                                  	extrn  stack_size:word
   197                                  	extrn  stack_addr:dword
   198                                  
   199                                  	%ENDIF
   200                                  
   201                                  	PUBLIC DOCONF
   202                                  	PUBLIC GETCHR
   203                                  	public Multi_Pass		;AN018;AN026;
   204                                  
   205                                  	public	MultDeviceFlag
   206 00000000 00                      MultDeviceFlag	db	0		;AN001;
   207                                  	public	DevMark_Addr
   208 00000001 ????                    DevMark_Addr	dw	?		;AN004;Segment address for DEVMARK.
   209                                  	public	SetDevMarkFlag
   210 00000003 00                      SetDevMarkFlag	    db	    0		;AN004;Flag used for DEVMARK
   211                                  
   212                                  %ifndef BUF2
   213                                  EMS_Stub_Installed  db	    0		;AN030;
   214                                  %endif
   215                                  
   216                                  Badparm_Ptr	label	dword
   217 00000004 0000                    Badparm_Off	dw	0		;AN007;
   218 00000006 0000                    Badparm_Seg	dw	0		;AN007;
   219                                  
   220                                  	global devicehighflag, devicehighdata, devicehighafter, devicehighsd
   221                                  	global deviceafter, shellhighflag
   222                                  	global altah_option, configmsg.altah_message, configmsg.altah_message.error
   223                                  	global devicefirstnewdpb, devicefirstnewdrive, deviceamountnew
   224                                  	global cds_installed_last_unit_plus, cds_amount_wanted
   225                                  
   226 00000008 0000                    country_block:	dw 0
   227 0000000A 0000                    CONFIG_used:	dw 0
   228 0000000C 0100                    checkdeviceflags:	dw 1
   229 0000000E 0000                    devicefilesizepara:	dw 0
   230 00000010 0000                    devicehighsd:		dw 0
   231 00000012 0000                    devicehighdata:		dw 0
   232 00000014 0000                    devicehighsize:		dw 0
   233 00000016 0000                    devicehighafter:	dw 0
   234 00000018 0000                    deviceafter:		dw 0
   235 0000001A FFFFFFFF                devicelastdpb:		dd -1
   236 0000001E FFFFFFFF                devicefirstnewdpb:	dd -1
   237 00000022 00                      deviceamountnew:	db 0
   238 00000023 00                      devicefirstnewdrive:	db 0
   239 00000024 00                      cds_installed_last_unit_plus: db 0
   240 00000025 00                      cds_amount_wanted:	db 0
   241 00000026 00                      devicehighflag:		db 0
   242 00000027 00                      shellhighflag:		db 0
   243 00000028 00                      altah_option:		db 0
   244                                   global hidedosentry_option, hidedosdatafirst_option
   245 00000029 00                      hidedosentry_option:	db 0
   246 0000002A 00                      hidedosdatafirst_option:db 0
   247 0000002B 00                      	align 2, db 0
   248                                   global autobounce_both_options, autobouncehmachs_option, autobouncehmalba_option
   249                                  autobounce_both_options:
   250 0000002C FF                      autobouncehmachs_option:db -1
   251 0000002D FF                      autobouncehmalba_option:db -1
   252                                   global enlargelma_option
   253 0000002E FF                      enlargelma_option:	db -1
   254 0000002F 00                      installasfirst_option:	db 0
   255 00000030 00                      installaslast_option:	db 0
   256                                   global preservecds_option
   257 00000031 FF                      preservecds_option:	db -1
   258                                   global reinitcds_option
   259 00000032 00                      reinitcds_option:	db 0
   260                                  
   261                                   extern dosdata_relocate_first, dosdata_relocate_early
   262                                  
   263                                  	struc COMPATOPTION
   264 00000000 ????                    coSetOrClear:		resw 1
   265 00000002 ????                    coPriorSegment:		resw 1		; 0 = sysinit, 1 = DOSDATA
   266 00000004 ????                    coAlwaysClear:		resw 1
   267 00000006 ????                    coNoMessage:		resw 1
   268 00000008 ????                    coYesMessage:		resw 1
   269                                  	endstruc
   270                                  
   271 00000033 00                      	align 2, db 0
   272                                  compatoptionstable:
   273                                  	istruc COMPATOPTION
   274 00000034 [2800]                  at coSetOrClear,	dw altah_option
   275 00000036 00<rep 4h>[2401]        at coNoMessage,		dw configmsg.noaltah
   276 0000003C [2601]                  at coYesMessage,	dw configmsg.altah
   277                                  	iend
   278                                  	istruc COMPATOPTION
   279 0000003E [0000]                  at coSetOrClear,	dw dosdata_relocate_first
   280 00000040 00<rep 4h>[0601]        at coNoMessage,		dw configmsg.nodosdatafirst
   281 00000046 [0801]                  at coYesMessage,	dw configmsg.dosdatafirst
   282                                  	iend
   283                                  	istruc COMPATOPTION
   284 00000048 [0000]                  at coSetOrClear,	dw dosdata_relocate_early
   285 0000004A 00<rep 4h>[1501]        at coNoMessage,		dw configmsg.nodosdataearly
   286 00000050 [1701]                  at coYesMessage,	dw configmsg.dosdataearly
   287                                  	iend
   288                                  
   289                                   extern config_bounce_hma_chs
   290                                   extern config_bounce_hma_lba
   291                                  	istruc COMPATOPTION
   292 00000052 [0000]                  at coSetOrClear,	dw config_bounce_hma_chs
   293 00000054 0100                    at coPriorSegment,	dw 1
   294 00000056 [2C00]                  at coAlwaysClear,	dw autobouncehmachs_option
   295 00000058 [2C01]                  at coNoMessage,		dw configmsg.nobouncehmachs
   296 0000005A [2E01]                  at coYesMessage,	dw configmsg.bouncehmachs
   297                                  	iend
   298                                  	istruc COMPATOPTION
   299 0000005C [2C00]                  at coSetOrClear,	dw autobouncehmachs_option
   300 0000005E 00<rep 6h>[4A01]        at coYesMessage,	dw configmsg.autobouncehmachs
   301                                  	iend
   302                                  	istruc COMPATOPTION
   303 00000066 [0000]                  at coSetOrClear,	dw config_bounce_hma_lba
   304 00000068 0100                    at coPriorSegment,	dw 1
   305 0000006A [2D00]                  at coAlwaysClear,	dw autobouncehmalba_option
   306 0000006C [3B01]                  at coNoMessage,		dw configmsg.nobouncehmalba
   307 0000006E [3D01]                  at coYesMessage,	dw configmsg.bouncehmalba
   308                                  	iend
   309                                  	istruc COMPATOPTION
   310 00000070 [2D00]                  at coSetOrClear,	dw autobouncehmalba_option
   311 00000072 00<rep 6h>[5B01]        at coYesMessage,	dw configmsg.autobouncehmalba
   312                                  	iend
   313                                  
   314                                   extern config_bounce_uma_chs
   315                                   extern config_bounce_uma_lba
   316                                  	istruc COMPATOPTION
   317 0000007A [0000]                  at coSetOrClear,	dw config_bounce_uma_chs
   318 0000007C 0100                    at coPriorSegment,	dw 1
   319 0000007E 00<rep 2h>[6C01]        at coNoMessage,		dw configmsg.nobounceumachs
   320 00000082 [6E01]                  at coYesMessage,	dw configmsg.bounceumachs
   321                                  	iend
   322                                  	istruc COMPATOPTION
   323 00000084 [0000]                  at coSetOrClear,	dw config_bounce_uma_lba
   324 00000086 0100                    at coPriorSegment,	dw 1
   325 00000088 00<rep 2h>[7B01]        at coNoMessage,		dw configmsg.nobounceumalba
   326 0000008C [7D01]                  at coYesMessage,	dw configmsg.bounceumalba
   327                                  	iend
   328                                  
   329                                   extern config_bounce_any_chs
   330                                   extern config_bounce_any_lba
   331                                  	istruc COMPATOPTION
   332 0000008E [0000]                  at coSetOrClear,	dw config_bounce_any_chs
   333 00000090 0100                    at coPriorSegment,	dw 1
   334 00000092 00<rep 2h>[8A01]        at coNoMessage,		dw configmsg.nobounceanychs
   335 00000096 [8C01]                  at coYesMessage,	dw configmsg.bounceanychs
   336                                  	iend
   337                                  	istruc COMPATOPTION
   338 00000098 [0000]                  at coSetOrClear,	dw config_bounce_any_lba
   339 0000009A 0100                    at coPriorSegment,	dw 1
   340 0000009C 00<rep 2h>[9901]        at coNoMessage,		dw configmsg.nobounceanylba
   341 000000A0 [9B01]                  at coYesMessage,	dw configmsg.bounceanylba
   342                                  	iend
   343                                  	istruc COMPATOPTION
   344 000000A2 [2900]                  at coSetOrClear,	dw hidedosentry_option
   345 000000A4 00<rep 4h>[A801]        at coNoMessage,		dw configmsg.nohidedosentry
   346 000000AA [AA01]                  at coYesMessage,	dw configmsg.hidedosentry
   347                                  	iend
   348                                  	istruc COMPATOPTION
   349 000000AC [2A00]                  at coSetOrClear,	dw hidedosdatafirst_option
   350 000000AE 00<rep 4h>[B701]        at coNoMessage,		dw configmsg.nohidedosdatafirst
   351 000000B4 [B901]                  at coYesMessage,	dw configmsg.hidedosdatafirst
   352                                  	iend
   353                                  	istruc COMPATOPTION
   354 000000B6 [2E00]                  at coSetOrClear,	dw enlargelma_option
   355 000000B8 00<rep 4h>[CA01]        at coNoMessage,		dw configmsg.noenlargelma
   356 000000BE [CC01]                  at coYesMessage,	dw configmsg.enlargelma
   357                                  	iend
   358                                  	istruc COMPATOPTION
   359 000000C0 [2E00]                  at coSetOrClear,	dw enlargelma_option
   360                                  	; ! yes and no reversed, protect first UMCB means no enlarge LMA
   361 000000C2 00<rep 4h>[D901]        at coNoMessage,		dw configmsg.protectfirstumcb
   362 000000C8 [D701]                  at coYesMessage,	dw configmsg.noprotectfirstumcb
   363                                  	iend
   364                                  	istruc COMPATOPTION
   365 000000CA [2F00]                  at coSetOrClear,	dw installasfirst_option
   366 000000CC 00<rep 4h>[EA01]        at coNoMessage,		dw configmsg.noinstallasfirst
   367 000000D2 [EC01]                  at coYesMessage,	dw configmsg.installasfirst
   368                                  	iend
   369                                  	istruc COMPATOPTION
   370 000000D4 [3000]                  at coSetOrClear,	dw installaslast_option
   371 000000D6 00<rep 4h>[FB01]        at coNoMessage,		dw configmsg.noinstallaslast
   372 000000DC [FD01]                  at coYesMessage,	dw configmsg.installaslast
   373                                  	iend
   374                                  	istruc COMPATOPTION
   375 000000DE [3100]                  at coSetOrClear,	dw preservecds_option
   376 000000E0 00<rep 4h>[0B02]        at coNoMessage,		dw configmsg.nopreservecds
   377 000000E6 [0D02]                  at coYesMessage,	dw configmsg.preservecds
   378                                  	iend
   379                                  	istruc COMPATOPTION
   380 000000E8 [3200]                  at coSetOrClear,	dw reinitcds_option
   381 000000EA 00<rep 4h>[1902]        at coNoMessage,		dw configmsg.noreinitcds
   382 000000F0 [1B02]                  at coYesMessage,	dw configmsg.reinitcds
   383                                  	iend
   384                                  
   385                                  %ifdef LDOSMEM
   386                                   extern config_collect_all_mcbs
   387                                  	istruc COMPATOPTION
   388 000000F2 [0000]                  at coSetOrClear,	dw config_collect_all_mcbs
   389 000000F4 0100                    at coPriorSegment,	dw 1
   390 000000F6 00<rep 2h>[2502]        at coNoMessage,		dw configmsg.nocollectallmcbs
   391 000000FA [2702]                  at coYesMessage,	dw configmsg.collectallmcbs
   392                                  	iend
   393                                   extern config_collect_free_mcb
   394                                  	istruc COMPATOPTION
   395 000000FC [0000]                  at coSetOrClear,	dw config_collect_free_mcb
   396 000000FE 0100                    at coPriorSegment,	dw 1
   397 00000100 00<rep 2h>[3602]        at coNoMessage,		dw configmsg.nocollectfreemcb
   398 00000104 [3802]                  at coYesMessage,	dw configmsg.collectfreemcb
   399                                  	iend
   400                                  %endif
   401                                  .end:
   402                                  
   403                                  configmsg:
   404 00000106 4E4F                    .nodosdatafirst:	db "NO"
   405 00000108 444F53444154414649-     .dosdatafirst:		asciz "DOSDATAFIRST"
   405 00000111 52535400           
   406 00000115 4E4F                    .nodosdataearly:	db "NO"
   407 00000117 444F53444154414541-     .dosdataearly:		asciz "DOSDATAEARLY"
   407 00000120 524C5900           
   408 00000124 4E4F                    .noaltah:		db "NO"
   409 00000126 414C54414800            .altah:			asciz "ALTAH"
   410 0000012C 4E4F                    .nobouncehmachs:	db "NO"
   411 0000012E 424F554E4345484D41-     .bouncehmachs:		asciz "BOUNCEHMACHS"
   411 00000137 43485300           
   412 0000013B 4E4F                    .nobouncehmalba:	db "NO"
   413 0000013D 424F554E4345484D41-     .bouncehmalba:		asciz "BOUNCEHMALBA"
   413 00000146 4C424100           
   414 0000014A 4155544F424F554E43-     .autobouncehmachs:	asciz "AUTOBOUNCEHMACHS"
   414 00000153 45484D4143485300   
   415 0000015B 4155544F424F554E43-     .autobouncehmalba:	asciz "AUTOBOUNCEHMALBA"
   415 00000164 45484D414C424100   
   416 0000016C 4E4F                    .nobounceumachs:	db "NO"
   417 0000016E 424F554E4345554D41-     .bounceumachs:		asciz "BOUNCEUMACHS"
   417 00000177 43485300           
   418 0000017B 4E4F                    .nobounceumalba:	db "NO"
   419 0000017D 424F554E4345554D41-     .bounceumalba:		asciz "BOUNCEUMALBA"
   419 00000186 4C424100           
   420 0000018A 4E4F                    .nobounceanychs:	db "NO"
   421 0000018C 424F554E4345414E59-     .bounceanychs:		asciz "BOUNCEANYCHS"
   421 00000195 43485300           
   422 00000199 4E4F                    .nobounceanylba:	db "NO"
   423 0000019B 424F554E4345414E59-     .bounceanylba:		asciz "BOUNCEANYLBA"
   423 000001A4 4C424100           
   424 000001A8 4E4F                    .nohidedosentry:	db "NO"
   425 000001AA 48494445444F53454E-     .hidedosentry:		asciz "HIDEDOSENTRY"
   425 000001B3 54525900           
   426 000001B7 4E4F                    .nohidedosdatafirst:	db "NO"
   427 000001B9 48494445444F534441-     .hidedosdatafirst:	asciz "HIDEDOSDATAFIRST"
   427 000001C2 5441464952535400   
   428 000001CA 4E4F                    .noenlargelma:		db "NO"
   429 000001CC 454E4C415247454C4D-     .enlargelma:		asciz "ENLARGELMA"
   429 000001D5 4100               
   430 000001D7 4E4F                    .noprotectfirstumcb:	db "NO"
   431 000001D9 50524F544543544649-     .protectfirstumcb:	asciz "PROTECTFIRSTUMCB"
   431 000001E2 525354554D434200   
   432 000001EA 4E4F                    .noinstallasfirst:	db "NO"
   433 000001EC 494E5354414C4C4153-     .installasfirst:	asciz "INSTALLASFIRST"
   433 000001F5 464952535400       
   434 000001FB 4E4F                    .noinstallaslast:	db "NO"
   435 000001FD 494E5354414C4C4153-     .installaslast:		asciz "INSTALLASLAST"
   435 00000206 4C41535400         
   436 0000020B 4E4F                    .nopreservecds:		db "NO"
   437 0000020D 505245534552564543-     .preservecds:		asciz "PRESERVECDS"
   437 00000216 445300             
   438 00000219 4E4F                    .noreinitcds:		db "NO"
   439 0000021B 5245494E4954434453-     .reinitcds:		asciz "REINITCDS"
   439 00000224 00                 
   440                                  %ifdef LDOSMEM
   441 00000225 4E4F                    .nocollectallmcbs:	db "NO"
   442 00000227 434F4C4C454354414C-     .collectallmcbs:	asciz "COLLECTALLMCBS"
   442 00000230 4C4D43425300       
   443 00000236 4E4F                    .nocollectfreemcb:	db "NO"
   444 00000238 434F4C4C4543544652-     .collectfreemcb:	asciz "COLLECTFREEMCB"
   444 00000241 45454D434200       
   445                                  %endif
   446 00000247 696E69743A20417070-     .altah_message:		asciz "init: Applying ALTAH compatibility option.",13,10
   446 00000250 6C79696E6720414C54-
   446 00000259 414820636F6D706174-
   446 00000262 6962696C697479206F-
   446 0000026B 7074696F6E2E0D0A00 
   447 00000274 696E69743A20457272-     .altah_message.error:	asciz "init: Error: ALTAH compatibility option failed!",13,10
   447 0000027D 6F723A20414C544148-
   447 00000286 20636F6D7061746962-
   447 0000028F 696C697479206F7074-
   447 00000298 696F6E206661696C65-
   447 000002A1 64210D0A00         
   448                                   global configmsg.hidedosentry_message
   449                                   global configmsg.hidedosentry_error
   450 000002A6 696E69743A20486964-     .hidedosentry_message:	asciz "init: Hiding DOSENTRY MCB.",13,10
   450 000002AF 696E6720444F53454E-
   450 000002B8 545259204D43422E0D-
   450 000002C1 0A00               
   451 000002C3 696E69743A20457272-     .hidedosentry_error:	asciz "init: Error: Hiding DOSENTRY MCB failed!",13,10
   451 000002CC 6F723A20486964696E-
   451 000002D5 6720444F53454E5452-
   451 000002DE 59204D434220666169-
   451 000002E7 6C6564210D0A00     
   452                                   global configmsg.hidedosdata_message
   453                                   global configmsg.hidedosdata_error
   454 000002EE 696E69743A20486964-     .hidedosdata_message:	asciz "init: Hiding DOSDATA first MCB.",13,10
   454 000002F7 696E6720444F534441-
   454 00000300 544120666972737420-
   454 00000309 4D43422E0D0A00     
   455 00000310 696E69743A20457272-     .hidedosdata_error:	asciz "init: Error: Hiding DOSDATA first MCB failed!",13,10
   455 00000319 6F723A20486964696E-
   455 00000322 6720444F5344415441-
   455 0000032B 206669727374204D43-
   455 00000334 42206661696C656421-
   455 0000033D 0D0A00             
   456                                   global .enlargelma_message
   457 00000340 696E69743A20456E6C-     .enlargelma_message:	asciz "init: Enlarging Low Memory Area with new UMB.",13,10
   457 00000349 617267696E67204C6F-
   457 00000352 77204D656D6F727920-
   457 0000035B 417265612077697468-
   457 00000364 206E657720554D422E-
   457 0000036D 0D0A00             
   458 00000370 696E69743A20457272-     .amisnumberinuse:	db "init: Error: Selected AMIS multiplex number "
   458 00000379 6F723A2053656C6563-
   458 00000382 74656420414D495320-
   458 0000038B 6D756C7469706C6578-
   458 00000394 206E756D62657220   
   459 0000039C 2D2D6820697320616C-     .amisnumberinuse.num:	asciz "--h is already in use!",13,10
   459 000003A5 726561647920696E20-
   459 000003AE 757365210D0A00     
   460                                  
   461 000003B5 584D41454D2E535953-     XMAEM_file	db	'XMAEM.SYS',0	;AN029;
   461 000003BE 00                 
   462                                  
   463                                  ;IBMCACHE_file	 db	 'IBMCACHE.SYS',0;AN024;AN026;To cope with the IBMCACHE.SYS
   464                                  					; problem of DOS version checking.
   465                                  
   466                                  ;******************************************************************************
   467                                  ;Take care of Config.sys file.
   468                                  ;SYSTEM parser data and code.
   469                                  ;******************************************************************************
   470                                  [list -]
   473                                  ;=== Push trace listing source: parse.nas
   474                                  	%include "parse.nas"			;together with PSDATA.INC ; NASM included file
     1                              <1> ;	PAGE				;AN000;
     2                              <1> ;  $SALUT (4,4,8,41)
     3                              <1> ;(deleted).XLIST
     4                              <1> ;(deleted)INCLUDE   STRUC.INC ;AN020;structured macro definitions for .IF,.ELSE etc.
     5                              <1> ;(deleted).LIST
     6                              <1> ;
     7                              <1> ; NOTE:   basesw must be set properly to allow the PARSER to access psdata.
     8                              <1> ;	   - basesw undefined	 means	 CS seg. override for psdata access.
     9                              <1> ;	   - basesw = 1 	 means	 DS seg. override for psdata access &
    10                              <1> ;					 DS must point to psdata.
    11                              <1> ;	   - basesw = 0 	 means	 ES seg. override for psdata access &
    12                              <1> ;					 ES must point to psdata.
    13                              <1> ;
    14                              <1> ;
    15                              <1> %IFNDEF basesw				;AN022;
    16                              <1>  %idefine psdata_seg	CS		;AN022;
    17                              <1> %ELSE					;AN022;
    18                              <1>    %IF  basesw				;AN022;IF "basesw  EQU  1" specified by caller THEN
    19                              <1>     %idefine psdata_seg	DS		;AN022;
    20                              <1>    %ELSE				;AN022;
    21                              <1>     %idefine psdata_seg	ES		;AN022;ELSE only other choice is ES (basesw EQU 0)
    22                              <1>    %ENDIF				;AN022;
    23                              <1> %ENDIF					;AN022;
    24                              <1> 
    25                              <1> %ifndef incsw				;AN000; (tm03) Someone doesn't want to include psdata
    26                              <1>  %iassign incsw	 1			;AN000; include psdata.inc (tm03)
    27                              <1> %endif					;AN000; (tm03)
    28                              <1> %if incsw				;AN000; If incsw = 1 then (tm03)
    29                              <1>    %include "psdata.mac"			;AN000;    include psdata.inc (tm03)
     1                              <2> ;*******************************************************************
     2                              <2> ; Parser include file
     3                              <2> ;*******************************************************************
     4                              <2> 	%warning out: INCLUDING COMP=COMMON DSN=PSDATA.INC...;AN000;
     4          ******************  <2>  warning: out: INCLUDING COMP=COMMON DSN=PSDATA.INC... [-w+user]
     5                              <2> ;
     6                              <2> ;**** Default assemble switches definition *************************
     7                              <2> 
     8                              <2> %ifndef	FarSW				;AN000;
     9                              <2> %iassign FarSW 0			;AN000; Near call expected
    10                              <2> %endif					;AN000;
    11                              <2> 
    12                              <2> %ifndef	DateSW				;AN000;
    13                              <2> %iassign DateSW 1			;AN000; Check date format
    14                              <2> %endif					;AN000;
    15                              <2> 
    16                              <2> %ifndef	TimeSW				;AN000;
    17                              <2> %iassign TimeSW 1			;AN000; Check time format
    18                              <2> %endif					;AN000;
    19                              <2> 
    20                              <2> %ifndef	FileSW				;AN000;
    21                              <2> %iassign FileSW 1			;AN000; Check file specification
    22                              <2> %endif					;AN000;
    23                              <2> 
    24                              <2> %ifndef	CAPSW				;AN000;
    25                              <2> %iassign CAPSW 1			;AN000; Perform CAPS if specified
    26                              <2> %endif					;AN000;
    27                              <2> 
    28                              <2> %ifndef	CmpxSW				;AN000;
    29                              <2> %iassign CmpxSW 1			;AN000; Check complex list
    30                              <2> %endif					;AN000;
    31                              <2> 
    32                              <2> %ifndef	NumSW				;AN000;
    33                              <2> %iassign NumSW 1			;AN000; Check numeric value
    34                              <2> %endif					;AN000;
    35                              <2> 
    36                              <2> %ifndef	KeySW				;AN000;
    37                              <2> %iassign KeySW 1			;AN000; Support keywords
    38                              <2> %endif					;AN000;
    39                              <2> 
    40                              <2> %ifndef	SwSW				;AN000;
    41                              <2> %iassign SwSW 1			;AN000; Support switches
    42                              <2> %endif					;AN000;
    43                              <2> 
    44                              <2> %ifndef	Val1SW				;AN000;
    45                              <2> %iassign Val1SW 1			;AN000; Support value definition 1
    46                              <2> %endif					;AN000;
    47                              <2> 
    48                              <2> %ifndef	Val2SW				;AN000;
    49                              <2> %iassign Val2SW 1			;AN000; Support value definition 2
    50                              <2> %endif					;AN000;
    51                              <2> 
    52                              <2> %ifndef	Val3SW				;AN000;
    53                              <2> %iassign Val3SW 1			;AN000; Support value definition 3
    54                              <2> %endif					;AN000;
    55                              <2> 
    56                              <2> %ifndef	DrvSW				;AN000;
    57                              <2> %iassign DrvSW 1			;AN000; Support drive only format
    58                              <2> %endif					;AN000;
    59                              <2> 
    60                              <2> %ifndef	QusSW				;AN000;
    61                              <2> %iassign QusSW 1			;AN000; Support quoted string format
    62                              <2> %endif					;AN000;
    63                              <2> 
    64                              <2> %ifndef	LFEOLSW 			;AN028;
    65                              <2> %iassign LFEOLSW 1			;AN028; Accept Line feed (0AH) as end of line
    66                              <2> %endif					;AN028;
    67                              <2> 
    68                              <2> ;**** Equation field
    69                              <2> ;-------- Character code definition
    70                              <2> 
    71                              <2> D_P_DBSP1	   equ	81h		;AN000; 1st byte of DBCS blank
    72                              <2> D_P_DBSP2	   equ	40h		;AN000; 2nd byte of DBCS blank
    73                              <2> D_P_Period	   equ	"."             ;AN020;
    74                              <2> D_P_Slash	   equ	"/"             ;AN020;
    75                              <2> D_P_Space	   equ	" "             ;AN000; SBCS blank
    76                              <2> D_P_Comma	   equ	","             ;AN000;
    77                              <2> D_P_Switch	   equ	"/"             ;AN000;
    78                              <2> D_P_Keyword	   equ	"="             ;AN000;
    79                              <2> D_P_Colon	   equ	":"             ;AN000;
    80                              <2> D_P_Plus 	   equ	"+"             ;AN000;
    81                              <2> D_P_Minus	   equ	"-"             ;AN000;
    82                              <2> D_P_Rparen	   equ	")"             ;AN000;
    83                              <2> D_P_Lparen	   equ	"("             ;AN000;
    84                              <2> ;(deleted ;AN025;) D_P_SQuote	      equ  "'"
    85                              <2> D_P_DQuote	   equ	'"'             ;AN000;
    86                              <2> D_P_NULL 	   equ	0		;AN000;
    87                              <2> D_P_TAB		   equ	9		;AN000;
    88                              <2> D_P_CR		   equ	0Dh		;AN000;
    89                              <2> D_P_LF		   equ	0Ah		;AN000;
    90                              <2> D_P_ASCII80	   equ	80h		;AN000; ASCII 80h character code
    91                              <2> 
    92                              <2> ;-------- Masks
    93                              <2> D_P_Make_Lower	   equ	20h		;AN000; make lower case character
    94                              <2> D_P_Make_Upper	   equ	0ffh-D_P_Make_Lower ;AN000; make upper case character
    95                              <2> 
    96                              <2> ;		   PAGE 		   ;AN000;
    97                              <2> ;-------- DOS function call related equs
    98                              <2> 
    99                              <2> D_P_DOS_Get_CDI	   equ	3800h		;AN000; get country dependent information
   100                              <2> 					; by this call, following information
   101                              <2> D_P_CDI		   struc		;AN000; is returned.
   102 00000000 ????                <2> D_P_CDI_DateF	   dw	? ;0		;AN000;
   103 00000002 ??????????          <2> D_P_CDI_Money	   db	?,?,?,?,? ;0,0,0,0,0	;AN000;
   104 00000007 ????                <2> D_P_CDI_1000	   db	?,? ;0,0		;AN000;
   105 00000009 ????                <2> D_P_CDI_Dec	   db	?,? ;0,0		;AN000;
   106 0000000B ????                <2> D_P_CDI_DateS	   db	?,? ;0,0		;AN000;
   107 0000000D ????                <2> D_P_CDI_TimeS	   db	?,? ;0,0		;AN000;
   108 0000000F ??                  <2> 		   db	? ;0		;AN000;
   109 00000010 ??                  <2> 		   db	? ;0		;AN000;
   110 00000011 ??                  <2> D_P_CDI_TimeF	   db	? ;0		;AN000;
   111 00000012 ????????            <2> 		   dw	?,? ;0,0		;AN000;
   112 00000016 ????                <2> 		   db	?,? ;0,0		;AN000;
   113 00000018 <res Ah>            <2> 		   dw	5 dup (?) ;(0)	;AN000;
   114                              <2> D_P_CDI		   ends 		;AN000;
   115                              <2> 
   116                              <2> D_P_Date_MDY	   equ	0		;AN000;
   117                              <2> D_P_Date_DMY	   equ	1		;AN000;
   118                              <2> D_P_Date_YMD	   equ	2		;AN000;
   119                              <2> ;-------------
   120                              <2> D_P_DOS_GetEV	   equ	6300h		;AN000; get DBCS EV call
   121                              <2> 					;AN000; DS:SI will points to DBCS EV
   122                              <2> ;-------------
   123                              <2> D_P_DOS_Get_TBL	   equ	65h		;AN000; get uppercase table call
   124                              <2> 					;AN000; following parameters are set
   125                              <2> 					;AN000; to get casemap table.
   126                              <2> D_P_DOSTBL_Def	   equ	-1		;AN000; get default
   127                              <2> D_P_DOSTBL_BL	   equ	5		;AN000; buffer length for Tbl pointer
   128                              <2> D_P_DOSTBL_File	   equ	4		;AN000; get file uppercase table
   129                              <2> D_P_DOSTBL_Char	   equ	2		;AN000; get character uppercase table
   130                              <2> 					; By this call following information
   131                              <2> 					; is returned.
   132                              <2> D_P_DOS_TBL	   struc		;AN000;
   133 00000000 ??                  <2> D_P_DOS_InfoID	   db	? ;0		;AN000; information id for the table
   134 00000001 ????                <2> D_P_DOS_TBL_Off	   dw	? ;0		;AN000; offset address of the table
   135 00000003 ????                <2> D_P_DOS_TBL_Seg	   dw	? ;0		;AN000; segment address of the table
   136                              <2> D_P_DOS_TBL	   ends 		;AN000;
   137                              <2> ;		   PAGE 		;AN000;
   138                              <2> ;---------------------------------------------------------------------------------------------------------
   139                              <2> ; PARMS 	LABEL	BYTE
   140                              <2> ;		DW	PARMSX
   141                              <2> ;		DB	2			; NUMBER OF STRINGS (0, 1, 2)
   142                              <2> ;		DB	length			; LENGTH OF THE NEXT LIST, 0 IF NONE
   143                              <2> ;		DB	" .. "                  ; EXTRA DELIMITER LIST,
   144                              <2> ;						; TYPICAL ARE ";", "="
   145                              <2> ;						; "," & WHITESPACE ALWAYS
   146                              <2> ;		DB	length			; LENGTH OF THE NEXT LIST, 0 IF NONE
   147                              <2> ;		DB	" .. "                  ; EXTRA END OF LINE LIST, CR, LF OR 0 ALWAYS
   148                              <2> ;---------------------------------------------------------------------------------------------------------
   149                              <2> 
   150                              <2> ;-------------------------------- PARMS block structure
   151                              <2> D_P_PARMS_Blk	   struc		;AN000;
   152 00000000 ????                <2> D_P_PARMSX_Address  dw	? ;0		;AN000; Address of PARMSX
   153 00000002 ??                  <2> D_P_Num_Extra	   db	? ;0		;AN000; Number of extra stuff
   154 00000003 ??                  <2> D_P_Len_Extra_Delim db	? ;0		;AN000; Length of extra delimiter
   155                              <2> D_P_PARMS_Blk	   ends 		;AN000;
   156                              <2> 
   157                              <2> D_P_Len_PARMS	   equ	4		;AN000;
   158                              <2> D_P_I_Use_Default   equ	0		;AN000; no extra stuff specified
   159                              <2> D_P_I_Have_Delim    equ	1		;AN000; extra delimiter specified
   160                              <2> D_P_I_Have_EOL	   equ	2		;AN000; extra EOL specified
   161                              <2> 
   162                              <2> ;---------------------------------------------------------------------------------------------------------
   163                              <2> ; PARMSX	LABEL	BYTE
   164                              <2> ;		DB	minp,maxp		; MIN, MAX POSITIONAL OPERANDS ALLOWED
   165                              <2> ;		DW	CONTROL 		; DESCRIPTION OF POSITIONAL 1
   166                              <2> ;		:				; REPEATS maxp-1 TIMES
   167                              <2> ;		DB	maxs			; # OF SWITCHES
   168                              <2> ;		DW	CONTROL 		; DESCRIPTION OF SWITCH 1
   169                              <2> ;		:				; REPEATS maxs-1 TIMES
   170                              <2> ;		DB	maxk			; # OF KEYWORD
   171                              <2> ;		DW	CONTROL 		; DESCRIPTION OF KEYWORD 1
   172                              <2> ;		:				; REPEATS maxk-1 TIMES
   173                              <2> ;---------------------------------------------------------------------------------------------------------
   174                              <2> 
   175                              <2> ;-------------------------------- PARMSX block structure
   176                              <2> D_P_PARMSX_Blk	   struc		;AN000;
   177 00000000 ??                  <2> D_P_MinP 	   db	? ;0		;AN000; Minimum positional number
   178 00000001 ??                  <2> D_P_Maxp 	   db	? ;0		;AN000; Maximum positional number
   179 00000002 ????                <2> D_P_1st_Control	   dw	? ;0		;AN000; Address of the 1st CONTROL block
   180                              <2> D_P_PARMSX_Blk	   ends 		;AN000;
   181                              <2> ;		   PAGE 		;AN000;
   182                              <2> ;---------------------------------------------------------------------------------------------------------
   183                              <2> ; << Control field definition  >>
   184                              <2> ;
   185                              <2> ;
   186                              <2> ;CONTROL   LABEL   BYTE
   187                              <2> ;	   DW	   MATCH_FLAGS	   ; CONTROLS TYPE MATCHED
   188                              <2> ;				   ; 8000H=NUMERIC VALUE, (VALUE LIST WILL BE CHECKED)
   189                              <2> ;				   ; 4000H=SIGNED NUMERIC VALUE (VALUE LIST WILL BE CHECKED)
   190                              <2> ;				   ; 2000H=SIMPLE STRING(VALUE LIST WILL BE CHECKED)
   191                              <2> ;				   ; 1000H=DATE STRING (VALUE LIST WON'T BE CHECKED)
   192                              <2> ;				   ; 0800H=TIME STRING (VALUE LIST WON'T BE CHECKED)
   193                              <2> ;				   ; 0400H=COMPLEX LIST (VALUE LIST WON'T BE CHECKED)
   194                              <2> ;				   ; 0200H=FILE SPEC (VALUE LIST WON'T BE CHECKED)
   195                              <2> ;				   ; 0100H=DRIVE ONLY (VALUE LIST WON'T BE CHECKED)
   196                              <2> ;				   ; 0080H=QUOTED STRING (VALUE LIST WON'T BE CHECKED)
   197                              <2> ;				   ; 0010H=IGNORE ":" AT END IN MATCH
   198                              <2> ;				   ; 0002H=REPEATS ALLOWED
   199                              <2> ;				   ; 0001H=OPTIONAL
   200                              <2> ;	   DW	   FUNCTION_FLAGS
   201                              <2> ;				   ; 0001H=CAP RESULT BY FILE TABLE
   202                              <2> ;				   ; 0002H=CAP RESULT BY CHAR TABLE
   203                              <2> ;				   ; 0010H=REMOVE ":" AT END
   204                              <2> ; (tm10)			   ; 0020H=colon is not necessary for switch
   205                              <2> ;	   DW	   RESULT	   ; RESULT BUFFER
   206                              <2> ;	   DW	   VALUES	   ; VALUE LISTS
   207                              <2> ;	   DB	   nid		   ; NUMBER OF KEYWORD/SWITCH SYNONYMS IN FOLLOWING LIST
   208                              <2> ;	   DB	   "...",0         ; IF n >0, KEYWORD 1
   209                              <2> ;	   :
   210                              <2> ;
   211                              <2> ;Note:
   212                              <2> ;    - The MATCH_FLAG is bit significant. You can set, for example, TIME bit and
   213                              <2> ;      DATE bit simalteniously.
   214                              <2> ;
   215                              <2> ;      The parser examins each bit along with the following priority.
   216                              <2> ;
   217                              <2> ;      COMPLEX -> DATE -> TIME -> NUMERIC VAL -> SIGNED NUMERIC VAL -> DRIVE ->
   218                              <2> ;      FILE SPEC -> SIMPLE STRING.
   219                              <2> ;
   220                              <2> ;
   221                              <2> ;    - When the FUNCTION_FLAG is 0001 or 0002, the STRING pointed to by a pointer
   222                              <2> ;      in the result buffer is capitalized.
   223                              <2> ;
   224                              <2> ;    - Match_Flags 0001H and 0002H have meaning only for the positional.
   225                              <2> ;
   226                              <2> ;
   227                              <2> ;    - The "...",0 (bottom most line) does require '=' or '/'. When you need a
   228                              <2> ;      switch, for example, '/A', then STRING points to;
   229                              <2> ;
   230                              <2> ;			DB    1 	; number of following synonyms
   231                              <2> ;			DB   '/A',0
   232                              <2> ;
   233                              <2> ;      When you need a keyword, for example, 'CODEPAGE=', then "...",0 will be;
   234                              <2> ;
   235                              <2> ;			DB    1 	; number of following synonyms
   236                              <2> ;			DB   'CODEPAGE=',0
   237                              <2> ;
   238                              <2> ;
   239                              <2> ;    - "..." must consist of upper case characters only because the parser
   240                              <2> ;      performs pattern matching after converting input to upper case (by
   241                              <2> ;      using the current country upper case table)
   242                              <2> ;
   243                              <2> ;
   244                              <2> ;    - One "..." can contain only one switch or keyword. If you need, for
   245                              <2> ;      example /A and /B, the format will be;
   246                              <2> ;
   247                              <2> ;			DB    2 	; number of following synonyms
   248                              <2> ;			DB    '/A',0
   249                              <2> ;			DB    '/B',0
   250                              <2> ;---------------------------------------------------------------------------------------------------------
   251                              <2> 
   252                              <2> ;**** Match_Flags
   253                              <2> 
   254                              <2> D_P_Num_Val	   equ	8000h		;AN000; Numeric Value
   255                              <2> D_P_SNum_Val	   equ	4000h		;AN000; Signed numeric value
   256                              <2> D_P_Simple_S	   equ	2000h		;AN000; Simple string
   257                              <2> D_P_Date_S	   equ	1000h		;AN000; Date string
   258                              <2> D_P_Time_S	   equ	0800h		;AN000; Time string
   259                              <2> D_P_Cmpx_S	   equ	0400h		;AN000; Complex string
   260                              <2> D_P_File_Spc	   equ	0200h		;AN000; File Spec
   261                              <2> D_P_Drv_Only	   equ	0100h		;AN000; Drive Only
   262                              <2> D_P_Qu_String	   equ	0080h		;AN000; Quoted string
   263                              <2> D_P_Ig_Colon	   equ	0010h		;AN000; Ignore colon at end in match
   264                              <2> D_P_Repeat	   equ	0002h		;AN000; Repeat allowed
   265                              <2> D_P_Optional	   equ	0001h		;AN000; Optional
   266                              <2> 
   267                              <2> ;**** Function flags
   268                              <2> 
   269                              <2> D_P_CAP_File	   equ	0001h		;AN000; CAP result by file table
   270                              <2> D_P_CAP_Char	   equ	0002h		;AN000; CAP result by character table
   271                              <2> D_P_Rm_Colon	   equ	0010h		;AN000; Remove ":" at the end
   272                              <2> D_P_colon_is_not_necessary equ 0020h	;AN000;(tm10) /+10 and /+:10
   273                              <2> 
   274                              <2> ;-------------------------------- Control block structure
   275                              <2> D_P_Control_Blk	   struc		;AN000;
   276 00000000 ????                <2> D_P_Match_Flag	   dw	? ;0		;AN000; Controls type matched
   277 00000002 ????                <2> D_P_Function_Flag   dw	? ;0		;AN000; Function should be taken
   278 00000004 ????                <2> D_P_Result_Buf	   dw	? ;0		;AN000; Result buffer address
   279 00000006 ????                <2> D_P_Value_List	   dw	? ;0		;AN000; Value list address
   280 00000008 ??                  <2> D_P_nid		   db	? ;0		;AN000; # of keyword/SW synonyms
   281 00000009 ??                  <2> D_P_KeyorSW	   db	? ;0		;AN000; keyword or sw
   282                              <2> D_P_Control_Blk	   ends 		;AN000;
   283                              <2> ;		   PAGE 		;AN000;
   284                              <2> ;---------------------------------------------------------------------------------------------------------
   285                              <2> ; << Value List Definition >>
   286                              <2> ;
   287                              <2> ;VALUES 	LABEL	BYTE
   288                              <2> ;		DB	nval			; NUMBER OF VALUE DEFINITIONS (0 - 3)
   289                              <2> ;	     =
   290                              <2> ;	     =	DB	nrng			; NUMBER OF RANGES
   291                              <2> ;	     = =DB	ITEM_TAG		; RETURN VALUE IF RANGE MATCHED
   292                              <2> ;	     = =DD	X,Y			; RANGE OF VALUES
   293                              <2> ;	     =	:
   294                              <2> ;	     =	DB	nnval			; NUMBER OF CHOICES
   295                              <2> ;	     = =DB	ITEM_TAG		; RETURN VALUE IF NUMBER CHOICE MATCHED
   296                              <2> ;	     = =DD	VALUE			; SPECIFIC CHOICE IF NUMBER
   297                              <2> ;	     =	:
   298                              <2> ;	     =	DB	nstrval 		; NUMBER OF CHOICES
   299                              <2> ;	     = =DB	ITEM_TAG		; RETURN VALUE IF STRING CHOICE MATCHED
   300                              <2> ;	     = =DW	STRING			; SPECIFIC CHOICE IF STING
   301                              <2> ;	     =	:
   302                              <2> ;
   303                              <2> ;STRING 	DB	"...",0                 ; ASCIIZ STRING IMAGE
   304                              <2> ;
   305                              <2> ;Note:
   306                              <2> ;    - ITEM_TAG must not be 0FFH, which will be used in the result buffer
   307                              <2> ;      when no choice lists are provided.
   308                              <2> ;
   309                              <2> ;    - STRING must consist of upper case characters only because the parser
   310                              <2> ;      performs pattern matching after converting input to upper case (by
   311                              <2> ;      using the current country upper case table)
   312                              <2> ;---------------------------------------------------------------------------------------------------------
   313                              <2> 
   314                              <2> D_P_nval_None	   equ	0		;AN000; no value list ID
   315                              <2> D_P_nval_Range	   equ	1		;AN000; range list ID
   316                              <2> D_P_nval_Value	   equ	2		;AN000; value list ID
   317                              <2> D_P_nval_String	   equ	3		;AN000; string list ID
   318                              <2> D_P_Len_Range	   equ	9		;AN000; Length of a range choice(two DD plus one DB)
   319                              <2> D_P_Len_Value	   equ	5		;AN000; Length of a value choice(one DD plus one DB)
   320                              <2> D_P_Len_String	   equ	3		;AN000; Length of a string choice(one DW plus one DB)
   321                              <2> D_P_No_nrng	   equ	0		;AN000; (tm07) no nrng. nnval must not be 0.
   322                              <2> 
   323                              <2> D_P_Val_List	   struc		;AN000;
   324 00000000 ??                  <2> D_P_NumofList	   db	? ;0		;AN000; number of following choice
   325 00000001 ????                <2> D_P_Val_XL	   dw	? ;0		;AN000; lower word of value
   326 00000003 ????                <2> D_P_Val_XH	   dw	? ;0		;AN000; higher word of value
   327 00000005 ????                <2> D_P_Val_YL	   dw	? ;0		;AN000; lower word of another value
   328 00000007 ????                <2> D_P_Val_YH	   dw	? ;0		;AN000; higher word of another value
   329                              <2> D_P_Val_List	   ends 		;AN000;
   330                              <2> ;		   PAGE 		;AN000;
   331                              <2> ;---------------------------------------------------------------------------------------------------------
   332                              <2> ; << Result Buffer Definition  >>
   333                              <2> ;
   334                              <2> ;RESULT 	LABEL	BYTE			; BELOW FILLED IN FOR DEFAULTS
   335                              <2> ;		DB	type			; TYPE RETURNED: 0=RESERVED,
   336                              <2> ;						;	1=NUMBER, 2=LIST INDEX,
   337                              <2> ;						;	3=STRING, 4=COMPLEX,
   338                              <2> ;						;	5=FILESPEC, 6=DRIVE
   339                              <2> ;						;	7=DATE, 8=TIME
   340                              <2> ;						;	9=QUOTED STRING
   341                              <2> ;		DB	ITEM_TAG		; MATCHED ITEM TAG
   342                              <2> ;
   343                              <2> ;		dw	synonym@		; es:@ points to found SYNONYM if provided.
   344                              <2> ;
   345                              <2> ;
   346                              <2> ;	    =	DD	n			; VALUE IF NUMBER
   347                              <2> ;	    = or
   348                              <2> ;	    =	DW	i			; INDEX (OFFSET) INTO VALUE LIST
   349                              <2> ;	    =					; (ES presents Segment address)
   350                              <2> ;	    = or
   351                              <2> ;	    =	DD	STRING			; OFFSET OF STRING VALUE
   352                              <2> ;	    = or
   353                              <2> ;	    =	DB	drv			; DRIVE NUMBER (1-A, 2-B,..., 26-Z)
   354                              <2> ;	    = or
   355                              <2> ;	    =	DW	YEAR	   ;(1980-2099)  IN CASE OF DATE
   356                              <2> ;	    =	DB	MONTH	   ;(1-12)	 Note: Range check is not performed.
   357                              <2> ;	    =	DB	DATE	   ;(1-31)	       0 is filled when the corresponding field was not specified.
   358                              <2> ;	    = or
   359                              <2> ;	    =	DB	HOUR	   ;(0-23)	  IN CASE OF TIME
   360                              <2> ;	    =	DB	MINUTES    ;(0-59)	  Note: Range check is not performed .
   361                              <2> ;	    =	DB	SECONDS    ;(0-59)		0 is filled when the corresponding field was not specified .
   362                              <2> ;	    =	DB	HUNDREDTHS ;(0-99)
   363                              <2> ;	    =
   364                              <2> ;
   365                              <2> ;
   366                              <2> ;Note: ITEM_TAG is 0FFH when the caller does not specify the choice
   367                              <2> ;      list.
   368                              <2> ;
   369                              <2> ;      YEAR: If the input value for the year is less than 100, parser
   370                              <2> ;	     adds 1900 to it.  For example, when 87 is input to parser for
   371                              <2> ;	     the year value, he returns 1987.
   372                              <2> ;---------------------------------------------------------------------------------------------------------
   373                              <2> 
   374                              <2> ;-------------------------------- Result block structure
   375                              <2> D_P_Result_Blk	   struc		;AN000;
   376 00000000 ??                  <2> D_P_Type 	   db	? ;0		;AN000; Type returned
   377 00000001 ??                  <2> D_P_Item_Tag	   db	? ;0		;AN000; Matched item tag
   378 00000002 ????                <2> D_P_SYNONYM_Ptr	   dw	? ;0		;AN000; pointer to Synonym list returned
   379 00000004 ????????            <2> D_P_Picked_Val	   db	?,?,?,? ;0,0,0,0 	;AN000; value
   380                              <2> D_P_Result_Blk	   ends 		;AN000;
   381                              <2> ;--------------------------------
   382                              <2> ;**** values for the type field in the result block
   383                              <2> 
   384                              <2> D_P_EOL		   equ	0		;AN000; End of line
   385                              <2> D_P_Number	   equ	1		;AN000; Number
   386                              <2> D_P_List_Idx	   equ	2		;AN000; List Index
   387                              <2> D_P_String	   equ	3		;AN000; String
   388                              <2> D_P_Complex	   equ	4		;AN000; Complex
   389                              <2> D_P_File_Spec	   equ	5		;AN000; File Spec
   390                              <2> D_P_Drive	   equ	6		;AN000; Drive
   391                              <2> D_P_Date_F	   equ	7		;AN000; Date
   392                              <2> D_P_Time_F	   equ	8		;AN000; Time
   393                              <2> D_P_Quoted_String   equ	9		;AN000; Quoted String
   394                              <2> 
   395                              <2> D_P_No_Tag	   equ	0FFH		;AN000; No ITEM_TAG found
   396                              <2> ;**** Return code
   397                              <2> ;
   398                              <2> ; following return code will be returned in the AX register.
   399                              <2> 
   400                              <2> D_P_No_Error	   equ	0		;AN000; No error
   401                              <2> D_P_Too_Many	   equ	1		;AN000; Too many operands
   402                              <2> D_P_Op_Missing	   equ	2		;AN000; Required operand missing
   403                              <2> D_P_Not_In_SW	   equ	3		;AN000; Not in switch list provided
   404                              <2> D_P_Not_In_Key	   equ	4		;AN000; Not in keyword list provided
   405                              <2> D_P_Out_Of_Range    equ	6		;AN000; Out of range specified
   406                              <2> D_P_Not_In_Val	   equ	7		;AN000; Not in value list provided
   407                              <2> D_P_Not_In_Str	   equ	8		;AN000; Not in string list provided
   408                              <2> D_P_Syntax	   equ	9		;AN000; Syntax error
   409                              <2> D_P_RC_EOL	   equ	-1		;AN000; End of command line
   410                              <2> 
   411                              <2> ;		   PAGE 		;AN000;
   412                              <2> ;********************** Local Data *************************************
   413 000003BF 0000                <2> D_P_ORDINAL	   dw	0		;AN000; Operand ordinal save area
   414 000003C1 0000                <2> D_P_RC		   dw	0		;AN000; Return code from parser
   415 000003C3 0000                <2> D_P_SI_Save	   dw	0		;AN000; Pointer of command buffer
   416 000003C5 0000                <2> D_P_DX		   dw	0		;AN000; Return result buffer address
   417 000003C7 00                  <2> D_P_Terminator	   db	0		;AN000; Terminator code (ASCII)
   418 000003C8 0000                <2> D_P_DBCSEV_OFF	   dw	0		;AN000; Offset of DBCS EV
   419 000003CA 0000                <2> D_P_DBCSEV_SEG	   dw	0		;AN000; Segment of DBCS EV
   420 000003CC 0000                <2> D_P_Flags	   dw	0		;AN000; Parser internal flags
   421                              <2> labelsize D_P_Flags1, byte, D_P_Flags ;AN038; to reference first byte flags
   422                              <2> labelsize D_P_Flags2, byte, D_P_Flags+1 ;AN038; to reference second byte flags only
   423                              <2> 
   424                              <2> ;in second byte of D_P_Flags, referenced as D_P_Flags2:
   425                              <2> D_P_equ		   equ	01h	      ;AN000; "=" packed in string buffet
   426                              <2> D_P_Neg		   equ	02h	      ;AN000; Negative value
   427                              <2> D_P_Time12	   equ	04h	      ;AN000; set when PM is specified
   428                              <2> D_P_Key_Cmp	   equ	08h	      ;AN000; set when keyword compare
   429                              <2> D_P_SW_Cmp	   equ	10h	      ;AN000; set when switch compare
   430                              <2> D_P_Extra	   equ	20h	      ;AN000; set when extra delimiter found
   431                              <2> D_P_SW		   equ	40h	      ;AN000; set when switch found (tm08)
   432                              <2> D_P_Signed	   equ	80h	      ;AN000; signed numeric specified
   433                              <2> 
   434                              <2> ;in first byte of D_P_Flags, referenced as D_P_Flags1:
   435                              <2> D_P_time12am	   equ	01h	      ;AN038; set when AM is specified on time
   436                              <2> D_P_TIME_AGAIN	   EQU	02H	      ;AN039; SET WHEN READY TO RE-PARSE TIME
   437                              <2> 
   438 000003CE 0000                <2> D_P_SaveSI_Cmpx	   dw	0		;AN000; save si for later use by complex
   439 000003D0 0000                <2> D_P_KEYorSW_Ptr	   dw	0		;AN000; points next to "=" or ":" code
   440 000003D2 0000                <2> D_P_Save_EOB	   dw	0		;AN000; save pointer to EOB
   441 000003D4 0000                <2> D_P_Found_SYNONYM   dw	0		;AN000; es:@ points to found synonym
   442                              <2> 
   443 000003D6 000000000000000000- <2> D_P_STRING_BUF	   db	128 dup(0)	;AN000; Pick a operand from command line
   443 000003DF 000000000000000000- <2>
   443 000003E8 000000000000000000- <2>
   443 000003F1 000000000000000000- <2>
   443 000003FA 000000000000000000- <2>
   443 00000403 000000000000000000- <2>
   443 0000040C 000000000000000000- <2>
   443 00000415 000000000000000000- <2>
   443 0000041E 000000000000000000- <2>
   443 00000427 000000000000000000- <2>
   443 00000430 000000000000000000- <2>
   443 00000439 000000000000000000- <2>
   443 00000442 000000000000000000- <2>
   443 0000044B 000000000000000000- <2>
   443 00000454 0000                <2>
   444                              <2> D_P_STRING_BUF_END  equ	$		;AN000;
   445                              <2> %IF		   TimeSw		;AN039; For TIME only
   446                              <2> D_P_ORIG_ORD	   DW	0		;AN039; ORIGINAL ORDINAL FROM CX
   447                              <2> D_P_ORIG_STACK	   DW	0		;AN039; ORIGINAL VALUE OF STACK FROM SP
   448                              <2> D_P_ORIG_SI	   DW	0		;AN039; ORIGINAL START PARSE POINTER FROM SI
   449                              <2> %endif					;AN039;
   450                              <2> %IF		   DateSw+TimeSw	;AN000;(Check if date or time format is supported)
   451                              <2> ;------------------------------
   452                              <2> ;
   453                              <2> D_P_Got_Time	   db	0		;AN023; if 1, use Time delimiters
   454                              <2> D_P_NeedToBeRead    equ	0ffffh		;AN000;
   455                              <2> 
   456                              <2> D_P_COUNTRY_INFO: ; NASM structure instance
   457                              <2> D_P_CDI_size equ D_P_CDI_struc_size	; NASM port equate
   458                              <2> istruc D_P_CDI
   459                              <2> at D_P_CDI_DateF
   460                              <2> 	dw D_P_NeedToBeRead
   461                              <2> iend
   462                              <2> ;
   463                              <2> D_P_1st_Val	   dw	0		;AN000; used when process date or time
   464                              <2> D_P_2nd_Val	   dw	0		;AN000; used when process date or time
   465                              <2> D_P_3rd_Val	   dw	0		;AN000; used when process date or time
   466                              <2> D_P_4th_Val	   dw	0		;AN000; used when process date or time
   467                              <2> ;------------------------------
   468                              <2> %endif					;AN000;(of DateSW+TimeSW)
   469 00000456 FF                  <2> D_P_Char_CAP_Ptr    db	0ffh		;AN000; info id
   470 00000457 0000                <2> 		   dw	0		;AN000; offset	of char case map table
   471 00000459 0000                <2> 		   dw	0		;AN000; segment of char case map table
   472                              <2> %IF		   CAPSW		;AN000;(Check if uppercase conversion is supported)
   473                              <2> D_P_File_CAP_Ptr    db	0ffh		;AN000; info id
   474                              <2> 		   dw	0		;AN000; offset	of file case map table
   475                              <2> 		   dw	0		;AN000; segment of file case map table
   476                              <2> %endif					;AN000;(of CAPSW)
   477                              <2> ; (tm06) IF	   FileSW		;AN000;(Check if file spec is supported)
   478                              <2> %IF		   FileSW+DrvSW 	;AN000;(Check if file spec is supported)
   479 0000045B 5B5D7C3C3E2B3D3B22  <2> D_P_FileSp_Char	   db	'[]|<>+=;"'     ;AN000; delimitter of file spec
   480                              <2> D_P_FileSp_Len	   equ	$-D_P_FileSp_Char ;AN000;
   481                              <2> %endif					;AN000;(of FileSW)
   482                              <2> ; (tm05) IF	   QusSW		;AN000;(Check if quoted string is supported)
   483                              <2> ;(deleted ;AN025;) IF		      QusSW+CmpxSW	   ; (tm05) ;AN000;(Check if quoted string is supported)
   484                              <2> ;(deleted ;AN025;) D_P_SorD_Quote      db   0		   ;AN000; keep double or single quote
   485                              <2> ;(deleted ;AN025;) %endif				   ;AN000;(of QueSW)
   486                              <2> %IF		   KeySW		;AN029; if keywords supported
   487                              <2> D_P_count_to_eol    dw	0		;AN029; count of chars not including EOL
   488                              <2> ;	REGISTER EQUATES - SPECIAL USAGE FOR REGISTERS
   489                              <2> %idefine D_P_REG_BH_CG_SW	BH		;AN029;0="NO CHANGES MADE", FF=CHANGES MADE
   490                              <2> %idefine D_P_REG_BL_DQ_SW	BL		;AN029;0=NOT IN QUOTES,FF=IN QUOTES
   491                              <2> 
   492                              <2> D_P_DOUBLE_QUOTE    EQU	'"'            ;AN029;
   493                              <2> D_P_BL_EQ	   EQU	"= "            ;AN029;
   494                              <2> D_P_EQ_BL	   EQU	" ="            ;AN029;
   495                              <2> D_P_TB_EQ	   EQU	093DH		;AN029; ;"<TAB>="
   496                              <2> D_P_EQ_TB	   EQU	3D09H		;AN029; ;"=<TAB>"
   497                              <2> %endif					;AN029; IF KeySW Supported
   498                              <2> 
   499                              <2> ; delimiter parsing
   500                              <2> D_P_colon_period    equ	01		;AN032; check for colon & period
   501                              <2> D_P_period_only	   equ	02		;AN032; check only for period
   502                              <2> 
   503                              <2> ;filespec error flag
   504 00000464 00                  <2> D_P_err_flag	   db	00		;AN033; flag set if filespec parsing error
   505                              <2> 					;AN033;  was detected.
   506                              <2> D_P_error_filespec  equ	01		;AN033; mask to set flag
   507                              <2> ;***********************************************************************
    30                              <1> %endif					;AN000; endif		  (tm03)
    31                              <1> ;   PAGE 				;AN000;
    32                              <1>    %warning out: INCLUDING COMP=COMMON DSN=PARSE.ASM...;AN000;
    32          ******************  <1>  warning: out: INCLUDING COMP=COMMON DSN=PARSE.ASM... [-w+user]
    33                              <1> ;***********************************************************************
    34                              <1> ; SysParse;
    35                              <1> ;
    36                              <1> ;  Function : Parser Entry
    37                              <1> ;
    38                              <1> ;  Input: DS:SI -> command line
    39                              <1> ;	  ES:DI -> parameter block
    40                              <1> ;	  psdata_seg -> psdata.inc
    41                              <1> ;	  CX = operand ordinal
    42                              <1> ;
    43                              <1> ;	  Note:  ES is the segment containing all the control blocks defined
    44                              <1> ;		 by the caller, except for the DOS COMMAND line parms, which
    45                              <1> ;		 is in DS.
    46                              <1> ;
    47                              <1> ;  Output: CY = 1   error of caller, means invalid parameter block or
    48                              <1> ;		    invalid value list. But this parser does NOT implement
    49                              <1> ;		    this feature. Therefore CY always zero.
    50                              <1> ;
    51                              <1> ;	   CY = 0   AX = return code
    52                              <1> ;		    BL = terminated delimiter code
    53                              <1> ;		    CX = new operand ordinal
    54                              <1> ;		    SI = set past scaned operand
    55                              <1> ;		    DX = selected result buffer
    56                              <1> ;
    57                              <1> ; Use:	D_P_Skip_Delim, D_P_Chk_EOL, D_P_Chk_Delim, D_P_Chk_DBCS
    58                              <1> ;	D_P_Chk_Swtch, D_P_Chk_Pos_Control, D_P_Chk_Key_Control
    59                              <1> ;	D_P_Chk_Sw_Control, D_P_Fill_Result
    60                              <1> ;
    61                              <1> ; Vars: D_P_Ordinal(RW), D_P_RC(RW), D_P_SI_Save(RW), D_P_DX(R), D_P_Terminator(R)
    62                              <1> ;	D_P_SaveSI_Cmpx(W), D_P_Flags(RW), D_P_Found_SYNONYM(R), D_P_Save_EOB(W)
    63                              <1> ;
    64                              <1> ;-------- Modification History -----------------------------------------
    65                              <1> ;
    66                              <1> ;  4/04/87 : Created by K. K,
    67                              <1> ;  4/28/87 : D_P_Val_YH assemble error (tm01)
    68                              <1> ;	   : JMP SHORT assemble error (tm02)
    69                              <1> ;  5/14/87 : Someone doesn't want to include psdata (tm03)
    70                              <1> ;  6/12/87 : D_P_Bridge is missing when TimeSw equ 0 and (CmpxSw equ 1 or
    71                              <1> ;	     DateSW equ 1)	      (tm04)
    72                              <1> ;  6/12/87 : D_P_SorD_Quote is missing when QusSw equ 0 and CmpxSW equ 1
    73                              <1> ;				      (tm05) in PSDATA.INC
    74                              <1> ;  6/12/87 : D_P_FileSp_Char and D_P_FileSP_Len are missing
    75                              <1> ;	     when FileSW equ 0 and DrvSW equ 1 (tm06) in PSDATA.INC
    76                              <1> ;  6/18/87 : $VAL1 and $VAL3, $VAL2 and $VAL3 can be used in the same
    77                              <1> ;	     value-list block	      (tm07)
    78                              <1> ;  6/20/87 : Add D_P_SW to check if there's an omiting parameter after
    79                              <1> ;	     switch (keyword) or not. If there is, backup si for next call
    80                              <1> ;	     (tm08)
    81                              <1> ;  6/24/87 : Complex Item checking does not work correctly when CmpSW equ 1
    82                              <1> ;	     and DateSW equ 0 and TimeSW equ 0 (tm09)
    83                              <1> ;  6/24/87 : New function flag D_P_colon_is_not_necessary for switch
    84                              <1> ;	     /+15 and /+:15 are allowed for user (tm10)
    85                              <1> ;  6/29/87 : ECS call changes DS register but it causes the address problem
    86                              <1> ;	     in user's routines. D_P_Chk_DBCS (tm11)
    87                              <1> ;  7/10/87 : Switch with no_match flag (0x0000H) does not work correctly
    88                              <1> ;					  (tm12)
    89                              <1> ;  7/10/87 : Invalid switch/keyword does not work correctly
    90                              <1> ;					  (tm13)
    91                              <1> ;  7/10/87 : Drive_only breaks 3 bytes after the result buffer
    92                              <1> ;					  (tm14)
    93                              <1> ;  7/12/87 : Too_Many_Operands sets DX=0 as the PARSE result
    94                              <1> ;					  (tm15)
    95                              <1> ;  7/24/87 : Negative lower bound on numeric ranges cause trouble
    96                              <1> 
    97                              <1> ;  7/24/87 : Quoted strings being returned with quotes.
    98                              <1> 
    99                              <1> ;  7/28/87 : Kerry S (;AN018;)
   100                              <1> ;	     Non optional value on switch (match flags<>0 and <>1) not flagged
   101                              <1> ;	     as an error when missing.	Solution: return error 2.  Modules
   102                              <1> ;	     affected: D_P_Chk_SW_Control.
   103                              <1> 
   104                              <1> ;  7/29/87 : Kerry S (;AN019;)
   105                              <1> ;	     Now allow the optional bit in match flags for switches.  This
   106                              <1> ;	     allows the switch to be encountered with a value or without a
   107                              <1> ;	     value and no error is returned.
   108                              <1> ;
   109                              <1> 
   110                              <1> ;  8/28/87 : Ed K, Kerry S (;AN020;)
   111                              <1> ;  9/14/87   In PROC D_P_Get_DecNum, when checking for field separators
   112                              <1> ;	     within a date response, instead of checking just for the one
   113                              <1> ;	     character defined by the COUNTRY DEPENDENT INFO, check for
   114                              <1> ;	     all three chars, "-", "/", and ".". Change D_P_Chk_Switch to allow
   115                              <1> ;	     slashes in date strings when DateSw (assembler switch) is set.
   116                              <1> 
   117                              <1> ;  9/1/87  : Kerry S (;AN021)
   118                              <1> ;	     In PROC D_P_String_Comp, when comparing the switch or keyword on
   119                              <1> ;	     the command line with the string in the control block the
   120                              <1> ;	     comparing was stopping at a colon (switch) or equal (keyword)
   121                              <1> ;	     on the command line and assuming a match.	This allowed a shorter
   122                              <1> ;	     string on the command line than in the synonym list in the control
   123                              <1> ;	     block.  I put in a test for a null in the control block so the
   124                              <1> ;	     string in the control block must be the same length as the string
   125                              <1> ;	     preceeding the colon or equal on the command line.
   126                              <1> 
   127                              <1> ;  8/28/87 : Kerry S (;AN022;)
   128                              <1> ;	     All references to data in PSDATA.INC had CS overrides.  This caused
   129                              <1> ;	     problems for people who included it themselves in a segment other
   130                              <1> ;	     than CS.  Added switch to allow including PSDATA.INC in any
   131                              <1> ;	     segment.
   132                              <1> 
   133                              <1> ;  9/16/87 : Ed K (;AN023;) PTM1040
   134                              <1> ;	     in D_P_set_cdi PROC, it assumes CS points to psdata. Change Push CS
   135                              <1> ;	     into PUSH PSDATA_SEG.  In D_P_Get_DecNum PROC, fix AN020
   136                              <1> ;	     forced both TIME and DATE to use the delims, "-","/",".".
   137                              <1> ;	     Created FLag, in D_P_time_Format PROC, to request the delim in
   138                              <1> ;	     BL be used if TIME is being parsed.
   139                              <1> 
   140                              <1> ;  9/24/87 : Ed K
   141                              <1> ;	     Removed the include to STRUC.INC.	Replaced the STRUC macro
   142                              <1> ;	     invocations with their normally expanded code; made comments
   143                              <1> ;	     out of the STRUC macro invocation statements to maintain readability.
   144                              <1> 
   145                              <1> ;  9/24/87 : Ed K (;AN024;) PTM1222
   146                              <1> ;	     When no CONTROL for a keyword found, tried to fill in RESULT
   147                              <1> ;	     pointed to by non-existant CONTROL.
   148                              <1> 
   149                              <1> ; 10/15/87 : Ed K (;AN025;) PTM1672
   150                              <1> ;	     A quoted text string can be framed only by double quote.  Remove
   151                              <1> ;	     support to frame quoted text string with single quote.
   152                              <1> ;	     (apostrophe) D_P_SorD_Quote is removed from PSDATA.INC.
   153                              <1> ;	     D_P_SQuote EQU also removed from PSDATA.INC.  Any references to
   154                              <1> ;	     single quote in PROC prologues are left as is for history reasons.
   155                              <1> 
   156                              <1> ;	     This fixes another bug, not mentioned in p1672, in that two
   157                              <1> ;	     quote chars within a quoted string is supposed to be reported as
   158                              <1> ;	     one quote character, but is reported as two quotes.  This changed
   159                              <1> ;	     two instructions in PROC D_P_Quoted_Str.
   160                              <1> 
   161                              <1> ;	     Also fixed are several JMP that caused a NOP, these changed to
   162                              <1> ;	     have the SHORT operator to avoid the unneeded NOP.
   163                              <1> 
   164                              <1> ;	     The code and PSDATA.INC have been aligned for ease of reading.
   165                              <1> 
   166                              <1> ; 10/26/87 : Ed K (;AN026;) PTM2041, DATE within SWITCH, BX reference to
   167                              <1> ;	     psdata buffer should have psdata_seg.
   168                              <1> 
   169                              <1> ; 10/27/87 : Ed K (;AN027;) PTM2042 comma between keywords implies
   170                              <1> ;	     positional missing.
   171                              <1> 
   172                              <1> ; 11/06/87 : Ed K (;AN028;) PTM 2315 Parser should not use line feed
   173                              <1> ;	     as a line delimiter, should use carriage return.
   174                              <1> ;	     Define switch: LFEOLSW, if on, accept LF as end of line char.
   175                              <1> 
   176                              <1> ; 11/11/87 : Ed K (;AN029;) PTM 1651 GET RID OF WHITESPACE AROUND "=".
   177                              <1> 
   178                              <1> ; 11/18/87 : Ed K (;AN030;) PTM 2551 If filename is just "", then
   179                              <1> ;	     endless loop since SI is returned still pointing to start
   180                              <1> ;	     of that parm.
   181                              <1> 
   182                              <1> ; 11/19/87 : Ed K (;AN031;) PTM 2585 date & time getting bad values.
   183                              <1> ;	     Vector to returned string has CS instead of Psdata_Seg, but
   184                              <1> ;	     when tried to fix it on previous version, changed similar
   185                              <1> ;	     but wrong place.
   186                              <1> 
   187                              <1> ; 12/09/87 : Bill L (;AN032;) PTM 2772 colon and period are now valid
   188                              <1> ;	     delimiters between hours, minutes, seconds for time. And period
   189                              <1> ;	     and comma are valid delimiters between seconds and 100th second.
   190                              <1> 
   191                              <1> ; 12/14/87 : Bill L (;AN033;) PTM 2722 if illegal delimiter characters
   192                              <1> ;	     in a filespec, then flag an error.
   193                              <1> 
   194                              <1> ; 12/22/87 : Bill L (;AN034;)	    All local data to parser is now
   195                              <1> ;	     indexed off of the psdata_seg equate instead of the DS register.
   196                              <1> ;	     Using this method, DS can point to the segment of PSP or to psdata
   197                              <1> ;  -->	     local parser data. Why were some references to local data changed
   198                              <1> ;	     to do this before, but not all ?????
   199                              <1> 
   200                              <1> ; 02/02/88 : Ed K (;AC035;) INSPECT utility, suggests optimizations.
   201                              <1> 
   202                              <1> ; 02/05/88 : Ed K (;AN036;) P3372-UPPERCASE TRANSLATION, PSDATA_SEG HOSED.
   203                              <1> ;
   204                              <1> ; 02/08/88 : Ed K (;AN037;) P3410-AVOID POP OF CS, CHECK BASESW FIRST.
   205                              <1> 
   206                              <1> ; 02/19/88 : Ed K (;AN038;) p3524 above noon and "am" should be error
   207                              <1> 
   208                              <1> ; 02/23/88 : Ed K (;AN039;) p3518 accept "comma" and "period" as decimal
   209                              <1> ;	     separator in TIME before hundredths field.
   210                              <1> ;
   211                              <1> ;***********************************************************************
   212                              <1> %IF FarSW				;AN000;(Check if need far return)
   213                              <1> SysParse proc far			;AN000;
   214                              <1> %ELSE					;AN000;
   215                              <1> SysParse proc near			;AN000;
   216                              <1> %ENDIF					;AN000;(of FarSW)
   217                              <1> ;	$SALUT	(4,9,17,41)
   218 00000465 2EC706[CC03]0000    <1> 	mov	word [psdata_seg:D_P_Flags],0	;AC034; Clear all internal flags
   219                              <1> %IF	TimeSw				;AN039; FOR TIME ONLY
   220                              <1> 	MOV    [PSDATA_SEG:D_P_ORIG_ORD],CX ;AN039; ORIGINAL ORDINAL FROM CX
   221                              <1> 	MOV    [PSDATA_SEG:D_P_ORIG_STACK],SP ;AN039; ORIGINAL VALUE OF STACK FROM SP
   222                              <1> 	MOV    [PSDATA_SEG:D_P_ORIG_SI],SI ;AN039; ORIGINAL START PARSE POINTER FROM SI
   223                              <1> D_P_REDO_TIME:				;AN039; try to parse time again
   224                              <1> %ENDIF					;AN039; FOR TIME ONLY
   225 0000046C FC                  <1> 	cld				      ;AN000; confirm forward direction
   226                              <1> D_P_ordinal equ D_P_ORDINAL	; NASM port label
   227 0000046D 2E890E[BF03]        <1> 	mov	[psdata_seg:D_P_ordinal],cx      ;AC034; save operand ordinal
   228 00000472 2EC706[C103]0000    <1> 	mov	word [psdata_seg:D_P_RC],D_P_No_Error  ;AC034; Assume no error
   229 00000479 2EC706[D403]0000    <1> 	mov	word [psdata_seg:D_P_Found_SYNONYM],0 ;AC034; initalize synonym pointer
   230                              <1> 
   231 00000480 2EC706[C503]0000    <1> 	mov	word [psdata_seg:D_P_DX],0   ;AC034; (tm15)
   232                              <1> %IF KeySW				;AN029;
   233                              <1> ;IN CASE THE USER PUT OPTIONAL WHITESPACE CHARS AROUND THE "=" USED IN
   234                              <1> ;KEYWORD DEFINITIONS, SCAN THE COMMAND LINE AND COMPRESS OUT ANY WHITESPACES
   235                              <1> ;NEXT TO "=" BEFORE STARTING THE USUAL PARSING.
   236                              <1>        push	 cx			;AN029;
   237                              <1>        push	 dx			;AN029;
   238                              <1>        push	 di			;AN029;
   239                              <1> 
   240                              <1>        push	 si			;AN029; remember where command line starts
   241                              <1>        mov	 cx,-1			;AN029; init counter
   242                              <1> ;      $do
   243                              <1> D_P_loc_eol:				;AN029;
   244                              <1> 	  inc	    cx			;AN029; bump counter of chars up to EOL
   245                              <1> 	  lodsb 			;AN029; get a char from command line
   246                              <1> 	  CALL	    D_P_Chk_EOL		;AN029; see if AL is EOL char
   247                              <1> 
   248                              <1> ;      enddo z
   249                              <1> D_P_loc_EOL equ D_P_loc_eol	; NASM port label
   250                              <1>        jnz	 D_P_loc_EOL		;AN029; not found that EOL char
   251                              <1> 
   252                              <1> D_P_count_to_EOL equ D_P_count_to_eol	; NASM port label
   253                              <1>        mov	 [psdata_seg:D_P_count_to_EOL],cx ;AN029;AC034;; save count of chars up to EOL
   254                              <1>        pop	 si			;AN029; restore start of command line
   255                              <1> 
   256                              <1> ;scan command string for combinations including "=",
   257                              <1> ;      and replace each with just the simple "="
   258                              <1> 
   259                              <1> ;REPEAT UNTIL ONE PASS IS MADE WHEREIN NO CHANGES WERE MADE
   260                              <1> ;  $do
   261                              <1> D_P_DO1: 			   ;AN029;
   262                              <1>        push si			   ;AN029; remember where string started
   263                              <1> D_P_COUNT_TO_EOL equ D_P_count_to_eol	; NASM port label
   264                              <1>        MOV  CX,[psdata_seg:D_P_COUNT_TO_EOL] ;AN029;AC034;; set  count to no. chars in string,
   265                              <1> 				   ;AN029; not counting the EOL char
   266                              <1>        XOR  BX,BX		   ;AN029;SET D_P_REG_BL_DQ_SW TO "NOT IN QUOTES", AND...
   267                              <1> 				   ;AN029;SET D_P_REG_BH_CG_SW TO "NO CHANGES MADE"
   268                              <1> ;MAKE ONE PASS THRU THE STRING, LOOKING AT EACH CHARACTER
   269                              <1> ;      $do			   ;AN029;
   270                              <1> D_P_DO2: 			   ;AN029;
   271                              <1> D_P_double_quote equ D_P_DOUBLE_QUOTE	; NASM port equate
   272                              <1> 	   cmp	BYTE PTR [SI],D_P_double_quote ;AN029;
   273                              <1> ;	   $if	e		   ;AN029;if a double quote was found
   274                              <1> 	   JNE D_P_IF3		   ;AN029;
   275                              <1> 	       NOT  D_P_REG_BL_DQ_SW ;AN029;TOGGLE THE DOUBLE QUOTE STATE SWITCH
   276                              <1> ;	   $endif		   ;AN029;
   277                              <1> D_P_IF3: 			   ;AN029;
   278                              <1> 	   OR	D_P_REG_BL_DQ_SW,D_P_REG_BL_DQ_SW ;AN029;IS THE DOUBLE QUOTE SWITCH SET?
   279                              <1> ;	   $if	Z		   ;AN029;IF NOT IN DOUBLE QUOTES
   280                              <1> 	   JNZ D_P_IF5		   ;AN029;
   281                              <1> 	       mov  ax,word ptr [si] ;AN029; get pair to be checked out
   282                              <1> 	       cmp  ax,D_P_BL_EQ    ;AN029;" ="
   283                              <1> ;	       $if  e,or	   ;AN029;
   284                              <1> 	       JE D_P_LL6	   ;AN029;
   285                              <1> 	       cmp  ax,D_P_EQ_BL    ;AN029;"= "
   286                              <1> ;	       $if  e,or	   ;AN029;
   287                              <1> 	       JE D_P_LL6	   ;AN029;
   288                              <1> 	       cmp  ax,D_P_EQ_TB    ;AN029; "=<tab>"
   289                              <1> ;	       $if  e,or	   ;AN029;
   290                              <1> 	       JE D_P_LL6	   ;AN029;
   291                              <1> 	       cmp  ax,D_P_TB_EQ    ;AN029;"<tab>="
   292                              <1> ;	       $if  e		   ;AN029;if this pair to be replaced with a single "="
   293                              <1> 	       JNE D_P_IF6	   ;AN029;
   294                              <1> D_P_LL6: 			   ;AN029;
   295                              <1> 		   mov	BYTE PTR [SI],D_P_Keyword ;AN029; "="
   296                              <1> 		   inc	si	   ;AN029;point to next char after the new "="
   297                              <1> 		   mov	di,si	   ;AN029;move target right after new "="
   298                              <1> 
   299                              <1> 		   push si	   ;AN029;remember where i am, right after new "="
   300                              <1> 		   PUSH CX	   ;AN029;SAVE CURRENT COUNT
   301                              <1> 		   inc	si	   ;AN029;source is one beyond that
   302                              <1> 		   push es	   ;AN029;remember the extra segment
   303                              <1> 		   push ds	   ;AN029;temporarily, set source seg and
   304                              <1> 		   pop	es	   ;AN029; target seg to the command line seg
   305                              <1> 		   rep	movsb	   ;AN029;move chars left one position
   306                              <1> 		   pop	es	   ;AN029;restore the extra segment
   307                              <1> 		   POP	CX	   ;AN029;RESTORE CURRENT COUNT
   308                              <1> 		   pop	si	   ;AN029;back to where I was
   309                              <1> 
   310                              <1> 		   DEC	SI	   ;AN029;LOOK AT FIRST CHAR JUST MOVED
   311                              <1> 		   MOV	D_P_REG_BH_CG_SW,-1 ;AN029;set switch to say "a change was made"
   312                              <1> 		   DEC	word [psdata_seg:D_P_COUNT_TO_EOL] ;AN029;AC034;;because just threw away a char
   313                              <1> 		   dec	CX	   ;AN029;DITTO
   314                              <1> ;	       $endif		   ;AN029;comparand pair found?
   315                              <1> D_P_IF6: 			   ;AN029;
   316                              <1> ;	   $endif		   ;AN029;double quote switch?
   317                              <1> D_P_IF5: 			   ;AN029;
   318                              <1> 	   inc	si		   ;AN029;bump index to look at next char in command string
   319                              <1> 	   dec	CX		   ;AN029;one less char to look at
   320                              <1> ;(deleted ;AC035;)  CMP  CX,0		    ;AN029;is char count all gone yet?
   321                              <1> ;      $enddo LE		   ;AN029;quit if no more chars
   322                              <1>        JNLE D_P_DO2		   ;AN029;
   323                              <1>        pop  si			   ;AN029;remember where string started
   324                              <1>        OR   D_P_REG_BH_CG_SW,D_P_REG_BH_CG_SW ;AN029;WAS "A CHANGE MADE"?
   325                              <1> ;  $enddo Z			   ;AN029;QUIT when no changes were made
   326                              <1>    JNZ D_P_DO1			   ;AN029;
   327                              <1>    pop	di			   ;AN029;
   328                              <1>    pop	dx			   ;AN029;
   329                              <1>    pop	cx			   ;AN029;
   330                              <1> 
   331                              <1> ;NOW THAT ALL WHITESPACE SURROUNDING "=" HAVE BEEN COMPRESSED OUT,
   332                              <1> ;RESUME NORMAL PARSING...
   333                              <1> %ENDIF					;AN029; KEYWORDS SUPPORTED?
   334 00000487 E8D106              <1> 	call	D_P_Skip_Delim		;AN000; Move si to 1st non white space
   335 0000048A 7313                <1> 	jnc	D_P_Start		;AN000; If EOL is not encountered, do parse
   336                              <1> 
   337                              <1> ;--------------------------- End of Line
   338 0000048C B8FFFF              <1> 	mov	ax,D_P_RC_EOL		;AN000; set exit code to -1
   339 0000048F 53                  <1> 	push	bx			;AN000;
   340 00000490 268B1D              <1> 	mov	bx,[es:di + D_P_PARMSX_Address] ;AN000; Get the PARMSX address to
   341 00000493 263A0F              <1> 	cmp	cl,[es:bx + D_P_MinP]	;AN000; check ORDINAL to see if the minimum
   342 00000496 7303                <1> 	jae	D_P_Fin			;AN000; positional found.
   343                              <1> 
   344 00000498 B80200              <1> 	mov	ax,D_P_Op_Missing	;AN000; If no, set exit code to missing operand
   345                              <1> D_P_Fin: 				;AN000;
   346 0000049B 5B                  <1> 	pop	bx			;AN000;
   347 0000049C E91D01              <1> 	jmp	D_P_Single_Exit		;AN000; return to the caller
   348                              <1> 
   349                              <1> ;---------------------------
   350                              <1> D_P_Start:				;AN000;
   351 0000049F 2E8936[CE03]        <1> 	mov	[psdata_seg:D_P_SaveSI_Cmpx],si ;AN000;AC034;  save ptr to command line for later use by complex,
   352 000004A4 53                  <1> 	push	bx			;AN000; quoted string or file spec.
   353 000004A5 57                  <1> 	push	di			;AN000;
   354 000004A6 55                  <1> 	push	bp			;AN000;
   355 000004A7 8D1E[D603]          <1> 	lea	bx,[D_P_STRING_BUF] ;AC034; set buffer to copy from command string
   356 000004AB 2EF606[CD03]20      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_Extra ;AC034; 3/9 extra delimiter encountered ?
   357 000004B1 7543                <1> 	jne	D_P_Pack_End		;AN000; 3/9 if yes, no need to copy
   358                              <1> 
   359                              <1> D_P_Pack_Loop:				;AN000;
   360 000004B3 AC                  <1> 	lodsb				;AN000; Pick a operand from buffer
   361 000004B4 E86107              <1> 	call	D_P_Chk_Switch		;AN000; Check switch character
   362 000004B7 723C                <1> 	jc	D_P_Pack_End_BY_EOL	;AN020; if carry set found delimiter type slash, need backup si, else continue
   363                              <1> 
   364 000004B9 E8C506              <1> 	call	D_P_Chk_EOL		;AN000; Check EOL character
   365 000004BC 7437                <1> 	je	D_P_Pack_End_BY_EOL	;AN000; need backup si
   366                              <1> 
   367 000004BE E8F606              <1> 	call	D_P_Chk_Delim		;AN000; Check delimiter
   368 000004C1 7518                <1> 	jne	D_P_PL01 		;AN000; If no, process next byte
   369                              <1> 
   370 000004C3 2EF606[CD03]20      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_Extra ;AC034; 3/9 If yes and white spec,
   371                              <1> ; (tm08)jne	D_P_Pack_End		;AN000; 3/9 then
   372                              <1> D_P_Pack_End_backup_si equ D_P_PAck_End_backup_si	; NASM port label
   373 000004C9 7505                <1> 	jne	D_P_Pack_End_backup_si	;AN000; (tm08)
   374                              <1> 
   375 000004CB E88D06              <1> 	call	D_P_Skip_Delim		;AN000; skip subsequent white space,too
   376 000004CE EB26                <1> 	jmp	short D_P_Pack_End	;AN000; finish copy by placing NUL at end
   377                              <1> 
   378                              <1> D_P_PAck_End_backup_si:			;AN000; (tm08)
   379 000004D0 2EF606[CD03]41      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_SW+D_P_equ ;AN000;AC034;  (tm08)
   380 000004D6 741E                <1> 	je	D_P_Pack_End		;AN000; (tm08)
   381                              <1> 
   382 000004D8 4E                  <1> 	dec	si			;AN000; (tm08)
   383 000004D9 EB1B                <1> 	jmp	short D_P_Pack_End	;AN025; (tm08)
   384                              <1> 
   385                              <1> D_P_PL01:				;AN000;
   386 000004DB 2E8807              <1> 	mov	[psdata_seg:bx],al	;AN000; move byte to STRING_BUF
   387 000004DE 3C3D                <1> 	cmp	al,D_P_Keyword		;AN000; if it is equal character,
   388 000004E0 7506                <1> 	jne	D_P_PL00 		;AN000; then
   389                              <1> 
   390 000004E2 2E800E[CD03]01      <1> 	or	byte [psdata_seg:D_P_Flags2],D_P_equ ;AC034; remember it in flag
   391                              <1> D_P_PL00:				;AN000;
   392 000004E8 43                  <1> 	inc	bx			;AN000; ready to see next byte
   393 000004E9 E84A07              <1> 	call	D_P_Chk_DBCS		;AN000; was it 1st byte of DBCS ?
   394 000004EC 73C5                <1> 	jnc	D_P_Pack_Loop		;AN000; if no, process to next byte
   395                              <1> 
   396 000004EE AC                  <1> 	lodsb				;AN000; if yes, store
   397 000004EF 2E8807              <1> 	mov	[psdata_seg:bx],al	;AN000;    2nd byte of DBCS
   398 000004F2 43                  <1> 	inc	bx			;AN000; update pointer
   399 000004F3 EBBE                <1> 	jmp	short D_P_Pack_Loop	;AN000; process to next byte
   400                              <1> 
   401                              <1> D_P_Pack_End_BY_EOL:			;AN000;
   402 000004F5 4E                  <1> 	dec	si			;AN000; backup si pointer
   403                              <1> D_P_Pack_End:				;AN000;
   404 000004F6 2E8936[C303]        <1> 	mov	[psdata_seg:D_P_SI_Save],si     ;AC034; save next pointer, SI
   405 000004FB 2EC60700            <1> 	mov	byte ptr [psdata_seg:bx],D_P_NULL ;AN000; put NULL at the end
   406 000004FF 2E891E[D203]        <1> 	mov	[psdata_seg:D_P_Save_EOB],bx    ;AC034; 3/17/87 keep the address for later use of complex
   407 00000504 268B1D              <1> 	mov	bx,[es:di + D_P_PARMSX_Address] ;AN000; get PARMSX address
   408 00000507 8D36[D603]          <1> 	lea	si,[D_P_STRING_BUF]  ;AC034;
   409 0000050B 2E803C2F            <1> 	cmp	byte ptr [psdata_seg:si],D_P_Switch ;AN000; the operand begins w/ switch char ?
   410 0000050F 7430                <1> 	je	D_P_SW_Manager		     ;AN000; if yes, process as switch
   411                              <1> 
   412 00000511 2EF606[CD03]01      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_equ   ;AC034; the operand includes equal char ?
   413                              <1> D_P_Key_manager equ D_P_Key_Manager	; NASM port label
   414 00000517 7554                <1> 	jne	D_P_Key_manager		     ;AN000; if yes, process as keyword
   415                              <1> 
   416                              <1> D_P_Positional_Manager:			;AN000; else process as positional
   417                              <1> D_P_MaxP equ D_P_Maxp	; NASM port equate
   418 00000519 268A4701            <1> 	mov	al,[es:bx + D_P_MaxP]	;AN000; get maxp
   419 0000051D 30E4                <1> 	xor	ah,ah			;AN000; ax = maxp
   420 0000051F 2E3906[BF03]        <1> 	cmp	[psdata_seg:D_P_ORDINAL],ax ;AC034; too many positional ?
   421 00000524 7312                <1> 	jae	D_P_Too_Many_Error	;AN000; if yes, set exit code to too many
   422                              <1> 
   423 00000526 2EA1[BF03]          <1> 	mov	ax,[psdata_seg:D_P_ORDINAL] ;AC034; see what the current ordinal
   424 0000052A D1E0                <1> 	shl	ax,1			;AN000; ax = ax*2
   425 0000052C 43                  <1> 	inc	bx			;AC035; add '2' to
   426 0000052D 43                  <1> 	inc	bx			;AC035;  BX reg
   427                              <1> 					;AN000; now bx points to 1st CONTROL
   428                              <1> ;(changed ;AC035;) add	   bx,2 	;AN000; now bx points to 1st CONTROL
   429 0000052E 01C3                <1> 	add	bx,ax			;AN000; now bx points to specified CONTROL address
   430 00000530 268B1F              <1> 	mov	bx,[es:bx]		;AN000; now bx points to specified CONTROL itself
   431 00000533 E88800              <1> 	call	D_P_Chk_Pos_Control	;AN000; Do process for positional
   432 00000536 EB69                <1> 	jmp	short D_P_Return_to_Caller ;AN000; and return to the caller
   433                              <1> 
   434                              <1> D_P_Too_Many_Error:			;AN000;
   435 00000538 2EC706[C103]0100    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Too_Many ;AC034; set exit code
   436 0000053F EB60                <1> 	jmp	short D_P_Return_to_Caller ;AN000; and return to the caller
   437                              <1> ;
   438                              <1> D_P_SW_Manager:				;AN000;
   439 00000541 268A4701            <1> 	mov	al,[es:bx + D_P_MaxP]	;AN000; get maxp
   440 00000545 30E4                <1> 	xor	ah,ah			;AN000; ax = maxp
   441 00000547 40                  <1> 	inc	ax			;AN000;
   442 00000548 D1E0                <1> 	shl	ax,1			;AN000; ax = (ax+1)*2
   443 0000054A 01C3                <1> 	add	bx,ax			;AN000; now bx points to maxs
   444 0000054C 268A0F              <1> 	mov	cl,[es:bx]		;AN000;
   445 0000054F 30ED                <1> 	xor	ch,ch			;AN000; cx = maxs
   446 00000551 09C9                <1> 	or	cx,cx			;AN000; at least one switch ?
   447 00000553 740F                <1> 	je	D_P_SW_Not_Found 	;AN000;
   448                              <1> 
   449 00000555 43                  <1> 	inc	bx			;AN000; now bx points to 1st CONTROL address
   450                              <1> 
   451                              <1> D_P_SW_Mgr_Loop: 			;AN000;
   452 00000556 53                  <1> 	push	bx			;AN000;
   453 00000557 268B1F              <1> 	mov	bx,[es:bx]		;AN000; bx points to Switch CONTROL itself
   454 0000055A E8C600              <1> 	call	D_P_Chk_SW_Control	;AN000; do process for switch
   455 0000055D 5B                  <1> 	pop	bx			;AN000;
   456 0000055E 7341                <1> 	jnc	D_P_Return_to_Caller	;AN000; if the CONTROL is for the switch, exit
   457                              <1> 
   458 00000560 43                  <1> 	inc	bx			;AC035; add '2' to
   459 00000561 43                  <1> 	inc	bx			;AC035;  BX reg
   460                              <1> 					;AN000; else bx points to the next CONTROL
   461                              <1> ;(changed ;AC035;)  add     bx,2	;AN000; else bx points to the next CONTROL
   462 00000562 E2F2                <1> 	loop	D_P_SW_Mgr_Loop		;AN000; and loop
   463                              <1> 
   464                              <1> D_P_SW_Not_Found:			;AN000;
   465 00000564 2EC706[C103]0300    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Not_In_SW ;AC034; here no CONTROL for the switch has
   466 0000056B EB34                <1> 	jmp	short D_P_Return_to_Caller0    ;AN000; not been found, means error.
   467                              <1> ;
   468                              <1> D_P_Key_Manager: 			;AN000;
   469 0000056D 268A4701            <1> 	mov	al,[es:bx + D_P_MaxP]	;AN000; get maxp
   470 00000571 30E4                <1> 	xor	ah,ah			;AN000; ax = maxp
   471 00000573 40                  <1> 	inc	ax			;AN000;
   472 00000574 D1E0                <1> 	shl	ax,1			;AN000; ax = (ax+1)*2
   473 00000576 01C3                <1> 	add	bx,ax			;AN000; now bx points to maxs
   474 00000578 268A07              <1> 	mov	al,[es:bx]		;AN000;
   475 0000057B 30E4                <1> 	xor	ah,ah			;AN000; ax = maxs
   476 0000057D D1E0                <1> 	shl	ax,1			;AN000;
   477 0000057F 40                  <1> 	inc	ax			;AN000; ax = ax*2+1
   478 00000580 01C3                <1> 	add	bx,ax			;AN000; now bx points to maxk
   479 00000582 268A0F              <1> 	mov	cl,[es:bx]		;AN000;
   480 00000585 30ED                <1> 	xor	ch,ch			;AN000; cx = maxk
   481 00000587 09C9                <1> 	or	cx,cx			;AN000; at least one keyword ?
   482 00000589 740F                <1> 	je	D_P_Key_Not_Found	;AN000;
   483                              <1> 
   484 0000058B 43                  <1> 	inc	bx			;AN000; now bx points to 1st CONTROL
   485                              <1> 
   486                              <1> D_P_Key_Mgr_Loop:			;AN000;
   487 0000058C 53                  <1> 	push	bx			;AN000;
   488 0000058D 268B1F              <1> 	mov	bx,[es:bx]		;AN000; bx points to keyword CONTROL itself
   489 00000590 E85D00              <1> 	call	D_P_Chk_Key_Control	;AN000; do process for keyword
   490 00000593 5B                  <1> 	pop	bx			;AN000;
   491 00000594 730B                <1> 	jnc	D_P_Return_to_Caller	;AN000; if the CONTROL is for the keyword, exit
   492                              <1> 
   493 00000596 43                  <1> 	inc	bx			;AC035; add '2' to
   494 00000597 43                  <1> 	inc	bx			;AC035;  BX reg
   495                              <1> 					;AN000; else bx points to the next CONTROL
   496                              <1> ;(changed ;AC035;)  add     bx,2	;AN000; else bx points to the next CONTROL
   497 00000598 E2F2                <1> 	loop	D_P_Key_Mgr_Loop 	;AN000; and loop
   498                              <1> 
   499                              <1> D_P_Key_Not_Found:			;AN000;
   500 0000059A 2EC706[C103]0400    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Not_In_Key ;AC034; here no CONTROL for the keyword has
   501                              <1> D_P_Return_to_Caller0:			;AN000; not been found, means error.
   502                              <1> 
   503                              <1> ;(deleted ;AN024;)	 mov	 bx,[es:bx-2]		 ;AN000; (tm13) backup bx
   504                              <1> 
   505                              <1> ;(deleted ;AN024;)	 mov	 al,D_P_String		 ;AN000; Set
   506                              <1> ;(deleted ;AN024;)	 mov	 ah,D_P_No_Tag		 ;AN000;     result
   507                              <1> ;(deleted ;AN024;)	 call	 D_P_Fill_Result 	 ;AN000;	    buffer
   508                              <1> 
   509                              <1> D_P_Return_to_Caller:			;AN000;
   510 000005A1 5D                  <1> 	pop	bp			;AN000;
   511 000005A2 5F                  <1> 	pop	di			;AN000;
   512 000005A3 5B                  <1> 	pop	bx			;AN000;
   513                              <1> D_P_Ordinal equ D_P_ORDINAL	; NASM port label
   514 000005A4 2E8B0E[BF03]        <1> 	mov	cx,[psdata_seg:D_P_Ordinal]    ;AC034; return next ordinal
   515 000005A9 2EA1[C103]          <1> 	mov	ax,[psdata_seg:D_P_RC]	    ;AC034; return exit code
   516 000005AD 2E8B36[C303]        <1> 	mov	si,[psdata_seg:D_P_SI_Save]    ;AC034; return next operand pointer
   517 000005B2 2E8B16[C503]        <1> 	mov	dx,[psdata_seg:D_P_DX]	    ;AC034; return result buffer address
   518 000005B7 2E8A1E[C703]        <1> 	mov	bl,[psdata_seg:D_P_Terminator] ;AC034; return delimiter code found
   519                              <1> D_P_Single_Exit: 			;AN000;
   520 000005BC F8                  <1> 	clc				;AN000;
   521 000005BD C3                  <1> 	ret				;AN000;
   522                              <1> SysParse endp				;AN000;
   523                              <1> ;PAGE					;AN000;
   524                              <1> ;***********************************************************************
   525                              <1> ; D_P_Chk_Pos_Control
   526                              <1> ;
   527                              <1> ; Function: Parse CONTROL block for a positional
   528                              <1> ;
   529                              <1> ; Input:     ES:BX -> CONTROL block
   530                              <1> ;	     psdata_seg:SI -> D_P_STRING_BUF
   531                              <1> ;
   532                              <1> ; Output:    None
   533                              <1> ;
   534                              <1> ; Use:	 D_P_Fill_Result, D_P_Check_Match_Flags
   535                              <1> ;
   536                              <1> ; Vars: D_P_Ordinal(W), D_P_RC(W)
   537                              <1> ;***********************************************************************
   538                              <1> D_P_Chk_Pos_Control proc 		;AN000;
   539 000005BE 50                  <1> 	push	ax			;AN000;
   540 000005BF 268B07              <1> 	mov	ax,[es:bx + D_P_Match_Flag] ;AN000;
   541 000005C2 A90200              <1> 	test	ax,D_P_Repeat		;AN000; repeat allowed ?
   542 000005C5 7505                <1> 	jne	D_P_CPC00		;AN000; then do not increment ORDINAL
   543                              <1> 
   544 000005C7 2EFF06[BF03]        <1> 	inc	word [psdata_seg:D_P_ORDINAL]	;AC034; update the ordinal
   545                              <1> D_P_CPC00:				;AN000;
   546 000005CC 2E803C00            <1> 	cmp	byte ptr [psdata_seg:si],D_P_NULL ;AN000; no data ?
   547 000005D0 7519                <1> 	jne	D_P_CPC01		;AN000;
   548                              <1> 
   549 000005D2 A90100              <1> 	test	ax,D_P_Optional		;AN000; yes, then is it optional ?
   550 000005D5 7509                <1> 	jne	D_P_CPC02		;AN000;
   551                              <1> 
   552 000005D7 2EC706[C103]0200    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Op_Missing ;AC034; no, then error	     3/17/87
   553 000005DE EB0E                <1> 	jmp	short D_P_CPC_Exit	;AN000;
   554                              <1> 
   555                              <1> D_P_CPC02:				;AN000;
   556 000005E0 50                  <1> 	push	ax			;AN000;
   557 000005E1 B003                <1> 	mov	al,D_P_String		;AN000; if it is optional return NULL
   558 000005E3 B4FF                <1> 	mov	ah,D_P_No_Tag		;AN000; no item tag indication
   559 000005E5 E89E00              <1> 	call	D_P_Fill_Result		;AN000;
   560 000005E8 58                  <1> 	pop	ax			;AN000;
   561 000005E9 EB03                <1> 	jmp	short D_P_CPC_Exit	;AN000;
   562                              <1> 
   563                              <1> D_P_CPC01:				;AN000;
   564 000005EB E81D01              <1> 	call	D_P_Check_Match_Flags	;AN000;
   565                              <1> D_P_CPC_Exit:				;AN000;
   566 000005EE 58                  <1> 	pop	ax			;AN000;
   567 000005EF C3                  <1> 	ret				;AN000;
   568                              <1> D_P_Chk_Pos_Control endp 		;AN000;
   569                              <1> ;PAGE					;AN000;
   570                              <1> ;***********************************************************************
   571                              <1> ; D_P_Chk_Key_Control
   572                              <1> ;
   573                              <1> ; Function: Parse CONTROL block for a keyword
   574                              <1> ;
   575                              <1> ; Input:     ES:BX -> CONTROL block
   576                              <1> ;	     psdata_seg:SI -> D_P_STRING_BUF
   577                              <1> ;
   578                              <1> ; Output:    CY = 1 : not match
   579                              <1> ;
   580                              <1> ; Use:	 D_P_Fill_Result, D_P_Search_KEYorSW, D_P_Check_Match_Flags
   581                              <1> ;
   582                              <1> ; Vars: D_P_RC(W), D_P_SaveSI_Cmpx(W), D_P_KEYorSW_Ptr(R), D_P_Flags(W)
   583                              <1> ;***********************************************************************
   584                              <1> D_P_Chk_Key_Control proc 		;AN000;
   585                              <1> %IF	KeySW				;AN000;(Check if keyword is supported)
   586                              <1> 	or	byte [psdata_seg:D_P_Flags2],D_P_Key_Cmp ;AC034; Indicate keyword for later string comparison
   587                              <1> 	call	D_P_Search_KEYorSW	;AN000; Search the keyword in the CONTROL block
   588                              <1> 	jc	D_P_Chk_Key_Err0 	;AN000; not found, then try next CONTROL
   589                              <1> 
   590                              <1> 	and	byte [psdata_seg:D_P_Flags2],0ffh-D_P_Key_Cmp ;AC034; reset the indicator previously set
   591                              <1> ;
   592                              <1> 	push	ax			     ;AN000;	      keyword=
   593                              <1> 	mov	ax,[psdata_seg:D_P_KEYorSW_Ptr] ;AC034;	      ^       ^
   594                              <1> 	sub	ax,si			;AN000;  SI	KEYorSW
   595                              <1> 	add	[psdata_seg:D_P_SaveSI_Cmpx],ax ;AC034; update for complex, quoted or file spec.
   596                              <1> 	pop	ax			;AN000;
   597                              <1> ;
   598                              <1> 	mov	si,[psdata_seg:D_P_KEYorSW_Ptr] ;AC034; set si just after equal char
   599                              <1> 	cmp	byte ptr [psdata_seg:si],D_P_NULL ;AN000; any data after equal ?
   600                              <1> 	je	D_P_Chk_Key_Err1 	;AN000; if no, syntax error
   601                              <1> 
   602                              <1> 	call	D_P_Check_Match_Flags	;AN000; else, process match flags
   603                              <1> 	clc				;AN000;
   604                              <1> 	jmp	short D_P_Chk_Key_Exit	;AN000;
   605                              <1> 
   606                              <1> D_P_Chk_Key_Err0:			;AN000;
   607                              <1> 	stc				;AN000; not found in keyword synonym list
   608                              <1> 	jmp	short D_P_Chk_Key_Exit	;AN000;
   609                              <1> 
   610                              <1> D_P_Chk_Key_Err1:			;AN000;
   611                              <1> 	mov	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; no parameter is not specified after "="
   612                              <1> D_P_Chk_Key_ErrExit:			;AN000;
   613                              <1> 	push	ax			;AN000;
   614                              <1> 	mov	al,D_P_String		;AN000; set
   615                              <1> 	mov	ah,D_P_No_Tag		;AN000;    result
   616                              <1> 	call	D_P_Fill_Result		;AN000; 	 buffer
   617                              <1> 	pop	ax			;AN000;
   618                              <1> 	clc				;AN000;
   619                              <1> D_P_Chk_Key_Exit:			;AN000;
   620                              <1> 	ret				;AN000;
   621                              <1> %ELSE					;AN000;(of IF KeySW)
   622 000005F0 F9                  <1> 	stc				;AN000;this logic works when the KeySW
   623 000005F1 C3                  <1> 	ret				;AN000;is reset.
   624                              <1> %ENDIF					;AN000;(of KeySW)
   625                              <1> D_P_Chk_Key_Control endp 		;AN000;
   626                              <1> ;PAGE					;AN000;
   627                              <1> ;***********************************************************************
   628                              <1> %IF	KeySW+SwSW			;AN000;(Check if keyword or switch is supported)
   629                              <1> ; D_P_Search_KEYorSW:
   630                              <1> ;
   631                              <1> ; Function: Seach specified keyword or switch from CONTROL
   632                              <1> ;
   633                              <1> ; Input:     ES:BX -> CONTROL block
   634                              <1> ;	     psdata_seg:SI -> D_P_STRING_BUF
   635                              <1> ;
   636                              <1> ; Output:    CY = 1 : not match
   637                              <1> ;
   638                              <1> ; Use:	 D_P_String_Comp, D_P_MoveBP_NUL, D_P_Found_SYNONYM
   639                              <1> ;***********************************************************************
   640                              <1> D_P_Search_KEYorSW proc			;AN000;
   641 000005F2 55                  <1> 	push	bp			;AN000;
   642 000005F3 51                  <1> 	push	cx			;AN000;
   643 000005F4 268A4F08            <1> 	mov	cl,[es:bx + D_P_nid]	;AN000; Get synonym count
   644 000005F8 30ED                <1> 	xor	ch,ch			;AN000; and set it to cx
   645 000005FA 09C9                <1> 	or	cx,cx			;AN000; No synonyms specified ?
   646 000005FC 740D                <1> 	je	D_P_KEYorSW_Not_Found	;AN000; then indicate not found by CY
   647                              <1> 
   648                              <1> D_P_KEYorSW equ D_P_KeyorSW	; NASM port equate
   649 000005FE 8D6F09              <1> 	lea	bp,[bx + D_P_KEYorSW]	;AN000; BP points to the 1st synonym
   650                              <1> D_P_KEYorSW_Loop:			;AN000;
   651 00000601 E8E203              <1> 	call	D_P_String_Comp		;AN000; compare string in buffer w/ the synonym
   652 00000604 7308                <1> 	jnc	D_P_KEYorSW_Found	;AN000; If match, set it to synonym pointer
   653                              <1> 
   654 00000606 E80E00              <1> 	call	D_P_MoveBP_NUL		;AN000; else, bp points to the next string
   655 00000609 E2F6                <1> 	loop	D_P_KEYorSW_Loop 	;AN000; loop nid times
   656                              <1> D_P_KEYorSW_Not_Found:			;AN000;
   657 0000060B F9                  <1> 	stc				;AN000; indicate not found in synonym list
   658 0000060C EB06                <1> 	jmp	short D_P_KEYorSW_Exit	;AN000; and exit
   659                              <1> 
   660                              <1> D_P_KEYorSW_Found:			;AN000;
   661 0000060E 2E892E[D403]        <1> 	mov	[psdata_seg:D_P_Found_SYNONYM],bp ;AC034; set synonym pointer
   662 00000613 F8                  <1> 	clc				;AN000; indicate found
   663                              <1> D_P_KEYorSW_Exit:			;AN000;
   664 00000614 59                  <1> 	pop	cx			;AN000;
   665 00000615 5D                  <1> 	pop	bp			;AN000;
   666 00000616 C3                  <1> 	ret				;AN000;
   667                              <1> D_P_Search_KEYorSW endp			;AN000;
   668                              <1> ;***********************************************************************
   669                              <1> ; D_P_MoveBP_NUL
   670                              <1> ;***********************************************************************
   671                              <1> D_P_MoveBP_NUL proc			;AN000;
   672                              <1> D_P_MBP_Loop:				;AN000;
   673 00000617 26807E0000          <1> 	cmp	byte ptr [es:bp],D_P_NULL ;AN000; Increment BP that points
   674 0000061C 7403                <1> 	je	D_P_MBP_Exit		;AN000; to the synomym list
   675                              <1> 
   676 0000061E 45                  <1> 	inc	bp			;AN000; until
   677 0000061F EBF6                <1> 	jmp	short D_P_MBP_Loop	;AN000; NULL encountered.
   678                              <1> 
   679                              <1> D_P_MBP_Exit:				;AN000;
   680 00000621 45                  <1> 	inc	bp			;AN000; bp points to next to NULL
   681 00000622 C3                  <1> 	ret				;AN000;
   682                              <1> D_P_MoveBP_NUL endp			;AN000;
   683                              <1> %ENDIF					;AN000;(of KeySW+SwSW)
   684                              <1> ;PAGE					;AN000;
   685                              <1> ;***********************************************************************
   686                              <1> ; D_P_Chk_SW_Control
   687                              <1> ;
   688                              <1> ; Function: Parse CONTROL block for a switch
   689                              <1> ;
   690                              <1> ; Input:     ES:BX -> CONTROL block
   691                              <1> ;	     psdata_seg:SI -> D_P_STRING_BUF
   692                              <1> ;
   693                              <1> ; Output:    CY = 1 : not match
   694                              <1> ;
   695                              <1> ; Use:	 D_P_Fill_Result, D_P_Search_KEYorSW, D_P_Check_Match_Flags
   696                              <1> ;
   697                              <1> ; Vars:  D_P_SaveSI_Cmpx(W), D_P_KEYorSW_Ptr(R), D_P_Flags(W)
   698                              <1> ;***********************************************************************
   699                              <1> D_P_Chk_SW_Control proc			;AN000;
   700                              <1> 
   701                              <1> 
   702                              <1> %IF	SwSW				;AN000;(Check if switch is supported)
   703                              <1> D_P_Sw_Cmp equ D_P_SW_Cmp	; NASM port equate
   704 00000623 2E800E[CD03]10      <1> 	or	byte [psdata_seg:D_P_Flags2],D_P_Sw_Cmp ;AC034; Indicate switch for later string comparison
   705 00000629 E8C6FF              <1> 	call	D_P_Search_KEYorSW	;AN000; Search the switch in the CONTROL block
   706 0000062C 724A                <1> 	jc	D_P_Chk_SW_Err0		;AN000; not found, then try next CONTROL
   707                              <1> 
   708 0000062E 2E8026[CD03]EF      <1> 	and	byte [psdata_seg:D_P_Flags2],0ffh-D_P_Sw_Cmp ;AC034; reset the indicator previously set
   709                              <1> ;
   710 00000634 50                  <1> 	push	ax			;AN000; 	      /switch:
   711 00000635 2EA1[D003]          <1> 	mov	ax,[psdata_seg:D_P_KEYorSW_Ptr] ;AC034;	      ^       ^
   712 00000639 29F0                <1> 	sub	ax,si			;AN000;  SI	KEYorSW
   713 0000063B 2E0106[CE03]        <1> 	add	[psdata_seg:D_P_SaveSI_Cmpx],ax ;AC034; update for complex list
   714 00000640 58                  <1> 	pop	ax			;AN000;
   715                              <1> ;
   716 00000641 2E8B36[D003]        <1> 	mov	si,[psdata_seg:D_P_KEYorSW_Ptr] ;AC034; set si at the end or colon
   717 00000646 2E803C00            <1> 	cmp	byte ptr [psdata_seg:si],D_P_NULL ;AN000; any data after colon
   718 0000064A 7526                <1> 	jne	D_P_CSW00		;AN000; if yes, process match flags
   719                              <1> 
   720 0000064C 2E807CFF3A          <1> 	cmp	byte ptr [psdata_seg:si-1],D_P_Colon ;AN000; if no, the switch terminated by colon ?
   721 00000651 7509                <1> 	jne	D_P_Chk_if_data_required ;AN000; if yes,
   722                              <1> 
   723 00000653 2EC706[C103]0900    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; return syntax error
   724 0000065A EB1F                <1> 	jmp	short D_P_Chk_SW_Exit	;AN000;
   725                              <1> 
   726                              <1> D_P_Chk_if_data_required:		;AN018; no data, no colon
   727 0000065C 26833F00            <1> 	cmp	word [es:bx + D_P_Match_Flag],0 ;AN018; should have data? zero match flag means switch followed by nothing is OK
   728 00000660 7419                <1> 	je	D_P_Chk_SW_Exit		;AN018; match flags not zero so should have something if optional bit is not on
   729                              <1> 
   730 00000662 26F7070100          <1> 	test	word [es:bx + D_P_Match_Flag],D_P_Optional ;AN019; see if no value is valid
   731 00000667 7512                <1> 	jnz	D_P_Chk_SW_Exit		;AN019; if so, then leave, else yell
   732                              <1> 
   733 00000669 2EC706[C103]0200    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Op_Missing ;AC034; return required operand missing
   734 00000670 EB09                <1> 	jmp	short D_P_Chk_SW_Exit	;AN018;
   735                              <1> 
   736                              <1> D_P_CSW00:				;AN000;
   737 00000672 E89600              <1> 	call	D_P_Check_Match_Flags	;AN000; process match flag
   738 00000675 F8                  <1> 	clc				;AN000; indicate match
   739 00000676 EB0D                <1> 	jmp	short D_P_Chk_SW_Single_Exit ;AN000;
   740                              <1> 
   741                              <1> D_P_Chk_SW_Err0: 			;AN000;
   742 00000678 F9                  <1> 	stc				;AN000; not found in switch synonym list
   743 00000679 EB0A                <1> 	jmp	short D_P_Chk_SW_Single_Exit ;AN000;
   744                              <1> 
   745                              <1> D_P_Chk_SW_Exit: 			;AN000;
   746 0000067B 50                  <1> 	push	ax			;AN000;
   747 0000067C B003                <1> 	mov	al,D_P_String		;AN000; set
   748 0000067E B4FF                <1> 	mov	ah,D_P_No_Tag		;AN000;    result
   749 00000680 E80300              <1> 	call	D_P_Fill_Result		;AN000; 	 buffer
   750 00000683 58                  <1> 	pop	ax			;AN000;
   751 00000684 F8                  <1> 	clc				;AN000;
   752                              <1> D_P_Chk_SW_Single_Exit:			;AN000;
   753 00000685 C3                  <1> 	ret				;AN000;
   754                              <1> %ELSE					;AN000;(of IF SwSW)
   755                              <1> 	stc				;AN000; this logic works when the SwSW
   756                              <1> 	ret				;AN000; is reset.
   757                              <1> %ENDIF					;AN000;(of SwSW)
   758                              <1> D_P_Chk_SW_Control endp			;AN000;
   759                              <1> ;PAGE					;AN000;
   760                              <1> ;***********************************************************************
   761                              <1> ; D_P_Fill_Result
   762                              <1> ;
   763                              <1> ; Function: Fill the result buffer
   764                              <1> ;
   765                              <1> ; Input:    AH = Item tag
   766                              <1> ;	    AL = type
   767                              <1> ;		  AL = 1: CX,DX has 32bit number (CX = high)
   768                              <1> ;		  AL = 2: DX has index(offset) into value list
   769                              <1> ;		  AL = 6: DL has driver # (1-A, 2-B, ... , 26 - Z)
   770                              <1> ;		  AL = 7: DX has year, CL has month and CH has date
   771                              <1> ;		  AL = 8: DL has hours, DH has minutes, CL has secondsn,
   772                              <1> ;			  amd CH has hundredths
   773                              <1> ;		  AL = else: psdata_seg:SI points to returned string buffer
   774                              <1> ;	    ES:BX -> CONTROL block
   775                              <1> ;
   776                              <1> ; Output:   None
   777                              <1> ;
   778                              <1> ; Use:	D_P_Do_CAPS_String, D_P_Remove_Colon, D_P_Found_SYNONYM
   779                              <1> ;
   780                              <1> ; Vars: D_P_DX(W)
   781                              <1> ;***********************************************************************
   782                              <1> D_P_Fill_Result proc			;AN000;
   783 00000686 57                  <1> 	push	di			;AN000;
   784 00000687 268B7F04            <1> 	mov	di,[es:bx + D_P_Result_Buf] ;AN000; di points to result buffer
   785 0000068B 2E893E[C503]        <1> 	mov	[psdata_seg:D_P_DX],di	;AC034; set returned result address
   786 00000690 268805              <1> 	mov	[es:di + D_P_Type],al	;AN000; store type
   787 00000693 26886501            <1> 	mov	[es:di + D_P_Item_Tag],ah	;AN000; store item tag
   788 00000697 50                  <1> 	push	ax			;AN000;
   789 00000698 2EA1[D403]          <1> 	mov	ax,[psdata_seg:D_P_Found_SYNONYM] ;AC034; if yes,
   790 0000069C 26894502            <1> 	mov	[es:di + D_P_SYNONYM_Ptr],ax ;AN000;   then set it to the result
   791 000006A0 58                  <1> 	pop	ax			;AN000;
   792                              <1> D_P_RLT04:				;AN000;
   793 000006A1 3C01                <1> 	cmp	al,D_P_Number		;AN000; if number
   794 000006A3 750A                <1> 	jne	D_P_RLT00		;AN000;
   795                              <1> 
   796                              <1> D_P_RLT02:				;AN000;
   797 000006A5 26895504            <1> 	mov	word ptr [es:di + D_P_Picked_Val],dx ;AN000; then store 32bit
   798 000006A9 26894D06            <1> 	mov	word ptr [es:di+2 + D_P_Picked_Val],cx ;AN000;	number
   799 000006AD EB5A                <1> 	jmp	short D_P_RLT_Exit	;AN000;
   800                              <1> 
   801                              <1> D_P_RLT00:				;AN000;
   802 000006AF 3C02                <1> 	cmp	al,D_P_List_Idx		;AN000; if list index
   803 000006B1 7506                <1> 	jne	D_P_RLT01		;AN000;
   804                              <1> 
   805 000006B3 26895504            <1> 	mov	word ptr [es:di + D_P_Picked_Val],dx ;AN000; then store list index
   806 000006B7 EB50                <1> 	jmp	short D_P_RLT_Exit	;AN000;
   807                              <1> 
   808                              <1> D_P_RLT01:				;AN000;
   809 000006B9 3C07                <1> 	cmp	al,D_P_Date_F		;AN000; Date format ?
   810 000006BB 74E8                <1> 	je	D_P_RLT02		;AN000;
   811                              <1> 
   812 000006BD 3C08                <1> 	cmp	al,D_P_Time_F		;AN000; Time format ?
   813 000006BF 74E4                <1> 	je	D_P_RLT02		;AN000;
   814                              <1> ;
   815 000006C1 3C06                <1> 	cmp	al,D_P_Drive		;AN000; drive format ?
   816 000006C3 7506                <1> 	jne	D_P_RLT03		;AN000;
   817                              <1> 
   818 000006C5 26885504            <1> 	mov	byte ptr [es:di + D_P_Picked_Val],dl ;AN000; store drive number
   819 000006C9 EB3E                <1> 	jmp	short D_P_RLT_Exit	;AN000;
   820                              <1> 
   821                              <1> D_P_RLT03:				;AN000;
   822 000006CB 3C04                <1> 	cmp	al,D_P_Complex		;AN000; complex format ?
   823 000006CD 750F                <1> 	jne	D_P_RLT05		;AN000;
   824                              <1> 
   825 000006CF 2EA1[CE03]          <1> 	mov	ax,[psdata_seg:D_P_SaveSI_Cmpx] ;AC034; then get pointer in command buffer
   826 000006D3 40                  <1> 	inc	ax			;AN000; skip left Parentheses
   827 000006D4 26894504            <1> 	mov	word ptr [es:di + D_P_Picked_Val],ax ;AN000; store offset
   828 000006D8 268C5D06            <1> 	mov	word ptr [es:di+2 + D_P_Picked_Val],ds ;AN000; store segment
   829 000006DC EB2B                <1> 	jmp	short D_P_RLT_Exit	;AN000;
   830                              <1> 
   831                              <1> D_P_RLT05:				;AN000;
   832                              <1> ;------------------------  AL = 3, 5, or 9
   833 000006DE 26897504            <1> 	mov	word ptr [es:di + D_P_Picked_Val],si ;AN000; store offset of STRING_BUF
   834                              <1> ;(replaced ;AN031;)  mov word ptr [es:di+word].D_P_Picked_Val,cs ;AN000; store segment of STRING_BUF
   835 000006E2 268C4D06            <1> 	mov	word ptr [es:di+2 + D_P_Picked_Val],Psdata_Seg ;AN031; store segment of STRING_BUF
   836                              <1> ;
   837 000006E6 50                  <1> 	push	ax			;AN000;
   838 000006E7 26F6470201          <1> 	test	byte ptr [es:bx + D_P_Function_Flag],D_P_CAP_File ;AN000; need CAPS by file table?
   839 000006EC 7404                <1> 	je	D_P_RLT_CAP00		;AN000;
   840                              <1> 
   841 000006EE B004                <1> 	mov	al,D_P_DOSTBL_File	;AN000; use file upper case table
   842 000006F0 EB09                <1> 	jmp	short D_P_RLT_CAP02	;AN000;
   843                              <1> 
   844                              <1> D_P_RLT_CAP00:				;AN000;
   845 000006F2 26F6470202          <1> 	test	byte ptr [es:bx + D_P_Function_Flag],D_P_CAP_Char ;AN000; need CAPS by char table ?
   846 000006F7 7405                <1> 	je	D_P_RLT_CAP01		;AN000;
   847                              <1> 
   848 000006F9 B002                <1> 	mov	al,D_P_DOSTBL_Char	;AN000; use character upper case table
   849                              <1> D_P_RLT_CAP02:				;AN000;
   850 000006FB E8E500              <1> 	call	D_P_Do_CAPS_String	;AN000;  process CAPS along the table
   851                              <1> D_P_RLT_CAP01:				;AN000;
   852 000006FE 58                  <1> 	pop	ax			;AN000;
   853 000006FF 26F6470210          <1> 	test	byte ptr [es:bx + D_P_Function_Flag],D_P_Rm_Colon ;AN000; removing colon at end ?
   854 00000704 7403                <1> 	je	D_P_RLT_Exit		;AN000;
   855                              <1> 
   856 00000706 E8B400              <1> 	call	D_P_Remove_Colon 	;AN000; then process it.
   857                              <1> D_P_RLT_Exit:				;AN000;
   858 00000709 5F                  <1> 	pop	di			;AN000;
   859 0000070A C3                  <1> 	ret				;AN000;
   860                              <1> D_P_Fill_Result endp			;AN000;
   861                              <1> ;PAGE					;AN000;
   862                              <1> ;***********************************************************************
   863                              <1> ; D_P_Check_Match_Flags
   864                              <1> ;
   865                              <1> ; Function:  Check the mutch_flags and make the exit code and set the
   866                              <1> ;	     result buffer
   867                              <1> ;
   868                              <1> ;	    Check for types in this order:
   869                              <1> ;		Complex
   870                              <1> ;		Date
   871                              <1> ;		Time
   872                              <1> ;		Drive
   873                              <1> ;		Filespec
   874                              <1> ;		Quoted String
   875                              <1> ;		Simple String
   876                              <1> ;
   877                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
   878                              <1> ;	     ES:BX -> CONTROL block
   879                              <1> ;
   880                              <1> ; Output:    None
   881                              <1> ;
   882                              <1> ; Use:	     D_P_Value, P$_SValue, D_P_Simple_String, D_P_Date_Format
   883                              <1> ;	     D_P_Time_Format, D_P_Complex_Format, D_P_File_Foemat
   884                              <1> ;	     D_P_Drive_Format
   885                              <1> ;***********************************************************************
   886                              <1> D_P_Check_Match_Flags proc		;AN000;
   887 0000070B 2EC606[6404]00      <1> 	mov	byte [psdata_seg:D_P_err_flag],D_P_NULL ;AN033;AC034;; clear filespec error flag.
   888 00000711 50                  <1> 	push	ax			;AN000;
   889 00000712 268B07              <1> 	mov	ax,[es:bx + D_P_Match_Flag] ;AN000; load match flag(16bit) to ax
   890                              <1> 
   891 00000715 09C0                <1> 	or	ax,ax			;AC035; test ax for zero
   892                              <1> ;(changed ;AC035;)  cmp     ax,0	;AN000; (tm12)
   893 00000717 7518                <1> 	jne	D_P_Mat			;AN000; (tm12)
   894                              <1> 
   895 00000719 50                  <1> 	push	ax			;AN000; (tm12)
   896 0000071A 53                  <1> 	push	bx			;AN000; (tm12)
   897 0000071B 52                  <1> 	push	dx			;AN000; (tm12)
   898 0000071C 57                  <1> 	push	di			;AN000; (tm12)
   899 0000071D 2EC706[C103]0900    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; (tm12)
   900 00000724 B4FF                <1> 	mov	ah,D_P_No_Tag		;AN000; (tm12)
   901 00000726 B003                <1> 	mov	al,D_P_String		;AN000; (tm12)
   902 00000728 E85BFF              <1> 	call	D_P_Fill_Result		;AN000; (tm12)
   903 0000072B 5F                  <1> 	pop	di			;AN000; (tm12)
   904 0000072C 5A                  <1> 	pop	dx			;AN000; (tm12)
   905 0000072D 5B                  <1> 	pop	bx			;AN000; (tm12)
   906 0000072E 58                  <1> 	pop	ax			;AN000; (tm12)
   907 0000072F EB02                <1> 	jmp	short D_P_Bridge 	;AC035; (tm12)
   908                              <1> 
   909                              <1> D_P_Mat: 				;AN000; (tm12)
   910                              <1> 
   911                              <1> %IF	CmpxSW				;AN000;(Check if complex item is supported)
   912                              <1> 	test	ax,D_P_Cmpx_S		;AN000; Complex string
   913                              <1> 	je	D_P_Match01		;AN000;
   914                              <1> 
   915                              <1> 	mov	word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error
   916                              <1> 	call	D_P_Complex_Format	;AN000; do process
   917                              <1> 	cmp	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type
   918                              <1> 	jne	D_P_Bridge		;AN000;
   919                              <1> 
   920                              <1> D_P_Match01:				;AN000;
   921                              <1> %ENDIF					;AN000;(of CmpxSW)
   922                              <1> %IF	DateSW				;AN000;(Check if date format is supported)
   923                              <1> 	test	ax,D_P_Date_S		;AN000; Date string
   924                              <1> 	je	D_P_Match02		;AN000;
   925                              <1> 
   926                              <1> 	mov	word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error
   927                              <1> 	call	D_P_Date_Format		;AN000; do process
   928                              <1> 	cmp	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type
   929                              <1> 	jne	D_P_Bridge		;AN000;
   930                              <1> 
   931                              <1> D_P_Match02:				;AN000;
   932                              <1> %ENDIF					;AN000;(of DateSW)
   933                              <1> %IF	TimeSW				;AN000;(Check if time format is supported)
   934                              <1> 	test	ax,D_P_Time_S		;AN000; Time string
   935                              <1> 	je	D_P_Match03		;AN000;
   936                              <1> 
   937                              <1> 	mov	word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error
   938                              <1> 	call	D_P_Time_Format		;AN000; do process
   939                              <1> 	cmp	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type
   940                              <1> ;	je	D_P_Match03		;AN000:
   941                              <1> 
   942                              <1> 	jne	D_P_Bridge		;AN000; (tm09)
   943                              <1> 
   944                              <1> %ENDIF					;AN000;(of TimeSW)  (tm04)
   945 00000731 EB03                <1> 	jmp	short D_P_Match03	;AN025; (tm09)
   946                              <1> 
   947                              <1> D_P_Bridge:				;AN000;
   948                              <1> ;	jmp	short D_P_Match_Exit (tm02)
   949                              <1> 
   950 00000733 EB6F                <1> 	jmp	D_P_Match_Exit		;AN000; (tm02)
   951 00000735 90                  <1> 	nop	; identicalise
   952                              <1> 
   953                              <1> D_P_Match03:				;AN000;
   954                              <1> ; ENDIF ;AN000;(of TimeSW) (tm04)
   955                              <1> %IF	NumSW				;AN000;(Check if numeric value is supported)
   956 00000736 A90080              <1> 	test	ax,D_P_Num_Val		;AN000; Numeric value
   957 00000739 7412                <1> 	je	D_P_Match04		;AN000;
   958                              <1> 
   959 0000073B 2EC706[C103]0000    <1> 	mov	word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error
   960 00000742 E82601              <1> 	call	D_P_Value		;AN000; do process
   961 00000745 2E833E[C103]09      <1> 	cmp	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type
   962 0000074B 7557                <1> 	jne	D_P_Match_Exit		;AN000;
   963                              <1> 
   964                              <1> D_P_Match04:				;AN000;
   965                              <1> D_P_SNUM_Val equ D_P_SNum_Val	; NASM port equate
   966 0000074D A90040              <1> 	test	ax,D_P_SNUM_Val		;AN000; Signed numeric value
   967 00000750 7412                <1> 	je	D_P_Match05		;AN000;
   968                              <1> 
   969 00000752 2EC706[C103]0000    <1> 	mov	word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error
   970 00000759 E8EB00              <1> 	call	D_P_SValue		;AN000; do process
   971 0000075C 2E833E[C103]09      <1> 	cmp	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type
   972 00000762 7540                <1> 	jne	D_P_Match_Exit		;AN000;
   973                              <1> 
   974                              <1> D_P_Match05:				;AN000;
   975                              <1> %ENDIF					;AN000;(of NumSW)
   976                              <1> %IF	DrvSW				;AN000;(Check if drive only is supported)
   977 00000764 A90001              <1> 	test	ax,D_P_Drv_Only		;AN000; Drive only
   978 00000767 7415                <1> 	je	D_P_Match06		;AN000;
   979                              <1> 
   980 00000769 2EC706[C103]0000    <1> 	mov	word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error
   981 00000770 E81603              <1> 	call	D_P_File_Format		;AN000; 1st, call file format
   982 00000773 E89903              <1> 	call	D_P_Drive_Format 	;AN000; check drive format, next
   983 00000776 2E833E[C103]09      <1> 	cmp	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examinee the next type
   984 0000077C 7526                <1> 	jne	D_P_Match_Exit		;AN000;
   985                              <1> 
   986                              <1> D_P_Match06:				;AN000;
   987                              <1> %ENDIF					;AN000;(of DrvSW)
   988                              <1> %IF	FileSW				;AN000;(Check if file spec is supported)
   989 0000077E A90002              <1> 	test	ax,D_P_File_Spc		;AN000; File spec
   990 00000781 7412                <1> 	je	D_P_Match07		;AN000;
   991                              <1> 
   992 00000783 2EC706[C103]0000    <1> 	mov	word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error
   993 0000078A E8FC02              <1> 	call	D_P_File_Format		;AN000; do process
   994 0000078D 2E833E[C103]09      <1> 	cmp	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type
   995 00000793 750F                <1> 	jne	D_P_Match_Exit		;AN000;
   996                              <1> 
   997                              <1> D_P_Match07:				;AN000;
   998                              <1> %ENDIF					;AN000;(of FileSW)
   999                              <1> %IF	QusSW				;AN000;(Check if quoted string is supported)
  1000                              <1> 	test	ax,D_P_Qu_String 	;AN000; Quoted string
  1001                              <1> 	je	D_P_Match08		;AN000;
  1002                              <1> 
  1003                              <1> 	mov	word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error
  1004                              <1> 	call	D_P_Quoted_Format	;AN000; do process
  1005                              <1> 	cmp	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type
  1006                              <1> 	jne	D_P_Match_Exit		;AN000;
  1007                              <1> 
  1008                              <1> D_P_Match08:				;AN000;
  1009                              <1> %ENDIF					;AN000;(of QusSW)
  1010 00000795 A90020              <1> 	test	ax,D_P_Simple_S		;AN000; Simple string
  1011 00000798 740A                <1> 	je	D_P_Match09		;AN000;
  1012                              <1> 
  1013 0000079A 2EC706[C103]0000    <1> 	mov	word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error
  1014 000007A1 E8D901              <1> 	call	D_P_Simple_String	;AN000; do process
  1015                              <1> ;;;;	cmp	psdata_seg:D_P_RC,D_P_Syntax ;AC034; These two lines will be alive
  1016                              <1> ;;;;	jne	D_P_Match_Exit			   ;when extending the match_flags.
  1017                              <1> D_P_Match09:				;AN000;
  1018                              <1> D_P_Match_Exit:				;AN000;
  1019 000007A4 2E803E[6404]01      <1> 	cmp	byte [psdata_seg:D_P_err_flag],D_P_error_filespec ;AC034; bad filespec ?
  1020 000007AA 750F                <1> 	jne	D_P_Match2_Exit		;AN033; no, continue
  1021 000007AC 2E833E[C103]00      <1> 	cmp	word [psdata_seg:D_P_RC],D_P_No_Error ;AN033;AC034;; check for other errors ?
  1022 000007B2 7507                <1> 	jne	D_P_Match2_Exit		;AN033; no, continue
  1023 000007B4 2EC706[C103]0900    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Syntax ;AN033;AC034;; set error flag
  1024                              <1> D_P_Match2_Exit: 			;AN033;
  1025 000007BB 58                  <1> 	pop	ax			;AN000;
  1026 000007BC C3                  <1> 	ret				;AN000;
  1027                              <1> D_P_Check_Match_Flags endp		;AN000;
  1028                              <1> ;PAGE					;AN000;
  1029                              <1> ;***********************************************************************
  1030                              <1> ; D_P_Remove_Colon;
  1031                              <1> ;
  1032                              <1> ; Function: Remove colon at end
  1033                              <1> ;
  1034                              <1> ; Input:    psdata_seg:SI points to string buffer to be examineed
  1035                              <1> ;
  1036                              <1> ; Output:   None
  1037                              <1> ;
  1038                              <1> ; Use:	D_P_Chk_DBCS
  1039                              <1> ;***********************************************************************
  1040                              <1> D_P_Remove_Colon proc			;AN000;
  1041 000007BD 50                  <1> 	push	ax			;AN000;
  1042 000007BE 56                  <1> 	push	si			;AN000;
  1043                              <1> D_P_RCOL_Loop:				;AN000;
  1044 000007BF 2E8A04              <1> 	mov	al,[psdata_seg:si]	;AN000; get character
  1045 000007C2 08C0                <1> 	or	al,al			;AN000; end of string ?
  1046 000007C4 741A                <1> 	je	D_P_RCOL_Exit		;AN000; if yes, just exit
  1047                              <1> 
  1048 000007C6 3C3A                <1> 	cmp	al,D_P_Colon		;AN000; is it colon ?
  1049 000007C8 750D                <1> 	jne	D_P_RCOL00		;AN000;
  1050                              <1> 
  1051 000007CA 2E807C0100          <1> 	cmp	byte ptr [psdata_seg:si+1],D_P_NULL ;AN000; if so, next is NULL ?
  1052 000007CF 7506                <1> 	jne	D_P_RCOL00		;AN000; no, then next char
  1053                              <1> 
  1054 000007D1 2EC60400            <1> 	mov	byte ptr [psdata_seg:si],D_P_NULL ;AN000; yes, remove colon
  1055 000007D5 EB09                <1> 	jmp	short D_P_RCOL_Exit	;AN000; and exit.
  1056                              <1> 
  1057                              <1> D_P_RCOL00:				;AN000;
  1058 000007D7 E85C04              <1> 	call	D_P_Chk_DBCS		;AN000; if not colon, then check if
  1059 000007DA 7301                <1> 	jnc	D_P_RCOL01		;AN000; DBCS leading byte.
  1060                              <1> 
  1061 000007DC 46                  <1> 	inc	si			;AN000; if yes, skip trailing byte
  1062                              <1> D_P_RCOL01:				;AN000;
  1063 000007DD 46                  <1> 	inc	si			;AN000; si points to next byte
  1064 000007DE EBDF                <1> 	jmp	short D_P_RCOL_Loop	;AN000; loop until NULL encountered
  1065                              <1> 
  1066                              <1> D_P_RCOL_Exit:				;AN000;
  1067 000007E0 5E                  <1> 	pop	si			;AN000;
  1068 000007E1 58                  <1> 	pop	ax			;AN000;
  1069 000007E2 C3                  <1> 	ret				;AN000;
  1070                              <1> D_P_Remove_Colon endp			;AN000;
  1071                              <1> ;PAGE					;AN000;
  1072                              <1> ;***********************************************************************
  1073                              <1> ; D_P_Do_CAPS_String;
  1074                              <1> ;
  1075                              <1> ; Function: Perform capitalization along with the file case map table
  1076                              <1> ;	    or character case map table.
  1077                              <1> ;
  1078                              <1> ; Input:    AL = 2 : Use character table
  1079                              <1> ;	    AL = 4 : Use file table
  1080                              <1> ;	    psdata_seg:SI points to string buffer to be capitalized
  1081                              <1> ;
  1082                              <1> ; Output:   None
  1083                              <1> ;
  1084                              <1> ; Use:	D_P_Do_CAPS_Char, D_P_Chk_DBCS
  1085                              <1> ;***********************************************************************
  1086                              <1> D_P_Do_CAPS_String proc			;AN000;
  1087 000007E3 56                  <1> 	push	si			;AN000;
  1088 000007E4 52                  <1> 	push	dx			;AN000;
  1089 000007E5 88C2                <1> 	mov	dl,al			;AN000; save info id
  1090                              <1> 
  1091                              <1> D_P_DCS_Loop:				;AN000;
  1092 000007E7 2E8A04              <1> 	mov	al,[psdata_seg:si]	;AN000; load charater and
  1093 000007EA E84904              <1> 	call	D_P_Chk_DBCS		;AN000; check if DBCS leading byte
  1094 000007ED 720C                <1> 	jc	D_P_DCS00		;AN000; if yes, do not need CAPS
  1095                              <1> 
  1096 000007EF 08C0                <1> 	or	al,al			;AN000; end of string ?
  1097 000007F1 740C                <1> 	je	D_P_DCS_Exit		;AN000; then exit.
  1098                              <1> 
  1099 000007F3 E80C00              <1> 	call	D_P_Do_CAPS_Char 	;AN000; Here a SBCS char need to be CAPS
  1100 000007F6 2E8804              <1> 	mov	[psdata_seg:si],al	;AN000; stored upper case char to buffer
  1101 000007F9 EB01                <1> 	jmp	short D_P_DCS01		;AN000; process nexit
  1102                              <1> D_P_DCS00:				;AN000;
  1103 000007FB 46                  <1> 	inc	si			;AN000; skip DBCS leading and trailing byte
  1104                              <1> D_P_DCS01:				;AN000;
  1105 000007FC 46                  <1> 	inc	si			;AN000; si point to next byte
  1106 000007FD EBE8                <1> 	jmp	short D_P_DCS_Loop	;AN000; loop until NULL encountered
  1107                              <1> D_P_DCS_Exit:				;AN000;
  1108 000007FF 5A                  <1> 	pop	dx			;AN000;
  1109 00000800 5E                  <1> 	pop	si			;AN000;
  1110 00000801 C3                  <1> 	ret				;AN000;
  1111                              <1> D_P_Do_CAPS_String endp			;AN000;
  1112                              <1> ;PAGE					;AN000;
  1113                              <1> ;***********************************************************************
  1114                              <1> ; D_P_Do_CAPS_Char;
  1115                              <1> ;
  1116                              <1> ; Function: Perform capitalization along with the file case map table
  1117                              <1> ;	    or character case map table.
  1118                              <1> ;
  1119                              <1> ; Input:    DL = 2 : Use character table
  1120                              <1> ;	    DL = 4 : Use file table
  1121                              <1> ;	    AL = character to be capitalized
  1122                              <1> ;
  1123                              <1> ; Output:   None
  1124                              <1> ;
  1125                              <1> ; Use:	INT 21h /w AH=65h
  1126                              <1> ;***********************************************************************
  1127                              <1> D_P_Do_CAPS_Char proc			;AN000;
  1128 00000802 3C80                <1> 	cmp	al,D_P_ASCII80		;AN000; need upper case table ?
  1129 00000804 730C                <1> 	jae	D_P_DCC_Go		;AN000;
  1130                              <1> 
  1131 00000806 3C61                <1> 	cmp	al,"a"                  ;AN000; if no,
  1132 00000808 723C                <1> 	jb	D_P_CAPS_Ret		;AN000;   check if  "a" <= AL <= "z"
  1133                              <1> 
  1134 0000080A 3C7A                <1> 	cmp	al,"z"                  ;AN000;
  1135 0000080C 7738                <1> 	ja	D_P_CAPS_Ret		;AN000;   if yes, make CAPS
  1136                              <1> 
  1137 0000080E 24DF                <1> 	and	al,D_P_Make_Upper	;AN000;   else do nothing.
  1138 00000810 EB34                <1> 	jmp	short D_P_CAPS_Ret	;AN000;
  1139                              <1> 
  1140                              <1> D_P_DCC_Go:				;AN000;
  1141 00000812 53                  <1> 	push	bx			;AN000;
  1142 00000813 06                  <1> 	push	es			;AN000;
  1143 00000814 57                  <1> 	push	di			;AN000;
  1144                              <1> %IF	CAPSW				;AN000;(Check if uppercase conversion is supported)
  1145                              <1> 	lea	di,[D_P_File_CAP_Ptr] ;AC034;
  1146                              <1> 	cmp	dl,D_P_DOSTBL_File	;AN000; Use file CAPS table ?
  1147                              <1> 	je	D_P_DCC00		;AN000;
  1148                              <1> 
  1149                              <1> %ENDIF					;AN000;(of CAPSW)
  1150 00000815 8D3E[5604]          <1> 	lea	di,[D_P_Char_CAP_Ptr] ;AC034; or use char CAPS table ?
  1151                              <1> D_P_DCC00:				;AN000;
  1152 00000819 2E3815              <1> 	cmp	[psdata_seg:di],dl	;AN000; already got table address ?
  1153 0000081C 7417                <1> 	je	D_P_DCC01		;AN000; if no,
  1154                              <1> 
  1155                              <1> ;In this next section, ES will be used to pass a 5 byte workarea to INT 21h,
  1156                              <1> ; the GET COUNTYRY INFO call.  This usage of ES is required by the function
  1157                              <1> ; call, regardless of what base register is currently be defined as PSDATA_SEG.
  1158                              <1> ;BASESW EQU 0 means that ES is the psdata_seg reg.
  1159                              <1> 
  1160                              <1> %IFDEF BASESW				;AN037; If BASESW has been defined, and
  1161                              <1>   %IFN BASESW				;AN037; If ES is psdata base
  1162                              <1> 	push	PSDATA_SEG		;AN037; save current base reg
  1163                              <1>   %ENDIF 				;AN037;
  1164                              <1> %ENDIF					;AN037;
  1165                              <1> 
  1166 0000081E 50                  <1> 	push	ax			;AN000; get CAPS table thru DOS call
  1167 0000081F 51                  <1> 	push	cx			;AN000;
  1168 00000820 52                  <1> 	push	dx			;AN000;
  1169                              <1> 
  1170                              <1> 
  1171 00000821 0E                  <1> 	push	PSDATA_SEG		;AC036; pass current base seg into
  1172                              <1> 					;(Note: this used to push CS.  BUG...
  1173 00000822 07                  <1> 	pop	es			;AN000;   ES reg, required for
  1174                              <1> 					;get extended country information
  1175 00000823 B465                <1> 	mov	ah,D_P_DOS_Get_TBL	;AN000; get extended CDI
  1176 00000825 88D0                <1> 	mov	al,dl			;AN000; upper case table
  1177 00000827 BBFFFF              <1> 	mov	bx,D_P_DOSTBL_Def	;AN000; get active CON
  1178 0000082A B90500              <1> 	mov	cx,D_P_DOSTBL_BL 	;AN000; buffer length
  1179 0000082D BAFFFF              <1> 	mov	dx,D_P_DOSTBL_Def	;AN000; get for default code page
  1180                              <1> 					;DI already set to point to buffer
  1181 00000830 CD21                <1> 	int	21h			;AN000; es:di point to buffer that
  1182                              <1> 					;now has been filled in with info
  1183 00000832 5A                  <1> 	pop	dx			;AN000;
  1184 00000833 59                  <1> 	pop	cx			;AN000;
  1185 00000834 58                  <1> 	pop	ax			;AN000;
  1186                              <1> %IFDEF BASESW				;AN037; If BASESW has been defined, and
  1187                              <1>   %IFN BASESW				;AN037; If ES is psdata base
  1188                              <1> 	pop	PSDATA_SEG		;AN037; restore current base reg
  1189                              <1>   %ENDIF 				;AN037;
  1190                              <1> %ENDIF					;AN037;
  1191                              <1> D_P_DCC01:				;AN000;
  1192                              <1> 
  1193                              <1> ;In this next section, ES will be used as the base of the XLAT table, provided
  1194                              <1> ; by the previous GET COUNTRY INFO DOS call.  This usage of ES is made
  1195                              <1> ; regardless of which base reg is currently the PSDATA_SEG reg.
  1196                              <1> 
  1197                              <1> %IFDEF BASESW				;AN037; If BASESW has been defined, and
  1198                              <1>   %IFN BASESW				;AN037; If ES is psdata base
  1199                              <1> 	push	PSDATA_SEG		;AN037; save current base reg
  1200                              <1>   %ENDIF 				;AN037;
  1201                              <1> %ENDIF					;AN037;
  1202 00000835 2E8B5D01            <1> 	mov	bx,[psdata_seg:di+D_P_DOS_TBL_Off] ;AN000; get offset of table
  1203 00000839 2E8E4503            <1> 	mov	es,[psdata_seg:di+D_P_DOS_TBL_Seg] ;AN000; get segment of table
  1204 0000083D 43                  <1> 	inc	bx			;AC035; add '2' to
  1205 0000083E 43                  <1> 	inc	bx			;AC035;  BX reg
  1206                              <1> 					;AN000; skip length field
  1207                              <1> ;(changed ;AN035;) add	   bx,word	;AN000; skip length field
  1208 0000083F 2C80                <1> 	sub	al,D_P_ASCII80		;AN000; make char to index
  1209 00000841 26D7                <1> 	es xlatb 		;AN000; perform case map
  1210                              <1> 
  1211                              <1> %IFDEF BASESW				;AN037; If BASESW has been defined, and
  1212                              <1>   %IFN BASESW				;AN037; If ES is psdata base
  1213                              <1> 	pop	PSDATA_SEG		;AN037; restore current base reg
  1214                              <1>   %ENDIF 				;AN037;
  1215                              <1> %ENDIF					;AN037;
  1216 00000843 5F                  <1> 	pop	di			;AN000;
  1217 00000844 07                  <1> 	pop	es			;AN000;
  1218 00000845 5B                  <1> 	pop	bx			;AN000;
  1219                              <1> D_P_CAPS_Ret:				;AN000;
  1220 00000846 C3                  <1> 	ret				;AN000;
  1221                              <1> D_P_Do_CAPS_Char endp			;AN000;
  1222                              <1> ;PAGE					;AN000;
  1223                              <1> ;***********************************************************************
  1224                              <1> %IF	NumSW				;AN000;(Check if numeric value is supported)
  1225                              <1> ; D_P_Value / D_P_SValue
  1226                              <1> ;
  1227                              <1> ; Function:  Make 32bit value from psdata_seg:SI and see value list
  1228                              <1> ;	     and make result buffer.
  1229                              <1> ;	     D_P_SValue is an entry point for the signed value
  1230                              <1> ;	     and this will simply call D_P_Value after the handling
  1231                              <1> ;	     of the sign character, "+" or "-"
  1232                              <1> ;
  1233                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  1234                              <1> ;	     ES:BX -> CONTROL block
  1235                              <1> ;
  1236                              <1> ; Output:    None
  1237                              <1> ;
  1238                              <1> ; Use:	D_P_Fill_Result, D_P_Check_OVF
  1239                              <1> ;
  1240                              <1> ; Vars: D_P_RC(W), D_P_Flags(RW)
  1241                              <1> ;***********************************************************************
  1242                              <1> D_P_SValue proc				;AN000; when signed value here
  1243 00000847 50                  <1> 	push	ax			;AN000;
  1244 00000848 2E800E[CD03]80      <1> 	or	byte [psdata_seg:D_P_Flags2],D_P_Signed	    ;AC034; indicate a signed numeric
  1245 0000084E 2E8026[CD03]FD      <1> 	and	byte [psdata_seg:D_P_Flags2],0ffh-D_P_Neg  ;AC034; assume positive value
  1246 00000854 2E8A04              <1> 	mov	al,[psdata_seg:si]	;AN000; get sign
  1247 00000857 3C2B                <1> 	cmp	al,D_P_Plus		;AN000; "+" ?
  1248 00000859 740A                <1> 	je	D_P_SVal00		;AN000;
  1249                              <1> 
  1250 0000085B 3C2D                <1> 	cmp	al,D_P_Minus		;AN000; "-" ?
  1251 0000085D 7507                <1> 	jne	D_P_Sval01		;AN000; else
  1252                              <1> 
  1253 0000085F 2E800E[CD03]02      <1> 	or	byte [psdata_seg:D_P_Flags2],D_P_Neg ;AC034; set this is negative value
  1254                              <1> D_P_SVal00:				;AN000;
  1255 00000865 46                  <1> 	inc	si			;AN000; skip sign char
  1256                              <1> D_P_Sval01:				;AN000;
  1257 00000866 E80200              <1> 	call	D_P_Value		;AN000; and process value
  1258 00000869 58                  <1> 	pop	ax			;AN000;
  1259 0000086A C3                  <1> 	ret				;AN000;
  1260                              <1> D_P_SValue endp				;AN000;
  1261                              <1> ;***********************************************************************
  1262                              <1> D_P_Value proc				;AN000;
  1263 0000086B 50                  <1> 	push	ax			;AN000;
  1264 0000086C 51                  <1> 	push	cx			;AN000;
  1265 0000086D 52                  <1> 	push	dx			;AN000;
  1266 0000086E 56                  <1> 	push	si			;AN000;
  1267 0000086F 31C9                <1> 	xor	cx,cx			;AN000; cx = higher 16 bits
  1268 00000871 31D2                <1> 	xor	dx,dx			;AN000; dx = lower 16 bits
  1269 00000873 53                  <1> 	push	bx			;AN000; save control pointer
  1270                              <1> D_P_Value_Loop:				;AN000;
  1271 00000874 2E8A04              <1> 	mov	al,[psdata_seg:si]	;AN000; get character
  1272 00000877 08C0                <1> 	or	al,al			;AN000; end of line ?
  1273 00000879 7442                <1> 	je	D_P_Value00		;AN000;
  1274                              <1> 
  1275 0000087B E8F100              <1> 	call	D_P_0099 		;AN000; make asc(0..9) to bin(0..9)
  1276 0000087E 7239                <1> 	jc	D_P_Value_Err0		;AN000;
  1277                              <1> 
  1278 00000880 30E4                <1> 	xor	ah,ah			;AN000;
  1279 00000882 89C5                <1> 	mov	bp,ax			;AN000; save binary number
  1280 00000884 D1E2                <1> 	shl	dx,1			;AN000; to have 2*x
  1281 00000886 D1D1                <1> 	rcl	cx,1			;AN000; shift left w/ carry
  1282 00000888 E8D200              <1> 	call	D_P_Check_OVF		;AN000; Overflow occurred ?
  1283 0000088B 722C                <1> 	jc	D_P_Value_Err0		;AN000; then error, exit
  1284                              <1> 
  1285 0000088D 89D3                <1> 	mov	bx,dx			;AN000; save low(2*x)
  1286 0000088F 89C8                <1> 	mov	ax,cx			;AN000; save high(2*x)
  1287 00000891 D1E2                <1> 	shl	dx,1			;AN000; to have 4*x
  1288 00000893 D1D1                <1> 	rcl	cx,1			;AN000; shift left w/ carry
  1289 00000895 E8C500              <1> 	call	D_P_Check_OVF		;AN000; Overflow occurred ?
  1290 00000898 721F                <1> 	jc	D_P_Value_Err0		;AN000; then error, exit
  1291                              <1> 
  1292 0000089A D1E2                <1> 	shl	dx,1			;AN000; to have 8*x
  1293 0000089C D1D1                <1> 	rcl	cx,1			;AN000; shift left w/ carry
  1294 0000089E E8BC00              <1> 	call	D_P_Check_OVF		;AN000; Overflow occurred ?
  1295 000008A1 7216                <1> 	jc	D_P_Value_Err0		;AN000; then error, exit
  1296                              <1> 
  1297 000008A3 01DA                <1> 	add	dx,bx			;AN000; now have 10*x
  1298 000008A5 11C1                <1> 	adc	cx,ax			;AN000; 32bit ADD
  1299 000008A7 E8B300              <1> 	call	D_P_Check_OVF		;AN000; Overflow occurred ?
  1300 000008AA 720D                <1> 	jc	D_P_Value_Err0		;AN000; then error, exit
  1301                              <1> 
  1302 000008AC 01EA                <1> 	add	dx,bp			;AN000; Add the current one degree decimal
  1303 000008AE 83D100              <1> 	adc	cx,0			;AN000; if carry, add 1 to high 16bit
  1304 000008B1 E8A900              <1> 	call	D_P_Check_OVF		;AN000; Overflow occurred ?
  1305 000008B4 7203                <1> 	jc	D_P_Value_Err0		;AN000; then error, exit
  1306                              <1> 
  1307 000008B6 46                  <1> 	inc	si			;AN000; update pointer
  1308 000008B7 EBBB                <1> 	jmp	short D_P_Value_Loop	;AN000; loop until NULL encountered
  1309                              <1> ;
  1310                              <1> D_P_Value_Err0:				;AN000;
  1311 000008B9 5B                  <1> 	pop	bx			;AN000;
  1312 000008BA E98D00              <1> 	jmp	D_P_Value_Err		;AN000; Bridge
  1313                              <1> ;
  1314                              <1> D_P_Value00:				;AN000;
  1315 000008BD 5B                  <1> 	pop	bx			;AN000; restore control pointer
  1316 000008BE 2EF606[CD03]02      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_Neg ;AC034; here cx,dx = 32bit value
  1317 000008C4 740A                <1> 	je	D_P_Value01		;AN000; was it negative ?
  1318                              <1> 
  1319 000008C6 F7D1                <1> 	not	cx			;AN000; +
  1320 000008C8 F7D2                <1> 	not	dx			;AN000; |- Make 2's complement
  1321 000008CA 83C201              <1> 	add	dx,1			;AN000; |
  1322 000008CD 83D100              <1> 	adc	cx,0			;AN000; +
  1323                              <1> D_P_Value01:				;AN000; / nval =0
  1324 000008D0 268B7706            <1> 	mov	si,[es:bx + D_P_Value_List] ;AN000; si points to value list
  1325 000008D4 268A04              <1> 	mov	al,[es:si]		;AN000; get nval
  1326 000008D7 3C00                <1> 	cmp	al,D_P_nval_None 	;AN000; no value list ?
  1327 000008D9 7507                <1> 	jne	D_P_Value02		;AN000;
  1328                              <1> 
  1329 000008DB B001                <1> 	mov	al,D_P_Number		;AN000; Set type
  1330 000008DD B4FF                <1> 	mov	ah,D_P_No_Tag		;AN000; No ITEM_TAG set
  1331 000008DF EB74                <1> 	jmp	D_P_Value_Exit		;AN000;
  1332 000008E1 90                  <1> 	nop	; identicalise
  1333                              <1> 
  1334                              <1> D_P_Value02:				;AN000; / nval = 1
  1335                              <1> %IF	Val1SW				;AN000;(Check if value list id #1 is supported)
  1336                              <1> ;(tm07) cmp	al,D_P_nval_Range	;AN000; have range list ?
  1337                              <1> ;(tm07) jne	D_P_Value03		;AN000;
  1338                              <1> 
  1339 000008E2 46                  <1> 	inc	si			;AN000;
  1340 000008E3 268A04              <1> 	mov	al,[es:si]		;AN000; al = number of range
  1341 000008E6 3C00                <1> 	cmp	al,D_P_No_nrng		;AN000; (tm07)
  1342 000008E8 7460                <1> 	je	D_P_Value03		;AN000; (tm07)
  1343                              <1> 
  1344 000008EA 46                  <1> 	inc	si			;AN000; si points to 1st item_tag
  1345                              <1> D_P_Val02_Loop:				;AN000;
  1346 000008EB 2EF606[CD03]80      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_Signed ;AC034;
  1347 000008F1 751E                <1> 	jne	D_P_Val02_Sign		;AN000;
  1348                              <1> 
  1349 000008F3 263B4C03            <1> 	cmp	cx,[es:si+D_P_Val_XH]	;AN000; comp cx with XH
  1350 000008F7 7236                <1> 	jb	D_P_Val02_Next		;AN000;
  1351                              <1> 
  1352 000008F9 7706                <1> 	ja	D_P_Val_In		;AN000;
  1353                              <1> 
  1354 000008FB 263B5401            <1> 	cmp	dx,[es:si+D_P_Val_XL]	;AN000; comp dx with XL
  1355 000008FF 722E                <1> 	jb	D_P_Val02_Next		;AN000;
  1356                              <1> 
  1357                              <1> D_P_Val_In:				;AN000;
  1358                              <1> ;;;;;;	cmp	cx,es:D_P_Val_YH]	; comp cx with YH (tm01)
  1359 00000901 263B4C07            <1> 	cmp	cx,[es:si+D_P_Val_YH]	;AN000; comp cx with YH (tm01)
  1360 00000905 7728                <1> 	ja	D_P_Val02_Next		;AN000;
  1361                              <1> 
  1362 00000907 723A                <1> 	jb	D_P_Val_Found		;AN000;
  1363                              <1> 
  1364 00000909 263B5405            <1> 	cmp	dx,[es:si+D_P_Val_YL]	;AN000; comp dx with YL
  1365 0000090D 7720                <1> 	ja	D_P_Val02_Next		;AN000;
  1366                              <1> 
  1367 0000090F EB32                <1> 	jmp	short D_P_Val_Found	;AN000;
  1368                              <1> 
  1369                              <1> D_P_Val02_Sign:				;AN000;
  1370 00000911 263B4C03            <1> 	cmp	cx,[es:si+D_P_Val_XH]	;AN000; comp cx with XH
  1371 00000915 7C18                <1> 	jl	D_P_Val02_Next		;AN000;
  1372                              <1> 
  1373 00000917 7F06                <1> 	jg	D_P_SVal_In		;AN000;
  1374                              <1> 
  1375 00000919 263B5401            <1> 	cmp	dx,[es:si+D_P_Val_XL]	;AN000; comp dx with XL
  1376 0000091D 7C10                <1> 	jl	D_P_Val02_Next		;AN000;
  1377                              <1> 
  1378                              <1> D_P_SVal_In:				;AN000;
  1379 0000091F 263B4C07            <1> 	cmp	cx,[es:si+D_P_Val_YH]	;AN000; comp cx with YH
  1380 00000923 7F0A                <1> 	jg	D_P_Val02_Next		;AN000;
  1381                              <1> 
  1382 00000925 7C1C                <1> 	jl	D_P_Val_Found		;AN000;
  1383                              <1> 
  1384 00000927 263B5405            <1> 	cmp	dx,[es:si+D_P_Val_YL]	;AN000; comp dx with YL
  1385 0000092B 7F02                <1> 	jg	D_P_Val02_Next		;AN000;
  1386                              <1> 
  1387 0000092D EB14                <1> 	jmp	short D_P_Val_Found	;AN000;
  1388                              <1> 
  1389                              <1> D_P_Val02_Next:				;AN000;
  1390 0000092F 83C609              <1> 	add	si,D_P_Len_Range 	;AN000;
  1391 00000932 FEC8                <1> 	dec	al			;AN000; loop nrng times in AL
  1392 00000934 75B5                <1> 	jne	D_P_Val02_Loop		;AN000;
  1393                              <1> 					; / Not found
  1394                              <1> D_P_Out_of_Range equ D_P_Out_Of_Range	; NASM port equate
  1395 00000936 2EC706[C103]0600    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Out_of_Range ;AC034;
  1396 0000093D B001                <1> 	mov	al,D_P_Number		;AN000;
  1397 0000093F B4FF                <1> 	mov	ah,D_P_No_Tag		;AN000; No ITEM_TAG set
  1398 00000941 EB12                <1> 	jmp	short D_P_Value_Exit	;AN000;
  1399                              <1> 
  1400                              <1> %ENDIF					;AN000;(of Val1SW)
  1401                              <1> %IF	Val1SW+Val2SW			;AN000;(Check if value list id #1 or #2 is supported)
  1402                              <1> D_P_Val_Found:				;AN000;
  1403 00000943 B001                <1> 	mov	al,D_P_Number		;AN000;
  1404 00000945 268A24              <1> 	mov	ah,[es:si]		;AN000; found ITEM_TAG set
  1405 00000948 EB0B                <1> 	jmp	short D_P_Value_Exit	;AN000;
  1406                              <1> 
  1407                              <1> %ENDIF					;AN000;(of Val1SW+Val2SW)
  1408                              <1> D_P_Value03:				;AN000; / nval = 2
  1409                              <1> %IF	Val2SW				;AN000;(Check if value list id #2 is supported)
  1410                              <1> ;;;;	cmp	al,D_P_nval_Value	; have match list ? ASSUME nval=2,
  1411                              <1> ;;;;	jne	D_P_Value04		; even if it is 3 or more.
  1412                              <1> ;(tm07) inc	si			;AN000;
  1413                              <1> ;(tm07) mov	al,[es:si]		;AN000; al = nrng
  1414                              <1> 	mov	ah,D_P_Len_Range 	;AN000;
  1415                              <1> 	mul	ah			;AN000;  Skip nrng field
  1416                              <1> 	inc	ax			;AN000;
  1417                              <1> 	add	si,ax			;AN000; si points to nnval
  1418                              <1> 	mov	al,[es:si]		;AN000; get nnval
  1419                              <1> 	inc	si			;AN000; si points to 1st item_tag
  1420                              <1> D_P_Val03_Loop:				;AN000;
  1421                              <1> 	cmp	cx,[es:si+D_P_Val_XH]	;AN000; comp cx with XH
  1422                              <1> 	jne	D_P_Val03_Next		;AN000;
  1423                              <1> 
  1424                              <1> 	cmp	dx,[es:si+D_P_Val_XL]	;AN000; comp dx with XL
  1425                              <1> 	je	D_P_Val_Found		;AN000;
  1426                              <1> 
  1427                              <1> D_P_Val03_Next:				;AN000;
  1428                              <1> 	add	si,D_P_Len_Value 	;AN000; points to next value choice
  1429                              <1> 	dec	al			;AN000; loop nval times in AL
  1430                              <1> 	jne	D_P_Val03_Loop		;AN000;
  1431                              <1> 					;AN000; / Not found
  1432                              <1> D_P_Not_in_Val equ D_P_Not_In_Val	; NASM port equate
  1433                              <1> 	mov	word [psdata_seg:D_P_RC],D_P_Not_in_Val ;AC034;
  1434                              <1> 	mov	al,D_P_Number		;AN000;
  1435                              <1> 	mov	ah,D_P_No_Tag		;AN000; No ITEM_TAG set
  1436                              <1> 	jmp	short D_P_Value_Exit	;AN000;
  1437                              <1> 
  1438                              <1> %ENDIF					;AN000;(of Val2SW)
  1439                              <1> D_P_Value04:				;AN000; / nval = 3 or else
  1440                              <1> D_P_Value_Err:				;AN000;
  1441 0000094A 2EC706[C103]0900    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034;
  1442 00000951 B003                <1> 	mov	al,D_P_String		;AN000; Set type
  1443 00000953 B4FF                <1> 	mov	ah,D_P_No_Tag		;AN000; No ITEM_TAG set
  1444                              <1> D_P_Value_Exit:				;AN000;
  1445 00000955 E82EFD              <1> 	call	D_P_Fill_Result		;AN000;
  1446 00000958 5E                  <1> 	pop	si			;AN000;
  1447 00000959 5A                  <1> 	pop	dx			;AN000;
  1448 0000095A 59                  <1> 	pop	cx			;AN000;
  1449 0000095B 58                  <1> 	pop	ax			;AN000;
  1450 0000095C C3                  <1> 	ret				;AN000;
  1451                              <1> D_P_Value endp				;AN000;
  1452                              <1> ;PAGE					;AN000;
  1453                              <1> ;***********************************************************************
  1454                              <1> ; D_P_Check_OVF
  1455                              <1> ;
  1456                              <1> ; Function:  Check if overflow is occurred with consideration of
  1457                              <1> ;	     signed or un-signed numeric value
  1458                              <1> ;
  1459                              <1> ; Input:     Flag register
  1460                              <1> ;
  1461                              <1> ; Output:    CY = 1  :	Overflow
  1462                              <1> ;
  1463                              <1> ; Vars:     D_P_Flags(R)
  1464                              <1> ;***********************************************************************
  1465                              <1> D_P_Check_OVF proc			;AN000;
  1466 0000095D 9C                  <1> 	pushf				;AN000;
  1467 0000095E 2EF606[CD03]02      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_Neg ;AC034; is it negative value ?
  1468 00000964 7502                <1> 	jne	D_P_COVF 		;AN000; if no, check overflow
  1469                              <1> 
  1470 00000966 9D                  <1> 	popf				;AN000; by the CY bit
  1471 00000967 C3                  <1> 	ret				;AN000;
  1472                              <1> 
  1473                              <1> D_P_COVF:				;AN000;
  1474 00000968 9D                  <1> 	popf				;AN000; else,
  1475 00000969 7002                <1> 	jo	D_P_COVF00		;AN000; check overflow by the OF
  1476                              <1> 
  1477 0000096B F8                  <1> 	clc				;AN000; indicate it with CY bit
  1478 0000096C C3                  <1> 	ret				;AN000; CY=0 means no overflow
  1479                              <1> 
  1480                              <1> D_P_COVF00:				;AN000;
  1481 0000096D F9                  <1> 	stc				;AN000; and CY=1 means overflow
  1482 0000096E C3                  <1> 	ret				;AN000;
  1483                              <1> D_P_Check_OVF endp			;AN000;
  1484                              <1> %ENDIF					;AN000;(of FarSW)
  1485                              <1> ;***********************************************************************
  1486                              <1> ; D_P_0099;
  1487                              <1> ;
  1488                              <1> ; Function:  Make ASCII 0-9 to Binary 0-9
  1489                              <1> ;
  1490                              <1> ; Input:     AL = character code
  1491                              <1> ;
  1492                              <1> ; Output:    CY = 1 : AL is not number
  1493                              <1> ;	     CY = 0 : AL contains binary value
  1494                              <1> ;***********************************************************************
  1495                              <1> D_P_0099 proc				;AN000;
  1496 0000096F 3C30                <1> 	cmp	al,"0"                  ;AN000;
  1497 00000971 7208                <1> 	jb	D_P_0099Err		;AN000;  must be 0 =< al =< 9
  1498                              <1> 
  1499 00000973 3C39                <1> 	cmp	al,"9"                  ;AN000;
  1500 00000975 7704                <1> 	ja	D_P_0099Err		;AN000;  must be 0 =< al =< 9
  1501                              <1> 
  1502 00000977 2C30                <1> 	sub	al,"0"                  ;AN000; make char -> bin
  1503 00000979 F8                  <1> 	clc				;AN000; indicate no error
  1504 0000097A C3                  <1> 	ret				;AN000;
  1505                              <1> 
  1506                              <1> D_P_0099Err:				;AN000;
  1507 0000097B F9                  <1> 	stc				;AN000; indicate error
  1508 0000097C C3                  <1> 	ret				;AN000;
  1509                              <1> D_P_0099 endp				;AN000;
  1510                              <1> ;PAGE					;AN000;
  1511                              <1> ;***********************************************************************
  1512                              <1> ; D_P_Simple_String
  1513                              <1> ;
  1514                              <1> ; Function:  See value list for the simple string
  1515                              <1> ;	     and make result buffer.
  1516                              <1> ;
  1517                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  1518                              <1> ;	     ES:BX -> CONTROL block
  1519                              <1> ;
  1520                              <1> ; Output:    None
  1521                              <1> ;
  1522                              <1> ; Use:	D_P_Fill_Result, D_P_String_Comp
  1523                              <1> ;
  1524                              <1> ; Vars: D_P_RC(W)
  1525                              <1> ;***********************************************************************
  1526                              <1> D_P_Simple_String proc			;AN000;
  1527 0000097D 50                  <1> 	push	ax			;AN000;
  1528 0000097E 53                  <1> 	push	bx			;AN000;
  1529 0000097F 52                  <1> 	push	dx			;AN000;
  1530 00000980 57                  <1> 	push	di			;AN000;
  1531 00000981 268B7F06            <1> 	mov	di,[es:bx + D_P_Value_List] ;AN000; di points to value list
  1532 00000985 268A05              <1> 	mov	al,[es:di]		;AN000; get nval
  1533 00000988 08C0                <1> 	or	al,al			;AN000; no value list ?
  1534 0000098A 7504                <1> 	jne	D_P_Sim00		;AN000; then
  1535                              <1> 
  1536 0000098C B4FF                <1> 	mov	ah,D_P_No_Tag		;AN000; No ITEM_TAG set
  1537 0000098E EB4C                <1> 	jmp	short D_P_Sim_Exit	;AN000; and set result buffer
  1538                              <1> 
  1539                              <1> D_P_Sim00:				;AN000;
  1540                              <1> %IF	Val3SW+KeySW			;AN000;(Check if keyword or value list id #3 is supported)
  1541 00000990 3C03                <1> 	cmp	al,D_P_nval_String	;AN000; String choice list provided ?
  1542 00000992 753F                <1> 	jne	D_P_Sim01		;AN000; if no, syntax error
  1543                              <1> 
  1544 00000994 47                  <1> 	inc	di			;AN000;
  1545 00000995 268A05              <1> 	mov	al,[es:di]		;AN000; al = nrng
  1546 00000998 B409                <1> 	mov	ah,D_P_Len_Range 	;AN000;
  1547 0000099A F6E4                <1> 	mul	ah			;AN000;  Skip nrng field
  1548 0000099C 40                  <1> 	inc	ax			;AN000; ax = (nrng*9)+1
  1549 0000099D 01C7                <1> 	add	di,ax			;AN000; di points to nnval
  1550 0000099F 268A05              <1> 	mov	al,[es:di]		;AN000; get nnval
  1551 000009A2 B405                <1> 	mov	ah,D_P_Len_Value 	;AN000;
  1552 000009A4 F6E4                <1> 	mul	ah			;AN000; Skip nnval field
  1553 000009A6 40                  <1> 	inc	ax			;AN000; ax = (nnval*5)+1
  1554 000009A7 01C7                <1> 	add	di,ax			;AN000; di points to nstrval
  1555 000009A9 268A05              <1> 	mov	al,[es:di]		;AN000; get nstrval
  1556 000009AC 47                  <1> 	inc	di			;AC035; add '2' to
  1557 000009AD 47                  <1> 	inc	di			;AC035;  DI reg
  1558                              <1> 					;AN000; di points to 1st string in list
  1559                              <1> ;(replaced ;AC035;) add     di,2	;AN000; di points to 1st string in list
  1560                              <1> D_P_Sim_Loop:				;AN000;
  1561 000009AE 268B2D              <1> 	mov	bp,[es:di]		;AN000; get string pointer
  1562 000009B1 E83200              <1> 	call	D_P_String_Comp		;AN000; compare it with operand
  1563 000009B4 7312                <1> 	jnc	D_P_Sim_Found		;AN000; found on list ?
  1564                              <1> 
  1565 000009B6 83C703              <1> 	add	di,D_P_Len_String	;AN000; if no, point to next choice
  1566 000009B9 FEC8                <1> 	dec	al			;AN000; loop nstval times in AL
  1567 000009BB 75F1                <1> 	jne	D_P_Sim_Loop		;AN000;
  1568                              <1> 					;AN000; / Not found
  1569 000009BD 2EC706[C103]0800    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Not_In_Str ;AC034;
  1570 000009C4 B4FF                <1> 	mov	ah,D_P_No_Tag		;AN000; No ITEM_TAG set
  1571 000009C6 EB14                <1> 	jmp	short D_P_Sim_Exit	;AN000;
  1572                              <1> 
  1573                              <1> D_P_Sim_Found:				;AN000;
  1574 000009C8 268A65FF            <1> 	mov	ah,[es:di-1]		;AN000; set item_tag
  1575 000009CC B002                <1> 	mov	al,D_P_List_Idx		;AN000;
  1576 000009CE 268B15              <1> 	mov	dx,[es:di]		;AN000; get address of STRING
  1577 000009D1 EB0B                <1> 	jmp	short D_P_Sim_Exit0	;AN000;
  1578                              <1> %ENDIF					;AN000;(of Val3SW+KeySW)
  1579                              <1> D_P_Sim01:				;AN000;
  1580 000009D3 2EC706[C103]0900    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034;
  1581 000009DA B4FF                <1> 	mov	ah,D_P_No_Tag		;AN000; No ITEM_TAG set
  1582                              <1> D_P_Sim_Exit:				;AN000;
  1583 000009DC B003                <1> 	mov	al,D_P_String		;AN000; Set type
  1584                              <1> D_P_Sim_Exit0:				;AN000;
  1585 000009DE E8A5FC              <1> 	call	D_P_Fill_Result		;AN000;
  1586 000009E1 5F                  <1> 	pop	di			;AN000;
  1587 000009E2 5A                  <1> 	pop	dx			;AN000;
  1588 000009E3 5B                  <1> 	pop	bx			;AN000;
  1589 000009E4 58                  <1> 	pop	ax			;AN000;
  1590 000009E5 C3                  <1> 	ret				;AN000;
  1591                              <1> D_P_Simple_String endp			;AN000;
  1592                              <1> ;PAGE					;AN000;
  1593                              <1> ;***********************************************************************
  1594                              <1> ; D_P_String_Comp:
  1595                              <1> ;
  1596                              <1> ; Function:  Compare two string
  1597                              <1> ;
  1598                              <1> ; Input:     psdata_seg:SI -> 1st string
  1599                              <1> ;	     ES:BP -> 2nd string  (Must be upper case)
  1600                              <1> ;	     ES:BX -> CONTROL block
  1601                              <1> ;
  1602                              <1> ; Output:    CY = 1 if not match
  1603                              <1> ;
  1604                              <1> ; Use:	D_P_Chk_DBCS, D_P_Do_CAPS_Char
  1605                              <1> ;
  1606                              <1> ; Vars: D_P_KEYor_SW_Ptr(W), D_P_Flags(R). D_P_KEYorSW_Ptr
  1607                              <1> ;***********************************************************************
  1608                              <1> D_P_String_Comp proc			;AN000;
  1609 000009E6 50                  <1> 	push	ax			;AN000;
  1610 000009E7 55                  <1> 	push	bp			;AN000;
  1611 000009E8 52                  <1> 	push	dx			;AN000;
  1612 000009E9 56                  <1> 	push	si			;AN000;
  1613 000009EA B202                <1> 	mov	dl,D_P_DOSTBL_Char	;AN000; use character case map table
  1614                              <1> D_P_SCOM_Loop:				;AN000;
  1615 000009EC 2E8A04              <1> 	mov	al,[psdata_seg:si]	;AN000; get command character
  1616 000009EF E84402              <1> 	call	D_P_Chk_DBCS		;AN000; DBCS ?
  1617 000009F2 723C                <1> 	jc	D_P_SCOM00		;AN000; yes,DBCS
  1618                              <1> 
  1619 000009F4 E80BFE              <1> 	call	D_P_Do_CAPS_Char 	;AN000; else, upper case map before comparison
  1620                              <1> %IF	KeySW+SwSW			;AN000;(Check if keyword or switch is supported)
  1621 000009F7 2EF606[CD03]08      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_Key_Cmp ;AC034; keyword search ?
  1622 000009FD 740D                <1> 	je	D_P_SCOM04		;AN000;
  1623                              <1> 
  1624 000009FF 3C3D                <1> 	cmp	al,D_P_Keyword		;AN000; "=" is delimiter
  1625 00000A01 751F                <1> 	jne	D_P_SCOM03		;AN000;IF "=" on command line AND  (bp+1=> char after the "=" in synonym list)
  1626                              <1> 
  1627 00000A03 26807E0100          <1> 	cmp	byte ptr [es:bp+1],D_P_NULL ;AN021;   at end of keyword string in the control block THEN
  1628                              <1> D_P_SCOM_DIFFER equ D_P_SCOM_Differ	; NASM port label
  1629 00000A08 7571                <1> 	jne	D_P_SCOM_DIFFER		;AN021;
  1630                              <1> 
  1631 00000A0A EB13                <1> 	jmp	short D_P_SCOM05 	;AN000;   keyword found in synonym list
  1632                              <1> 
  1633                              <1> D_P_SCOM04:				;AN000;
  1634 00000A0C 2EF606[CD03]10      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_SW_Cmp ;AC034; switch search ?
  1635 00000A12 740E                <1> 	je	D_P_SCOM03		;AN000;
  1636                              <1> 
  1637 00000A14 3C3A                <1> 	cmp	al,D_P_Colon		;AN000; ":" is delimiter, at end of switch on command line
  1638 00000A16 750A                <1> 	jne	D_P_SCOM03		;AN000; continue compares
  1639                              <1> 
  1640 00000A18 26807E0000          <1> 	cmp	byte ptr [es:bp],D_P_NULL ;AN021; IF at end of switch on command AND
  1641 00000A1D 755C                <1> 	jne	D_P_SCOM_DIFFER		;AN021;   at end of switch string in the control block THEN
  1642                              <1> 
  1643                              <1> D_P_SCOM05:				;AN000;   found a match
  1644 00000A1F 46                  <1> 	inc	si			;AN000; si points to just after "=" or ":"
  1645 00000A20 EB5C                <1> 	jmp	short D_P_SCOM_Same	;AN000; exit
  1646                              <1> 
  1647                              <1> D_P_SCOM03:				;AN000;
  1648                              <1> %ENDIF					;AN000;(of KeySW+SwSW)
  1649 00000A22 263A4600            <1> 	cmp	al,[es:bp]		;AN000; compare operand w/ a synonym
  1650 00000A26 751D                <1> 	jne	D_P_SCOM_Differ0 	;AN000; if different, check ignore colon option
  1651                              <1> 
  1652 00000A28 08C0                <1> 	or	al,al			;AN000; end of line
  1653 00000A2A 7452                <1> 	je	D_P_SCOM_Same		;AN000; if so, exit
  1654                              <1> 
  1655 00000A2C 46                  <1> 	inc	si			;AN000; update operand pointer
  1656 00000A2D 45                  <1> 	inc	bp			;AN000; 	   and synonym pointer
  1657 00000A2E EB13                <1> 	jmp	short D_P_SCOM01 	;AN000; loop until NULL or "=" or ":" found in case
  1658                              <1> 
  1659                              <1> D_P_SCOM00:				;AN000; Here al is DBCS leading byte
  1660 00000A30 263A4600            <1> 	cmp	al,[es:bp]		;AN000; compare leading byte
  1661 00000A34 7545                <1> 	jne	D_P_SCOM_Differ		;AN000; if not match, say different
  1662                              <1> 
  1663 00000A36 46                  <1> 	inc	si			;AN000; else, load next byte
  1664 00000A37 2E8A04              <1> 	mov	al,[psdata_seg:si]	;AN000; and
  1665 00000A3A 45                  <1> 	inc	bp			;AN000;
  1666 00000A3B 263A4600            <1> 	cmp	al,[es:bp]		;AN000; compare 2nd byte
  1667 00000A3F 753A                <1> 	jne	D_P_SCOM_Differ		;AN000; if not match, say different, too
  1668                              <1> 
  1669 00000A41 46                  <1> 	inc	si			;AN000; else update operand pointer
  1670 00000A42 45                  <1> 	inc	bp			;AN000; 		and synonym pointer
  1671                              <1> D_P_SCOM01:				;AN000;
  1672 00000A43 EBA7                <1> 	jmp	short D_P_SCOM_Loop	;AN000; loop until NULL or "=" or "/" found in case
  1673                              <1> 
  1674                              <1> D_P_SCOM_Differ0:			;AN000;
  1675                              <1> 
  1676                              <1> %IF	SwSW				;AN000;(tm10)
  1677 00000A45 2EF606[CD03]40      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_SW ;AC034;(tm10)
  1678 00000A4B 740F                <1> 	je	D_P_not_applicable	;AN000;(tm10)
  1679                              <1> 
  1680 00000A4D 26F747022000        <1> 	test	word [es:bx + D_P_Function_Flag],D_P_colon_is_not_necessary ;AN000;(tm10)
  1681 00000A53 7407                <1> 	je	D_P_not_applicable	;AN000;(tm10)
  1682                              <1> 
  1683 00000A55 26807E0000          <1> 	cmp	byte ptr [es:bp],D_P_NULL ;AN000;(tm10)
  1684                              <1> ;(deleted ;AN025;) jne D_P_not_applicable ;AN000;(tm10)
  1685 00000A5A 7422                <1> 	je	D_P_SCOM_Same		;AN025;(tm10)
  1686                              <1> 
  1687                              <1> D_P_not_applicable:			;AN000;(tm10)
  1688                              <1> %ENDIF					;AN000;(tm10)
  1689                              <1> 
  1690 00000A5C 26F7071000          <1> 	test	word [es:bx + D_P_Match_Flag],D_P_Ig_Colon ;AN000; ignore colon option specified ?
  1691 00000A61 7418                <1> 	je	D_P_SCOM_Differ		;AN000; if no, say different.
  1692                              <1> 
  1693 00000A63 3C3A                <1> 	cmp	al,D_P_Colon		;AN000; End up with ":" and
  1694 00000A65 7509                <1> 	jne	D_P_SCOM02		;AN000;    subseqently
  1695                              <1> 
  1696 00000A67 26807E0000          <1> 	cmp	byte ptr [es:bp],D_P_NULL ;AN000;       NULL ?
  1697 00000A6C 750D                <1> 	jne	D_P_SCOM_Differ		;AN000; if no, say different
  1698                              <1> 
  1699 00000A6E EB0E                <1> 	jmp	short D_P_SCOM_Same	;AN000; else, say same
  1700                              <1> 
  1701                              <1> D_P_SCOM02:				;AN000;
  1702 00000A70 3C00                <1> 	cmp	al,D_P_NULL		;AN000; end up NULL and :
  1703 00000A72 7507                <1> 	jne	D_P_SCOM_Differ		;AN000;
  1704                              <1> 
  1705 00000A74 26807E003A          <1> 	cmp	byte ptr [es:bp],D_P_Colon ;AN000; if no, say different
  1706 00000A79 7403                <1> 	je	D_P_SCOM_Same		;AN000; else, say same
  1707                              <1> 
  1708                              <1> D_P_SCOM_Differ: 			;AN000;
  1709 00000A7B F9                  <1> 	stc				;AN000; indicate not found
  1710 00000A7C EB06                <1> 	jmp	short D_P_SCOM_Exit	;AN000;
  1711                              <1> 
  1712                              <1> D_P_SCOM_Same:				;AN000;
  1713 00000A7E 2E8936[D003]        <1> 	mov	[psdata_seg:D_P_KEYorSW_Ptr],si ;AC034; for later use by keyword or switch
  1714 00000A83 F8                  <1> 	clc				;AN000; indicate found
  1715                              <1> D_P_SCOM_Exit:				;AN000;
  1716 00000A84 5E                  <1> 	pop	si			;AN000;
  1717 00000A85 5A                  <1> 	pop	dx			;AN000;
  1718 00000A86 5D                  <1> 	pop	bp			;AN000;
  1719 00000A87 58                  <1> 	pop	ax			;AN000;
  1720 00000A88 C3                  <1> 	ret				;AN000;
  1721                              <1> D_P_String_Comp endp			;AN000;
  1722                              <1> ;PAGE					;AN000;
  1723                              <1> ;***********************************************************************
  1724                              <1> %IF	DateSW				;AN000;(Check if date format is supported)
  1725                              <1> ; D_P_Date_Format
  1726                              <1> ;
  1727                              <1> ; Function:  Convert a date string to DOS date format for int 21h
  1728                              <1> ;	     with format validation.
  1729                              <1> ;
  1730                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  1731                              <1> ;	     ES:BX -> CONTROL block
  1732                              <1> ;
  1733                              <1> ; Output:    None
  1734                              <1> ;
  1735                              <1> ; Use:	D_P_Fill_Result, D_P_Set_CDI, D_P_Get_DecNum
  1736                              <1> ;
  1737                              <1> ; Vars: D_P_RC(W), D_P_1st_Val(RW), D_P_2nd_Val(RW), D_P_3rd_Val(RW)
  1738                              <1> ;***********************************************************************
  1739                              <1> D_P_Date_Format proc			;AN000;
  1740                              <1> 	push	ax			;AN000;
  1741                              <1> 	push	cx			;AN000;
  1742                              <1> 	push	dx			;AN000;
  1743                              <1> 	push	si			;AN000;
  1744                              <1> 	push	bx			;AN000;
  1745                              <1> 	push	si			;AN000;
  1746                              <1> 	call	D_P_Set_CDI		;AN000; set country dependent information before process
  1747                              <1> ;	mov	bl,[psdata_seg:si].D_P_CDI_DateS ;load date separator ;AN020; (deleted)
  1748                              <1> ;					note: the country info is still needed
  1749                              <1> ;					to determine the order of the fields,
  1750                              <1> ;					but the separator char is no longer used.
  1751                              <1> 	pop	si			;AN000;
  1752                              <1> 	mov	word [psdata_seg:D_P_1st_Val],0 ;AC034; set initial value
  1753                              <1> 	mov	word [psdata_seg:D_P_2nd_Val],0 ;AC034; set initial value
  1754                              <1> 	mov	word [psdata_seg:D_P_3rd_Val],0 ;AC034; set initial value
  1755                              <1> 	call	D_P_Get_DecNum		;AN000; get 1st number
  1756                              <1> 	jc	D_P_DateF_Err0		;AN000;-----------------------+
  1757                              <1> 
  1758                              <1> 	mov	[psdata_seg:D_P_1st_Val],ax ;AC034;	      |
  1759                              <1> 	or	bl,bl			;AN000; end of line ?	      |
  1760                              <1> 	je	D_P_DateF_YMD		;AN000; 		      |
  1761                              <1> 
  1762                              <1> 	call	D_P_Get_DecNum		;AN000; get 2nd number	      |
  1763                              <1> 	jc	D_P_DateF_Error		;AN000; 		      |
  1764                              <1> 
  1765                              <1> 	mov	[psdata_seg:D_P_2nd_Val],ax ;AC034;	      |
  1766                              <1> 	or	bl,bl			;AN000; end of line ?	      |
  1767                              <1> 	je	D_P_DateF_YMD		;AN000; 		      |
  1768                              <1> 
  1769                              <1> 	call	D_P_Get_DecNum		;AN000; get 3rd number	      |
  1770                              <1> D_P_DateF_Err0:				;AN000; Bridge	  <-----------+
  1771                              <1> 	jc	D_P_DateF_Error		;AN000;
  1772                              <1> 
  1773                              <1> 	mov	[psdata_seg:D_P_3rd_Val],ax ;AC034;
  1774                              <1> 	or	bl,bl			;AN000; end of line ?
  1775                              <1> 	jne	D_P_DateF_Error		;AN000;
  1776                              <1> 
  1777                              <1> D_P_DateF_YMD:				;AN000;
  1778                              <1> D_P_Country_Info equ D_P_COUNTRY_INFO	; NASM port label
  1779                              <1> 	mov	bx,[psdata_seg:D_P_Country_Info + D_P_CDI_DateF] ;AC034; get date format
  1780                              <1> 	cmp	bx,D_P_Date_YMD		;AN000;
  1781                              <1> 	je	D_P_DateF00		;AN000;
  1782                              <1> 
  1783                              <1> 	mov	ax,[psdata_seg:D_P_1st_Val] ;AC034;
  1784                              <1> 	or	ah,ah			;AN000;
  1785                              <1> 	jne	D_P_DateF_Error		;AN000;
  1786                              <1> 
  1787                              <1> 	mov	cl,al			;AN000; set month
  1788                              <1> 	mov	ax,[psdata_seg:D_P_2nd_Val] ;AC034;
  1789                              <1> 	or	ah,ah			;AN000; if overflow, error.
  1790                              <1> 	jne	D_P_DateF_Error		;AN000;
  1791                              <1> 
  1792                              <1> 	mov	ch,al			;AN000; set date
  1793                              <1> 	mov	dx,[psdata_seg:D_P_3rd_Val] ;AC034; set year
  1794                              <1> 	cmp	bx,D_P_Date_DMY		;AN000; from here format = MDY
  1795                              <1> 	jne	D_P_DateF01		;AN000; if it is DMY
  1796                              <1> 
  1797                              <1> 	xchg	ch,cl			;AN000;  then swap M <-> D
  1798                              <1> D_P_DateF01:				;AN000;
  1799                              <1> 	jmp	short D_P_DateF02	;AN000;
  1800                              <1> 
  1801                              <1> D_P_DateF00:				;AN000; / here format = YMD
  1802                              <1> 	mov	dx,[psdata_seg:D_P_1st_Val] ;AC034; set year
  1803                              <1> 	mov	ax,[psdata_seg:D_P_2nd_Val] ;AC034;
  1804                              <1> 	or	ah,ah			;AN000; if overflow, error
  1805                              <1> 	jne	D_P_DateF_Error		;AN000;
  1806                              <1> 
  1807                              <1> 	mov	cl,al			;AN000; set month
  1808                              <1> 	mov	ax,[psdata_seg:D_P_3rd_Val] ;AC034;
  1809                              <1> 	or	ah,ah			;AN000; if overflow, error
  1810                              <1> 	jne	D_P_DateF_Error		;AN000;
  1811                              <1> 
  1812                              <1> 	mov	ch,al			;AN000; set date
  1813                              <1> D_P_DateF02:				;AN000;
  1814                              <1> 	cmp	dx,100			;AN000; year is less that 100 ?
  1815                              <1> 	jae	D_P_DateF03		;AN000;
  1816                              <1> 
  1817                              <1> 	add	dx,1900 		;AN000; set year 19xx
  1818                              <1> D_P_DateF03:				;AN000;
  1819                              <1> 	pop	bx			;AN000; recover CONTROL block
  1820                              <1> 	pop	si			;AN000; recover string pointer
  1821                              <1> 	mov	ah,D_P_No_Tag		;AN000; set
  1822                              <1> 	mov	al,D_P_Date_F		;AN000;     result
  1823                              <1> 	call	D_P_Fill_Result		;AN000; 	   buffer
  1824                              <1> 	jmp	short D_P_Date_Format_Exit ;AN000;	to Date
  1825                              <1> 
  1826                              <1> D_P_DateF_Error: 			;AN000;
  1827                              <1> 	pop	bx			;AN000; recover CONTROL block
  1828                              <1> 	pop	si			;AN000; recover string pointer
  1829                              <1> 	mov	ah,D_P_No_Tag		;AN000; set
  1830                              <1> 	mov	al,D_P_String		;AN000;     result
  1831                              <1> 	call	D_P_Fill_Result		;AN000; 	   buffer  to string
  1832                              <1> 	mov	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; indicate syntax error
  1833                              <1> D_P_Date_Format_Exit:			;AN000;
  1834                              <1> 	pop	dx			;AN000;
  1835                              <1> 	pop	cx			;AN000;
  1836                              <1> 	pop	ax			;AN000;
  1837                              <1> 	ret				;AN000;
  1838                              <1> D_P_Date_Format endp			;AN000;
  1839                              <1> %ENDIF					;AN000;(of DateSW)
  1840                              <1> ;PAGE					;AN000;
  1841                              <1> ;***********************************************************************
  1842                              <1> %IF	TimeSW+DateSW			;AN000;(Check if time or date format is supported)
  1843                              <1> ; D_P_Set_CDI:
  1844                              <1> ;
  1845                              <1> ; Function: Read CDI from DOS if it has not been read yet
  1846                              <1> ;
  1847                              <1> ; Input:    None
  1848                              <1> ;
  1849                              <1> ; Output:   psdata_seg:SI -> CDI
  1850                              <1> ;
  1851                              <1> ; Use:	INT 21h w/ AH = 38h
  1852                              <1> ;***********************************************************************
  1853                              <1> D_P_Set_CDI proc 			;AN000;
  1854                              <1> 	lea	si,[D_P_Country_Info] ;AC034;
  1855                              <1> 	cmp	word [psdata_seg:si + D_P_CDI_DateF],D_P_NeedToBeRead ;AN000; already read ?
  1856                              <1> 	je	D_P_Read_CDI		;AN000;
  1857                              <1> 
  1858                              <1> 	jmp	short D_P_Set_CDI_Exit	;AN000; then do nothing
  1859                              <1> 
  1860                              <1> D_P_Read_CDI:				;AN000; else read CDI thru DOS
  1861                              <1> 	push	ds			;AN000;
  1862                              <1> 	push	dx			;AN000;
  1863                              <1> 	push	ax			;AN000;
  1864                              <1> 	push	PSDATA_SEG		;AC023;
  1865                              <1> 	pop	ds			;AN000; set segment register
  1866                              <1> 	mov	ax,D_P_DOS_Get_CDI	;AN000; get country information
  1867                              <1> 	mov	dx,si			;AN000; set offset of CDI in local data area
  1868                              <1> 	int	21h			;AN000;
  1869                              <1> 	pop	ax			;AN000;
  1870                              <1> 	pop	dx			;AN000;
  1871                              <1> 	pop	ds			;AN000;
  1872                              <1> D_P_Set_CDI_Exit:			;AN000;
  1873                              <1> 	ret				;AN000;
  1874                              <1> D_P_Set_CDI endp 			;AN000;
  1875                              <1> ;PAGE					;AN000;
  1876                              <1> ;***********************************************************************
  1877                              <1> ; D_P_Get_DecNum:
  1878                              <1> ;
  1879                              <1> ; Function:  Read a chcrater code from psdata_seg:SI until specified delimiter
  1880                              <1> ;	     or NULL encountered. And make a decimal number.
  1881                              <1> ;
  1882                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  1883                              <1> ;
  1884                              <1> ; Output:    BL = delimiter code or NULL
  1885                              <1> ;	     AX = Decimal number
  1886                              <1> ;	     SI advanced to the next number
  1887                              <1> ;	     CY = 1 : Syntax error, AL = Latest examineed number
  1888                              <1> ;
  1889                              <1> ; Use:	D_P_0099
  1890                              <1> ;***********************************************************************
  1891                              <1> D_P_Get_DecNum proc			;AN000;
  1892                              <1> 	push	cx			;AN000;
  1893                              <1> 	push	dx			;AN000;
  1894                              <1> 	xor	cx,cx			;AN000; cx will have final value
  1895                              <1> D_P_GetNum_Loop: 			;AN000;
  1896                              <1> 	mov	al,[psdata_seg:si]	;AN000; load character
  1897                              <1> 	or	al,al			;AN000; end of line ?
  1898                              <1> 	je	D_P_GetNum00		;AN000; if yes, exit
  1899                              <1> 
  1900                              <1> 	cmp	byte [psdata_seg:D_P_Got_Time],0 ;AC034; ;is this numeric in a time field?    ;AC023
  1901                              <1> 	je	D_P_Do_Date_Delims	;AN000;no, go check out Date delimiters  ;AC023
  1902                              <1> 
  1903                              <1> ; Determine which delimiter(s) to check for.  Colon & period  or period only
  1904                              <1> 	cmp	bl,D_P_colon_period	;AN032; ;Time
  1905                              <1> 	jne	D_P_Do_Time_Delim1	;AN032; ;only check for period
  1906                              <1> 
  1907                              <1> 	cmp	al,D_P_Colon		;AN032; ;Is this a valid delimiter ?
  1908                              <1> 	je	D_P_GetNum01		;AN032; ;yes, exit
  1909                              <1> 
  1910                              <1> D_P_Do_Time_Delim1:			;AN000;
  1911                              <1> 	cmp	al,D_P_Period		;;AC032;;AC023;Is this a valid delimiter ?
  1912                              <1> 	je	D_P_GetNum01		;AC023; yes, exit
  1913                              <1> 
  1914                              <1> 	jmp	short D_P_Neither_Delims ;AN023;
  1915                              <1> 
  1916                              <1> D_P_Do_Date_Delims:			;AN000;
  1917                              <1> ;Regardless of the date delimiter character specified in the country
  1918                              <1> ;dependent information, check for the presence of any one of these
  1919                              <1> ;three field delimiters: "-", "/", or ".".
  1920                              <1> 	cmp	al,D_P_Minus		;AN020;is this a date delimiter character?
  1921                              <1> 	je	D_P_GetNum01		;AN020;if yes, exit
  1922                              <1> 
  1923                              <1> 	cmp	al,D_P_Slash		;AN020;is this a date delimiter character?
  1924                              <1> 	je	D_P_GetNum01		;AN020;if yes, exit
  1925                              <1> 
  1926                              <1> 	cmp	al,D_P_Period		;AN020;is this a date delimiter character?
  1927                              <1> 	je	D_P_GetNum01		;AN000; if yes, exit
  1928                              <1> 
  1929                              <1> D_P_Neither_Delims:			;AN023;
  1930                              <1> 
  1931                              <1> 	call	D_P_0099 		;AN000; convert it to binary
  1932                              <1> 	jc	D_P_GetNum_Exit		;AN000; if error exit
  1933                              <1> 
  1934                              <1> 	mov	ah,0			;AN000;
  1935                              <1> 	xchg	ax,cx			;AN000;
  1936                              <1> 	mov	dx,10			;AN000;
  1937                              <1> 	mul	dx			;AN000; ax = ax * 10
  1938                              <1> 	or	dx,dx			;AN000; overflow
  1939                              <1> 	jne	D_P_GetNum02		;AN000; then exit
  1940                              <1> 
  1941                              <1> 	add	ax,cx			;AN000;
  1942                              <1> 	jc	D_P_GetNum_Exit		;AN000;
  1943                              <1> 
  1944                              <1> 	xchg	ax,cx			;AN000;
  1945                              <1> 	inc	si			;AN000;
  1946                              <1> 	jmp	short D_P_GetNum_Loop	;AN000;
  1947                              <1> 
  1948                              <1> D_P_GetNum00:				;AN000;
  1949                              <1> 	mov	bl,al			;AN000; set bl to NULL
  1950                              <1> 	clc				;AN000; indicate no error
  1951                              <1> 	jmp	short D_P_GetNum_Exit	;AN000;
  1952                              <1> 
  1953                              <1> D_P_GetNum01:				;AN000;
  1954                              <1> 	inc	si			;AN000; si points to next number
  1955                              <1> 	clc				;AN000; indicate no error
  1956                              <1> 	jmp	short D_P_GetNum_Exit	;AN000;
  1957                              <1> 
  1958                              <1> D_P_GetNum02:				;AN000;
  1959                              <1> 	stc				;AN000; indicate error
  1960                              <1> D_P_GetNum_Exit: 			;AN000;
  1961                              <1> 	mov	ax,cx			;AN000;return value
  1962                              <1> 	pop	dx			;AN000;
  1963                              <1> 	pop	cx			;AN000;
  1964                              <1> 	ret				;AN000;
  1965                              <1> D_P_Get_DecNum endp			;AN000;
  1966                              <1> %ENDIF					;AN000;(of TimeSW+DateSW)
  1967                              <1> ;PAGE					;AN000;
  1968                              <1> ;***********************************************************************
  1969                              <1> %IF	TimeSW				;AN000;(Check if time format is supported)
  1970                              <1> ; D_P_Time_Format
  1971                              <1> ;
  1972                              <1> ; Function:  Convert a time string to DOS time format for int 21h
  1973                              <1> ;	     with format validation.
  1974                              <1> ;
  1975                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  1976                              <1> ;	     ES:BX -> CONTROL block
  1977                              <1> ;
  1978                              <1> ; Output:    None
  1979                              <1> ;
  1980                              <1> ; Use:	D_P_Fill_Result, D_P_Set_CDI, D_P_Get_DecNum, D_P_Time_2412
  1981                              <1> ;
  1982                              <1> ; Vars: D_P_RC(W), D_P_Flags(R), D_P_1st_Val(RW), D_P_2nd_Val(RW)
  1983                              <1> ;	D_P_3rd_Val(RW), D_P_4th_Val(RW)
  1984                              <1> ;***********************************************************************
  1985                              <1> D_P_Time_Format proc			;AN000;
  1986                              <1> 	push	ax			;AN000;
  1987                              <1> 	push	cx			;AN000;
  1988                              <1> 	push	dx			;AN000;
  1989                              <1> 	push	si			;AN000;
  1990                              <1> 	push	bx			;AN000;
  1991                              <1> 	push	si			;AN000;
  1992                              <1> 	call	D_P_Set_CDI		;AN000; Set country independent
  1993                              <1> 					; information before process
  1994                              <1> ;(AN032; deleted)  mov	   bl,[psdata_seg:si].D_P_CDI_TimeS ;load time separator
  1995                              <1> ;(AN032; deleted)  mov	   bh,[psdata_seg:si].D_P_CDI_Dec ;load decimal separator
  1996                              <1> 	test	byte ptr [psdata_seg:si + D_P_CDI_TimeF],1 ;AN000; 24 hour system
  1997                              <1> 	pop	si			;AN000;
  1998                              <1> 	jne	D_P_TimeF00		;AN000; if no, means 12 hour system
  1999                              <1> 
  2000                              <1> 	call	D_P_Time_2412		;AN000; this routine handle "am" "pm"
  2001                              <1> D_P_TimeF00:				;AN000;
  2002                              <1> 	mov	word [psdata_seg:D_P_1st_Val],0 ;AC034; set initial value
  2003                              <1> 	mov	word [psdata_seg:D_P_2nd_Val],0 ;AC034; set initial value
  2004                              <1> 	mov	word [psdata_seg:D_P_3rd_Val],0 ;AC034; set initial value
  2005                              <1> 	mov	word [psdata_seg:D_P_4th_Val],0 ;AC034; set initial value
  2006                              <1> 	mov	byte [psdata_seg:D_P_Got_Time],1 ;AN023;AC034;; use time delimiter
  2007                              <1> 	mov	bl,D_P_colon_period	;AN032; flag, indicates use of
  2008                              <1> 					; delimiters between hours,
  2009                              <1> 					;  minutes,seconds
  2010                              <1> 	call	D_P_Get_DecNum		;AN000; get 1st number
  2011                              <1> 	jc	D_P_TimeF_Err0		;AN000;
  2012                              <1> 
  2013                              <1> 	mov	[psdata_seg:D_P_1st_Val],ax ;AC034;
  2014                              <1> 	or	bl,bl			;AN000; end of line ?
  2015                              <1> D_P_TimeF_Rlt equ D_P_TimeF_RLT	; NASM port label
  2016                              <1> 	je	D_P_TimeF_Rlt		;AN000;
  2017                              <1> 
  2018                              <1> 	call	D_P_Get_DecNum		;AN000; get 2nd number
  2019                              <1> 	jc	D_P_TimeF_Err0		;AC038; if OK
  2020                              <1> 
  2021                              <1> 	mov	[psdata_seg:D_P_2nd_Val],ax ;AC034;
  2022                              <1> 	or	bl,bl			;AN000; end of line ?
  2023                              <1> 	je	D_P_TimeF_Rlt		;AN000;
  2024                              <1> 
  2025                              <1> ;(;AN032; deleted) mov	   bl,bh		   ;set decimal separator
  2026                              <1> 	mov	bl,D_P_period_only	;AN032; flag, which to decimal separator
  2027                              <1> 	call	D_P_Get_DecNum		;AN000; get 3rd number
  2028                              <1> 	jc	D_P_TimeF_Err0		;AC039; if problem, bridge to error
  2029                              <1> 
  2030                              <1> 	mov	[psdata_seg:D_P_3rd_Val],ax ;AC034;
  2031                              <1> 	or	bl,bl			;AN000; end of line ?
  2032                              <1> ;(DELETED ;AN039;)  je D_P_TimeF_Rlt	;AN000;
  2033                              <1> 	jne	D_P_Time_4		;AN039; NOT END OF LINE,
  2034                              <1> 					;AN039;   GO TO 4TH NUMBER
  2035                              <1> D_P_Time_Again equ D_P_TIME_AGAIN	; NASM port equate
  2036                              <1> 	test	byte [psdata_seg:D_P_Flags1],D_P_Time_Again ;AN039; HAS TIME PARSE
  2037                              <1> 					;AN039;    BEEN REPEATED?
  2038                              <1> 	jnz	D_P_TimeF_Rlt		;AN039; yes, this is really
  2039                              <1> 					;AN039;   the end of line
  2040                              <1> 					;AN039; no, time has not been repeated
  2041                              <1> 	mov	si,[psdata_seg:D_P_SI_Save] ;AN039; get where parser quit
  2042                              <1> 					 ;AN039;   in command line
  2043                              <1> 	cmp	byte ptr [si-1],D_P_Comma ;AN039; look at delimiter
  2044                              <1> 					;AN039;   from command line
  2045                              <1> 	jne	D_P_TimeF_Rlt		;AN039; was not a comma, this is
  2046                              <1> 					;AN039;  really end of line
  2047                              <1> 					;AN039; is comma before hundredths,
  2048                              <1> 					;AN039;   redo TIME
  2049                              <1> 	mov	byte ptr [si-1],D_P_Period ;AN039; change that ambiguous
  2050                              <1> 					;AN039;    comma to a decimal point
  2051                              <1> 					;AN039;     parse can understand
  2052                              <1> 	mov	word [psdata_seg:D_P_Flags],0	;AN039; Clear all internal flags
  2053                              <1> 	or	byte [psdata_seg:D_P_Flags1],D_P_Time_Again ;AN039; indicate TIME
  2054                              <1> 					;AN039; is being repeated
  2055                              <1> 	mov	cx,[psdata_seg:D_P_ORIG_ORD] ;AN039; ORIGINAL ORDINAL FROM CX
  2056                              <1> 	mov	sp,[psdata_seg:D_P_ORIG_STACK] ;AN039; ORIGINAL VALUE
  2057                              <1> 					 ;AN039;   OF STACK FROM SP
  2058                              <1> 	mov	si,[psdata_seg:D_P_ORIG_SI] ;AN039; ORIGINAL START
  2059                              <1> 					 ;AN039;   PARSE POINTER FROM SI
  2060                              <1> D_P_Redo_Time equ D_P_REDO_TIME	; NASM port label
  2061                              <1> 	jmp	D_P_Redo_Time		;AN039; go try TIME again
  2062                              <1> ; ===============================================================
  2063                              <1> D_P_Time_4:				;AN039; READY FOR 4TH (HUNDREDTHS) NUMBER
  2064                              <1> 	call	D_P_Get_DecNum		;AN000; get 4th number
  2065                              <1> D_P_TimeF_Err0:				;AN000; Bridge
  2066                              <1> 	jc	D_P_TimeF_Error		;AN000;
  2067                              <1> 
  2068                              <1> 	mov	[psdata_seg:D_P_4th_Val],ax ;AC034;
  2069                              <1> 	or	bl,bl			;AN000; After hundredth, no data allowed
  2070                              <1> 	jne	D_P_TimeF_Error		;AN000; if some, then error
  2071                              <1> 
  2072                              <1> D_P_TimeF_RLT:				;AN000;
  2073                              <1> 	mov	ax,[psdata_seg:D_P_1st_Val] ;AC034;
  2074                              <1> 	or	ah,ah			;AN000; if overflow then error
  2075                              <1> 	jne	D_P_TimeF_Err		;AN000;
  2076                              <1> 
  2077                              <1> D_P_Time12am equ D_P_time12am	; NASM port equate
  2078                              <1> 	test	byte [psdata_seg:D_P_Flags1],D_P_Time12am ;AN038;if "am" specified
  2079                              <1> 	jz	D_P_Time_notAM		;AN038;skip if no "AM" specified
  2080                              <1> 					;since "AM" was specified,
  2081                              <1> 	cmp	al,12			;AN038: if hour specified as later than noon
  2082                              <1> 	ja	D_P_TimeF_Err		;AN038; error if "AM" on more than noon
  2083                              <1> 	jne	D_P_Time_notAM		;AN038; for noon exactly,
  2084                              <1> 
  2085                              <1> 	xor	al,al			;AN038; set hour = zero
  2086                              <1> D_P_Time_notAM:				;AN038;
  2087                              <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_Time12 ;AC034; if 12 hour system and pm is specified
  2088                              <1> 	je	D_P_TimeSkip00		;AN000; then
  2089                              <1> 
  2090                              <1> 	cmp	al,12			;AN038; if 12:00 o'clock already
  2091                              <1> 	je	D_P_TimeSkip00		;AN038; it is PM already
  2092                              <1> 
  2093                              <1> 	add	al,12			;AN000; add 12 hours to make it afternoon
  2094                              <1> 	jc	D_P_TimeF_Err		;AN000; if overflow then error
  2095                              <1> 
  2096                              <1> 	cmp	al,24			;AN038; after adding 12, now cannot be >24
  2097                              <1> 	ja	D_P_TimeF_Err		;AN038; if too big, error
  2098                              <1> 
  2099                              <1> D_P_TimeSkip00:				;AN000;
  2100                              <1> 	mov	dl,al			;AN000; set hour
  2101                              <1> 	mov	ax,[psdata_seg:D_P_2nd_Val] ;AC034;
  2102                              <1> 	or	ah,ah			;AN000; if overflow then error
  2103                              <1> 	jne	D_P_TimeF_Err		;AN000;
  2104                              <1> 
  2105                              <1> 	mov	dh,al			;AN000; set minute
  2106                              <1> 	mov	ax,[psdata_seg:D_P_3rd_Val] ;AC034;
  2107                              <1> 	or	ah,ah			;AN000; if overflow then error
  2108                              <1> 	jne	D_P_TimeF_Err		;AN000;
  2109                              <1> 
  2110                              <1> 	mov	cl,al			;AN000; set second
  2111                              <1> 	mov	ax,[psdata_seg:D_P_4th_Val] ;AC034;
  2112                              <1> 	or	ah,ah			;AN000; if overflow then error
  2113                              <1> 	jne	D_P_TimeF_Err		;AN000;
  2114                              <1> 
  2115                              <1> 	mov	ch,al			;AN000; set hundredth
  2116                              <1> 	pop	bx			;AN000; recover CONTROL block
  2117                              <1> 	pop	si			;AN000; recover string pointer
  2118                              <1> 	mov	ah,D_P_No_Tag		;AN000; set
  2119                              <1> 	mov	al,D_P_Time_F		;AN000;    result
  2120                              <1> 	call	D_P_Fill_Result		;AN000; 	 buffer
  2121                              <1> 	jmp	short D_P_Time_Format_Exit ;AN000;    to time
  2122                              <1> 
  2123                              <1> D_P_TimeF_Error: 			;AN000;
  2124                              <1> D_P_TimeF_Err:				;AN000;
  2125                              <1> 	pop	bx			;AN000; recover CONTROL block
  2126                              <1> 	pop	si			;AN000; recover string pointer
  2127                              <1> 	mov	ah,D_P_No_Tag		;AN000; set
  2128                              <1> 	mov	al,D_P_String		;AN000;     result
  2129                              <1> 	call	D_P_Fill_Result		;AN000; 	  buffer to string
  2130                              <1> 	mov	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; return syntax error
  2131                              <1> D_P_Time_Format_Exit:			;AN000;
  2132                              <1> 	mov	byte [psdata_seg:D_P_Got_Time],0 ;AN023;AC034;; finished with this time field
  2133                              <1> 	pop	dx			;AN000;
  2134                              <1> 	pop	cx			;AN000;
  2135                              <1> 	pop	ax			;AN000;
  2136                              <1> 	ret				;AN000;
  2137                              <1> D_P_Time_Format endp			;AN000;
  2138                              <1> ;PAGE					;AN000;
  2139                              <1> ;***********************************************************************
  2140                              <1> ; D_P_Time_2412:
  2141                              <1> ;
  2142                              <1> ; Function:  Remove "a", "p", "am", or "pm" from the end of stinrg
  2143                              <1> ;
  2144                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  2145                              <1> ;
  2146                              <1> ; Output:    Set D_P_Time12 flag when the string is terminated by "p"
  2147                              <1> ;	     or "pm"
  2148                              <1> ;
  2149                              <1> ; Vars:  D_P_Flags(W)
  2150                              <1> ;***********************************************************************
  2151                              <1> D_P_Time_2412 proc			;AN000;
  2152                              <1> 	push	ax			;AN000;
  2153                              <1> 	push	si			;AN000;
  2154                              <1> D_P_T12_Loop:				;AN000;
  2155                              <1> 	mov	al,[psdata_seg:si]	;AN000; Move
  2156                              <1> 	inc	si			;AN000;     si
  2157                              <1> 	or	al,al			;AN000;       to
  2158                              <1> 	jne	D_P_T12_Loop		;AN000; 	end of string
  2159                              <1> 
  2160                              <1> 	mov	al,[psdata_seg:si-2] ;AN000; get char just before NULL
  2161                              <1> 	or	al,D_P_Make_Lower	;AN000; lower case map
  2162                              <1> 	cmp	al,"p"                  ;AN000; only "p" of "pm" ?
  2163                              <1> 	je	D_P_T1200		;AN000;
  2164                              <1> 
  2165                              <1> 	cmp	al,"a"                  ;AN000; only "a" of "am" ?
  2166                              <1> 	je	D_P_T1201		;AN000;
  2167                              <1> 
  2168                              <1> 	cmp	al,"m"                  ;AN000; "m" of "am" or "pm"
  2169                              <1> 	jne	D_P_T12_Exit		;AN000;
  2170                              <1> 
  2171                              <1> 	dec	si			;AN000;
  2172                              <1> 	mov	al,[psdata_seg:si-2] ;AN000;
  2173                              <1> D_P_Make_lower equ D_P_Make_Lower	; NASM port equate
  2174                              <1> 	or	al,D_P_Make_lower	;AN000; lower case map
  2175                              <1> 	cmp	al,"p"                  ;AN000; "p" of "pm" ?
  2176                              <1> 	je	D_P_T1200		;AN000;
  2177                              <1> 
  2178                              <1> 	cmp	al,"a"                  ;AN000; "a" of "am" ?
  2179                              <1> 	je	D_P_T1201		;AN000; go process "a"
  2180                              <1> 
  2181                              <1> 	jmp	short D_P_T12_Exit	;AN000; no special chars found
  2182                              <1> 
  2183                              <1> D_P_T1200:				;AN000; "P" found
  2184                              <1> 	or	byte [psdata_seg:D_P_Flags2],D_P_Time12 ;AC034; flag "PM" found
  2185                              <1> 	jmp	short D_P_Tclr_chr	;AN038; go clear the special char
  2186                              <1> 
  2187                              <1> D_P_T1201:				;AN000; "A" found
  2188                              <1> D_P_Time12AM equ D_P_time12am	; NASM port equate
  2189                              <1> 	or	byte [psdata_seg:D_P_Flags1],D_P_Time12AM ;AN038; flag "AM" found
  2190                              <1> D_P_Tclr_chr:				;AN038;
  2191                              <1> 	mov	byte ptr [psdata_seg:si-2],D_P_NULL ;AN000; null out special char
  2192                              <1> D_P_T12_Exit:				;AN000;
  2193                              <1> 	pop	si			;AN000;
  2194                              <1> 	pop	ax			;AN000;
  2195                              <1> 	ret				;AN000;
  2196                              <1> D_P_Time_2412 endp			;AN000;
  2197                              <1> %ENDIF					;AN000;(of TimeSW)
  2198                              <1> ;PAGE					;AN000;
  2199                              <1> ;***********************************************************************
  2200                              <1> %IF	CmpxSW				;AN000;(Check if complex item is supported)
  2201                              <1> ; D_P_Complex_Format:
  2202                              <1> ;
  2203                              <1> ; Function:  Check if the input string is valid complex format.
  2204                              <1> ;	     And set the result buffer.
  2205                              <1> ;
  2206                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  2207                              <1> ;	     ES:BX -> CONTROL block
  2208                              <1> ;
  2209                              <1> ; Output:    None
  2210                              <1> ;
  2211                              <1> ; Use:	D_P_Fill_Result, D_P_Chk_DBCS, D_P_Chk_EOL, D_P_Skip_Delim
  2212                              <1> ;	D_P_Quoted_str, D_P_Chk_DSQuote
  2213                              <1> ;
  2214                              <1> ; Vars: D_P_RC(W), D_P_SI_Save(W), D_P_SaveSI_Cmpx(R), D_P_Save_EOB(R)
  2215                              <1> ;***********************************************************************
  2216                              <1> D_P_Complex_Format proc			;AN000;
  2217                              <1> 	push	ax			;AN000;
  2218                              <1> 	push	bx			;AN000;
  2219                              <1> 	push	si			;AN000;
  2220                              <1> 	mov	bx,[psdata_seg:D_P_SaveSI_Cmpx] ;AC034; bx points to user buffer
  2221                              <1> 	cmp	byte ptr [bx],D_P_Lparen ;AN000; 1st char = left parentheses
  2222                              <1> 	jne	D_P_Cmpx_Err		;AN000;
  2223                              <1> 
  2224                              <1> 	xor	ah,ah			;AN000; ah = parentheses counter
  2225                              <1> D_P_Cmpx_Loop:				;AN000;
  2226                              <1> 	mov	al,[bx] 		;AN000; load character from command buffer
  2227                              <1> 	call	D_P_Chk_EOL		;AN000; if it is one of EOL
  2228                              <1> 	je	D_P_CmpxErr0		;AN000; then error exit.
  2229                              <1> 
  2230                              <1> 	cmp	al,D_P_Lparen		;AN000; left parentheses ?
  2231                              <1> 	jne	D_P_Cmpx00		;AN000; then
  2232                              <1> 
  2233                              <1> 	inc	ah			;AC035; add '1' to AH reg
  2234                              <1> 					;AN000; increment parentheses counter
  2235                              <1> ;(replaced ;AC035;) add     ah,1	;AN000; increment parentheses counter
  2236                              <1> 	jc	D_P_CmpxErr0		;AN000; if overflow, error
  2237                              <1> D_P_Cmpx00:				;AN000;
  2238                              <1> 	cmp	al,D_P_Rparen		;AN000; right parentheses ?
  2239                              <1> 	jne	D_P_Cmpx01		;AN000; then
  2240                              <1> 
  2241                              <1> 	dec	ah			;AC035; subtract '1' from AH reg
  2242                              <1> 					;AN000; decrement parentheses counter
  2243                              <1> ;(changed ;AC035;) sub	   ah,1 	;AN000; decrement parentheses counter
  2244                              <1> 	jc	D_P_CmpxErr0		;AN000; if overflow error
  2245                              <1> 
  2246                              <1> 	je	D_P_Cmpx03		;AN000; ok, valid complex
  2247                              <1> 
  2248                              <1> D_P_Cmpx01:				;AN000;
  2249                              <1> ;(deleted ;AN025;) call D_P_Chk_DSQuote	;AN000; double or single quotation mark ? 3/17/KK
  2250                              <1> 	cmp	al,D_P_DQuote		;AN025; double quotation mark?
  2251                              <1> 	jne	D_P_Cmpx04		;AN000; 3/17/KK
  2252                              <1> 
  2253                              <1> 	mov	[psdata_seg:si],al	;AN000; here quoted string is found in the complex list.
  2254                              <1> 	inc	si			;AN000;
  2255                              <1> 	inc	bx			;AN000; bx points to 2nd character
  2256                              <1> 	call	D_P_Quoted_Str		;AN000; skip pointers until closing of quoted string
  2257                              <1> 	jc	D_P_CmpxErr0		;AN000; if error in quoted string syntax then exit
  2258                              <1> 
  2259                              <1> 	jmp	short D_P_Cmpx05 	;AN000;
  2260                              <1> 
  2261                              <1> D_P_Cmpx04:				;AN000;
  2262                              <1> 	call	D_P_Chk_DBCS		;AN000; was it a lead byte of DBCS ?
  2263                              <1> 	jnc	D_P_Cmpx02		;AN000;
  2264                              <1> 
  2265                              <1> 	mov	[psdata_seg:si],al	;AN000; then store 1st byte
  2266                              <1> 	inc	si			;AN000;
  2267                              <1> 	inc	bx			;AN000;
  2268                              <1> 	mov	al,[bx] 		;AN000; load 2nd byte
  2269                              <1> D_P_Cmpx02:				;AN000;
  2270                              <1> 	mov	[psdata_seg:si],al	;AN000; store SBCS or 2nd byte of DBCS
  2271                              <1> D_P_Cmpx05:				;AN000;
  2272                              <1> 	inc	si			;AN000;
  2273                              <1> 	inc	bx			;AN000;
  2274                              <1> 	jmp	short D_P_Cmpx_Loop	;AN000; loop
  2275                              <1> ;----					;AN000;
  2276                              <1> D_P_Cmpx03:				;AN000;
  2277                              <1> 	mov	byte ptr [psdata_seg:si],al ;AN000;
  2278                              <1> 	mov	byte ptr [psdata_seg:si+1],D_P_NULL ;AN000;
  2279                              <1> 	mov	byte ptr [bx],D_P_NULL	;AN000; replace right parentheses with NULL
  2280                              <1> 	mov	si,bx			;AN000; skip whitespaces
  2281                              <1> 	inc	si			;AN000;     after
  2282                              <1> 	call	D_P_Skip_Delim		;AN000;        right parentheses
  2283                              <1> 	mov	[psdata_seg:D_P_SI_Save],si ;AC034; save next pointer, SI
  2284                              <1> 	jmp	short D_P_Cmpx_Exit	;AN000;
  2285                              <1> 
  2286                              <1> D_P_CmpxErr0:				;AN000;
  2287                              <1> 	mov	si,[psdata_seg:D_P_Save_EOB] ;AC034; if EOF encountered, restore
  2288                              <1> 	mov	byte ptr [psdata_seg:si],D_P_NULL ;AN000; EOB mark
  2289                              <1> D_P_Cmpx_Err:				;AN000;
  2290                              <1> 	mov	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034;
  2291                              <1> D_P_Cmpx_Exit:				;AN000;
  2292                              <1> 	mov	ah,D_P_No_Tag		;AN000;
  2293                              <1> 	mov	al,D_P_Complex		;AN000;
  2294                              <1> 	pop	si			;AN000;
  2295                              <1> 	pop	bx			;AN000;
  2296                              <1> 	call	D_P_Fill_Result		;AN000;
  2297                              <1> 	pop	ax			;AN000;
  2298                              <1> 	ret				;AN000;
  2299                              <1> D_P_Complex_Format endp			;AN000;
  2300                              <1> %ENDIF					;AN000;(of CpmxSW)
  2301                              <1> ;PAGE					;AN000;
  2302                              <1> ;***********************************************************************
  2303                              <1> %IF	QusSW				;AN000;(Check if quoted string is supported)
  2304                              <1> ; D_P_Quoted_Format:
  2305                              <1> ;
  2306                              <1> ; Function:  Check if the input string is valid quoted string format.
  2307                              <1> ;	     And set the result buffer.
  2308                              <1> ;
  2309                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  2310                              <1> ;	     ES:BX -> CONTROL block
  2311                              <1> ;
  2312                              <1> ; Output:    None
  2313                              <1> ;
  2314                              <1> ; Use:	D_P_Fill_Result, D_P_Chk_DBCS, D_P_Chk_EOL, D_P_Skip_Delim
  2315                              <1> ;	D_P_Chk_DSQuote, D_P_Quoted_Str
  2316                              <1> ;
  2317                              <1> ; Vars: D_P_RC(W), D_P_SI_Save(W), D_P_SaveSI_Cmpx(R),D_P_Save_EOB(R)
  2318                              <1> ;***********************************************************************
  2319                              <1> D_P_Quoted_Format proc			;AN000;
  2320                              <1> 	push	ax			;AN000;
  2321                              <1> 	push	bx			;AN000;
  2322                              <1> 	push	si			;AN000;
  2323                              <1> 	mov	bx,[psdata_seg:D_P_SaveSI_Cmpx] ;AC034; bx points to user buffer
  2324                              <1> 	mov	al,byte ptr [bx]	;AN000; get 1st character
  2325                              <1> ;(deleted ;AN025;) call D_P_Chk_DSQuote	;AN000; is it single or double quote ?
  2326                              <1> 	cmp	al,D_P_DQuote		;AN025; double quotation mark?
  2327                              <1> 	jne	D_P_Qus_Err		;AN000; if no, error
  2328                              <1> 
  2329                              <1> ;	mov	[psdata_seg:si],al	;AN000; move it to internal buffer
  2330                              <1> ;	inc	si			;AN000;
  2331                              <1> 	inc	bx			;AN000; bx points to 2nd character
  2332                              <1> 	call	D_P_Quoted_Str		;AN000; skip pointers to the closing of quoted string
  2333                              <1> 	jc	D_P_Qus_Err0		;AN000; if invali quoted string syntax, exit
  2334                              <1> 
  2335                              <1> 	mov	byte ptr [psdata_seg:si+1],D_P_NULL ;AN000; end up with NULL
  2336                              <1> 	mov	si,bx			;AN000;
  2337                              <1> 	inc	si			;AN000;
  2338                              <1> 	call	D_P_Skip_Delim		;AN000; skip whitespaces after closing quote
  2339                              <1> 	mov	[psdata_seg:D_P_SI_Save],si ;AC034; save next pointer, SI
  2340                              <1> 	jmp	short D_P_Qus_Exit	;AN000;
  2341                              <1> 
  2342                              <1> D_P_Qus_Err0:				;AN000;
  2343                              <1> 	mov	si,[psdata_seg:D_P_Save_EOB] ;AC034; if EOF encountered, restore
  2344                              <1> 	mov	byte ptr [psdata_seg:si],D_P_NULL ;AN000; EOB mark
  2345                              <1> D_P_Qus_Err:				;AN000;AN000
  2346                              <1> 	mov	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; indicate syntax error
  2347                              <1> D_P_Qus_Exit:				;AN000;
  2348                              <1> 	mov	ah,D_P_No_Tag		;AN000; set
  2349                              <1> 	mov	al,D_P_Quoted_String	;AN000;    result
  2350                              <1> 	pop	si			;AN000; 	 buffer
  2351                              <1> 	pop	bx			;AN000; 	       to
  2352                              <1> 	call	D_P_Fill_Result		;AN000; 		 quoted string
  2353                              <1> 	pop	ax			;AN000;
  2354                              <1> 	ret				;AN000;
  2355                              <1> D_P_Quoted_Format endp			;AN000;
  2356                              <1> %ENDIF					;AN000;(of QusSW)
  2357                              <1> ;PAGE					;AN000;
  2358                              <1> ;***********************************************************************
  2359                              <1> ; D_P_Chk_DSQuote;
  2360                              <1> ;
  2361                              <1> ; Function: Check if AL is double quotation or single quotation
  2362                              <1> ;
  2363                              <1> ; Input:    AL = byte to be examineed
  2364                              <1> ;
  2365                              <1> ; Output:   ZF on if AL is single or double quotetaion
  2366                              <1> ;
  2367                              <1> ; Vars:  D_P_SorD_Quote(W)
  2368                              <1> ;***********************************************************************
  2369                              <1> %IF	QusSW+CmpxSW			;AN000;(Check if quoted string or complex item is supported)
  2370                              <1> ;(deleted ;AN025;) D_P_Chk_DSQuote proc			   ;
  2371                              <1> ;(deleted ;AN025;)	   mov	   D_P_SorD_Quote,D_P_SQuote ; 3/17/87   assume single quote
  2372                              <1> ;(deleted ;AN025;)	   cmp	   al,D_P_DQuote 	   ; 1st char = double quotation ?
  2373                              <1> ;(deleted ;AN025;)	   jne	   D_P_CDSQ00		   ; 3/17/87
  2374                              <1> ;(deleted ;AN025;)	   mov	   D_P_SorD_Quote,al	   ; 3/17/87 set bigning w/ double quote
  2375                              <1> ;(deleted ;AN025;)	   ret				   ; 3/17/87
  2376                              <1> ;(deleted ;AN025;) D_P_CDSQ00:				   ; 3/17/87
  2377                              <1> ;(deleted ;AN025;)	   cmp	   al,D_P_SQuote 	   ; 1st char = single quotation ?
  2378                              <1> ;(deleted ;AN025;)	   ret				   ;
  2379                              <1> ;(deleted ;AN025;) D_P_Chk_DSQuote endp			   ;
  2380                              <1> ;    PAGE				;AN000;
  2381                              <1> ;***********************************************************************
  2382                              <1> ; D_P_Quoted_Str:
  2383                              <1> ;
  2384                              <1> ; Function:  Copy chracacter from ES:BX to psdata_seg:SI until closing single
  2385                              <1> ;	     (double) quotation found.
  2386                              <1> ;
  2387                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  2388                              <1> ;	     ES:BX -> Operand in command buffer
  2389                              <1> ;
  2390                              <1> ; Output:    CY on indicates EOF encounterd before closing quotation
  2391                              <1> ;	     BX and SI
  2392                              <1> ;
  2393                              <1> ;
  2394                              <1> ; Vars: D_P_SorD_Quote(R)
  2395                              <1> ;***********************************************************************
  2396                              <1> D_P_Quoted_Str proc			;AN000;
  2397                              <1> 	push	ax			;AN000;
  2398                              <1> D_P_Qus_Loop:				;AN000;
  2399                              <1> 	mov	ax,[bx] 		;AN000; 3/17/87
  2400                              <1> 	call	D_P_Chk_EOL		;AN000;
  2401                              <1> 	je	D_P_Qustr_Err0		;AN000;
  2402                              <1> 
  2403                              <1> ;(deleted ;AN025;) cmp al,D_P_SorD_Quote ;AN000; quotation ?   3/17/87
  2404                              <1> 	cmp	al,D_P_DQuote		;AN025; double quote?
  2405                              <1> 	jne	D_P_Qus00		;AN000;
  2406                              <1> 
  2407                              <1> ;(deleted ;AN025;) cmp ah,D_P_SorD_Quote ;AN000; contiguous quotation 3/17/87
  2408                              <1> 	cmp	ah,D_P_DQuote		;AN025; double quote?
  2409                              <1> 	jne	D_P_Qus02		;AN000;
  2410                              <1> 
  2411                              <1> ;(deleted ;AN025:) mov word ptr [psdata_seg:si],ax ;AN000; 3/17/87
  2412                              <1> 	mov	byte ptr [psdata_seg:si],al ;AN025; save one of the quotes
  2413                              <1> ;(deleted ;AN025:) add si,2		;AN000;
  2414                              <1> 
  2415                              <1> 	inc	si			;AC035; add '1' to SI reg
  2416                              <1> 					;AN025; adjust target index
  2417                              <1> ;(changed ;AC035;) add	   si,1 	;AN025; adjust target index
  2418                              <1> 	inc	bx			;AC035; add '2' to
  2419                              <1> 	inc	bx			;AC035;  BX reg
  2420                              <1> 					;AN000; adjust source index by 2 to skip extra quote
  2421                              <1> ;(changed ;AC035;) add	   bx,2 	;AN000; adjust source index by 2 to skip extra quote
  2422                              <1> 	jmp	short D_P_Qus_Loop	;AN000;
  2423                              <1> 
  2424                              <1> D_P_Qus00:				;AN000;
  2425                              <1> 	call	D_P_Chk_DBCS		;AN000; was it a lead byte of DBCS ?
  2426                              <1> 	jnc	D_P_Qus01		;AN000;
  2427                              <1> 
  2428                              <1> 	mov	[psdata_seg:si],al	;AN000; store 1st byte
  2429                              <1> 	inc	si			;AN000;
  2430                              <1> 	inc	bx			;AN000;
  2431                              <1> 	mov	al,[bx] 		;AN000; load 2nd byte
  2432                              <1> D_P_Qus01:				;AN000;
  2433                              <1> 	mov	[psdata_seg:si],al	;AN000; store SBCS or 2nd byte of DBCS
  2434                              <1> 	inc	si			;AN000;
  2435                              <1> 	inc	bx			;AN000;
  2436                              <1> 	jmp	short D_P_Qus_Loop	;AN000;
  2437                              <1> 
  2438                              <1> D_P_Qustr_Err0:				;AN000;
  2439                              <1> 	stc				;AN000; indicate error
  2440                              <1> 	jmp	short D_P_Quoted_Str_Exit ;AN000;
  2441                              <1> 
  2442                              <1> D_P_Qus02:				;AN000;
  2443                              <1> 	mov	byte ptr [psdata_seg:si],0 ;AN000;
  2444                              <1> 	clc				;AN000; indicate no error
  2445                              <1> D_P_Quoted_Str_Exit:			;AN000;
  2446                              <1> 	pop	ax			;AN000;
  2447                              <1> 	ret				;AN000;
  2448                              <1> D_P_Quoted_Str endp			;AN000;
  2449                              <1> %ENDIF					;AN000;(of QusSW+CmpxSW)
  2450                              <1> ;PAGE					;AN000;
  2451                              <1> ;***********************************************************************
  2452                              <1> %IF	FileSW+DrvSW			;AN000;(Check if file spec or drive only is supported)
  2453                              <1> ; D_P_File_Format;
  2454                              <1> ;
  2455                              <1> ; Function:  Check if the input string is valid file spec format.
  2456                              <1> ;	     And set the result buffer.
  2457                              <1> ;
  2458                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  2459                              <1> ;	     ES:BX -> CONTROL block
  2460                              <1> ;
  2461                              <1> ; Output:    None
  2462                              <1> ;
  2463                              <1> ; Use:	D_P_Fill_Result, D_P_Chk_DBCS, D_P_FileSp_Chk
  2464                              <1> ;
  2465                              <1> ; Vars: D_P_RC(W), D_P_SI_Save(W), D_P_Terminator(W), D_P_SaveSI_Cmpx(R)
  2466                              <1> ;	D_P_SaveSI_Cmpx(R)
  2467                              <1> ;***********************************************************************
  2468                              <1> D_P_File_Format proc			;AN000;
  2469 00000A89 50                  <1> 	push	ax			;AN000;
  2470 00000A8A 57                  <1> 	push	di			;AN000;
  2471 00000A8B 56                  <1> 	push	si			;AN000;
  2472                              <1> D_P_SaveSI_cmpx equ D_P_SaveSI_Cmpx	; NASM port label
  2473 00000A8C 2E8B3E[CE03]        <1> 	mov	di,[psdata_seg:D_P_SaveSI_cmpx] ;AC034; get user buffer address
  2474                              <1> D_P_FileF_Loop0: 			;AN000; / skip special characters
  2475 00000A91 2E8A04              <1> 	mov	al,[psdata_seg:si]	;AN000; load character
  2476 00000A94 08C0                <1> 	or	al,al			;AN000; end of line ?
  2477 00000A96 7413                <1> 	je	D_P_FileF_Err		;AN000; if yes, error exit
  2478                              <1> 
  2479 00000A98 E85F00              <1> 	call	D_P_FileSp_Chk		;AN000; else, check if file special character
  2480 00000A9B 7524                <1> 	jne	D_P_FileF03		;AN000; if yes,
  2481                              <1> 
  2482                              <1> ;AN033; deleted   inc	  di			  ;skip
  2483                              <1> ;AN033; deleted   inc	  si			  ;   the
  2484                              <1> ;AN033; deleted   jmp	  short D_P_FileF_Loop0	  ;	  character
  2485 00000A9D 2EC606[6404]01      <1> 	mov	byte [psdata_seg:D_P_err_flag],D_P_error_filespec ;AN033;AC034;; set error flag- bad char.
  2486 00000AA3 5E                  <1> 	pop	si			;AN033;
  2487 00000AA4 2EC60400            <1> 	mov	byte ptr [psdata_seg:si],D_P_NULL ;AN033;
  2488 00000AA8 5F                  <1> 	pop	di			;AN033;
  2489 00000AA9 EB3F                <1> 	jmp	short D_P_FileF02	;AN033;
  2490                              <1> 
  2491                              <1> 
  2492                              <1> D_P_FileF_Err:				;AN000;
  2493 00000AAB 5E                  <1> 	pop	si			;AN000;
  2494 00000AAC 2EC60400            <1> 	mov	byte ptr [psdata_seg:si],D_P_NULL ;AN000;
  2495                              <1> ;(deleted ;AN030;) mov di,D_P_SaveSI_cmpx ;AN000; get user buffer address
  2496                              <1> ;(deleted ;AN030;) mov D_P_SI_Save,di	 ;AN000; update pointer to user buffer
  2497 00000AB0 5F                  <1> 	pop	di			;AN000;
  2498 00000AB1 26F7070100          <1> 	test	word [es:bx + D_P_Match_Flag],D_P_Optional ;AN000; is it optional ?
  2499 00000AB6 7532                <1> 	jne	D_P_FileF02		;AN000;
  2500                              <1> 
  2501 00000AB8 2EC706[C103]0200    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Op_Missing ;AC034; 3/17/87
  2502 00000ABF EB29                <1> 	jmp	short D_P_FileF02	;AN000;
  2503                              <1> 
  2504                              <1> D_P_FileF03:				;AN000;
  2505 00000AC1 58                  <1> 	pop	ax			;AN000; discard save si
  2506 00000AC2 56                  <1> 	push	si			;AN000; save new si
  2507                              <1> D_P_FileF_Loop1: 			;AN000;
  2508 00000AC3 2E8A04              <1> 	mov	al,[psdata_seg:si]	;AN000; load character (not special char)
  2509 00000AC6 08C0                <1> 	or	al,al			;AN000; end of line ?
  2510 00000AC8 741E                <1> 	je	D_P_FileF_RLT		;AN000;
  2511                              <1> 
  2512 00000ACA E82D00              <1> 	call	D_P_FileSp_Chk		;AN000; File special character ?
  2513 00000ACD 740B                <1> 	je	D_P_FileF00		;AN000;
  2514                              <1> 
  2515 00000ACF E86401              <1> 	call	D_P_Chk_DBCS		;AN000; no, then DBCS ?
  2516 00000AD2 7302                <1> 	jnc	D_P_FileF01		;AN000;
  2517 00000AD4 47                  <1> 	inc	di			;AN000; if yes, skip next byte
  2518 00000AD5 46                  <1> 	inc	si			;AN000;
  2519                              <1> D_P_FileF01:				;AN000;
  2520 00000AD6 47                  <1> 	inc	di			;AN000;
  2521 00000AD7 46                  <1> 	inc	si			;AN000;
  2522 00000AD8 EBE9                <1> 	jmp	short D_P_FileF_Loop1	;AN000;
  2523                              <1> ;
  2524                              <1> D_P_FileF00:				;AN000;
  2525 00000ADA 2EA2[C703]          <1> 	mov	[psdata_seg:D_P_Terminator],al ;AC034;
  2526 00000ADE 2EC60400            <1> 	mov	byte ptr [psdata_seg:si],D_P_NULL ;AN000; update end of string
  2527 00000AE2 47                  <1> 	inc	di			;AN000;
  2528 00000AE3 2E893E[C303]        <1> 	mov	[psdata_seg:D_P_SI_Save],di ;AC034; update next pointer in command line
  2529                              <1> D_P_FileF_RLT:				;AN000;
  2530 00000AE8 5E                  <1> 	pop	si			;AN000;
  2531 00000AE9 5F                  <1> 	pop	di			;AN000;
  2532                              <1> D_P_FileF02:				;AN000;
  2533                              <1> 
  2534 00000AEA 58                  <1> 	pop	ax			;AN000; (tm14)
  2535 00000AEB A90002              <1> 	test	ax,D_P_File_Spc		;AN000; (tm14)
  2536 00000AEE 7409                <1> 	je	D_P_Drv_Only_Exit	;AN000; (tm14)
  2537                              <1> 
  2538 00000AF0 50                  <1> 	push	ax			;AN000;  (tm14)
  2539                              <1> 
  2540 00000AF1 B4FF                <1> 	mov	ah,D_P_No_Tag		;AN000; set
  2541 00000AF3 B005                <1> 	mov	al,D_P_File_Spec 	;AN000;    result
  2542 00000AF5 E88EFB              <1> 	call	D_P_Fill_Result		;AN000; 	 buffer to file spec
  2543 00000AF8 58                  <1> 	pop	ax			;AN000;
  2544                              <1> 
  2545                              <1> D_P_Drv_Only_Exit:			;AN000; (tm14)
  2546                              <1> 
  2547 00000AF9 C3                  <1> 	ret				;AN000;
  2548                              <1> D_P_File_Format endp			;AN000;
  2549                              <1> ;PAGE					;AN000;
  2550                              <1> ;***********************************************************************
  2551                              <1> ; D_P_FileSp_Chk
  2552                              <1> ;
  2553                              <1> ; Function:  Check if the input byte is one of file special characters
  2554                              <1> ;
  2555                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  2556                              <1> ;	     AL = character code to be examineed
  2557                              <1> ;
  2558                              <1> ; Output:    ZF = 1 , AL is one of special characters
  2559                              <1> ;***********************************************************************
  2560                              <1> D_P_FileSp_Chk proc			;AN000;
  2561 00000AFA 53                  <1> 	push	bx			;AN000;
  2562 00000AFB 51                  <1> 	push	cx			;AN000;
  2563 00000AFC 8D1E[5B04]          <1> 	lea	bx,[D_P_FileSp_Char] ;AC034; special character table
  2564 00000B00 B90900              <1> 	mov	cx,D_P_FileSp_Len	;AN000; load length of it
  2565                              <1> D_P_FileSp_Loop: 			;AN000;
  2566 00000B03 2E3A07              <1> 	cmp	al,[psdata_seg:bx]	;AN000; is it one of special character ?
  2567 00000B06 7404                <1> 	je	D_P_FileSp_Exit		;AN000;
  2568                              <1> 
  2569 00000B08 43                  <1> 	inc	bx			;AN000;
  2570 00000B09 E2F8                <1> 	loop	D_P_FileSp_Loop		;AN000;
  2571                              <1> 
  2572 00000B0B 41                  <1> 	inc	cx			;AN000; reset ZF
  2573                              <1> D_P_FileSp_Exit: 			;AN000;
  2574 00000B0C 59                  <1> 	pop	cx			;AN000;
  2575 00000B0D 5B                  <1> 	pop	bx			;AN000;
  2576 00000B0E C3                  <1> 	ret				;AN000;
  2577                              <1> D_P_FileSp_Chk endp			;AN000;
  2578                              <1> %ENDIF					;AN000;(of FileSW+DrvSW)
  2579                              <1> ;PAGE					;AN000;
  2580                              <1> ;***********************************************************************
  2581                              <1> %IF	DrvSW				;AN000;(Check if drive only is supported)
  2582                              <1> ; D_P_Drive_Format;
  2583                              <1> ;
  2584                              <1> ; Function:  Check if the input string is valid drive only format.
  2585                              <1> ;	     And set the result buffer.
  2586                              <1> ;
  2587                              <1> ; Input:     psdata_seg:SI -> D_P_STRING_BUF
  2588                              <1> ;	     ES:BX -> CONTROL block
  2589                              <1> ;
  2590                              <1> ; Output:    None
  2591                              <1> ;
  2592                              <1> ; Use:	D_P_Fill_Result, D_P_Chk_DBCS
  2593                              <1> ;
  2594                              <1> ; Vars: D_P_RC(W)
  2595                              <1> ;***********************************************************************
  2596                              <1> D_P_Drive_Format proc			;AN000;
  2597 00000B0F 50                  <1> 	push	ax			;AN000;
  2598 00000B10 52                  <1> 	push	dx			;AN000;
  2599 00000B11 2E8A04              <1> 	mov	al,[psdata_seg:si]	;AN000;
  2600 00000B14 08C0                <1> 	or	al,al			;AN000; if null string
  2601 00000B16 7440                <1> 	je	D_P_Drv_Exit		;AN000; do nothing
  2602                              <1> 
  2603 00000B18 E81B01              <1> 	call	D_P_Chk_DBCS		;AN000; is it leading byte ?
  2604 00000B1B 7234                <1> 	jc	D_P_Drv_Err		;AN000;
  2605                              <1> 
  2606 00000B1D 2E837C013A          <1> 	cmp	word ptr [psdata_seg:si+1],D_P_Colon ;AN000; "d", ":", 0  ?
  2607 00000B22 740E                <1> 	je	D_P_DrvF00		;AN000;
  2608                              <1> 
  2609 00000B24 26F7071000          <1> 	test	word [es:bx + D_P_Match_Flag],D_P_Ig_Colon ;AN000; colon can be ignored?
  2610 00000B29 7426                <1> 	je	D_P_Drv_Err		;AN000;
  2611                              <1> 
  2612 00000B2B 2E807C0100          <1> 	cmp	byte ptr [psdata_seg:si+1],D_P_NULL ;AN000; "d", 0  ?
  2613 00000B30 751F                <1> 	jne	D_P_Drv_Err		;AN000;
  2614                              <1> 
  2615                              <1> D_P_DrvF00:				;AN000;
  2616 00000B32 3C61                <1> 	cmp al, 'a'
  2617 00000B34 7206                <1> 	jb .nottocaps
  2618 00000B36 3C7A                <1> 	cmp al, 'z'
  2619 00000B38 7702                <1> 	ja .nottocaps
  2620 00000B3A 3420                <1> 	xor al, 20h
  2621                              <1> .nottocaps:
  2622 00000B3C 3C41                <1> 	cmp	al,"A"                  ;AN000; drive letter must
  2623 00000B3E 7211                <1> 	jb	D_P_Drv_Err		;AN000; in range of
  2624 00000B40 3C60                <1> 	cmp	al,"`"                  ;AN000; "a" - "z" (CDS limit)
  2625 00000B42 770D                <1> 	ja	D_P_Drv_Err		;AN000; if no, error
  2626 00000B44 2C40                <1> 	sub	al,"A"-1                ;AN000; make text drive to binary drive
  2627 00000B46 88C2                <1> 	mov	dl,al			;AN000; set
  2628 00000B48 B4FF                <1> 	mov	ah,D_P_No_Tag		;AN000;    result
  2629 00000B4A B006                <1> 	mov	al,D_P_Drive		;AN000; 	 buffer
  2630 00000B4C E837FB              <1> 	call	D_P_Fill_Result		;AN000; 	       to drive
  2631 00000B4F EB07                <1> 	jmp	short D_P_Drv_Exit	;AN000;
  2632                              <1> 
  2633                              <1> D_P_Drv_Err:				;AN000;
  2634 00000B51 2EC706[C103]0900    <1> 	mov	word [psdata_seg:D_P_RC],D_P_Syntax ;AC034;
  2635                              <1> D_P_Drv_Exit:				;AN000;
  2636 00000B58 5A                  <1> 	pop	dx			;AN000;
  2637 00000B59 58                  <1> 	pop	ax			;AN000;
  2638 00000B5A C3                  <1> 	ret				;AN000;
  2639                              <1> D_P_Drive_Format endp			;AN000;
  2640                              <1> %ENDIF					;AN000;(of DrvSW)
  2641                              <1> ;PAGE					;AN000;
  2642                              <1> ;***********************************************************************
  2643                              <1> ; D_P_Skip_Delim;
  2644                              <1> ;
  2645                              <1> ; Function: Skip delimiters specified in the PARMS list, white space
  2646                              <1> ;	    and comma.
  2647                              <1> ;
  2648                              <1> ; Input:    DS:SI -> Command String
  2649                              <1> ;	    ES:DI -> Parameter List
  2650                              <1> ;
  2651                              <1> ; Output:   CY = 1 if the end of line encounterd
  2652                              <1> ;	    CY = 0 then SI move to 1st non-delimiter character
  2653                              <1> ;	    AL = Last examineed character
  2654                              <1> ;
  2655                              <1> ; Use:	    D_P_Chk_EOL, D_P_Chk_Delim,
  2656                              <1> ;
  2657                              <1> ; Vars:     D_P_Flags(R)
  2658                              <1> ;***********************************************************************
  2659                              <1> D_P_Skip_Delim proc			;AN000;
  2660                              <1> D_P_Skip_Delim_Loop:			;AN000;
  2661 00000B5B AC                  <1> 	LODSB				;AN000;
  2662 00000B5C E82200              <1> 	call	D_P_Chk_EOL		;AN000; is it EOL character ?
  2663 00000B5F 7418                <1> 	je	D_P_Skip_Delim_CY	;AN000; if yes, exit w/ CY on
  2664                              <1> 
  2665 00000B61 E85300              <1> 	call	D_P_Chk_Delim		;AN000; is it one of delimiters ?
  2666 00000B64 7516                <1> 	jne	D_P_Skip_Delim_NCY	;AN000; if no, exit w/ CY off
  2667                              <1> 
  2668 00000B66 2EF606[CD03]20      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_Extra ;AC034; extra delim or comma found ?
  2669 00000B6C 74ED                <1> 	je	D_P_Skip_Delim_Loop	;AN000; if no, loop
  2670                              <1> 
  2671 00000B6E 2EF606[CD03]41      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_SW+D_P_equ ;AC034; /x , or xxx=zzz , (tm08)
  2672 00000B74 7409                <1> 	je	short D_P_Exit_At_Extra	;AN000; no switch, no keyword (tm08)
  2673                              <1> 
  2674 00000B76 4E                  <1> 	dec	si			;AN000; backup si for next call (tm08)
  2675 00000B77 EB06                <1> 	jmp	short D_P_Exit_At_Extra	;AN000; else exit w/ CY off
  2676                              <1> 
  2677                              <1> D_P_Skip_Delim_CY:			;AN000;
  2678 00000B79 F9                  <1> 	stc				;AN000; indicate EOL
  2679 00000B7A EB01                <1> 	jmp	short D_P_Skip_Delim_Exit ;AN000;
  2680                              <1> 
  2681                              <1> D_P_Skip_Delim_NCY:			;AN000;
  2682 00000B7C F8                  <1> 	clc				;AN000; indicate non delim
  2683                              <1> D_P_Skip_Delim_Exit:			;AN000; in this case, need
  2684 00000B7D 4E                  <1> 	dec	si			;AN000;  backup index pointer
  2685 00000B7E C3                  <1> 	ret				;AN000;
  2686                              <1> 
  2687                              <1> D_P_Exit_At_Extra:			;AN000;
  2688 00000B7F F8                  <1> 	clc				;AN000; indicate extra delim
  2689 00000B80 C3                  <1> 	ret				;AN000;
  2690                              <1> D_P_Skip_Delim endp			;AN000;
  2691                              <1> ;PAGE					;AN000;
  2692                              <1> ;***********************************************************************
  2693                              <1> ; D_P_Chk_EOL;
  2694                              <1> ;
  2695                              <1> ; Function: Check if AL is one of End of Line characters.
  2696                              <1> ;
  2697                              <1> ; Input:    AL = character code
  2698                              <1> ;	    ES:DI -> Parameter List
  2699                              <1> ;
  2700                              <1> ; Output:   ZF = 1 if one of End of Line characters
  2701                              <1> ;**********************************************************************
  2702                              <1> D_P_Chk_EOL proc 			;AN000;
  2703 00000B81 53                  <1> 	push	bx			;AN000;
  2704 00000B82 51                  <1> 	push	cx			;AN000;
  2705 00000B83 3C0D                <1> 	cmp	al,D_P_CR		;AN000; Carriage return ?
  2706 00000B85 742D                <1> 	je	D_P_Chk_EOL_Exit 	;AN000;
  2707                              <1> 
  2708 00000B87 3C00                <1> 	cmp	al,D_P_NULL		;AN000; zero ?
  2709 00000B89 7429                <1> 	je	D_P_Chk_EOL_Exit 	;AN000;
  2710                              <1> 
  2711                              <1> %IF LFEOLSW				;AN028; IF LF TO BE ACCEPTED AS EOL
  2712 00000B8B 3C0A                <1> 	cmp	al,D_P_LF		;AN000; Line feed ?
  2713 00000B8D 7425                <1> 	je	D_P_Chk_EOL_Exit 	;AN000;
  2714                              <1> %ENDIF					;AN028;
  2715                              <1> 
  2716 00000B8F 26807D0202          <1> 	cmp	byte ptr [es:di + D_P_Num_Extra],D_P_I_Have_EOL ;AN000; EOL character specified ?
  2717 00000B94 721E                <1> 	jb	D_P_Chk_EOL_Exit 	;AN000;
  2718                              <1> 
  2719 00000B96 31DB                <1> 	xor	bx,bx			;AN000;
  2720 00000B98 268A5D03            <1> 	mov	bl,[es:di + D_P_Len_Extra_Delim] ;AN000; get length of delimiter list
  2721 00000B9C 83C304              <1> 	add	bx,D_P_Len_PARMS 	;AN000; skip it
  2722 00000B9F 26803900            <1> 	cmp	byte ptr [es:bx+di],D_P_I_Use_Default ;AN000; No extra EOL character ?
  2723 00000BA3 740D                <1> 	je	D_P_Chk_EOL_NZ		;AN000;
  2724                              <1> 
  2725 00000BA5 31C9                <1> 	xor	cx,cx			;AN000; Get number of extra chcracter
  2726 00000BA7 268A09              <1> 	mov	cl,[es:bx+di]		;AN000;
  2727                              <1> D_P_Chk_EOL_Loop:			;AN000;
  2728 00000BAA 43                  <1> 	inc	bx			;AN000;
  2729 00000BAB 263A01              <1> 	cmp	al,[es:bx+di]		;AN000; Check extra EOL character
  2730 00000BAE 7404                <1> 	je	D_P_Chk_EOL_Exit 	;AN000;
  2731                              <1> 
  2732 00000BB0 E2F8                <1> 	loop	D_P_Chk_EOL_Loop 	;AN000;
  2733                              <1> 
  2734                              <1> D_P_Chk_EOL_NZ:				;AN000;
  2735 00000BB2 3C0D                <1> 	cmp	al,D_P_CR		;AN000; reset ZF
  2736                              <1> D_P_Chk_EOL_Exit:			;AN000;
  2737 00000BB4 59                  <1> 	pop	cx			;AN000;
  2738 00000BB5 5B                  <1> 	pop	bx			;AN000;
  2739 00000BB6 C3                  <1> 	ret				;AN000;
  2740                              <1> D_P_Chk_EOL endp 			;AN000;
  2741                              <1> ;PAGE					;AN000;
  2742                              <1> ;***********************************************************************
  2743                              <1> ; D_P_Chk_Delim;
  2744                              <1> ;
  2745                              <1> ; Function: Check if AL is one of delimiter characters.
  2746                              <1> ;	    if AL+[si] is DBCS blank, it is replaced with two SBCS
  2747                              <1> ;	    blanks.
  2748                              <1> ;
  2749                              <1> ; Input:    AL = character code
  2750                              <1> ;	    DS:SI -> Next Character
  2751                              <1> ;	    ES:DI -> Parameter List
  2752                              <1> ;
  2753                              <1> ; Output:   ZF = 1 if one of delimiter characters
  2754                              <1> ;	    SI points to the next character
  2755                              <1> ; Vars:  D_P_Terminator(W), D_P_Flags(W)
  2756                              <1> ;***********************************************************************
  2757                              <1> D_P_Chk_Delim proc			;AN000;
  2758 00000BB7 53                  <1> 	push	bx			;AN000;
  2759 00000BB8 51                  <1> 	push	cx			;AN000;
  2760 00000BB9 2EC606[C703]20      <1> 	mov	byte [psdata_seg:D_P_Terminator],D_P_Space   ;AC034; Assume terminated by space
  2761 00000BBF 2E8026[CD03]DF      <1> 	and	byte [psdata_seg:D_P_Flags2],0ffh-D_P_Extra ;AC034;
  2762 00000BC5 3C20                <1> 	cmp	al,D_P_Space		;AN000; Space ?
  2763 00000BC7 7436                <1> 	je	D_P_Chk_Delim_Exit	;AN000;
  2764                              <1> 
  2765 00000BC9 3C09                <1> 	cmp	al,D_P_TAB		;AN000; TAB ?
  2766 00000BCB 7432                <1> 	je	D_P_Chk_Delim_Exit	;AN000;
  2767                              <1> 
  2768 00000BCD 3C2C                <1> 	cmp	al,D_P_Comma		;AN000; Comma ?
  2769 00000BCF 7431                <1> 	je	D_P_Chk_Delim_Exit0	;AN000;
  2770                              <1> 
  2771                              <1> D_P_Chk_Delim00: 			;AN000;
  2772 00000BD1 3C81                <1> 	cmp	al,D_P_DBSP1		;AN000; 1st byte of DBCS Space ?
  2773 00000BD3 750C                <1> 	jne	D_P_Chk_Delim01		;AN000;
  2774                              <1> 
  2775 00000BD5 803C40              <1> 	cmp	byte ptr [si],D_P_DBSP2	;AN000; 2nd byte of DBCS Space ?
  2776 00000BD8 7507                <1> 	jne	D_P_Chk_Delim01		;AN000;
  2777                              <1> 
  2778 00000BDA B020                <1> 	mov	al,D_P_Space		;AN000;
  2779 00000BDC 46                  <1> 	inc	si			;AN000; make si point to next character
  2780 00000BDD 38C0                <1> 	cmp	al,al			;AN000; Set ZF
  2781 00000BDF EB1E                <1> 	jmp	short D_P_Chk_Delim_Exit ;AN000;
  2782                              <1> 
  2783                              <1> D_P_Chk_Delim01: 			;AN000;
  2784 00000BE1 26807D0201          <1> 	cmp	byte ptr [es:di + D_P_Num_Extra],D_P_I_Have_Delim ;AN000; delimiter character specified ?
  2785 00000BE6 7217                <1> 	jb	D_P_Chk_Delim_Exit	;AN000;
  2786                              <1> 
  2787 00000BE8 31C9                <1> 	xor	cx,cx			;AN000;
  2788 00000BEA 268A4D03            <1> 	mov	cl,[es:di + D_P_Len_Extra_Delim] ;AN000; get length of delimiter list
  2789 00000BEE 09C9                <1> 	or	cx,cx			;AN000; No extra Delim character ?
  2790 00000BF0 740B                <1> 	je	D_P_Chk_Delim_NZ 	;AN000;
  2791                              <1> 
  2792 00000BF2 BB0300              <1> 	mov	bx,D_P_Len_PARMS-1	;AN000; set bx to 1st extra delimiter
  2793                              <1> D_P_Chk_Delim_Loop:			;AN000;
  2794 00000BF5 43                  <1> 	inc	bx			;AN000;
  2795 00000BF6 263A01              <1> 	cmp	al,[es:bx+di]		;AN000; Check extra Delim character
  2796 00000BF9 7407                <1> 	je	D_P_Chk_Delim_Exit0	;AN000;
  2797                              <1> 
  2798 00000BFB E2F8                <1> 	loop	D_P_Chk_Delim_Loop	;AN000; examine all extra delimiter
  2799                              <1> 
  2800                              <1> D_P_Chk_Delim_NZ:			;AN000;
  2801 00000BFD 3C20                <1> 	cmp	al,D_P_Space		;AN000; reset ZF
  2802                              <1> D_P_Chk_Delim_Exit:			;AN000;
  2803                              <1> ;;;;	jne	D_P_ChkDfin
  2804                              <1> ;;;;	mov	psdata_seg:D_P_Terminator,al ;AN034;
  2805                              <1> D_P_ChkDfin:				;AN000;
  2806 00000BFF 59                  <1> 	pop	cx			;AN000;
  2807 00000C00 5B                  <1> 	pop	bx			;AN000;
  2808 00000C01 C3                  <1> 	ret				;AN000;
  2809                              <1> 
  2810                              <1> D_P_Chk_Delim_Exit0:			;AN000;
  2811 00000C02 2EA2[C703]          <1> 	mov	[psdata_seg:D_P_Terminator],al ;AC034; keep terminated delimiter
  2812                              <1> D_P_Equ equ D_P_equ	; NASM port equate
  2813 00000C06 2EF606[CD03]01      <1> 	test	byte [psdata_seg:D_P_Flags2],D_P_Equ  ;AN027;AC034;; if terminating a key=
  2814 00000C0C 7506                <1> 	jnz	D_P_No_Set_Extra 	;AN027; then do not set the EXTRA bit
  2815                              <1> 
  2816 00000C0E 2E800E[CD03]20      <1> 	or	byte [psdata_seg:D_P_Flags2],D_P_Extra ;AC034; flag terminated extra delimiter or comma
  2817                              <1> D_P_No_Set_Extra:			;AN027;
  2818 00000C14 38C0                <1> 	cmp	al,al			;AN000; set ZF
  2819 00000C16 EBE7                <1> 	jmp	short D_P_Chk_Delim_Exit ;AN000;
  2820                              <1> 
  2821                              <1> D_P_Chk_Delim endp			;AN000;
  2822                              <1> ;PAGE					;AN000;
  2823                              <1> ;***********************************************************************
  2824                              <1> ; D_P_Chk_Switch;
  2825                              <1> ;
  2826                              <1> ; Function: Check if AL is the switch character not in first position of
  2827                              <1> ;	    D_P_STRING_BUF
  2828                              <1> ;
  2829                              <1> ; Input:    AL = character code
  2830                              <1> ;	    BX = current pointer within D_P_String_Buf
  2831                              <1> ;	    SI =>next char on command line (following the one in AL)
  2832                              <1> ;
  2833                              <1> ; Output:   CF = 1 (set)if AL is switch character, and not in first
  2834                              <1> ;		 position, and has no chance of being part of a date string,
  2835                              <1> ;		 i.e. should be treated as a delimiter.
  2836                              <1> 
  2837                              <1> ;	    CF = 0 (reset, cleared) if AL is not a switch char, is in the first
  2838                              <1> ;		 position, or is a slash but may be part of a date string, i.e.
  2839                              <1> ;		 should not be treated as a delimiter.
  2840                              <1> ;
  2841                              <1> ; Vars:  D_P_Terminator(W)
  2842                              <1> 
  2843                              <1> ; Use:	 D_P_0099
  2844                              <1> ;***********************************************************************
  2845                              <1> D_P_Chk_Switch proc			;AN000;
  2846                              <1> 
  2847                              <1> ;AN020;; Function: Check if AL is the switch character from 2nd position of D_P_STRING_BUF
  2848                              <1> ;AN020;; Output:   ZF = 1 if switch character
  2849                              <1> ;AN020;;	lea	bp,D_P_STRING_BUF ;AN000;
  2850                              <1> ;AN020;;	cmp	bx,bp		 ;AN000; 1st position ?
  2851                              <1> ;AN020;;	je	D_P_Chk_S_Exit_1  ;AN000;
  2852                              <1> ;AN020;;	cmp	al,D_P_Switch	 ;AN000;
  2853                              <1> ;AN020;;	jmp	short D_P_Chk_S_Exit_0  ;AN000;
  2854                              <1> ;AN020;;D_P_Chk_S_Exit_1:		       ;AN000;
  2855                              <1> ;AN020;;	cmp	al,D_P_Switch	 ;AN000; (tm08)
  2856                              <1> ;AN020;;	jne	D_P_Nop		;AN000; (tm08)
  2857                              <1> ;AN020;;	or	D_P_Flags2,D_P_SW  ;AN000; (tm08) It could be valid switch
  2858                              <1> ;AN020;;D_P_Nop: 			;AN000; (tm08)
  2859                              <1> ;AN020;;	inc	bp		       ;AN000;
  2860                              <1> ;AN020;;	cmp	bx,bp		       ;AN000; reset ZF
  2861                              <1> ;AN020;;D_P_Chk_S_Exit_0:		       ;AN000;
  2862                              <1> ;AN020;;	jne	D_P_Chk_S_Exit	       ;AN000;
  2863                              <1> ;AN020;;	mov	   D_P_Terminator,al    ;AN000; store switch character
  2864                              <1> ;AN020;;D_P_Chk_S_Exit:			       ;AN000;
  2865                              <1> 
  2866                              <1> D_P_String_Buf equ D_P_STRING_BUF	; NASM port label
  2867 00000C18 8D2E[D603]          <1> 	LEA	BP,[D_P_String_Buf] ;AN020;AC034; BP=OFFSET of D_P_String_Buf even in group addressing
  2868                              <1> ;	.IF <BX NE BP> THEN		;AN020;IF not first char THEN
  2869 00000C1C 39EB                <1> 	cmp	BX,BP			;AN000;
  2870 00000C1E 740A                <1> 	je	D_P_STRUC_L2		;AN000;
  2871                              <1> 
  2872                              <1> ;	    .IF <AL EQ D_P_Switch> THEN	;AN020;otherwise see if a slash
  2873 00000C20 3C2F                <1> 	    cmp     AL,D_P_Switch	;AN000;
  2874 00000C22 7503                <1> 	    jne     D_P_STRUC_L5 	;AN000;
  2875                              <1> 
  2876 00000C24 F9                  <1> 		STC			;AN020;not in first position and is slash, now see if might be in date string
  2877                              <1> %IF	DateSw				;AN020;caller looking for date, see if this may be part of one
  2878                              <1> 		PUSH	AX		;AN020;save input char
  2879                              <1> 		MOV	AL,[PSDATA_SEG:BX-1] ;AN026;AL=char before the current char
  2880                              <1> 		CALL	D_P_0099 	;AN020;return carry set if not numeric
  2881                              <1> ;		.IF   NC ;AND		;AN020;IF previous char numeric AND
  2882                              <1> 		jc	D_P_STRUC_L7	;AN000;
  2883                              <1> 
  2884                              <1> 		    MOV     AL,[SI]	;AN020;AL=char after the current char
  2885                              <1> 		    CALL    D_P_0099	;AN020;return carry set if not numeric
  2886                              <1> ;(deleted)	    .IF     NC THEN	;AN020;IF next char numeric THEN could be a date
  2887                              <1> ;(deleted)		CLC		;AN020;reset CF so "/" not treated as a delimiter
  2888                              <1> ;(deleted)	    .ENDIF		;AN026;
  2889                              <1> ;		.ENDIF			;AN020;ENDIF looks like date (number/number)
  2890                              <1> D_P_STRUC_L7:				;AN000;
  2891                              <1> 		POP	AX		;AN020;restore AL to input char
  2892                              <1> %ENDIF					;AN020;DateSw
  2893                              <1> ;	    .ELSE			;AN020;
  2894 00000C25 EB0E                <1> 	    jmp     short D_P_STRUC_L1	;AN000;
  2895                              <1> 
  2896                              <1> D_P_STRUC_L5:				;AN000;
  2897 00000C27 F8                  <1> 		CLC			;AN020;not a slash
  2898                              <1> ;	    .ENDIF			;AN020;
  2899                              <1> ;	.ELSE				;AN020;is first char in the buffer, ZF=0
  2900 00000C28 EB0B                <1> 	jmp	short D_P_STRUC_L1	;AN000;
  2901                              <1> 
  2902                              <1> D_P_STRUC_L2:				;AN000;
  2903                              <1> ;	    .IF <AL EQ D_P_Switch> THEN	;AN020;
  2904 00000C2A 3C2F                <1> 	    cmp     AL,D_P_Switch	;AN000;
  2905 00000C2C 7506                <1> 	    jne     D_P_STRUC_L12	;AN000;
  2906                              <1> 
  2907 00000C2E 2E800E[CD03]40      <1> 		OR	byte [psdata_seg:D_P_Flags2],D_P_SW ;AN020;AC034;;could be valid switch, first char and is slash
  2908                              <1> ;	    .ENDIF			;AN020;
  2909                              <1> D_P_STRUC_L12:				;AN000;
  2910 00000C34 F8                  <1> 	    CLC 			;AN020;CF=0 indicating first char
  2911                              <1> ;	.ENDIF				;AN020;
  2912                              <1> D_P_STRUC_L1:				;AN000;
  2913                              <1> 
  2914 00000C35 C3                  <1> 	ret				;AN000;
  2915                              <1> D_P_Chk_Switch endp			;AN000;
  2916                              <1> ;	PAGE				;AN000;
  2917                              <1> ;**************************************************************************
  2918                              <1> ; D_P_Chk_DBCS:
  2919                              <1> ;
  2920                              <1> ;  Function: Check if a specified byte is in ranges of the DBCS lead bytes
  2921                              <1> ;
  2922                              <1> ;  Input:
  2923                              <1> ;	  AL	= Code to be examineed
  2924                              <1> ;
  2925                              <1> ;  Output:
  2926                              <1> ;	  If CF is on then a lead byte of DBCS
  2927                              <1> ;
  2928                              <1> ; Use: INT 21h w/AH=63
  2929                              <1> ;
  2930                              <1> ; Vars:  D_P_DBCSEV_Seg(RW), D_P_DBCSEV_Off(RW)
  2931                              <1> ;***************************************************************************
  2932                              <1> D_P_Chk_DBCS PROC			;AN000;
  2933                              <1> ;
  2934 00000C36 1E                  <1> 	PUSH	DS			;AN000;
  2935 00000C37 56                  <1> 	PUSH	SI			;AN000;
  2936 00000C38 53                  <1> 	PUSH	bx			;AN000; (tm11)
  2937 00000C39 2E833E[CA03]00      <1> 	CMP	word [psdata_seg:D_P_DBCSEV_SEG],0 ;AC034; ALREADY SET ?
  2938 00000C3F 7527                <1> 	JNE	D_P_DBCS00		;AN000;
  2939                              <1> 
  2940 00000C41 50                  <1> 	PUSH	AX			;AN000;
  2941                              <1> ;	PUSH	BX			;AN000; (tm11)
  2942 00000C42 1E                  <1> 	PUSH	ds			;AN000; (tm11)
  2943 00000C43 51                  <1> 	PUSH	CX			;AN000;
  2944 00000C44 52                  <1> 	PUSH	DX			;AN000;
  2945 00000C45 57                  <1> 	PUSH	DI			;AN000;
  2946 00000C46 55                  <1> 	PUSH	BP			;AN000;
  2947 00000C47 06                  <1> 	PUSH	ES			;AN000;
  2948 00000C48 31F6                <1> 	XOR	SI,SI			;AN000;
  2949 00000C4A 8EDE                <1> 	MOV	DS,SI			;AN000;
  2950 00000C4C B80063              <1> 	MOV	AX,D_P_DOS_GetEV 	;AN000; GET DBCS EV CALL
  2951 00000C4F CD21                <1> 	INT	21H			;AN000;
  2952                              <1> 
  2953                              <1> ;	MOV	AX,DS			;AN000; (tm11)
  2954                              <1> ;	OR	AX,AX			;AN000; (tm11)
  2955 00000C51 8CDB                <1> 	MOV	bx,DS			;AN000; (tm11)
  2956 00000C53 09DB                <1> 	OR	bx,bx			;AN000; (tm11)
  2957 00000C55 07                  <1> 	POP	ES			;AN000;
  2958 00000C56 5D                  <1> 	POP	BP			;AN000;
  2959 00000C57 5F                  <1> 	POP	DI			;AN000;
  2960 00000C58 5A                  <1> 	POP	DX			;AN000;
  2961 00000C59 59                  <1> 	POP	CX			;AN000;
  2962                              <1> ;	POP	BX			;AN000; (tm11)
  2963 00000C5A 1F                  <1> 	POP	ds			;AN000; (tm11)
  2964 00000C5B 58                  <1> 	POP	AX			;AN000;
  2965 00000C5C 7429                <1> 	JE	D_P_NON_DBCS		;AN000;
  2966                              <1> 
  2967                              <1> D_P_DBCS02:				;AN000;
  2968 00000C5E 2E8936[C803]        <1> 	MOV	[psdata_seg:D_P_DBCSEV_OFF],SI ;AC034; save EV offset
  2969                              <1> ;	MOV	psdata_seg:D_P_DBCSEV_SEG,DS ;AC034; save EV segment
  2970 00000C63 2E891E[CA03]        <1> 	MOV	[psdata_seg:D_P_DBCSEV_SEG],bx ;AC034; save EV segment (tm11)
  2971                              <1> D_P_DBCS00:				;AN000;
  2972 00000C68 2E8B36[C803]        <1> 	MOV	SI,[psdata_seg:D_P_DBCSEV_OFF] ;AC034; load EV offset
  2973 00000C6D 2E8E1E[CA03]        <1> 	MOV	DS,[psdata_seg:D_P_DBCSEV_SEG] ;AC034; and segment
  2974                              <1> 
  2975                              <1> D_P_DBCS_LOOP:				;AN000;
  2976 00000C72 833C00              <1> 	CMP	WORD PTR [SI],0 	;AN000; zero vector ?
  2977 00000C75 7410                <1> 	JE	D_P_NON_DBCS		;AN000; then exit
  2978                              <1> 
  2979 00000C77 3A04                <1> 	CMP	AL,[SI] 		;AN000;
  2980 00000C79 7208                <1> 	JB	D_P_DBCS01		;AN000; Check if AL is in
  2981                              <1> 
  2982 00000C7B 3A4401              <1> 	CMP	AL,[SI+1]		;AN000;   range of
  2983 00000C7E 7703                <1> 	JA	D_P_DBCS01		;AN000;      the vector
  2984                              <1> 
  2985 00000C80 F9                  <1> 	STC				;AN000; if yes, indicate DBCS and exit
  2986 00000C81 EB05                <1> 	JMP	short D_P_DBCS_EXIT	;AN000;
  2987                              <1> 
  2988                              <1> D_P_DBCS01:				;AN000;
  2989 00000C83 46                  <1> 	INC	SI			;AC035; add '2' to
  2990 00000C84 46                  <1> 	INC	SI			;AC035;  SI reg
  2991                              <1> 					;AN000; get next vector
  2992                              <1> ;(changed ;AC035;) ADD	   SI,2 	;AN000; get next vector
  2993 00000C85 EBEB                <1> 	JMP	short D_P_DBCS_LOOP	;AN000; loop until zero vector found
  2994                              <1> 
  2995                              <1> D_P_NON_DBCS:				;AN000;
  2996 00000C87 F8                  <1> 	CLC				;AN000; indicate SBCS
  2997                              <1> D_P_DBCS_EXIT:				;AN000;
  2998 00000C88 5B                  <1> 	POP	bx			;AN000; (tm11)
  2999 00000C89 5E                  <1> 	POP	SI			;AN000;
  3000 00000C8A 1F                  <1> 	POP	DS			;AN000;
  3001 00000C8B C3                  <1> 	RET				;AN000;
  3002                              <1> D_P_Chk_DBCS ENDP			;AN000;
   475                                  ;=== Pop trace listing source
   476                                  ;Control block definitions for PARSER.
   477                                  ;---------------------------------------------------
   478                                  ; BUFFER = [n | n,m] {/E}
   479                                  
   480                                  Buf_Parms	label	byte	;AN000;
   481 00000C8C [910C]                  	dw	Buf_Parmsx	;AN000;
   482 00000C8E 01                      	db	1		;AN000; An extra delimeter list
   483 00000C8F 01                      	db	1		;AN000; length is 1
   484 00000C90 3B                      	db	SEMICOLON	;AN000;
   485                                  
   486                                  Buf_Parmsx	label	byte	;AN000;
   487 00000C91 0102                    	db	1,2		;AN000; Min 1, Max 2 positional
   488 00000C93 [9B0C]                  	dw	Buf_Pos1	;AN000;
   489 00000C95 [AF0C]                  	dw	Buf_Pos2	;AN000;
   490 00000C97 01                      	db	1		;AN000; 1 switch
   491 00000C98 [C30C]                  	dw	SW_X_Ctrl	;AN000;AN025; /X control
   492 00000C9A 00                      	db	0		;AN000; no keywords
   493                                  
   494                                  Buf_Pos1	label	word	;AN000;
   495 00000C9B 0080                    	dw	8000h		;AN000; Numeric value
   496 00000C9D 0000                    	dw	0		;AN000; no function
   497 00000C9F [D60C]                  	dw	Result_Val	;AN000; Result value buffer
   498 00000CA1 [A40C]                  	dw	Buf_Range_1	;AN000; value list
   499 00000CA3 00                      	db	0		;AN000; no switches/keywords
   500                                  
   501                                  Buf_Range_1	label	byte	;AN000; value definition
   502 00000CA4 01                      	db	1		;AN000; range definition
   503 00000CA5 01                      	db	1		;AN000; 1 definition of range
   504 00000CA6 01                      	db	1		;AN000; item tag for this range
   505 00000CA7 0100000010270000        	dd	1,10000 	;AN000; from 1 to 10000
   506                                  
   507                                  Buf_Pos2	label	word	;AN000;
   508 00000CAF 0180                    	dw	8001h		;AN000; Numeric value, Optional
   509 00000CB1 0000                    	dw	0		;AN000; no function
   510 00000CB3 [D60C]                  	dw	Result_Val	;AN000; Result value buffer
   511 00000CB5 [B80C]                  	dw	Buf_Range_2	;AN000; value list
   512 00000CB7 00                      	db	0		;AN000; no switches/keywords
   513                                  
   514                                  Buf_Range_2	label	byte	;AN000; value definition
   515 00000CB8 01                      	db	1		;AN000; range definition
   516 00000CB9 01                      	db	1		;AN000; 1 definition of range
   517 00000CBA 01                      	db	1		;AN000; item tag for this range
   518 00000CBB 0000000008000000        	dd	0,8		;AN000; from 0 to 8.
   519                                  
   520                                  SW_X_Ctrl	label	word	;AN000;AN025;
   521 00000CC3 0000                    	dw	0		;AN000; no matching flag
   522 00000CC5 0000                    	dw	0		;AN000; no function
   523 00000CC7 [D60C]                  	dw	Result_Val	;AN000; return value
   524 00000CC9 [D50C]                  	dw	NoVal		;AN000; no value definition
   525 00000CCB 01                      	db	1		;AN000; # of switches
   526                                  Switch_X	label	byte	;AN000;AN025;
   527 00000CCC 2F5800                  	db	'/X',0		;AN000;AN025;
   528                                  ;local variables
   529 00000CCF 0000                    P_Buffers	dw     0	;AN000;
   530 00000CD1 0000                    P_H_Buffers	dw     0	;AN000;
   531 00000CD3 00                      P_Buffer_Slash_X db    0	;AN000;AN025;
   532 00000CD4 00                      Buffer_Pre_Scan  db    0	;AN030;
   533                                  
   534                                  ;Common definitions -------------
   535 00000CD5 00                      NoVal	db	0		;AN000;
   536                                  
   537                                  Result_Val	label	byte	;AN000;
   538 00000CD6 ??                      	db	?		;AN000; type returned
   539 00000CD7 ??                      	db	?		;AN000; item tag returned
   540 00000CD8 ????                    	dw	?		;AN000; ES:offset of the switch defined
   541                                  RV_Byte 	label	byte	;AN000;
   542                                  RV_Dword	label	dword	;AN000;
   543 00000CDA ????????                	dd	?		;AN000; value if number, or seg:offset to string.
   544                                  ;--------------------------------
   545                                  
   546                                  ; BREAK = [ ON | OFF ]
   547                                  
   548                                  Brk_Parms	label	byte	;AN000;
   549 00000CDE [E30C]                  	dw	Brk_Parmsx	;AN000;
   550 00000CE0 01                      	db	1		;AN000; An extra delimeter list
   551 00000CE1 01                      	db	1		;AN000; length is 1
   552 00000CE2 3B                      	db	SEMICOLON	;AN000;
   553                                  
   554                                  Brk_Parmsx	label	byte	;AN000;
   555 00000CE3 0101                    	db	1,1		;AN000; Min 1, Max 1 positional
   556 00000CE5 [E90C]                  	dw	Brk_Pos 	;AN000;
   557 00000CE7 00                      	db	0		;AN000; no switches
   558 00000CE8 00                      	db	0		;AN000; no keywords
   559                                  
   560                                  Brk_Pos 	label	word	;AN000;
   561 00000CE9 0020                    	dw	2000h		;AN000; Simple string
   562 00000CEB 0000                    	dw	0		;AN000; No functions
   563 00000CED [D60C]                  	dw	Result_Val	;AN000;
   564 00000CEF [F20C]                  	dw	On_Off_String	;AN000; ON,OFF string descriptions
   565 00000CF1 00                      	db	0		;AN000; no keyword/switch synonyms
   566                                  
   567                                  On_Off_String	label	byte	;AN000;
   568 00000CF2 03                      	db	3		;AN000; signals that there is a string choice
   569 00000CF3 00                      	db	0		;AN000; no range definition
   570 00000CF4 00                      	db	0		;AN000; no numeric values choice
   571 00000CF5 02                      	db	2		;AN000; 2 strings for choice
   572 00000CF6 01                      	db	1		;AN000; the 1st string tag
   573 00000CF7 [FC0C]                  	dw	On_String	;AN000;
   574 00000CF9 02                      	db	2		;AN000; the 2nd string tag
   575 00000CFA [FF0C]                  	dw	Off_String	;AN000;
   576                                  
   577 00000CFC 4F4E00                  On_String	db	"ON",0	;AN000;
   578 00000CFF 4F464600                Off_String	db	"OFF",0 ;AN000;
   579                                  ;local variable
   580 00000D03 00                      P_Ctrl_Break	db	0	;AN000; local variable
   581                                  
   582                                  ;--------------------------------
   583                                  
   584                                  ; COUNTRY = n {m {path}}
   585                                  ; or
   586                                  ; COUNTRY = n,,path
   587                                  
   588                                  Cntry_Parms	label	byte	;AN000;
   589 00000D04 [090D]                  	dw	Cntry_Parmsx	;AN000;
   590 00000D06 01                      	db	1		;AN000; An extra delimeter list
   591 00000D07 01                      	db	1		;AN000; length is 1
   592 00000D08 3B                      	db	SEMICOLON	;AN000;
   593                                  
   594                                  Cntry_Parmsx	label	byte	;AN000;
   595 00000D09 0103                    	db	1,3		;AN000; Min 1, Max 3 positional
   596 00000D0B [130D]                  	dw	Cntry_Pos1	;AN000;
   597 00000D0D [270D]                  	dw	Cntry_Pos2	;AN000;
   598 00000D0F [300D]                  	dw	Cntry_Pos3	;AN000;
   599 00000D11 00                      	db	0		;AN000; no switches
   600 00000D12 00                      	db	0		;AN000; no keywords
   601                                  
   602                                  Cntry_Pos1	label	word	;AN000; control definition for positional 1
   603 00000D13 0080                    	dw	8000h		;AN000; Numeric value
   604 00000D15 0000                    	dw	0		;AN000; no functions
   605 00000D17 [D60C]                  	dw	Result_Val	;AN000;
   606 00000D19 [1C0D]                  	dw	Cntry_Codepage_Range  ;AN000; country id code range description
   607 00000D1B 00                      	db	0		;AN000; no switch/keyword synonyms
   608                                  
   609                                  Cntry_Codepage_Range  label   byte  ;AN000;
   610 00000D1C 01                      	db	1		;AN000; # of value definitions
   611 00000D1D 01                      	db	1		;AN000; # of ranges
   612 00000D1E 01                      	db	1		;AN000; Tag for this range
   613 00000D1F 01000000E7030000        	dd	1,999		;AN000;
   614                                  
   615                                  Cntry_Pos2	label	word	;AN000; control definition for positional 2
   616 00000D27 0180                    	dw	8001h		;AN000; Numeric value, optional
   617 00000D29 0000                    	dw	0		;AN000; no functions
   618 00000D2B [D60C]                  	dw	Result_Val	;AN000;
   619 00000D2D [1C0D]                  	dw	Cntry_Codepage_Range  ;AN000; code page range descriptions.
   620 00000D2F 00                      	db	0		;AN000; no switch/keyword synonyms
   621                                  
   622                                  Cntry_Pos3	label	word	;AN000; control definition for positional 3
   623 00000D30 0102                    	dw	0201h		;AN000; File spec, optional
   624 00000D32 0000                    	dw	0		;AN000; No functions. Don't need to CAP.
   625 00000D34 [D60C]                  	dw	Result_Val	;AN000;
   626 00000D36 [D50C]                  	dw	NoVal		;AN000; no value list
   627 00000D38 00                      	db	0		;AN000; no switch/keyword synonyms
   628                                  
   629                                  ;Local variables
   630 00000D39 0000                    P_Cntry_Code	dw	0	;AN000;
   631 00000D3B 0000                    P_Code_Page	dw	0	;AN000;
   632                                  
   633                                  ;--------------------------------
   634                                  
   635                                  ; FILES = n
   636                                  
   637                                  Files_Parms	label	byte	;AN000;
   638 00000D3D [420D]                  	dw	Files_Parmsx	;AN000;
   639 00000D3F 01                      	db	1		;AN000; An extra delimeter list
   640 00000D40 01                      	db	1		;AN000; length is 1
   641 00000D41 3B                      	db	SEMICOLON	;AN000;
   642                                  
   643                                  Files_Parmsx	label	byte	;AN000;
   644 00000D42 0101                    	db	1,1		;AN000; Min 1, Max 1 positional
   645 00000D44 [480D]                  	dw	Files_Pos	;AN000;
   646 00000D46 00                      	db	0		;AN000; no switches
   647 00000D47 00                      	db	0		;AN000; no keywords
   648                                  
   649                                  Files_Pos	label	byte	;AN000;
   650 00000D48 0080                    	dw	8000h		;AN000; Numeric value
   651 00000D4A 0000                    	dw	0		;AN000; no functions
   652 00000D4C [D60C]                  	dw	Result_Val	;AN000;
   653 00000D4E [510D]                  	dw	Files_Range	;AN000; Files range description
   654 00000D50 00                      	db	0		;AN000; no switch/keyword synonyms
   655                                  
   656                                  Files_Range	label	byte	;AN000;
   657 00000D51 01                      	db	1		;AN000; # of value definitions
   658 00000D52 01                      	db	1		;AN000; # of ranges
   659 00000D53 01                      	db	1		;AN000; Tag for this range
   660 00000D54 08000000FF000000        	dd	8,255		;AN000;
   661                                  ;local variable
   662 00000D5C 00                      P_Files db	0		;AN000;
   663                                  
   664                                  ;--------------------------------
   665                                  
   666                                  ; FCBS = n,m
   667                                  
   668                                  FCBS_Parms	label	byte	;AN000;
   669 00000D5D [620D]                  	dw	FCBS_Parmsx	;AN000;
   670 00000D5F 01                      	db	1		;AN000; An extra delimeter list
   671 00000D60 01                      	db	1		;AN000; length is 1
   672 00000D61 3B                      	db	SEMICOLON	;AN000;
   673                                  
   674                                  FCBS_Parmsx	label	byte	;AN000;
   675 00000D62 0202                    	db	2,2		;AN000; Min 2, Max 2 positional
   676 00000D64 [6A0D]                  	dw	FCBS_Pos_1	;AN000;
   677 00000D66 [7E0D]                  	dw	FCBS_Pos_2	;AN000;
   678 00000D68 00                      	db	0		;AN000; no switches
   679 00000D69 00                      	db	0		;AN000; no keywords
   680                                  
   681                                  FCBS_Pos_1	label	byte	;AN000;
   682 00000D6A 0080                    	dw	8000h		;AN000; Numeric value
   683 00000D6C 0000                    	dw	0		;AN000; no functions
   684 00000D6E [D60C]                  	dw	Result_Val	;AN000;
   685 00000D70 [730D]                  	dw	FCBS_Range	;AN000; FCBS range descriptions
   686 00000D72 00                      	db	0		;AN000; no switch/keyword synonyms
   687                                  
   688                                  FCBS_Range	label	byte	;AN000;
   689 00000D73 01                      	db	1		;AN000; # of value definitions
   690 00000D74 01                      	db	1		;AN000; # of ranges
   691 00000D75 01                      	db	1		;AN000; Tag for this range
   692 00000D76 01000000FF000000        	dd	1,255		;AN000;
   693                                  
   694                                  FCBS_Pos_2	label	byte	;AN000;
   695 00000D7E 0080                    	dw	8000h		;AN000; Numeric value
   696 00000D80 0000                    	dw	0		;AN000; no functions
   697 00000D82 [D60C]                  	dw	Result_Val	;AN000;
   698 00000D84 [870D]                  	dw	FCBS_Keep_Range ;AN000; FCBS KEEP range descriptions
   699 00000D86 00                      	db	0		;AN000; no switch/keyword synonyms
   700                                  
   701                                  FCBS_Keep_Range label	byte	;AN000;
   702 00000D87 01                      	db	1		;AN000; # of value definitions
   703 00000D88 01                      	db	1		;AN000; # of ranges
   704 00000D89 01                      	db	1		;AN000; Tag for this range
   705 00000D8A 00000000FF000000        	dd	0,255		;AN000;
   706                                  
   707                                  ;local variable
   708 00000D92 00                      P_Fcbs	db	0		;AN000;
   709 00000D93 00                      P_Keep	db	0		;AN000;
   710                                  ;--------------------------------
   711                                  
   712                                  ; STACKS = n,m
   713                                  
   714                                  STKS_Parms	label	byte	;AN000;
   715 00000D94 [990D]                  	dw	STKS_Parmsx	;AN000;
   716 00000D96 01                      	db	1		;AN000; An extra delimeter list
   717 00000D97 01                      	db	1		;AN000; length is 1
   718 00000D98 3B                      	db	SEMICOLON	;AN000;
   719                                  
   720                                  STKS_Parmsx	label	byte	;AN000;
   721 00000D99 0202                    	db	2,2		;AN000; Min 2, Max 2 positional
   722 00000D9B [A10D]                  	dw	STKS_Pos_1	;AN000;
   723 00000D9D [B50D]                  	dw	STKS_Pos_2	;AN000;
   724 00000D9F 00                      	db	0		;AN000; no switches
   725 00000DA0 00                      	db	0		;AN000; no keywords
   726                                  
   727                                  STKS_Pos_1	label	byte	;AN000;
   728 00000DA1 0080                    	dw	8000h		;AN000; Numeric value
   729 00000DA3 0000                    	dw	0		;AN000; no functions
   730 00000DA5 [D60C]                  	dw	Result_Val	;AN000;
   731 00000DA7 [AA0D]                  	dw	STKS_Range	;AN000; number of stack range descriptions
   732 00000DA9 00                      	db	0		;AN000; no switch/keyword synonyms
   733                                  
   734                                  STKS_Range	label	byte	;AN000;
   735 00000DAA 01                      	db	1		;AN000; # of value definitions
   736 00000DAB 01                      	db	1		;AN000; # of ranges
   737 00000DAC 01                      	db	1		;AN000; Tag for this range
   738 00000DAD 0000000040000000        	dd	0,64		;AN000;
   739                                  
   740                                  STKS_Pos_2	label	byte	;AN000;
   741 00000DB5 0080                    	dw	8000h		;AN000; Numeric value
   742 00000DB7 0000                    	dw	0		;AN000; no functions
   743 00000DB9 [D60C]                  	dw	Result_Val	;AN000;
   744 00000DBB [BE0D]                  	dw	STK_SIZE_Range	;AN000; stack size range descriptions
   745 00000DBD 00                      	db	0		;AN000; no switch/keyword synonyms
   746                                  
   747                                  STK_SIZE_Range label   byte	;AN000;
   748 00000DBE 01                      	db	1		;AN000; # of value definitions
   749 00000DBF 01                      	db	1		;AN000; # of ranges
   750 00000DC0 01                      	db	1		;AN000; Tag for this range
   751 00000DC1 0000000000020000        	dd	0,512		;AN000;
   752                                  ;local variables
   753 00000DC9 0000                    P_Stack_Count	dw	0	;AN000;
   754 00000DCB 0000                    P_Stack_Size	dw	0	;AN000;
   755                                  
   756                                  ;--------------------------------
   757                                  
   758                                  ; MULTITRACK = [ ON | OFF ]
   759                                  
   760                                  MTrk_Parms	label	byte	;AN002;
   761 00000DCD [D20D]                  	dw	MTrk_Parmsx	;AN002;
   762 00000DCF 01                      	db	1		;AN002; An extra delimeter list
   763 00000DD0 01                      	db	1		;AN002; length is 1
   764 00000DD1 3B                      	db	SEMICOLON	;AN002;
   765                                  
   766                                  MTrk_Parmsx	label	byte	;AN002;
   767 00000DD2 0101                    	db	1,1		;AN002; Min 1, Max 1 positional
   768 00000DD4 [D80D]                  	dw	MTrk_Pos	;AN002;
   769 00000DD6 00                      	db	0		;AN002; no switches
   770 00000DD7 00                      	db	0		;AN002; no keywords
   771                                  
   772                                  MTrk_Pos	label	word	;AN002;
   773 00000DD8 0020                    	dw	2000h		;AN002; Simple string
   774 00000DDA 0000                    	dw	0		;AN002; No functions
   775 00000DDC [D60C]                  	dw	Result_Val	;AN002;
   776 00000DDE [F20C]                  	dw	On_Off_String	;AN002; ON,OFF string descriptions
   777 00000DE0 00                      	db	0		;AN002; no keyword/switch synonyms
   778                                  
   779                                  ;local variables
   780 00000DE1 00                      P_Mtrk	db	0		;AN002;
   781                                  ;--------------------------------
   782                                  
   783                                  ; CPSW = [ ON | OFF ]
   784                                  
   785                                  CPSW_Parms	label	byte	;AN002;
   786 00000DE2 [E70D]                  	dw	CPSW_Parmsx	;AN002;
   787 00000DE4 01                      	db	1		;AN002; An extra delimeter list
   788 00000DE5 01                      	db	1		;AN002; length is 1
   789 00000DE6 3B                      	db	SEMICOLON	;AN002;
   790                                  
   791                                  CPSW_Parmsx	label	byte	;AN002;
   792 00000DE7 0101                    	db	1,1		;AN002; Min 1, Max 1 positional
   793 00000DE9 [ED0D]                  	dw	CPSW_Pos	;AN002;
   794 00000DEB 00                      	db	0		;AN002; no switches
   795 00000DEC 00                      	db	0		;AN002; no keywords
   796                                  
   797                                  CPSW_Pos	label	word	;AN002;
   798 00000DED 0020                    	dw	2000h		;AN002; Simple string
   799 00000DEF 0000                    	dw	0		;AN002; No functions
   800 00000DF1 [D60C]                  	dw	Result_Val	;AN002;
   801 00000DF3 [F20C]                  	dw	On_Off_String	;AN002; ON,OFF string descriptions
   802 00000DF5 00                      	db	0		;AN002; no keyword/switch synonyms
   803                                  
   804                                  ;local variables
   805 00000DF6 00                      P_CPSW	db	0		;AN002;
   806                                  
   807                                  ;--------------------------------
   808                                  ; SWITCHES=/K
   809                                  
   810                                  Swit_Parms	label	byte	;AN019;
   811 00000DF7 [FC0D]                  	dw	Swit_Parmsx	;AN019;
   812 00000DF9 01                      	db	1		;AN019; An extra delimeter list
   813 00000DFA 01                      	db	1		;AN019; length is 1
   814 00000DFB 3B                      	db	SEMICOLON	;AN019;
   815                                  
   816                                  Swit_Parmsx	label	byte	;AN019;
   817 00000DFC 0000                    	db	0,0		;AN019; No positionals
   818 00000DFE 01                      	db	1		;AN019; 1 switch for now.
   819 00000DFF [020E]                  	dw	Swit_K_Ctrl	;AN019; /K control
   820 00000E01 00                      	db	0		;AN019; no keywords
   821                                  
   822                                  Swit_K_Ctrl	label	word	;AN019;
   823 00000E02 0000                    	dw	0		;AN019; no matching flag
   824 00000E04 0000                    	dw	0		;AN019; no function
   825 00000E06 [D60C]                  	dw	Result_Val	;AN019; return value
   826 00000E08 [D50C]                  	dw	NoVal		;AN019; no value definition
   827 00000E0A 01                      	db	1		;AN019; # of switches
   828                                  Swit_K		label	byte	;AN019;
   829 00000E0B 2F4B00                  	db	'/K',0		;AN019;
   830                                  ;local variables
   831 00000E0E 00                      P_Swit_K	db     0	;AN019;
   832                                  
   833 00000E0F 00                      no_config_file:		db 0
   834                                  
   835                                  ;******************************************************************************
   836                                  
   837                                  %if 0
   838                                  %macro debugnumber 1
   839                                  	push ax
   840                                  	mov ax, %1
   841                                  	call display_debugnumber
   842                                  	pop ax
   843                                  %endmacro
   844                                  
   845                                  display_debugnumber:
   846                                  	pushf
   847                                  	push bx
   848                                  	push bp
   849                                  	push ax
   850                                  	mov ah, 0Eh
   851                                  	mov bx, 7
   852                                  	int 10h
   853                                  	pop ax
   854                                  	push ax
   855                                  	xchg al, ah
   856                                  	test al, al
   857                                  	jz .nohigh
   858                                  	mov ah, 0Eh
   859                                  	mov bx, 7
   860                                  	int 10h
   861                                  .nohigh:
   862                                  	pop ax
   863                                  	pop bp
   864                                  	pop bx
   865                                  	popf
   866                                  	retn
   867                                  %else
   868                                  %macro debugnumber 1
   869                                  %endmacro
   870                                  %endif
   871                                  
   872                                  DOCONF:
   873                                   assume ds:nothing, es:nothing, ss:nothing
   874                                  	debugnumber '0'
   875 00000E10 0E                      	PUSH	CS
   876 00000E11 1F                      	POP	DS
   877                                   ASSUME DS:SYSINITGROUP
   878                                  
   879                                  CHAR_OPER equ Char_Oper	; NASM port equate
   880 00000E12 B80037                  	MOV	AX,(CHAR_OPER << 8)	;GET SWITCH CHARACTER
   881 00000E15 CD21                    	INT	21H
   882 00000E17 8816[0100]              	MOV	[COMMAND_LINE+1],DL	; Set in default command line
   883                                  
   884                                  extern CONFIG_pointers
   885 00000E1B BE[FEFF]                	mov si, CONFIG_pointers - 2	; -> at command line name of prior
   886                                  .loop:
   887 00000E1E AD                      	lodsw				; skip command line name
   888 00000E1F AD                      	lodsw				; skip function pointer
   889 00000E20 40                      	inc ax				; is it -1 ?
   890 00000E21 AD                      	lodsw				; (load pointer)
   891 00000E22 741A                    	jz No_Config_sys		; yes, end -->
   892 00000E24 85C0                    	test ax, ax			; pointer is zero ?
   893 00000E26 74F6                    	jz .loop			; yes, load next -->
   894 00000E28 89C3                    	mov bx, ax
   895 00000E2A 803F00                  	cmp byte [bx], 0		; pointer points at empty string ?
   896 00000E2D 74EF                    	je .loop			; yes, load next -->
   897 00000E2F 92                      	xchg dx, ax
   898                                  OPEN equ Open	; NASM port equate
   899 00000E30 B8003D                  	MOV	AX,OPEN << 8		;OPEN FILE "CONFIG.SYS"
   900 00000E33 F9                      	STC				;IN CASE OF INT 24
   901 00000E34 CD21                    	int 21h				; does open succeed ?
   902 00000E36 72E6                    	jc .loop			; no, try next -->
   903 00000E38 8916[0A00]              	mov word [CONFIG_used], dx
   904 00000E3C EB55                    	JMP	NOPROB			;PROBLEM WITH OPEN
   905                                  
   906                                  No_Config_sys:				;AN028;
   907 00000E3E F616[0F0E]              	not byte [no_config_file]
   908 00000E42 31C0                    	xor ax, ax
   909 00000E44 31D2                    	xor dx, dx			; = empty config
   910 00000E46 EB56                    	jmp continue_no_file
   911                                  
   912                                  ENDCONF:
   913 00000E48 C3                      	return
   914                                  
   915                                  
   916 00000E49 BA[0000]                BADOP:	MOV	DX,OFFSET BADOPM	;WANT TO PRINT COMMAND ERROR "Unrecognized command..."
   917 00000E4C E8(0000)                	invoke	PRINT
   918 00000E4F E89D11                  	call	Error_Line		;show "Error in CONFIG.SYS ..." .
   919 00000E52 E93A02                  	JMP	COFF
   920                                  
   921                                  Badop_p 	proc	near		;AN000;
   922                                  ;Same thing as BADOP, but will make sure to set DS register back to SYSINITSEG
   923                                  ;and return back to the calller.
   924 00000E55 0E                      	push	cs
   925 00000E56 1F                      	pop	ds			;set ds to CONFIGSYS seg.
   926                                   assume ds:SYSINITGROUP
   927                                  badopm equ BADOPM	; NASM port label
   928 00000E57 BA[0000]                	mov	dx, offset badopm
   929 00000E5A E8(0000)                	invoke	PRINT
   930 00000E5D E88F11                  	call	Error_Line
   931 00000E60 C3                      	ret
   932                                  Badop_p 	endp
   933                                  
   934                                  Badparm_p	proc	near		;AN007;
   935                                   assume ds:nothing, es:nothing, ss:nothing
   936                                  ;Show "Bad command or parameters - xxxxxx"
   937                                  ;In Badparm_seg, Badparm_off -> xxxxx
   938                                  ;
   939 00000E61 2E803E[D40C]01          	cmp	byte [cs:Buffer_Pre_Scan], 1	;AN030; Pre scanning Buffers ... /X?
   940 00000E67 7429                    	je	BadParmp_Ret		;AN030;  then do not show any message.
   941 00000E69 1E                      	push	ds			;AN007;
   942 00000E6A 52                      	push	dx			;AN007;
   943 00000E6B 56                      	push	si			;AN007;
   944                                  
   945 00000E6C 0E                      	push	cs			;AN007;
   946 00000E6D 1F                      	pop	ds			;AN007;
   947                                   assume ds:SYSINITGROUP
   948 00000E6E BA[0000]                	mov	dx, offset Badparm	;AN007;
   949 00000E71 E8(0000)                	invoke	PRINT			;AN007;"Bad command or parameters - "
   950                                  Badparm_ptr equ Badparm_Ptr	; NASM port label
   951 00000E74 C536[0400]              	lds	si, [Badparm_ptr] 	;AN007;
   952                                   assume ds:nothing
   953                                  Badparm_Prt:				;AN007;print "xxxx" until CR.
   954 00000E78 8A14                    	mov	dl, byte ptr [si]	;AN007;
   955                                  STD_CON_OUTPUT equ Std_Con_Output	; NASM port equate
   956 00000E7A B402                    	mov	ah,STD_CON_OUTPUT	;AN007;
   957 00000E7C CD21                    	int	21h			;AN007;
   958 00000E7E 46                      	inc	si			;AN007;
   959 00000E7F 80FA0D                  	cmp	dl, CR			;AN007;
   960 00000E82 75F4                    	jne	Badparm_Prt		;AN007;
   961 00000E84 0E                      	push	cs			;AN007;
   962 00000E85 1F                      	pop	ds			;AN007;
   963                                   assume ds:SYSINITGROUP
   964 00000E86 BA[0000]                	mov	dx, offset CRLFM	;AN007;
   965 00000E89 E8(0000)                	invoke	PRINT			;AN007;
   966 00000E8C E86011                  	call	Error_Line		;AN007;
   967 00000E8F 5E                      	pop	si			;AN007;
   968 00000E90 5A                      	pop	dx			;AN007;
   969 00000E91 1F                      	pop	ds			;AN007;
   970                                   assume ds:nothing
   971                                  BadParmp_Ret:				;AN030;
   972 00000E92 C3                      	ret				;AN007;
   973                                  Badparm_p	endp
   974                                  
   975                                  NOPROB:					;GET FILE SIZE (NOTE < 64K!!)
   976                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
   977 00000E93 89C3                    	MOV	BX,AX
   978 00000E95 31C9                    	XOR	CX,CX
   979 00000E97 31D2                    	XOR	DX,DX
   980                                  LSEEK equ LSeek	; NASM port equate
   981 00000E99 B80242                  	MOV	AX,(LSEEK << 8) | 2
   982 00000E9C CD21                    	INT	21H
   983                                  
   984                                  continue_no_file:
   985                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
   986 00000E9E BEFEFE                  	mov si, 64 * 1024 - 1 - 1 - 256	; maximum size
   987                                  		; 1 = offset of end <= 0FFFFh
   988                                  		; 1 = linebreak we'll append
   989                                  		; 256 = maximum length of APPEND/PREPEND kernel command line names
   990 00000EA1 85D2                    	test dx, dx			; >= 64 KiB ?
   991 00000EA3 7504                    	jnz .overflow			; yes -->
   992 00000EA5 39F0                    	cmp ax, si
   993 00000EA7 7608                    	jbe .fine
   994                                  .overflow:
   995 00000EA9 BA[0000]                	mov	dx, config_overflow
   996 00000EAC E8(0000)                	invoke	PRINT
   997 00000EAF 89F0                    	mov ax, si
   998                                  .fine:
   999 00000EB1 A3[0000]                	MOV	[COUNT],AX		; true file size to read
  1000                                  
  1001 00000EB4 83C001                  	add ax, 1
  1002                                  config_size equ Config_Size	; NASM port label
  1003 00000EB7 A3[0000]                	mov	[config_size], ax	;save the size of config.sys file.
  1004                                  
  1005 00000EBA D006[0F0E]              	rol byte [no_config_file], 1
  1006 00000EBE 7207                    	jc @F
  1007                                  
  1008 00000EC0 31D2                    	XOR	DX,DX
  1009 00000EC2 B80042                  	MOV	AX,LSEEK << 8		;Reset pointer to beginning of file
  1010 00000EC5 CD21                    	INT	21H
  1011                                  
  1012                                  @@:
  1013 00000EC7 57                      	push di
  1014 00000EC8 53                      	push bx
  1015 00000EC9 BB[D10E]                	mov bx, .add
  1016 00000ECC E8B000                  	call parse_configuration_command_line
  1017 00000ECF EB05                    	jmp @F
  1018                                  
  1019                                  .add:
  1020 00000ED1 010E[0000]              	add [config_size], cx		; add in PREPEND= / APPEND= line length
  1021 00000ED5 C3                      	retn
  1022                                  
  1023                                  @@:
  1024 00000ED6 5B                      	pop bx
  1025 00000ED7 5F                      	pop di
  1026                                  
  1027 00000ED8 57                      	push di
  1028 00000ED9 53                      	push bx
  1029                                  
  1030 00000EDA A1[0000]                	MOV	AX,[config_size]
  1031 00000EDD BE[0000]                	mov si, alloc_initconfig
  1032 00000EE0 E8(0000)                	call allocate_temporary_block
  1033 00000EE3 8C06[0000]              	MOV [config_block], es		; Config starts here. New CONBOT value.
  1034                                  	; CALL	TEMPCDS			; Finally get CDS to "safe" location
  1035                                  ASSUME	DS:NOTHING,ES:NOTHING
  1036                                  
  1037 00000EE7 0E                      	 push cs
  1038 00000EE8 1F                      	 pop ds
  1039                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  1040 00000EE9 8B16[0000]              	MOV	DX,[config_block]
  1041 00000EED 8EC2                    	MOV	ES,DX
  1042                                   assume es:nothing
  1043 00000EEF 31D2                    	XOR	DX,DX			; es:dx -> config buffer
  1044                                  
  1045 00000EF1 BB[F90E]                	mov bx, .prepend
  1046 00000EF4 E88800                  	call parse_configuration_command_line
  1047 00000EF7 EB14                    	jmp @F
  1048                                  
  1049                                  .prepend:
  1050                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  1051 00000EF9 81FF[0000]              	cmp di, nameprepend
  1052 00000EFD 750D                    	jne .retn
  1053 00000EFF 29CE                    	sub si, cx
  1054 00000F01 87D7                    	xchg dx, di
  1055 00000F03 F3A4                    	rep movsb
  1056 00000F05 26C645FF0A              	mov byte [es:di - 1], 10	; LF
  1057 00000F0A 87D7                    	xchg dx, di
  1058                                  .retn:
  1059 00000F0C C3                      	retn
  1060                                  
  1061                                  @@:
  1062 00000F0D 5B                      	pop bx
  1063 00000F0E 5F                      	pop di
  1064                                  
  1065 00000F0F 06                      	push es
  1066 00000F10 1F                      	pop ds				; ds:dx -> where to read config file
  1067                                   assume ds:nothing
  1068 00000F11 2E8B0E[0000]            	MOV	CX,[cs:COUNT]
  1069 00000F16 31C0                    	xor ax, ax			; NC, ax = 0
  1070 00000F18 E305                    	jcxz @F
  1071                                  READ equ Read	; NASM port equate
  1072 00000F1A B43F                    	MOV	AH,READ
  1073 00000F1C F9                      	STC				;IN CASE OF INT 24
  1074 00000F1D CD21                    	INT	21H			;Function request
  1075                                  @@:
  1076 00000F1F 9C                      	PUSHF
  1077                                  ;
  1078                                  ; Find the EOF mark in the file.  If present, then trim length.
  1079                                  
  1080 00000F20 505751                  	SaveReg <AX,DI,CX>
  1081 00000F23 91                      	xchg cx, ax			; cx = length actually read
  1082 00000F24 B01A                    	MOV	AL,1Ah			; eof mark
  1083 00000F26 89D7                    	MOV	DI,DX			; point ro buffer
  1084 00000F28 E305                    	JCXZ	PutEOL			; no chars
  1085 00000F2A F2AE                    	REPNZ	SCASB			; find end
  1086 00000F2C 7501                    	JNZ	PutEOL			; none found and count exahusted
  1087                                  ;
  1088                                  ; We found a 1A.  Back up
  1089                                  ;
  1090 00000F2E 4F                      	DEC	DI			; backup past 1A
  1091                                  ;
  1092                                  ;  Just for the halibut, stick in an extra EOL
  1093                                  ;
  1094                                  PutEOL:
  1095 00000F2F B00A                    	MOV	AL,LF
  1096 00000F31 AA                      	STOSB				; ! LF only
  1097                                  
  1098 00000F32 0E                      	 push cs
  1099 00000F33 1F                      	 pop ds
  1100                                   assume ds:SYSINITGROUP
  1101 00000F34 89FA                    	mov dx, di
  1102 00000F36 53                      	push bx
  1103 00000F37 BB[3F0F]                	mov bx, .append
  1104 00000F3A E84200                  	call parse_configuration_command_line
  1105 00000F3D EB14                    	jmp @F
  1106                                  
  1107                                  .append:
  1108                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  1109 00000F3F 81FF[0000]              	cmp di, nameappend
  1110 00000F43 750D                    	jne .retn
  1111 00000F45 29CE                    	sub si, cx			; -> content
  1112 00000F47 87D7                    	xchg dx, di
  1113 00000F49 F3A4                    	rep movsb			; store in buffer
  1114 00000F4B 26C645FF0A              	mov byte [es:di - 1], 10	; LF
  1115 00000F50 87D7                    	xchg dx, di
  1116                                  .retn:
  1117 00000F52 C3                      	retn
  1118                                  
  1119                                  @@:
  1120 00000F53 5B                      	pop bx
  1121 00000F54 87D7                    	xchg dx, di			; di = size of configuration
  1122                                  
  1123                                  Count equ COUNT	; NASM port label
  1124 00000F56 893E[0000]              	MOV	[Count],DI		; new count
  1125                                  ;
  1126                                  ; Restore registers
  1127                                  ;
  1128 00000F5A 595F58                  	RestoreReg  <CX,DI,AX>
  1129                                  
  1130                                  ASSUME	DS:SYSINITSEG
  1131 00000F5D 50                      	PUSH	AX
  1132 00000F5E 2ED006[0F0E]            	rol byte [cs:no_config_file], 1
  1133 00000F63 7204                    	jc @F
  1134                                  CLOSE equ Close	; NASM port equate
  1135 00000F65 B43E                    	MOV	AH,CLOSE
  1136 00000F67 CD21                    	INT	21H
  1137                                  @@:
  1138 00000F69 58                      	POP	AX
  1139 00000F6A 9D                      	POPF
  1140 00000F6B 7207                    	JC	CONFERR 		;IF NOT WE'VE GOT A PROBLEM
  1141 00000F6D 39C1                    	CMP	CX,AX
  1142 00000F6F 7503E9BF00              	JZ	GETCOM			;COULDN'T READ THE FILE
  1143                                  CONFERR:
  1144                                   assume ds:nothing, es:nothing, ss:nothing
  1145 00000F74 2E8B16[0A00]            	MOV	DX,[cs:CONFIG_used]	;WANT TO PRINT CONFIG ERROR
  1146 00000F79 E8(0000)                	CALL	BADFIL
  1147 00000F7C E9C9FE                  ENDCONV:JMP	ENDCONF
  1148                                  
  1149                                  extern nameprepend, nameappend, kernelcommandline, kernelcommandline.end
  1150                                  
  1151                                  		; INP:	ds = cs
  1152                                  		;	ds:kernelcommandline -> contents
  1153                                  		;	word [kernelcommandline.end] -> end
  1154                                  		;	nameprepend, nameappend
  1155                                  		;	bx = callback near function
  1156                                  		; CHG:	ax, si, cx, di
  1157                                  		; Callback called with:
  1158                                  		; INP:	ds:si -> past name's content terminator
  1159                                  		;	cx = length of content including terminator
  1160                                  		;	es = unchanged
  1161                                  		;	dx = unchanged
  1162                                  		;	di = nameprepend or nameappend, whichever matched
  1163                                  		; CHG:	cx, ax
  1164                                  		; REM:	changes of dx passed back to caller
  1165                                  parse_configuration_command_line:
  1166                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  1167 00000F7F BE[0000]                	mov si, kernelcommandline
  1168                                  .loopcommand:
  1169 00000F82 A8                      	db __TEST_IMM8		; skip inc
  1170                                  @@:
  1171 00000F83 46                      	inc si
  1172 00000F84 803C20                  	cmp byte [si], 32
  1173 00000F87 74FA                    	je @B
  1174 00000F89 803C09                  	cmp byte [si], 9
  1175 00000F8C 74F5                    	je @B
  1176                                  
  1177 00000F8E BF[0000]                	mov di, nameprepend	; -> first name
  1178                                  .loopname:
  1179 00000F91 57                      	push di
  1180 00000F92 56                      	push si
  1181                                  .comparename:
  1182 00000F93 AC                      	lodsb
  1183 00000F94 3C00                    	cmp al, 0
  1184 00000F96 7427                    	je .next
  1185 00000F98 3C61                    	cmp al, 'a'
  1186 00000F9A 7206                    	jb @F
  1187 00000F9C 3C7A                    	cmp al, 'z'
  1188 00000F9E 7702                    	ja @F
  1189 00000FA0 2C20                    	sub al, 20h
  1190                                  @@:
  1191 00000FA2 06                      	push es
  1192 00000FA3 0E                      	 push cs
  1193 00000FA4 07                      	 pop es
  1194                                   assume es:SYSINITGROUP
  1195 00000FA5 AE                      	scasb
  1196 00000FA6 07                      	pop es
  1197                                   assume es:nothing
  1198 00000FA7 7516                    	jne .next
  1199 00000FA9 803D00                  	cmp byte [di], 0
  1200 00000FAC 75E5                    	jne .comparename
  1201 00000FAE AC                      	lodsb
  1202 00000FAF 3C00                    	cmp al, 0
  1203 00000FB1 741A                    	je .found
  1204 00000FB3 3C20                    	cmp al, 32
  1205 00000FB5 7416                    	je .found
  1206 00000FB7 3C09                    	cmp al, 9
  1207 00000FB9 7412                    	je .found
  1208 00000FBB 3C3D                    	cmp al, '='
  1209 00000FBD 740E                    	je .found
  1210                                  .next:
  1211 00000FBF 5E                      	pop si
  1212 00000FC0 5F                      	pop di
  1213 00000FC1 81FF[0000]              	cmp di, nameprepend
  1214 00000FC5 752D                    	jne .donename
  1215 00000FC7 BF[0000]                	mov di, nameappend
  1216 00000FCA EBC5                    	jmp .loopname
  1217                                  
  1218                                  @@:
  1219 00000FCC AC                      	lodsb
  1220                                  .found:
  1221 00000FCD 3C20                    	cmp al, 32
  1222 00000FCF 74FB                    	je @B
  1223 00000FD1 3C09                    	cmp al, 9
  1224 00000FD3 74F7                    	je @B
  1225 00000FD5 3C3D                    	cmp al, '='
  1226 00000FD7 7501                    	jne @FF
  1227                                  @@:
  1228 00000FD9 AC                      	lodsb
  1229                                  @@:
  1230 00000FDA 3C20                    	cmp al, 32
  1231 00000FDC 74FB                    	je @BB
  1232 00000FDE 3C09                    	cmp al, 9
  1233 00000FE0 74F7                    	je @BB
  1234                                  
  1235 00000FE2 4E                      	dec si			; -> content
  1236 00000FE3 89F1                    	mov cx, si
  1237                                  .findlen:
  1238 00000FE5 AC                      	lodsb
  1239 00000FE6 84C0                    	test al, al
  1240 00000FE8 75FB                    	jnz .findlen
  1241 00000FEA F7D9                    	neg cx
  1242 00000FEC 01F1                    	add cx, si		; = length, including terminator
  1243 00000FEE 5F                      	pop di			; discard si
  1244 00000FEF 5F                      	pop di			; restore di
  1245 00000FF0 FFD3                    	call bx
  1246 00000FF2 EB05                    	jmp .nextcommand
  1247                                  .donename:
  1248                                  @@:
  1249 00000FF4 AC                      	lodsb
  1250 00000FF5 3C00                    	cmp al, 0
  1251 00000FF7 75FB                    	jne @B
  1252                                  .nextcommand:
  1253 00000FF9 3B36[0000]              	cmp si, word [kernelcommandline.end]
  1254 00000FFD 7283                    	jb .loopcommand
  1255 00000FFF C3                      	retn
  1256                                  
  1257                                  
  1258                                   global get_config_size
  1259                                  get_config_size:
  1260                                   assume ds:nothing, es:nothing, ss:nothing
  1261 00001000 2EA1[0000]              	mov ax, [cs:Org_Count]
  1262 00001004 89C1                    	mov cx, ax
  1263 00001006 E8(0000)                	invoke ParaRound
  1264 00001009 93                      	xchg bx, ax
  1265 0000100A C3                      	retn
  1266                                  
  1267                                  
  1268                                  Multi_Pass:				;AN018;AN026; called to execute IFS=,  INSTALL= commands
  1269                                   assume ds:nothing, es:nothing, ss:nothing
  1270 0000100B 0E                      	push	cs			;AN018;
  1271 0000100C 1F                      	pop	ds			;AN018;
  1272                                   assume ds:SYSINITGROUP
  1273                                  Multi_Pass_id equ Multi_Pass_Id	; NASM port label
  1274 0000100D 803E[0000]0A            	cmp	byte [Multi_Pass_id], 10	;J.K.
  1275                                  Endconv equ ENDCONV	; NASM port label
  1276 00001012 7203E965FF              	jae	Endconv			;J.K. Do nothing. Just return.
  1277 00001017 8E06[0000]              	mov es, word [config_block]	; => config
  1278                                   assume es:nothing
  1279 0000101B 8B36[0000]              	mov	si, [Org_Count]		;AN018;
  1280 0000101F 8936[0000]              	mov	[Count], si		;AN018; set Count
  1281 00001023 31F6                    	xor	si,si			;AN018;
  1282                                  Chrptr equ CHRPTR	; NASM port label
  1283 00001025 8936[0000]              	mov	[Chrptr], si		;AN018; reset Chrptr, LineCount
  1284 00001029 8936[0000]              	mov	[LineCount], si		;AN018;
  1285                                  GetChr equ GETCHR	; NASM port label
  1286 0000102D E8990F                  	call	GetChr			;AN018;
  1287                                  Conflp equ CONFLP	; NASM port label
  1288 00001030 EB1B                    	jmp	Conflp			;AN018;
  1289 00001032 90                      	nop	; identicalise
  1290                                  GETCOM:
  1291 00001033 E8(0000)                	invoke	ORGANIZE		;ORGANIZE THE FILE
  1292 00001036 E8C7FF                  	call get_config_size
  1293 00001039 B44A                    	mov ah, 4Ah
  1294 0000103B CD21                    	int 21h
  1295 0000103D 1E                      	push ds
  1296 0000103E 8CC0                    	mov ax, es
  1297 00001040 48                      	dec ax
  1298 00001041 8ED8                    	mov ds, ax
  1299                                   assume ds:MCB
  1300 00001043 C70601000800            	mov word [mcbOwner], 8
  1301 00001049 1F                      	pop ds
  1302                                   assume ds:SYSINITGROUP
  1303 0000104A E87C0F                  	CALL	GETCHR
  1304                                  
  1305 0000104D 7303E92AFF              CONFLP: JC	ENDCONV
  1306 00001052 E86F10                  	call	Reset_DOS_Version	;AN024;AN026; Still need to reset version even IBMDOS handles this through
  1307                                  					; function 4Bh call, since IBMDOS does not know when Load/Overlay call finishes.
  1308                                  
  1309                                  %ifndef BUF2
  1310                                  %IFN BUFFERFLAG
  1311                                  EMS_Stub_handler equ EMS_Stub_Handler	; NASM port label
  1312                                  	call	EMS_Stub_handler	;AN030;
  1313                                  %ENDIF
  1314                                  %endif
  1315                                  
  1316 00001055 FF06[0000]              	inc	word [LineCount]		;AN000; Increase LineCount.
  1317 00001059 C606[D40C]00            	mov	byte [Buffer_Pre_Scan], 0	;AN030; Reset Buffer_Pre_Scan.
  1318 0000105E C606[0000]00            	mov	byte [MultDeviceFlag],0	;AN001; Reset MultDeviceFlag.
  1319 00001063 C606[0300]00            	mov	byte [SetDevMarkFlag],0	;AN004; Reset SetDevMarkFlag.
  1320 00001068 8326[1200]00            	and word [devicehighdata], 0
  1321 0000106D 3C0A                    	cmp	al, LF			;AN000; LineFeed?
  1322 0000106F 7425                    	je	Blank_Line		;AN000;  then ignore this line.
  1323 00001071 88C4                    	MOV	AH,AL
  1324 00001073 E8530F                  	CALL	GETCHR
  1325                                  TryI equ TRYI	; NASM port label
  1326 00001076 7325                    	jnc	TryI			;AN000;
  1327                                  Multi_Pass_ID equ Multi_Pass_Id	; NASM port label
  1328 00001078 803E[0000]00            	cmp byte [Multi_Pass_ID], 0
  1329 0000107D 7503E9FAFE              	je Endconv
  1330 00001082 803E[0000]02            	cmp	byte [Multi_Pass_ID], 2	;AN026;
  1331 00001087 7203E9F0FE              	jae	Endconv 		;AN026;Do not show Badop again for multi_pass.
  1332 0000108C E9BAFD                  	JMP	BADOP
  1333                                  
  1334 0000108F 0E                      COFF:	PUSH	CS
  1335 00001090 1F                      	POP	DS
  1336                                   assume ds:SYSINITGROUP
  1337 00001091 E8(0000)                	invoke	NEWLINE
  1338 00001094 EBB7                    	JMP	CONFLP
  1339                                  Blank_Line:				;AN000;
  1340                                  Getchr equ GETCHR	; NASM port label
  1341 00001096 E8300F                  	call	Getchr			;AN000;
  1342 00001099 EBB2                    	jmp	CONFLP			;AN000;
  1343                                  
  1344                                  COFF_P:
  1345 0000109B 0E                      	push	cs
  1346 0000109C 1F                      	pop	ds
  1347                                  
  1348                                  
  1349                                  ;J.K. 1/27/88 ;;;;;;;;;;;;;;;;;;
  1350                                  ;To handle INSTALL= commands, we are going to use multi-pass.
  1351                                  ;The first pass handles the other commands and only set Install_Flag when
  1352                                  ;it finds any INSTALL command.	 The second pass will only handle the
  1353                                  ;INSTALL= command.
  1354                                  
  1355                                  ;------------------------------------------------------------------------------
  1356                                  ;INSTALL command
  1357                                  ;------------------------------------------------------------------------------
  1358                                  TRYI:
  1359                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  1360 0000109D 803E[0000]FF            	cmp	byte [Multi_Pass_Id], -1
  1361 000010A2 745F                    	je	Multi_Try_Compat
  1362 000010A4 803E[0000]00            	cmp	byte [Multi_Pass_Id], 0		;AN029; the initial pass for XMAEM.SYS
  1363 000010A9 7503E92201              	je	Multi_Try_XMAEM			;AN029;     and BUFFERS= ... /X pre scan.
  1364 000010AE 803E[0000]02            	cmp	byte [Multi_Pass_Id], 2		;AN026; the second pass for IFS= ?
  1365 000010B3 7503E94301              	je	Multi_Try_J			;AN026;
  1366 000010B8 803E[0000]03            	cmp	byte [Multi_Pass_Id], 3		;AN026; the third pass for INSTALL= ?
  1367 000010BD 7503E97901              	je	Multi_Try_I			;AN026;
  1368 000010C2 803E[0000]04            	cmp	byte [Multi_Pass_Id], 4		; pass for INSTALLLAST= ?
  1369 000010C7 7503E93A01              	je	Multi_Try_I80
  1370 000010CC 80FCE9                  	cmp ah, 'i' | 80h			; INSTALLLASTHIGH= command ?
  1371 000010CF 742B                    	je .install
  1372 000010D1 80FCC9                  	cmp ah, 'I' | 80h			; INSTALLLAST= command ?
  1373 000010D4 7426                    	je .install
  1374 000010D6 80FC36                  	cmp ah, '6'				; INSTALLMIDHIGH= command ?
  1375 000010D9 7421                    	je .install
  1376 000010DB 80FC35                  	cmp ah, '5'				; INSTALLMID= command ?
  1377 000010DE 741C                    	je .install
  1378 000010E0 D006[3000]              	rol byte [installaslast_option], 1
  1379 000010E4 7209                    	jc .notasfirst
  1380 000010E6 D006[2F00]              	rol byte [installasfirst_option], 1
  1381 000010EA 7303E9D701              	jc TryB
  1382                                  .notasfirst:
  1383 000010EF 80FC69                  	cmp ah, 'i'				; INSTALLHIGH= command ?
  1384 000010F2 7408                    	je .install
  1385 000010F4 80FC49                  	cmp	ah, 'I'				;AN018; INSTALL= command?
  1386 000010F7 7403E9CA01              	jne	TryB				;AN018; the first pass is for normal operation.
  1387                                  .install:
  1388 000010FC 830E[0000]01            	or	word [Install_Flag], HAVE_INSTALL_CMD	;AN018; Set the flag
  1389                                  coff equ COFF	; NASM port label
  1390 00001101 EB8C                    	jmp	coff				;AN018; and handles the next command
  1391                                  
  1392                                  Multi_Try_Compat:
  1393 00001103 80FC32                  	cmp ah, '2'
  1394 00001106 7566                    	jne .not
  1395 00001108 1E                      	push ds
  1396 00001109 06                      	push es
  1397 0000110A 56                      	push si
  1398 0000110B 06                      	 push es
  1399 0000110C 1F                      	 pop ds
  1400                                   assume ds:nothing
  1401                                  .loop:
  1402 0000110D E8C50F                  	call skipcomma
  1403 00001110 E82F10                  	call iseol?
  1404 00001113 7453                    	je .done
  1405 00001115 4E                      	dec si
  1406 00001116 0E                      	 push cs
  1407 00001117 07                      	 pop es
  1408                                   assume es:SYSINITGROUP
  1409                                  
  1410 00001118 BB[3400]                	mov bx, compatoptionstable
  1411                                  .loop_table:
  1412 0000111B 31C9                    	xor cx, cx
  1413 0000111D 2E8B5706                	mov dx, [cs:bx + coNoMessage]
  1414 00001121 85D2                    	test dx, dx
  1415 00001123 7405                    	jz @F
  1416 00001125 E8C00F                  	call isstring?
  1417 00001128 741A                    	je .got_table
  1418                                  @@:
  1419 0000112A F7D1                    	not cx
  1420 0000112C 2E8B5708                	mov dx, [cs:bx + coYesMessage]
  1421 00001130 E8B50F                  	call isstring?
  1422 00001133 740F                    	je .got_table
  1423 00001135 83C30A                  	add bx, COMPATOPTION_size
  1424 00001138 81FB[0601]              	cmp bx, compatoptionstable.end
  1425 0000113C 72DD                    	jb .loop_table
  1426                                  
  1427 0000113E 5E                      	pop si
  1428 0000113F 07                      	pop es
  1429 00001140 1F                      	pop ds
  1430                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  1431 00001141 E905FD                  	jmp BADOP
  1432                                  
  1433                                  .got_table:
  1434                                   assume es:SYSINITGROUP, ds:nothing, ss:nothing
  1435 00001144 2E8B7F04                	mov di, word [cs:bx + coAlwaysClear]
  1436 00001148 85FF                    	test di, di
  1437 0000114A 7404                    	jz @F
  1438 0000114C 2EC60500                	mov byte [cs:di], 0
  1439                                  @@:
  1440 00001150 2EF6470201              	testopt [cs:bx + coPriorSegment], 1
  1441 00001155 2E8B1F                  	mov bx, word [cs:bx + coSetOrClear]
  1442 00001158 7505                    	jnz .got_dosdata
  1443 0000115A 2E880F                  	mov byte [cs:bx], cl
  1444 0000115D EBAE                    	jmp .loop
  1445                                  
  1446                                  .got_dosdata:
  1447 0000115F 1E                      	push ds
  1448 00001160 E8(0000)                	call sysinit_get_ds_dosbiodata
  1449                                   assume ds:DOSGROUP
  1450 00001163 880F                    	mov byte [bx], cl
  1451 00001165 1F                      	pop ds
  1452                                   assume ds:nothing
  1453 00001166 EBA5                    	jmp .loop
  1454                                  
  1455                                  .done:
  1456 00001168 5E                      	pop si
  1457 00001169 07                      	pop es
  1458 0000116A 1F                      	pop ds
  1459                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  1460 0000116B E91701                  	jmp Multi_Pass_Filter
  1461                                  
  1462                                  .not:
  1463                                  
  1464                                  Multi_Try_AMISNumber:
  1465 0000116E 80FC37                  	cmp ah, '7'
  1466 00001171 755A                    	jne .not
  1467 00001173 1E                      	push ds
  1468 00001174 06                      	push es
  1469 00001175 56                      	push si
  1470 00001176 06                      	 push es
  1471 00001177 1F                      	 pop ds
  1472                                   assume ds:nothing
  1473 00001178 E8(0000)                	call ldos_getnum
  1474 0000117B 7219                    	jc .error
  1475 0000117D 84F6                    	test dh, dh
  1476 0000117F 7515                    	jnz .error
  1477                                  @@:
  1478 00001181 AC                      	lodsb
  1479 00001182 3C20                    	cmp al, 32
  1480 00001184 74FB                    	je @B
  1481 00001186 3C09                    	cmp al, 9
  1482 00001188 74F7                    	je @B
  1483 0000118A 3C0D                    	cmp al, 13
  1484 0000118C 7420                    	je .done
  1485 0000118E 3C0A                    	cmp al, 10
  1486 00001190 741C                    	je .done
  1487 00001192 3C00                    	cmp al, 0
  1488 00001194 7418                    	je .done
  1489                                  .error:
  1490 00001196 5E                      	pop si
  1491 00001197 07                      	pop es
  1492 00001198 1F                      	pop ds
  1493                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  1494 00001199 E9ADFC                  	jmp BADOP
  1495                                  
  1496                                   extern hexbyte, init2_disp_msg_asciz_cs_dx
  1497                                  .inuse:
  1498 0000119C 0E                      	push cs
  1499 0000119D 07                      	pop es
  1500                                   assume es:SYSINITGROUP
  1501 0000119E BF[9C03]                	mov di, configmsg.amisnumberinuse.num
  1502 000011A1 88E0                    	mov al, ah
  1503 000011A3 E8(0000)                	call hexbyte
  1504 000011A6 BA[7003]                	mov dx, configmsg.amisnumberinuse
  1505 000011A9 E8(0000)                	call init2_disp_msg_asciz_cs_dx
  1506 000011AC EB19                    	jmp .skip
  1507                                  
  1508                                   extern i2D.amisnumber
  1509                                  .done:
  1510                                   assume es:nothing
  1511 000011AE BE[ssss]                	mov si, DOSENTRY
  1512 000011B1 8EDE                    	mov ds, si
  1513                                   assume ds:DOSENTRYGROUP
  1514 000011B3 3816[0000]              	cmp byte [i2D.amisnumber], dl
  1515 000011B7 740E                    	je .skip
  1516 000011B9 88D4                    	mov ah, dl
  1517 000011BB B000                    	mov al, 0
  1518 000011BD CD2D                    	int 2Dh
  1519 000011BF 84C0                    	test al, al
  1520 000011C1 75D9                    	jnz .inuse
  1521 000011C3 8826[0000]              	mov byte [i2D.amisnumber], ah
  1522                                  .skip:
  1523 000011C7 5E                      	pop si
  1524 000011C8 07                      	pop es
  1525 000011C9 1F                      	pop ds
  1526                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  1527 000011CA E9B800                  	jmp Multi_Pass_Filter
  1528                                  
  1529                                  .not:
  1530 000011CD E9B500                  	jmp Multi_Pass_Filter
  1531                                  
  1532                                  Multi_Try_XMAEM:				;AN029;
  1533 000011D0 80FC64                  	cmp ah, 'd'
  1534 000011D3 7405                    	je .devicehigh
  1535 000011D5 80FC44                  	cmp	ah, 'D' 			;AN029; device= command?
  1536 000011D8 7510                    	jne	Multi_Try_Buff			;AN029; no skip it.
  1537                                  .devicehigh:
  1538 000011DA E8B10E                  	call	Chk_XMAEM			;AN029; is it for XMAEM.SYS?
  1539                                  Multi_Pass_FIlter equ Multi_Pass_Filter	; NASM port label
  1540 000011DD 7403E9A300              	jnz	Multi_Pass_FIlter		;AN029; no skip it.
  1541 000011E2 26C644FFFF              	mov	byte ptr [es:si-1], 0FFh	;AN029; mark this command as a Null command for the next pass.
  1542                                  TryDJ equ TRYDJ	; NASM port label
  1543 000011E7 E91902                  	jmp	TryDJ				;AN029; execute this command.
  1544                                  Multi_Try_Buff: 				;AN030;
  1545 000011EA 80FC42                  	cmp	ah, 'B' 			;AN030; Buffers= command?
  1546 000011ED 7403E99300              	jne	Multi_Pass_Filter		;AN030;
  1547 000011F2 C606[D40C]01            	mov	byte [Buffer_Pre_Scan], 1		;AN030; Set Buffer_Pre_Scan
  1548 000011F7 E9CC00                  	jmp	TryB				;AN030; TryB will set P_Buffer_Slash_X to non-zero value.
  1549 000011FA 90                      	nop	; identicalise
  1550                                  
  1551                                  Multi_Try_J:					;AN026;
  1552 000011FB 80FC4A                  	cmp	ah, 'J' 			;AN026; IFS= command?
  1553 000011FE 7403E98200              	jne	Multi_Pass_Filter		;AN026; No. Ignore this.
  1554                                  GotJ equ GOTJ	; NASM port label
  1555 00001203 E9E703                  	jmp	GotJ				;AN026; Handles IFS= command.
  1556                                  
  1557                                  Multi_Try_I80:
  1558 00001206 2ED006[3000]            	rol byte [cs:installaslast_option], 1
  1559 0000120B 7317                    	jnc .notinstall
  1560 0000120D 2EC606[2600]00          	mov byte [cs:devicehighflag], 0
  1561 00001213 80FC69                  	cmp ah, 'i'
  1562 00001216 7507                    	jne @F
  1563 00001218 2EF616[2600]            	not byte [cs:devicehighflag]
  1564 0000121D B449                    	mov ah, 'I'
  1565                                  @@:
  1566 0000121F 80FC49                  	cmp ah, 'I'				; INSTALL= command?
  1567 00001222 7451                    	je ..@run_install
  1568                                  
  1569                                  .notinstall:
  1570 00001224 2EC606[2600]00          	mov byte [cs:devicehighflag], 0
  1571 0000122A 80FCE9                  	cmp ah, 'i' | 80h
  1572 0000122D 7507                    	jne @F
  1573 0000122F 2EF616[2600]            	not byte [cs:devicehighflag]
  1574 00001234 B4C9                    	mov ah, 'I' | 80h
  1575                                  @@:
  1576 00001236 80FCC9                  	cmp	ah, 'I' | 80h			; INSTALLLAST= command?
  1577 00001239 EB3A                    	jmp ..@run_install
  1578                                  
  1579                                  Multi_Try_I:					;AN026;
  1580 0000123B 2EC606[2600]00          	mov byte [cs:devicehighflag], 0
  1581 00001241 80FC36                  	cmp ah, '6'
  1582 00001244 7507                    	jne @F
  1583 00001246 2EF616[2600]            	not byte [cs:devicehighflag]
  1584 0000124B B435                    	mov ah, '5'
  1585                                  @@:
  1586 0000124D 80FC35                  	cmp ah, '5'				; INSTALLMID= command ?
  1587 00001250 7423                    	je ..@run_install
  1588                                  
  1589 00001252 2ED006[3000]            	rol byte [cs:installaslast_option], 1
  1590 00001257 722C                    	jc Multi_Pass_Filter
  1591 00001259 2ED006[2F00]            	rol byte [cs:installasfirst_option], 1
  1592 0000125E 7225                    	jc Multi_Pass_Filter
  1593                                  
  1594 00001260 2EC606[2600]00          	mov byte [cs:devicehighflag], 0
  1595 00001266 80FC69                  	cmp ah, 'i'
  1596 00001269 7507                    	jne @F
  1597 0000126B 2EF616[2600]            	not byte [cs:devicehighflag]
  1598 00001270 B449                    	mov ah, 'I'
  1599                                  @@:
  1600 00001272 80FC49                  	cmp	ah, 'I' 			;AN026; INSTALL= command?
  1601                                  ..@run_install:
  1602 00001275 750E                    	jne	Multi_Pass_Filter		;AN026; No. Ignore this.
  1603 00001277 E8(0000)                	call	Do_Install_Exec 		;Install it.
  1604                                  
  1605                                  extern init2_relocate_device
  1606                                  
  1607 0000127A 06                      	push es
  1608 0000127B B8FFFF                  	mov ax, -1
  1609 0000127E E8(0000)                	call init2_relocate_device
  1610 00001281 07                      	pop es
  1611                                   assume es:nothing
  1612                                  
  1613                                  Coff equ COFF	; NASM port label
  1614 00001282 E90AFE                  	jmp	Coff				;to handle next Install= command.
  1615                                  
  1616                                  Multi_Pass_Filter:				;AN023;AN026;
  1617 00001285 80FC59                  	cmp	ah, 'Y' 			;AN023; Comment?
  1618 00001288 740A                    	je	Multi_Pass_Adjust		;AN023;
  1619 0000128A 80FC5A                  	cmp	ah, 'Z' 			;AN023; Bad command?
  1620 0000128D 7405                    	je	Multi_Pass_Adjust		;AN023;
  1621 0000128F 80FC30                  	cmp	ah, '0' 			;AN023; REM?
  1622 00001292 7508                    	jne	Multi_Pass_Coff 		;AN023; ignore the rest of the commands.
  1623                                  Multi_Pass_Adjust:				;AN023; These commands need to
  1624 00001294 FF0E[0000]              	dec	word [Chrptr]				;AN023;  adjust chrptr, count
  1625 00001298 FF06[0000]              	inc	word [Count]				;AN023;  for NEWLINE proc.
  1626                                  Multi_Pass_Coff:				;AN023;
  1627 0000129C E9F0FD                  	jmp	Coff				;AN018; To handle next INSTALL= commands.
  1628                                  
  1629                                  ;------------------------------------------------------------------------------
  1630                                  
  1631                                  Sysinit_Parse	proc
  1632                                  ;Set up registers for SysParse
  1633                                  ;In)	ES:SI -> command line in  CONFBOT
  1634                                  ;	DI -> offset of the parse control defintion.
  1635                                  ;
  1636                                  ;Out)	Calls SYSPARSE.
  1637                                  ;	Carry will set if Parse error.
  1638                                  ;	*** The caller should check the EOL condition by looking at AX
  1639                                  ;	*** after each call.
  1640                                  ;	*** If no parameters are found, then AX will contain a error code.
  1641                                  ;	*** If the caller needs to look at the SYNOMYM@ of the result,
  1642                                  ;	***  the caller should use CS:@ instead of ES:@.
  1643                                  ;	CX register should be set to 0 at the first time the caller calls this
  1644                                  ;	 procedure.
  1645                                  ;	AX - exit code
  1646                                  ;	BL - TErminated delimeter code
  1647                                  ;	CX - new positional ordinal
  1648                                  ;	SI - set to pase scanned operand
  1649                                  ;	DX - selected result buffer
  1650                                  
  1651 0000129F 06                      	push	es			;save es,ds
  1652 000012A0 1E                      	push	ds
  1653                                  
  1654 000012A1 06                      	push	es
  1655 000012A2 1F                      	pop	ds			;now DS:SI -> command line
  1656                                   assume ds:nothing
  1657 000012A3 0E                      	push	cs
  1658 000012A4 07                      	pop	es			;now ES:DI -> control definition
  1659                                   assume es:SYSINITGROUP
  1660                                  
  1661 000012A5 2E8C1E[0600]            	mov	[cs:Badparm_Seg],ds	;AN007;Save the pointer to the parm
  1662 000012AA 2E8936[0400]            	mov	[cs:Badparm_Off],si	;AN007; we are about to parse for Badparm msg.
  1663 000012AF BA0000                  	mov	dx, 0
  1664 000012B2 E8B0F1                  	call	SysParse
  1665                                  D_P_NO_ERROR equ D_P_No_Error	; NASM port equate
  1666 000012B5 83F800                  	cmp	ax, D_P_NO_ERROR 	;no error
  1667                                  ;	$IF	E,OR
  1668 000012B8 7405                    	JE DD_LL1
  1669 000012BA 83F8FF                  	cmp	ax, D_P_RC_EOL		;or the end of line?
  1670                                  ;	$IF	E
  1671 000012BD 7503                    	JNE DD_IF1
  1672                                  DD_LL1:
  1673 000012BF F8                      		clc
  1674                                  ;	$ELSE
  1675 000012C0 EB01                    	JMP SHORT DD_EN1
  1676                                  DD_IF1:
  1677 000012C2 F9                      		stc
  1678                                  ;	$ENDIF
  1679                                  DD_EN1:
  1680 000012C3 1F                      	pop	ds
  1681 000012C4 07                      	pop	es			;restore es,ds
  1682                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  1683 000012C5 C3                      	ret
  1684                                  Sysinit_Parse	endp
  1685                                  
  1686                                  ;------------------------------------------------------------------------------
  1687                                  ; Buffer command
  1688                                  ;------------------------------------------------------------------------------
  1689                                  ;*******************************************************************************
  1690                                  ;									       *
  1691                                  ; Function: Parse the parameters of buffers= command.			       *
  1692                                  ;									       *
  1693                                  ; Input :								       *
  1694                                  ;	ES:SI -> parameters in command line.				       *
  1695                                  ; Output:								       *
  1696                                  ;	Buffers set							       *
  1697                                  ;	Buffer_Slash_X	flag set if /X option chosen.			       *
  1698                                  ;	H_Buffers set if secondary buffer cache specified.		       *
  1699                                  ;									       *
  1700                                  ; Subroutines to be called:						       *
  1701                                  ;	Sysinit_Parse							       *
  1702                                  ; Logic:								       *
  1703                                  ; {									       *
  1704                                  ;	Set DI points to Buf_Parms;  /*Parse control definition*/	       *
  1705                                  ;	Set DX,CX to 0; 						       *
  1706                                  ;	Reset Buffer_Slash_X;						       *
  1707                                  ;	While (End of command line)					       *
  1708                                  ;	{ Sysinit_parse;						       *
  1709                                  ;	  if (no error) then						       *
  1710                                  ;	       if (Result_Val.D_P_SYNONYM_ptr == Slash_E) then /*Not a switch   *
  1711                                  ;		    Buffer_Slash_X = 1					       *
  1712                                  ;	       else if	 (CX == 1) then 	    /* first positional */     *
  1713                                  ;			  Buffers = Result_Val.D_P_Picked_Val;		       *
  1714                                  ;		    else  H_Buffers = Result_Val.D_P_Picked_Val; 	       *
  1715                                  ;	  else	{Show Error message;Error Exit} 			       *
  1716                                  ;	};								       *
  1717                                  ;	If (Buffer_Slash_X is off & Buffers > 99) then Show_Error;	       *
  1718                                  ; };									       *
  1719                                  ;									       *
  1720                                  ;*******************************************************************************
  1721                                  ;TryB:	 CMP	 AH,'B' 		 ;BUFFER COMMAND?
  1722                                  ;	 JNZ	 TRYC
  1723                                  ;	 invoke  GETNUM
  1724                                  ;	 JZ	 TryBBad		 ; Gotta have at least one
  1725                                  ;	 CMP	 AX,100 		 ; check for max number
  1726                                  ;	 JB	 SaveBuf
  1727                                  ;TryBBad:JMP	 BadOp
  1728                                  ;SaveBuf:
  1729                                  ;	 MOV	 [BUFFERS],AX
  1730                                  ;CoffJ1: JMP	 COFF
  1731                                  
  1732                                  TryB:
  1733                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  1734 000012C6 80FC42                  	CMP	AH,'B'
  1735 000012C9 7570                    	JNZ	TryC
  1736 000012CB C606[D30C]00            	mov	byte [P_Buffer_Slash_X], 0	;AN000;AN025;
  1737 000012D0 BF[8C0C]                	mov	di, offset Buf_Parms	;AN000;
  1738 000012D3 31C9                    	xor	cx, cx			;AN000;
  1739 000012D5 89CA                    	mov	dx, cx			;AN000;
  1740                                  
  1741                                  ;	$SEARCH 			;AN000;
  1742                                  DD_DO4:
  1743 000012D7 E8C5FF                  	    call   Sysinit_Parse	;AN000;
  1744                                  ;	$EXITIF    C			;AN000; Parse Error,
  1745 000012DA 7305                    	JNC DD_IF4
  1746 000012DC E882FB                  	    call   Badparm_p		;AN007;   and Show messages and end the search loop.
  1747                                  ;	$ORELSE 			;AN000;
  1748 000012DF EB57                    	JMP SHORT DD_SR4
  1749                                  DD_IF4:
  1750 000012E1 83F8FF                  	    cmp    ax, D_P_RC_EOL	;AN000; End of Line?
  1751                                  ;	$LEAVE	   E			;AN000;  then jmp to $Endloop for semantic check.
  1752 000012E4 7421                    	JE DD_EN4
  1753                                  D_P_SYNONYM_PTR equ D_P_SYNONYM_Ptr	; NASM port equate
  1754 000012E6 813E[D80C][CC0C]        	    cmp    word [Result_Val + D_P_SYNONYM_PTR], offset Switch_X ;AN000;AN025;
  1755                                  ;	    $IF    E					      ;AN000;
  1756 000012EC 7507                    	    JNE DD_IF8
  1757 000012EE C606[D30C]01            		mov	byte [P_Buffer_Slash_X], 1		      ;AN000;AN025; set the flag
  1758                                  ;	    $ELSE					      ;AN000;
  1759 000012F3 EB10                    	    JMP SHORT DD_EN8
  1760                                  DD_IF8:
  1761                                  D_P_PICKED_VAL equ D_P_Picked_Val	; NASM port equate
  1762 000012F5 A1[DA0C]                		mov	ax, word ptr [Result_Val + D_P_PICKED_VAL] ;AN000;
  1763 000012F8 83F901                  		cmp	cx, 1				      ;AN000;
  1764                                  ;		$IF	E				      ;AN000;
  1765 000012FB 7505                    		JNE DD_IF10
  1766 000012FD A3[CF0C]                		    mov    [P_Buffers], ax		      ;AN000;
  1767                                  ;		$ELSE					      ;AN000;
  1768 00001300 EB03                    		JMP SHORT DD_EN10
  1769                                  DD_IF10:
  1770 00001302 A3[D10C]                		    mov    [P_H_Buffers], ax		      ;AN000;
  1771                                  ;		$ENDIF					      ;AN000;
  1772                                  DD_EN10:
  1773                                  ;	    $ENDIF					      ;AN000;
  1774                                  DD_EN8:
  1775                                  ;	$ENDLOOP			;AN000;
  1776 00001305 EBD0                    	JMP SHORT DD_DO4
  1777                                  DD_EN4:
  1778 00001307 833E[CF0C]63            	    cmp     word [P_Buffers], 99	;AN000;
  1779                                  ;	    $IF     A,AND		;AN000;
  1780 0000130C 7612                    	    JNA DD_IF15
  1781 0000130E 803E[D30C]00            	    cmp     byte [P_Buffer_Slash_X], 0 ;AN000;AN025;
  1782                                  ;	    $IF     E			;AN000;
  1783 00001313 750B                    	    JNE DD_IF15
  1784 00001315 E849FB                  		 call	Badparm_p	;AN000;
  1785 00001318 C706[D10C]0000          		 mov	word [P_H_Buffers], 0	;AN000;
  1786                                  ;	    $ELSE			;AN000;
  1787 0000131E EB18                    	    JMP SHORT DD_EN15
  1788                                  DD_IF15:
  1789 00001320 A1[CF0C]                		 mov	ax, [P_Buffers]	;AN000; We don't have any problem.
  1790                                  Buffers equ BUFFERS	; NASM port label
  1791 00001323 A3[0000]                		 mov	[Buffers], ax	;AN000; Now, let's set it really.
  1792 00001326 A1[D10C]                		 mov	ax, [P_H_Buffers] ;AN000;
  1793 00001329 A3[0000]                		 mov	[H_Buffers], ax	;AN000;
  1794 0000132C A0[D30C]                		 mov	al, [P_Buffer_Slash_X]  ;AN000;AN025;
  1795 0000132F A2[0000]                		 mov	[Buffer_Slash_X], al    ;AN000;AN025;
  1796 00001332 A1[0000]                		 mov	ax, [LineCount]	      ;AN000;
  1797 00001335 A3[0000]                		 mov	[Buffer_LineNum], ax    ;AN000; Save the line number for the future use.
  1798                                  ;	    $ENDIF			;AN000;
  1799                                  DD_EN15:
  1800                                  ;	$ENDSRCH			;AN000;
  1801                                  DD_SR4:
  1802 00001338 E954FD                  	jmp	Coff
  1803                                  
  1804                                  ;------------------------------------------------------------------------------
  1805                                  ; Break command
  1806                                  ;------------------------------------------------------------------------------
  1807                                  ;*******************************************************************************
  1808                                  ;									       *
  1809                                  ; Function: Parse the parameters of Break = command.			       *
  1810                                  ;									       *
  1811                                  ; Input :								       *
  1812                                  ;	ES:SI -> parameters in command line.				       *
  1813                                  ; Output:								       *
  1814                                  ;	Turn the Control-C check on or off.				       *
  1815                                  ;									       *
  1816                                  ; Subroutines to be called:						       *
  1817                                  ;	Sysinit_Parse							       *
  1818                                  ; Logic:								       *
  1819                                  ; {									       *
  1820                                  ;	Set DI to Brk_Parms;						       *
  1821                                  ;	Set DX,CX to 0; 						       *
  1822                                  ;	While (End of command line)					       *
  1823                                  ;	{ Sysinit_Parse;						       *
  1824                                  ;	  if (no error) then						       *
  1825                                  ;	       if (Result_Val.D_P_Item_Tag == 1) then	  /*ON		 */    *
  1826                                  ;		   Set P_Ctrl_Break, on;				       *
  1827                                  ;	       else					  /*OFF 	 */    *
  1828                                  ;		   Set P_Ctrl_Break, off;				       *
  1829                                  ;	  else {Show message;Error_Exit};				       *
  1830                                  ;	};								       *
  1831                                  ;	If (no error) then						       *
  1832                                  ;	   DOS function call to set Ctrl_Break check according to	       *
  1833                                  ; };									       *
  1834                                  ;									       *
  1835                                  ;********************************************************************************
  1836                                  ;TryC:	 CMP	 AH,'C'
  1837                                  ;	 JZ	 GOTC
  1838                                  ;	 JMP	 TRYDJ
  1839                                  ;GOTC:
  1840                                  ;	 CMP	 AL,'O' 		 ;FIRST LETTER OF "ON" or "OFF"
  1841                                  ;	 JNZ	 TryCBad
  1842                                  ;	 CALL	 GETCHR
  1843                                  ;	 JC	 TryCBad
  1844                                  ;	 CMP	 AL,'N' 		 ;SECOND LETTER OF "ON"
  1845                                  ;	 JNZ	 TryCoff
  1846                                  ;	 MOV	 AH,SET_CTRL_C_TRAPPING  ;TURN ON CONTROL-C CHECK
  1847                                  ;	 MOV	 AL,1
  1848                                  ;	 MOV	 DL,AL
  1849                                  ;	 INT	 21H
  1850                                  ;CoffJ2: JMP	 Coff
  1851                                  ;TryCOff:CMP	 AL,'F'
  1852                                  ;	 JNZ	 TryCBad		 ; Check for "OFF"
  1853                                  ;	 CALL	 GetChr
  1854                                  ;	 JC	 TryCBad
  1855                                  ;	 CMP	 AL,'F'
  1856                                  ;	 JZ	 COffJ2
  1857                                  ;TryCBad:JMP	 BadOp
  1858                                  ;
  1859                                  TryC:
  1860 0000133B 80FC43                  	CMP	AH,'C'
  1861                                  TRYM equ TryM	; NASM port label
  1862 0000133E 7538                    	JNZ	TRYM
  1863 00001340 BF[DE0C]                	mov	di, offset Brk_Parms	;AN000;
  1864 00001343 31C9                    	xor	cx,cx			;AN000;
  1865 00001345 89CA                    	mov	dx,cx			;AN000;
  1866                                  ;	$SEARCH 			;AN000;
  1867                                  DD_DO19:
  1868 00001347 E855FF                  	    call   Sysinit_Parse	;AN000;
  1869                                  ;	$EXITIF    C			;AN000; Parse error
  1870 0000134A 7305                    	JNC DD_IF19
  1871 0000134C E812FB                  	    call   Badparm_p		;AN007;  Show message and end the serach loop.
  1872                                  ;	$ORELSE 			;AN000;
  1873 0000134F EB24                    	JMP SHORT DD_SR19
  1874                                  DD_IF19:
  1875 00001351 83F8FF                  	    cmp    ax, D_P_RC_EOL	;AN000; End of Line?
  1876                                  ;	$LEAVE	   E			;AN000;  then end the $ENDLOOP
  1877 00001354 7415                    	JE DD_EN19
  1878                                  D_P_ITEM_TAG equ D_P_Item_Tag	; NASM port equate
  1879 00001356 803E[D70C]01            	    cmp    byte [Result_Val + D_P_ITEM_TAG], 1	 ;AN000;
  1880                                  ;	    $IF    E				 ;AN000;
  1881 0000135B 7507                    	    JNE DD_IF23
  1882 0000135D C606[030D]01            	       mov    byte [P_Ctrl_Break], 1		 ;AN000; Turn it on
  1883                                  ;	    $ELSE				 ;AN000;
  1884 00001362 EB05                    	    JMP SHORT DD_EN23
  1885                                  DD_IF23:
  1886 00001364 C606[030D]00            	       mov    byte [P_Ctrl_Break], 0		 ;AN000; Turn it off
  1887                                  ;	    $ENDIF				 ;AN000;
  1888                                  DD_EN23:
  1889                                  ;	$ENDLOOP			   ;AN000; we actually set the ctrl break
  1890 00001369 EBDC                    	JMP SHORT DD_DO19
  1891                                  DD_EN19:
  1892                                  SET_CTRL_C_TRAPPING equ Set_CTRL_C_Trapping	; NASM port equate
  1893 0000136B B433                    	    mov    ah, SET_CTRL_C_TRAPPING ;AN000; if we don't have any parse error.
  1894 0000136D B001                    	    mov    al, 1		   ;AN000;
  1895 0000136F 8A16[030D]              	    mov    dl, [P_Ctrl_Break]	   ;AN000;
  1896 00001373 CD21                    	    Int    21h			   ;AN000;
  1897                                  ;	$ENDSRCH			   ;AN000;
  1898                                  DD_SR19:
  1899 00001375 E917FD                  	jmp	Coff
  1900                                  
  1901                                  ;------------------------------------------------------------------------------
  1902                                  ; MultiTrack command
  1903                                  ;------------------------------------------------------------------------------
  1904                                  ;*******************************************************************************
  1905                                  ;									       *
  1906                                  ; Function: Parse the parameters of MultiTrack= command.		       *
  1907                                  ;									       *
  1908                                  ; Input :								       *
  1909                                  ;	ES:SI -> parameters in command line.				       *
  1910                                  ; Output:								       *
  1911                                  ;	Turn MulTrk_Flag on or off.					       *
  1912                                  ;									       *
  1913                                  ; Subroutines to be called:						       *
  1914                                  ;	Sysinit_Parse							       *
  1915                                  ; Logic:								       *
  1916                                  ; {									       *
  1917                                  ;	Set DI to Brk_Parms;						       *
  1918                                  ;	Set DX,CX to 0; 						       *
  1919                                  ;	While (End of command line)					       *
  1920                                  ;	{ Sysinit_Parse;						       *
  1921                                  ;	  if (no error) then						       *
  1922                                  ;	       if (Result_Val.D_P_Item_Tag == 1) then	  /*ON		 */    *
  1923                                  ;		   Set P_Mtrk, on;					       *
  1924                                  ;	       else					  /*OFF 	 */    *
  1925                                  ;		   Set P_Mtrk, off;					       *
  1926                                  ;	  else {Show message;Error_Exit};				       *
  1927                                  ;	};								       *
  1928                                  ;	If (no error) then						       *
  1929                                  ;	   DOS function call to set MulTrk_Flag according to P_Mtrk.	       *
  1930                                  ;									       *
  1931                                  ; };									       *
  1932                                  ;									       *
  1933                                  ;********************************************************************************
  1934                                  TryM:					;AN002;
  1935 00001378 80FC4D                  	CMP	AH,'M'			;AN002;
  1936                                  TRYW equ TryW	; NASM port label
  1937 0000137B 7549                    	JNZ	TRYW			;AN002;
  1938                                  Mtrk_Parms equ MTrk_Parms	; NASM port label
  1939 0000137D BF[CD0D]                	mov	di, offset Mtrk_Parms	;AN002;
  1940 00001380 31C9                    	xor	cx,cx			;AN002;
  1941 00001382 89CA                    	mov	dx,cx			;AN002;
  1942                                  ;	$SEARCH 			;AN002;
  1943                                  DD_DO28:
  1944 00001384 E818FF                  	    call   Sysinit_Parse	;AN002;
  1945                                  ;	$EXITIF    C			;AN002; Parse error
  1946 00001387 7305                    	JNC DD_IF28
  1947 00001389 E8D5FA                  	    call   Badparm_p		;AN007;  Show message and end the serach loop.
  1948                                  ;	$ORELSE 			;AN002;
  1949 0000138C EB35                    	JMP SHORT DD_SR28
  1950                                  DD_IF28:
  1951 0000138E 83F8FF                  	    cmp    ax, D_P_RC_EOL	;AN002; End of Line?
  1952                                  ;	$LEAVE	   E			;AN002;  then end the $ENDLOOP
  1953 00001391 7415                    	JE DD_EN28
  1954 00001393 803E[D70C]01            	    cmp    byte [Result_Val + D_P_ITEM_TAG], 1	 ;AN002;
  1955                                  ;	    $IF    E				 ;AN002;
  1956 00001398 7507                    	    JNE DD_IF32
  1957 0000139A C606[E10D]01            	       mov    byte [P_Mtrk], 1 		 ;AN002; Turn it on temporarily.
  1958                                  ;	    $ELSE				 ;AN002;
  1959 0000139F EB05                    	    JMP SHORT DD_EN32
  1960                                  DD_IF32:
  1961 000013A1 C606[E10D]00            	       mov    byte [P_Mtrk], 0 		 ;AN002; Turn it off temporarily.
  1962                                  ;	    $ENDIF				 ;AN002;
  1963                                  DD_EN32:
  1964                                  ;	$ENDLOOP			;AN002; we actually set the MulTrk_Flag here.
  1965 000013A6 EBDC                    	JMP SHORT DD_DO28
  1966                                  DD_EN28:
  1967 000013A8 1E                      	    push   ds			;AN002;
  1968 000013A9 E8(0000)                	call sysinit_get_ds_dosbiodata
  1969                                   assume ds:DOSGROUP
  1970 000013AC 2E803E[E10D]00          	    cmp    byte [cs:P_Mtrk], 0		;AN002;
  1971                                  ;	    $IF    E			;AN002;
  1972 000013B2 7508                    	    JNE DD_IF36
  1973                                  MulTrk_Flag equ MulTrk_flag	; NASM port label
  1974 000013B4 C706[0000]0100          	       mov    word [MulTrk_Flag], MULTRK_OFF2	  ;AN002; 0001h
  1975                                  ;	    $ELSE				  ;AN002;
  1976 000013BA EB06                    	    JMP SHORT DD_EN36
  1977                                  DD_IF36:
  1978 000013BC C706[0000]8000          	       mov    word [MulTrk_Flag], MULTRK_ON	  ;AN002; 8000h
  1979                                  ;	    $ENDIF			;AN002;
  1980                                  DD_EN36:
  1981 000013C2 1F                      	    pop    ds			;AN002;
  1982                                   assume ds:SYSINITGROUP
  1983                                  ;	$ENDSRCH			;AN002;
  1984                                  DD_SR28:
  1985 000013C3 E9C9FC                  	jmp	Coff			;AN002;
  1986                                  
  1987                                  ;------------------------------------------------------------------------------
  1988                                  ; CPSW command
  1989                                  ;------------------------------------------------------------------------------
  1990                                  ;*******************************************************************************
  1991                                  ;									       *
  1992                                  ; Function: Parse the parameters of CPSW= command.			       *
  1993                                  ;									       *
  1994                                  ; Input :								       *
  1995                                  ;	ES:SI -> parameters in command line.				       *
  1996                                  ; Output:								       *
  1997                                  ;	Turn CPSW on or off.						       *
  1998                                  ;									       *
  1999                                  ; Subroutines to be called:						       *
  2000                                  ;	Sysinit_Parse							       *
  2001                                  ; Logic:								       *
  2002                                  ; {									       *
  2003                                  ;	Set DI to CPSW_Parms;						       *
  2004                                  ;	Set DX,CX to 0; 						       *
  2005                                  ;	While (End of command line)					       *
  2006                                  ;	{ Sysinit_Parse;						       *
  2007                                  ;	  if (no error) then						       *
  2008                                  ;	       if (Result_Val.D_P_Item_Tag == 1) then	  /*ON		 */    *
  2009                                  ;		   Set P_CPSW, on;					       *
  2010                                  ;	       else					  /*OFF 	 */    *
  2011                                  ;		   Set P_CPSW, off;					       *
  2012                                  ;	  else {Show message;Error_Exit};				       *
  2013                                  ;	};								       *
  2014                                  ;	If (no error) then						       *
  2015                                  ;	   DOS function call to set CPSW according to P_CPSW.		       *
  2016                                  ; };									       *
  2017                                  ;									       *
  2018                                  ;********************************************************************************
  2019                                  TryW:					;AN002;
  2020 000013C6 80FC57                  	CMP	AH,'W'			;AN002;
  2021 000013C9 7538                    	JNZ	TRYDJ			;AN002;
  2022 000013CB BF[E20D]                	mov	di, offset CPSW_Parms	;AN002;
  2023 000013CE 31C9                    	xor	cx,cx			;AN002;
  2024 000013D0 89CA                    	mov	dx,cx			;AN002;
  2025                                  ;	$SEARCH 			;AN002;
  2026                                  DD_DO40:
  2027 000013D2 E8CAFE                  	    call   Sysinit_Parse	;AN002;
  2028                                  ;	$EXITIF    C			;AN002; Parse error
  2029 000013D5 7305                    	JNC DD_IF40
  2030 000013D7 E887FA                  	    call   Badparm_p		;AN007;  Show message and end the serach loop.
  2031                                  ;	$ORELSE 			;AN002;
  2032 000013DA EB24                    	JMP SHORT DD_SR40
  2033                                  DD_IF40:
  2034 000013DC 83F8FF                  	    cmp    ax, D_P_RC_EOL	;AN002; End of Line?
  2035                                  ;	$LEAVE	   E			;AN002;  then end the $ENDLOOP
  2036 000013DF 7415                    	JE DD_EN40
  2037 000013E1 803E[D70C]01            	    cmp    byte [Result_Val + D_P_ITEM_TAG], 1	 ;AN002;
  2038                                  ;	    $IF    E				 ;AN002;
  2039 000013E6 7507                    	    JNE DD_IF44
  2040 000013E8 C606[F60D]01            	       mov    byte [P_CPSW], 1 		 ;AN002; Turn it on temporarily.
  2041                                  ;	    $ELSE				 ;AN002;
  2042 000013ED EB05                    	    JMP SHORT DD_EN44
  2043                                  DD_IF44:
  2044 000013EF C606[F60D]00            	       mov    byte [P_CPSW], 0 		 ;AN002; Turn it off temporarily.
  2045                                  ;	    $ENDIF				 ;AN002;
  2046                                  DD_EN44:
  2047                                  ;	$ENDLOOP			;AN002; we actually set the MulTrk_Flag here.
  2048 000013F4 EBDC                    	JMP SHORT DD_DO40
  2049                                  DD_EN40:
  2050 000013F6 B433                    	    mov    ah, SET_CTRL_C_TRAPPING ;AN000; The same function number as Ctrl_Break
  2051 000013F8 B004                    	    mov    al, 4		   ;AN000; Set CPSW state function
  2052 000013FA 8A16[F60D]              	    mov    dl, [P_CPSW]		   ;AN000; 0=off, 1=on
  2053 000013FE CD21                    	    Int    21h			   ;AN000;
  2054                                  ;	$ENDSRCH			;AN002;
  2055                                  DD_SR40:
  2056 00001400 E98CFC                  	jmp	Coff			;AN002;
  2057                                  
  2058                                  ;------------------------------------------------------------------------------
  2059                                  ; Device command
  2060                                  ;------------------------------------------------------------------------------
  2061                                  TRYDJ:
  2062 00001403 2EC606[2600]00          	mov byte [cs:devicehighflag], 0
  2063 00001409 80FC34                  	cmp ah, '4'
  2064 0000140C 7507                    	jne @F
  2065 0000140E 2EF616[2600]            	not byte [cs:devicehighflag]
  2066 00001413 B433                    	mov ah, '3'
  2067                                  @@:
  2068 00001415 80FC33                  	cmp ah, '3'			; INSTALLFIRST= command?
  2069 00001418 7503E958FE              	je ..@run_install
  2070                                  
  2071 0000141D 2ED006[3000]            	rol byte [cs:installaslast_option], 1
  2072 00001422 7221                    	jc .notinstall			; INSTALLASLAST overrides INSTALLASFIRST
  2073 00001424 2ED006[2F00]            	rol byte [cs:installasfirst_option], 1
  2074 00001429 731A                    	jnc .notinstall			; not INSTALLASFIRST -->
  2075 0000142B 2EC606[2600]00          	mov byte [cs:devicehighflag], 0
  2076 00001431 80FC69                  	cmp ah, 'i'
  2077 00001434 7507                    	jne @F
  2078 00001436 2EF616[2600]            	not byte [cs:devicehighflag]
  2079 0000143B B449                    	mov ah, 'I'
  2080                                  @@:
  2081 0000143D 80FC49                  	cmp ah, 'I'			; INSTALL= command?
  2082 00001440 7503E930FE              	je ..@run_install
  2083                                  
  2084                                  .notinstall:
  2085                                  
  2086                                  Try_CheckDevice:
  2087 00001445 80FC38                  	cmp ah, '8'
  2088 00001448 7572                    	jne .not
  2089 0000144A 1E                      	push ds
  2090 0000144B 06                      	push es
  2091 0000144C 56                      	push si
  2092 0000144D 06                      	 push es
  2093 0000144E 1F                      	 pop ds
  2094                                   assume ds:nothing
  2095 0000144F 0E                      	 push cs
  2096 00001450 07                      	 pop es
  2097                                   assume es:SYSINITGROUP
  2098                                  
  2099 00001451 BA[FC0C]                	mov dx, On_String
  2100 00001454 E8910C                  	call isstring?
  2101 00001457 741D                    	je .on
  2102 00001459 BA[FF0C]                	mov dx, Off_String
  2103 0000145C E8890C                  	call isstring?
  2104 0000145F 741C                    	je .off
  2105 00001461 31DB                    	xor bx, bx
  2106 00001463 AC                      	lodsb
  2107 00001464 3C2B                    	cmp al, '+'
  2108 00001466 7407                    	je @F
  2109 00001468 43                      	inc bx
  2110 00001469 3C2D                    	cmp al, '-'
  2111 0000146B 7402                    	je @F
  2112 0000146D 43                      	inc bx
  2113 0000146E 4E                      	dec si
  2114                                  @@:
  2115 0000146F E8(0000)                	call ldos_getnum
  2116                                  		; OUT:	NC if success,
  2117                                  		;	 dx = number
  2118                                  		;	 bl = 0 if +, 1 if -, 2 else
  2119 00001472 7223                    	jc .error
  2120 00001474 EB0C                    	jmp @F
  2121                                  
  2122                                  .on:
  2123 00001476 BA0100                  	mov dx, 1
  2124 00001479 B300                    	mov bl, 0
  2125 0000147B EB05                    	jmp @F
  2126                                  
  2127                                  .off:
  2128 0000147D BA0100                  	mov dx, 1
  2129 00001480 B301                    	mov bl, 1
  2130                                  @@:
  2131 00001482 AC                      	lodsb
  2132 00001483 3C20                    	cmp al, 32
  2133 00001485 74FB                    	je @B
  2134 00001487 3C09                    	cmp al, 9
  2135 00001489 74F7                    	je @B
  2136 0000148B 3C0D                    	cmp al, 13
  2137 0000148D 740E                    	je .done
  2138 0000148F 3C0A                    	cmp al, 10
  2139 00001491 740A                    	je .done
  2140 00001493 3C00                    	cmp al, 0
  2141 00001495 7406                    	je .done
  2142                                  .error:
  2143 00001497 5E                      	pop si
  2144 00001498 07                      	pop es
  2145 00001499 1F                      	pop ds
  2146                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  2147 0000149A E9ACF9                  	jmp BADOP
  2148                                  
  2149                                  .done:
  2150                                   assume es:nothing
  2151 0000149D 5E                      	pop si
  2152 0000149E 07                      	pop es
  2153 0000149F 1F                      	pop ds
  2154                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  2155 000014A0 80FB01                  	cmp bl, 1
  2156 000014A3 7208                    	jb .or
  2157 000014A5 740C                    	je .clr
  2158                                  .set:
  2159 000014A7 8916[0C00]              	mov word [checkdeviceflags], dx
  2160 000014AB EB0C                    	jmp .end
  2161                                  .or:
  2162 000014AD 0916[0C00]              	or word [checkdeviceflags], dx
  2163 000014B1 EB06                    	jmp .end
  2164                                  .clr:
  2165 000014B3 F7D2                    	not dx
  2166 000014B5 2116[0C00]              	and word [checkdeviceflags], dx
  2167                                  .end:
  2168 000014B9 E9D3FB                  	jmp COFF
  2169                                  .not:
  2170                                  
  2171                                  Try_EarlyLastdrive:
  2172 000014BC 80FC39                  	cmp ah, '9'
  2173 000014BF 7403E90A01              	jne .not
  2174 000014C4 1E                      	push ds
  2175 000014C5 06                      	push es
  2176 000014C6 56                      	push si
  2177 000014C7 06                      	 push es
  2178 000014C8 1F                      	 pop ds
  2179                                   assume ds:nothing
  2180 000014C9 0E                      	 push cs
  2181 000014CA 07                      	 pop es
  2182                                   assume es:SYSINITGROUP
  2183 000014CB AD                      	lodsw
  2184 000014CC 80FC3A                  	cmp ah, ':'
  2185 000014CF 7419                    	je .trydrive
  2186 000014D1 80FC20                  	cmp ah, 32
  2187 000014D4 7414                    	je .trydrive
  2188 000014D6 80FC09                  	cmp ah, 9
  2189 000014D9 740F                    	je .trydrive
  2190 000014DB 80FC0D                  	cmp ah, 13
  2191 000014DE 740A                    	je .trydrive
  2192 000014E0 80FC0A                  	cmp ah, 10
  2193 000014E3 7405                    	je .trydrive
  2194 000014E5 80FC00                  	cmp ah, 0
  2195 000014E8 7518                    	jne .number
  2196                                  .trydrive:
  2197 000014EA E84A0C                  	call capitalise
  2198 000014ED 3C41                    	cmp al, 'A'
  2199 000014EF 7211                    	jb .number
  2200 000014F1 3C60                    	cmp al, '`'		; CDS limit
  2201 000014F3 770D                    	ja .number
  2202 000014F5 2C40                    	sub al, 'A' - 1
  2203 000014F7 B302                    	mov bl, 2
  2204 000014F9 80FC3A                  	cmp ah, ':'
  2205 000014FC 7401                    	je @F
  2206 000014FE 4E                      	dec si
  2207                                  @@:
  2208 000014FF 92                      	xchg dx, ax
  2209 00001500 EB18                    	jmp .got
  2210                                  
  2211                                  .number:
  2212 00001502 4E                      	dec si
  2213 00001503 31DB                    	xor bx, bx
  2214 00001505 3C2B                    	cmp al, '+'
  2215 00001507 7407                    	je @F
  2216 00001509 43                      	inc bx
  2217 0000150A 3C2D                    	cmp al, '-'
  2218 0000150C 7402                    	je @F
  2219 0000150E 43                      	inc bx
  2220 0000150F 4E                      	dec si
  2221                                  @@:
  2222 00001510 E8(0000)                	call ldos_getnum
  2223                                  		; OUT:	NC if success,
  2224                                  		;	 dx = number
  2225                                  		;	 bl = 0 if +, 1 if -, 2 else
  2226 00001513 721A                    	jc .error
  2227 00001515 83FA20                  	cmp dx, 32		; CDS limit
  2228 00001518 7715                    	ja .error
  2229                                  .got:
  2230                                  @@:
  2231 0000151A AC                      	lodsb
  2232 0000151B 3C20                    	cmp al, 32
  2233 0000151D 74FB                    	je @B
  2234 0000151F 3C09                    	cmp al, 9
  2235 00001521 74F7                    	je @B
  2236 00001523 3C0D                    	cmp al, 13
  2237 00001525 740E                    	je .done
  2238 00001527 3C0A                    	cmp al, 10
  2239 00001529 740A                    	je .done
  2240 0000152B 3C00                    	cmp al, 0
  2241 0000152D 7406                    	je .done
  2242                                  .error:
  2243 0000152F 5E                      	pop si
  2244 00001530 07                      	pop es
  2245 00001531 1F                      	pop ds
  2246                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  2247 00001532 E914F9                  	jmp BADOP
  2248                                  
  2249                                  .done:
  2250                                   assume es:nothing
  2251 00001535 36C43E[0000]            	LES	DI,[ss:DOSINFO]
  2252                                   assume es:DOSGROUP
  2253 0000153A 268A4521                	mov al, [es:di + SYSI_NCDS]
  2254 0000153E 88C4                    	mov ah, al
  2255                                  
  2256 00001540 80FB01                  	cmp bl, 1
  2257 00001543 7206                    	jb .plus
  2258 00001545 7411                    	je .minus
  2259                                  .set:
  2260 00001547 88D4                    	mov ah, dl
  2261 00001549 EB13                    	jmp .common
  2262                                  
  2263                                  .plus:
  2264 0000154B 00D4                    	add ah, dl
  2265 0000154D 7205                    	jc .max
  2266 0000154F 80FC20                  	cmp ah, 32		; CDS limit
  2267 00001552 760A                    	jna .common
  2268                                  .max:
  2269 00001554 B420                    	mov ah, 32		; CDS limit
  2270 00001556 EB06                    	jmp .common
  2271                                  
  2272                                  .minus:
  2273 00001558 28D4                    	sub ah, dl
  2274 0000155A 7302                    	jnc .common
  2275                                  .min:
  2276 0000155C B400                    	mov ah, 0
  2277                                  .common:
  2278                                    extern cds_last_used, alloc_initcds, free_temp_cds, tempcds_block
  2279                                    extern FOOSTRNG, FOOSET
  2280 0000155E 92                      	xchg dx, ax		; dh = desired
  2281 0000155F E8(0000)                	call cds_last_used
  2282 00001562 FEC7                    	inc bh			; = minimum
  2283 00001564 38F7                    	cmp bh, dh
  2284 00001566 7302                    	jae @F
  2285 00001568 88F7                    	mov bh, dh		; max(bh, dh)
  2286                                  @@:
  2287 0000156A 36C43E[0000]            	LES	DI,[ss:DOSINFO]
  2288                                   assume es:DOSGROUP
  2289 0000156F 268A5D21                	mov bl, [es:di + SYSI_NCDS]
  2290 00001573 38DF                    	cmp bh, bl
  2291 00001575 7302                    	jnb @F
  2292 00001577 88FB                    	mov bl, bh			; how many to preserve: min(bl, bh)
  2293                                  @@:
  2294 00001579 B058                    	mov al, curdir_list_struc_size
  2295 0000157B F6E3                    	mul bl
  2296 0000157D 53                      	push bx				; stack = how many entries in old CDS
  2297 0000157E 50                      	push ax				; stack = how much to preserve in bytes
  2298                                  
  2299 0000157F 31C9                    	xor cx, cx
  2300 00001581 88F9                    	mov cl, bh
  2301 00001583 26884D21                	mov byte [es:di + SYSI_NCDS], cl	; update amount CDS entries
  2302 00001587 B058                    	mov al, curdir_list_struc_size
  2303 00001589 F6E1                    	mul cl				; ax = how much to allocate in bytes
  2304                                  
  2305 0000158B 51                      	push cx
  2306 0000158C 06                      	push es
  2307 0000158D 57                      	push di
  2308 0000158E BE[0000]                	mov si, alloc_initcds
  2309 00001591 E8(0000)                	call allocate_temporary_block
  2310                                   assume es:nothing
  2311 00001594 5E                      	pop si
  2312 00001595 1F                      	pop ds				; -> DOSINFO
  2313                                   assume ds:DOSGROUP
  2314 00001596 5B                      	pop bx				; bl = how many entries in new CDS
  2315 00001597 59                      	pop cx				; = how much to preserve in bytes
  2316                                  
  2317 00001598 1E                      	push ds
  2318 00001599 56                      	push si
  2319 0000159A C57416                  	lds si, [si + SYSI_CDS]		; -> old CDS
  2320                                   assume ds:CDS
  2321 0000159D 89FA                    	mov dx, di			; es:dx -> new CDS
  2322 0000159F F3A4                    	rep movsb			; preserve old
  2323 000015A1 5E                      	pop si
  2324 000015A2 1F                      	pop ds
  2325                                   assume ds:DOSGROUP
  2326 000015A3 E8(0000)                	call free_temp_cds		; free old
  2327 000015A6 2E8C06[0000]            	mov word [cs:tempcds_block], es	; => temp CDS
  2328 000015AB 58                      	pop ax				; al = how many entries in old CDS
  2329 000015AC 8C4418                  	MOV	WORD PTR [si + SYSI_CDS + 2], es
  2330 000015AF 895416                  	mov	WORD PTR [si + SYSI_CDS], dx
  2331                                  					; -> new temp CDS
  2332 000015B2 28C3                    	sub bl, al			; = additional amount
  2333 000015B4 7702                    	ja @F
  2334 000015B6 31DB                    	xor bx, bx			; just run for the init: verbose line,
  2335                                  					;  do not add any drives
  2336                                  @@:
  2337 000015B8 0441                    	add al, "A"			; prior amount + "A"
  2338 000015BA 36A2[0000]              	mov byte [ss:FOOSTRNG], al	; first letter of additional table
  2339                                  
  2340 000015BE 31C9                    	xor cx, cx
  2341 000015C0 88D9                    	mov cl, bl			; cx = additional amount of CDS entries
  2342 000015C2 BEFFFF                  	mov si, -1			; no DPBs for additional table
  2343 000015C5 E8(0000)                	call FOOSET			; init additional table
  2344 000015C8 5E                      	pop si
  2345 000015C9 07                      	pop es
  2346 000015CA 1F                      	pop ds
  2347                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  2348 000015CB E9C1FA                  	jmp COFF
  2349                                  
  2350                                  .not:
  2351                                  Try_Device:
  2352                                  	debugnumber 'DJ'
  2353 000015CE 2EC606[2600]00          	mov byte [cs:devicehighflag], 0
  2354 000015D4 2E8126[0000]FE00        	and	word [cs:IFS_Flag], NOT_IFS	;AN000; Reset the flag
  2355 000015DB 80FC64                  	cmp ah, 'd'
  2356 000015DE 741D                    	je GOTDJ_devicehigh
  2357 000015E0 80FC44                  	CMP	AH,'D'
  2358 000015E3 741D                    	JZ	GOTDJ
  2359 000015E5 80FC4A                  	CMP	AH,'J'
  2360 000015E8 7403                    	jz	GOTJ
  2361 000015EA E9FA05                  	JMP	TRYQ
  2362                                  GOTJ:					;AN000; IFS= command.
  2363 000015ED 2E830E[0000]01          	or	word [cs:IFS_Flag], IS_IFS	;AN000; set the flag.
  2364 000015F3 803E[0000]02            	cmp	byte [Multi_Pass_Id], 2	;second pass?
  2365 000015F8 7408                    	je	GOTDJ			;then proceed
  2366 000015FA E992FA                  	jmp	Coff			;else ignore this until the second pass.
  2367                                  
  2368                                  ;	 jmp	 GOTDJ_Cont
  2369                                  ;GOTD:
  2370                                  ;	 test	 [cs:IFS_Flag], HAD_IFS  ;AN000; Cannot have DEVICE= command after IFS= command.
  2371                                  ;	 jz	 GOTDJ_Cont		 ;AN000;
  2372                                  ;	 call	 Incorrect_Order	 ;AN000; Display "Incorrect order ..." msg.
  2373                                  ;	 jmp	 COFF			 ;AN000;
  2374                                  
  2375                                  GOTDJ_devicehigh:
  2376 000015FD 2EF616[2600]            	not byte [cs:devicehighflag]
  2377                                  GOTDJ:
  2378                                  	debugnumber 'gt'
  2379 00001602 8CCB                    	MOV	BX,CS			;DEVICE= or IFS= command.
  2380 00001604 8EDB                    	MOV	DS,BX
  2381                                   assume ds:SYSINITGROUP
  2382                                  
  2383 00001606 8936[0000]              	MOV	WORD PTR [BPB_ADDR],SI
  2384 0000160A 8C06[0200]              	MOV	WORD PTR [BPB_ADDR+2],ES
  2385                                  
  2386                                  ;J.K. In case it is for IFS=, then set the parameter pointer.
  2387                                  ifs_rh equ IFS_RH	; NASM port label
  2388 0000160E 8936[1600]              	mov	word ptr [ifs_rh + IFSR_PARMS@], SI   ;AN000; for IFS
  2389 00001612 8C06[1800]              	mov	word ptr [ifs_rh + IFSR_PARMS@+2], ES ;AN000;
  2390                                  
  2391                                  ; We are going to open the cdevice driver and size it as is done
  2392                                  ;  in LDFIL. The reason we must do this is that EXEC does NO checking
  2393                                  ;  for us. We must make sure there is room to load the device without
  2394                                  ;  trashing SYSINIT. This code is not
  2395                                  ;  perfect (for instance .EXE device drivers are possible) because
  2396                                  ;  it does its sizing based on the assumption that the file being loaded
  2397                                  ;  is a .COM file. It is close enough to correctness to be usable.
  2398                                  
  2399 00001616 06                      	PUSH	ES
  2400 00001617 1F                      	POP	DS
  2401                                  ASSUME	DS:NOTHING
  2402 00001618 89F2                    	MOV	DX,SI			;DS:DX POINTS TO FILE NAME
  2403                                  
  2404 0000161A B8003D                  	MOV	AX,OPEN << 8		;OPEN THE FILE
  2405 0000161D F9                      	STC				;IN CASE OF INT 24
  2406 0000161E CD21                    	INT	21H
  2407 00001620 7303E9B201              	JC	BADLDRESET
  2408 00001625 89C3                    	MOV	BX,AX			;Handle in BX
  2409 00001627 1E                      	push ds
  2410 00001628 52                      	PUSH	DX			; Save pointer to name
  2411                                  
  2412 00001629 89E7                    	mov di, sp			; -> original stack
  2413 0000162B 16                      	push ss
  2414 0000162C 1F                      	pop ds
  2415 0000162D B91A00                  	mov cx, exeOverlayNum
  2416 00001630 29CC                    	sub sp, cx			; -> space for MZ header
  2417 00001632 89E2                    	mov dx, sp			; -> buffer
  2418 00001634 B43F                    	mov ah, 3Fh
  2419 00001636 CD21                    	int 21h				; read header
  2420 00001638 7248                    	jc .closebad
  2421 0000163A 39C8                    	cmp ax, cx			; full header read ?
  2422 0000163C 7519                    	jne .flat			; no, must be a flat file -->
  2423 0000163E 58                      	pop ax				; exeSignature
  2424 0000163F 3D4D5A                  	cmp ax, "MZ"			; sign match ?
  2425 00001642 7405                    	je .mz
  2426 00001644 3D5A4D                  	cmp ax, "ZM"
  2427 00001647 750E                    	jne .flat			; no -->
  2428                                  .mz:
  2429 00001649 58                      	pop ax				; exeExtraBytes
  2430 0000164A 58                      	pop ax				; exePages
  2431 0000164B B105                    	mov cl, 9 - 4			; log2(512) - log2(16)
  2432 0000164D D3E0                    	shl ax, cl			; (some sources report this is mod 1 MiB)
  2433 0000164F 5A                      	pop dx				; exeRelocItems
  2434 00001650 5A                      	pop dx				; exeHeaderSize
  2435 00001651 29D0                    	sub ax, dx			; image size in paragraphs
  2436 00001653 762D                    	jbe .closebad
  2437 00001655 EB37                    	jmp .got
  2438                                  
  2439                                  .flat:
  2440 00001657 31C9                    	XOR	CX,CX
  2441 00001659 31D2                    	XOR	DX,DX
  2442 0000165B B80242                  	MOV	AX,(LSEEK << 8) | 2	; seek to EOF
  2443 0000165E F9                      	STC				;IN CASE OF INT 24
  2444 0000165F CD21                    	INT	21H			; Get file size in DX:AX
  2445 00001661 721F                    	jc .closebad
  2446                                  
  2447                                      ; Convert size in DX:AX to para in AX
  2448 00001663 83C00F                  	ADD	AX,15			; Round up size for conversion to para
  2449 00001666 83D200                  	ADC	DX,0
  2450 00001669 7212                    	jc .err				; rounded up is 4 GiB ? -->
  2451 0000166B B90400                  	mov cx, 4
  2452                                  @@:
  2453 0000166E D1EA                    	shr dx, 1
  2454 00001670 D1D8                    	rcr ax, 1
  2455 00001672 E2FA                    	loop @B
  2456 00001674 85D2                    	test dx, dx			; >= 1 MiB ?
  2457 00001676 7505                    	jnz .err			; -->
  2458 00001678 83F8F0                  	cmp ax, -16			; allow for some increment
  2459 0000167B 7211                    	jb .got				; if fine -->
  2460                                  .err:
  2461 0000167D 89FC                    	mov sp, di
  2462 0000167F E92C01                  	jmp MEM_ERRJY
  2463                                  
  2464                                  .closebad:
  2465 00001682 89FC                    	mov sp, di
  2466 00001684 B43E                    	MOV	AH,CLOSE		; Close file
  2467 00001686 CD21                    	INT	21H
  2468 00001688 5A                      	POP	DX			; Clean stack
  2469 00001689 5A                      	pop dx				; discard ds
  2470 0000168A F9                      	STC				; Close may clear carry
  2471 0000168B E94901                  	JMP	BADLDRESET
  2472                                  .got:
  2473 0000168E 89FC                    	mov sp, di
  2474 00001690 0E                      	push cs
  2475 00001691 1F                      	pop ds
  2476                                   assume ds:SYSINITGROUP
  2477 00001692 A3[0E00]                	mov word [devicefilesizepara], ax
  2478                                  
  2479                                  retry_devicehigh_oom:
  2480 00001695 8B16[0E00]              	mov dx, word [devicefilesizepara]
  2481                                  ;	rol byte [devicehighflag], 1
  2482                                  ;	jnc .low1
  2483                                  .high1:
  2484                                  
  2485 00001699 53                      	push bx				; preserve handle
  2486 0000169A B80058                  	mov ax, 5800h
  2487 0000169D CD21                    	int 21h
  2488 0000169F 50                      	push ax
  2489 000016A0 B80158                  	mov ax, 5801h
  2490 000016A3 BB4001                  	mov bx, 0140h			; ignore UMB link, UMA only, first fit
  2491 000016A6 D006[2600]              	rol byte [devicehighflag], 1
  2492 000016AA 7203                    	jc @F
  2493 000016AC BB1001                  	mov bx, 0110h			; ignore UMB link, LMA only, first fit
  2494                                  @@:
  2495 000016AF CD21                    	int 21h
  2496                                  
  2497 000016B1 89D3                    	mov bx, dx
  2498 000016B3 43                      	inc bx				; space for SD sub-MCB
  2499 000016B4 B448                    	mov ah, 48h
  2500 000016B6 CD21                    	int 21h
  2501 000016B8 7316                    	jnc @F
  2502                                  
  2503 000016BA 5B                      	pop bx
  2504 000016BB B80158                  	mov ax, 5801h
  2505 000016BE CD21                    	int 21h
  2506 000016C0 5B                      	pop bx				; handle
  2507                                  
  2508 000016C1 D006[2600]              	rol byte [devicehighflag], 1	; already tried LMA ?
  2509 000016C5 7306                    	jnc .oom			; yes -->
  2510 000016C7 F616[2600]              	not byte [devicehighflag]	; toggle back to try LMA
  2511 000016CB EBC8                    	jmp retry_devicehigh_oom
  2512                                  
  2513                                  .oom:
  2514 000016CD E9(0000)                	jmp MEM_ERR
  2515                                  
  2516                                  @@:
  2517 000016D0 89C2                    	mov dx, ax
  2518 000016D2 5B                      	pop bx
  2519 000016D3 B80158                  	mov ax, 5801h
  2520 000016D6 CD21                    	int 21h
  2521                                  
  2522 000016D8 06                      	push es
  2523 000016D9 56                      	push si
  2524                                  
  2525 000016DA 8EC2                    	mov es, dx
  2526                                   assume es:nothing
  2527 000016DC B44A                    	mov ah, 4Ah
  2528 000016DE BBFFFF                  	mov bx, -1
  2529 000016E1 CD21                    	int 21h			; grow to largest size
  2530                                  
  2531                                  		; recreate stack frame of init2_relocate_device
  2532                                  	lframe 0
  2533                                  	lvar word, umb_first_umcb
  2534                                  	lvar word, umb_last_umcb
  2535                                  	lvar word, last_mcb
  2536 000016E3 5589E58D66FA            	lenter
  2537                                  	lvar word, flags
  2538 000016E9 50                      	 push ax
  2539                                  	lvar word, first_mcb
  2540 000016EA B452                    	mov ah, 52h
  2541 000016EC CD21                    	int 21h
  2542                                   assume es:nothing
  2543 000016EE 26FF77FE                	 push word [es:bx - 2]
  2544                                  	lvar word, first_umcb
  2545 000016F2 B86112                  	mov ax, 1261h
  2546 000016F5 CD2F                    	int 2Fh
  2547 000016F7 50                      	 push ax
  2548                                  
  2549 000016F8 4A                      	dec dx
  2550                                  
  2551 000016F9 31F6                    	xor si, si
  2552 000016FB 56                      	push si			; loop detection counter word
  2553 000016FC BE2000                  	mov si, 20h		; "LMA then UMA" (+ first fit)
  2554 000016FF 56                      	push si
  2555 00001700 89E6                    	mov si, sp		; ss:si -> area flags and strategy word
  2556                                  
  2557 00001702 31C0                    	xor ax, ax		; = 0 = get first UMCB
  2558                                  .search_umb:
  2559 00001704 8946FA                  	mov word [bp + ?last_mcb], ax
  2560 00001707 E8(0000)                	call init2_SNextMCB
  2561 0000170A 722A                    	jc .no_sd_merge		; chain corrupted
  2562 0000170C 7528                    	jnz .no_sd_merge	; end reached
  2563                                  
  2564 0000170E 39D0                    	cmp ax, dx
  2565 00001710 75F2                    	jne .search_umb
  2566                                  
  2567 00001712 8B46FA                  	mov ax, word [bp + ?last_mcb]
  2568 00001715 8ED8                    	mov ds, ax
  2569                                   assume ds:MCB
  2570 00001717 837D0108                	cmp word [di + mcbOwner], 8
  2571 0000171B 7519                    	jne .no_sd_merge
  2572 0000171D 817D085344              	cmp word [di + mcbName], "SD"
  2573 00001722 7512                    	jne .no_sd_merge
  2574 00001724 807D0A00                	cmp byte [di + mcbName + 2], 0
  2575 00001728 750C                    	jne .no_sd_merge
  2576                                  
  2577                                  		; ax => SD MCB immediately before ours
  2578                                  .sd_merge:
  2579 0000172A 8EC2                    	mov es, dx		; => new MCB (to become sub MCB)
  2580                                   assume es:MCB
  2581 0000172C 268B5D03                	mov bx, [es:di + mcbSize]
  2582                                  				; get size
  2583 00001730 43                      	inc bx			; count MCB itself
  2584 00001731 015D03                  	add word [di + mcbSize], bx
  2585                                  				; grow SD MCB
  2586 00001734 EB24                    	jmp .merge_common
  2587                                  
  2588                                  .no_sd_merge:
  2589 00001736 8EDA                    	mov ds, dx		; => new MCB (to become SD MCB)
  2590                                   assume ds:MCB
  2591 00001738 89D0                    	mov ax, dx
  2592 0000173A C745010800              	mov word [di + mcbOwner], 8
  2593 0000173F C745085344              	mov word [di + mcbName], "SD"
  2594 00001744 897D0A                  	mov word [di + mcbName + 2], di
  2595 00001747 42                      	inc dx
  2596 00001748 8EC2                    	mov es, dx		; => new sub MCB
  2597                                   assume es:nothing
  2598 0000174A 8B5D03                  	mov bx, [di + mcbSize]
  2599 0000174D 4B                      	dec bx
  2600 0000174E 26895D03                	mov word [es:di + mcbSize], bx
  2601 00001752 26897D05                	mov word [es:di + mcbReserved], di
  2602 00001756 26897D07                	mov word [es:di + mcbReserved + 2], di
  2603                                  				; clear reserved fields
  2604                                  .merge_common:
  2605                                  		; ax => SD MCB, we are at the tail end
  2606                                  		; es => sub-MCB we're creating
  2607                                  		; di = 0
  2608                                  		; dx = es
  2609 0000175A 26C60544                	mov byte [es:di + mcbSignature], DEVMARK_DEVICE
  2610                                  				; set devmark
  2611 0000175E 42                      	inc dx
  2612 0000175F 26895501                	mov word [es:di + mcbOwner], dx
  2613                                  				; set owner
  2614 00001763 26897D08                	mov word [es:di + mcbName], di
  2615 00001767 26897D0A                	mov word [es:di + mcbName + 2], di
  2616 0000176B 26897D0C                	mov word [es:di + mcbName + 4], di
  2617 0000176F 26897D0E                	mov word [es:di + mcbName + 6], di
  2618                                  				; clear name for a bit
  2619 00001773 268B5D03                	mov bx, word [es:di + mcbSize]
  2620                                  				; bx = size
  2621                                  		; ax => SD MCB, we are at the tail end
  2622                                  		; es => sub-MCB we've created
  2623                                  		; di = 0
  2624                                  		; dx => data block to use
  2625                                  		; bx = size of sub-MCB
  2626                                  
  2627 00001777 89EC5D                  	lleave
  2628 0000177A 0E                      	push cs
  2629 0000177B 1F                      	pop ds
  2630                                   assume ds:SYSINITGROUP, es:nothing
  2631 0000177C A3[1000]                	mov word [devicehighsd], ax
  2632 0000177F 8916[1200]              	mov word [devicehighdata], dx
  2633 00001783 891E[1400]              	mov word [devicehighsize], bx
  2634 00001787 01D3                    	add bx, dx
  2635 00001789 891E[1600]              	mov word [devicehighafter], bx
  2636                                  
  2637 0000178D 06                      	push es
  2638 0000178E 1F                      	pop ds				; ds => sub-MCB
  2639                                   assume ds:nothing
  2640                                  
  2641 0000178F 5E                      	pop si
  2642 00001790 07                      	pop es				; es:si -> filename
  2643                                   assume es:nothing
  2644                                  
  2645 00001791 06                      	push es
  2646 00001792 56                      	push si
  2647 00001793 E8B908                  	call get_device_mcb_name
  2648 00001796 5E                      	pop si
  2649 00001797 07                      	pop es
  2650                                   assume es:nothing
  2651                                  
  2652 00001798 92                      	xchg ax, dx			; ax => memory block
  2653 00001799 5B                      	pop bx				; handle
  2654 0000179A EB00                    	jmp .common1
  2655                                  
  2656                                  %if 0
  2657                                  .low1:
  2658                                  	CALL	ROUND
  2659                                  ;J.K. Set up the DEVMARK entries here for MEM command.
  2660                                  ;J.K. Only the DEVMARK_ID and DEVMARK_FILENAME will be set.
  2661                                  ;J.K. DEVMARK_SIZE should be set after a successful process of this file.
  2662                                  	call	Set_DevMark		;AN004;
  2663                                  	inc	word [MEMHI] 		;AN004;Size of DEVMARK is a paragraph!!
  2664                                  					;Don't forget decrease MEMHI
  2665                                  					; with an unsuccessful process of this file!!.
  2666                                  	MOV	AX,[MEMHI]
  2667                                  %endif
  2668                                  
  2669                                  .common1:
  2670 0000179C 0E                      	push cs
  2671 0000179D 1F                      	pop ds
  2672                                   assume ds:SYSINITGROUP, es:nothing
  2673 0000179E 8326[0000]00            	and	WORD PTR [ENTRY_POINT], 0
  2674 000017A3 A3[0200]                	MOV	WORD PTR [ENTRY_POINT+2],AX	;SET ENTRY POINT
  2675                                  
  2676 000017A6 A3[0000]                	MOV	[PRMBLK],AX		;SET LOAD OFFSET
  2677 000017A9 A3[0200]                	MOV	[PRMBLK + 2],AX		;SET LOAD OFFSET
  2678                                  
  2679                                  %if 1
  2680 000017AC EB03                    	jmp OKLDX
  2681                                  %else
  2682                                  	rol byte [devicehighflag], 1
  2683                                  	jc OKLDX			; already know for devicehigh -->
  2684                                  	MOV	CX,ax			; CX:0 is xaddr
  2685                                  	ADD	CX, [devicefilesizepara]; New device will take up to here
  2686                                  	JC	MEM_ERRJY		; WOW!!!!
  2687                                  	CMP	CX, [ALLOCLIM]
  2688                                  	JB	OKLDX
  2689                                  %endif
  2690                                  
  2691                                  MEM_ERRJY:
  2692 000017AE E9(0000)                	JMP	MEM_ERR
  2693                                  
  2694                                  OKLDX:
  2695 000017B1 5A                      	POP	DX			; Recover name pointer
  2696 000017B2 1F                      	pop ds
  2697                                   assume ds:nothing
  2698 000017B3 B43E                    	MOV	AH,CLOSE		; Close file
  2699 000017B5 CD21                    	INT	21H
  2700 000017B7 0E                      	push cs
  2701 000017B8 07                      	pop es
  2702                                   assume es:SYSINITGROUP
  2703 000017B9 BB[0000]                	MOV	BX,OFFSET PRMBLK	;ES:BX POINTS TO PARAMETERS
  2704 000017BC B003                    	MOV	AL,3
  2705                                  EXEC equ Exec	; NASM port equate
  2706 000017BE B44B                    	MOV	AH,EXEC
  2707 000017C0 F9                      	STC				;IN CASE OF INT 24
  2708 000017C1 CD21                    	INT	21H			;LOAD IN THE DEVICE DRIVER
  2709 000017C3 2EC706[1A00]FFFF        	mov word [cs:devicelastdpb], -1
  2710 000017CA 2EC706[1E00]FFFF        	mov word [cs:devicefirstnewdpb], -1
  2711 000017D1 2EC606[2200]00          	mov byte [cs:deviceamountnew], 0
  2712                                  
  2713                                  BADLDRESET:
  2714 000017D7 1E                      	PUSH	DS
  2715 000017D8 07                      	POP	ES			;ES:SI BACK TO CONFIG.SYS
  2716                                   assume es:nothing
  2717 000017D9 0E                      	PUSH	CS
  2718 000017DA 1F                      	POP	DS			;DS BACK TO SYSINIT
  2719                                   ASSUME DS:SYSINITGROUP
  2720 000017DB 731A                    	JNC	GOODLD_first
  2721                                  BADBRK:
  2722                                   assume ds:nothing, es:nothing, ss:nothing
  2723 000017DD 2EF606[0300]01          	test	byte [cs:SetDevMarkFlag],SETBRKDONE ;AN004;If already Set_Break is done,
  2724 000017E3 7503                    	jnz	Skip0_ResetMEMHI	;AN004; then do not
  2725                                  	; dec	word [cs:MEMHI]		   ;AN004;Adjust MEMHI by a paragrah of DEVMARK.
  2726 000017E5 E87D01                  	call release_device_memory
  2727                                  Skip0_ResetMEMHI:
  2728 000017E8 26803C0D                	cmp	byte ptr [es:si], CR	;file name is CR? (Somebody entered "device=" without filename)
  2729 000017EC 7503                    	jne	BADBRK_1
  2730 000017EE E958F6                  	jmp	BADOP			;show "Unrecognized command in CONFIG.SYS"
  2731                                  BADBRK_1:
  2732 000017F1 E8(0000)                	invoke	BADLOAD
  2733 000017F4 E998F8                  	JMP	COFF
  2734                                  
  2735                                  GOODLD_first:
  2736 000017F7 2EF606[0C00]01          	testopt [cs:checkdeviceflags], 1
  2737 000017FD 7431                    	jz .nocheck
  2738 000017FF 1E                      	push ds
  2739 00001800 2E8E1E[0200]            	mov ds, word [cs:ENTRY_POINT + 2]
  2740                                   assume ds:nothing
  2741                                  		; The first word is not checked in order to allow
  2742                                  		;  loading dual-mode .COM executables, which need
  2743                                  		;  a short jump in the first two bytes.
  2744                                  		; Dual-mode MZ .EXE executables may also want to
  2745                                  		;  provide a "zero entrypoint" here, though it is
  2746                                  		;  not required to make a dual-mode .EXE file.
  2747 00001805 833E0200FF              	cmp word [2], -1		; check that second word = 0FFFFh
  2748 0000180A 7520                    	jne .bad
  2749 0000180C 2E8B16[0E00]            	mov dx, word [cs:devicefilesizepara]
  2750 00001811 81FA0010                	cmp dx, 1000h
  2751 00001815 7314                    	jae .good
  2752 00001817 D1E2                    	shl dx, 1
  2753 00001819 D1E2                    	shl dx, 1
  2754 0000181B D1E2                    	shl dx, 1
  2755 0000181D D1E2                    	shl dx, 1			; to byte offset
  2756 0000181F 39160600                	cmp word [6], dx		; check strategy entry low enough
  2757 00001823 7307                    	jae .bad
  2758 00001825 39160800                	cmp word [8], dx		; check interrupt entry low enough
  2759 00001829 7301                    	jae .bad
  2760                                  		; The interrupt entrypoint dvc_int is only chained to
  2761                                  		;  after the strategy. If the file is compressed
  2762                                  		;  then the interrupt may point behind the packed
  2763                                  		;  data, and it may become initialised in time.
  2764                                  		; Therefore we do not check for the interrupt entry.
  2765                                  		; Update: Added CHECKDEVICE commanf if this check
  2766                                  		;  would really need to be bypassed.
  2767                                  .good:
  2768 0000182B A8                      	db __TEST_IMM8			; skip stc, NC
  2769                                  .bad:
  2770 0000182C F9                      	stc
  2771                                  
  2772 0000182D 1F                      	pop ds
  2773                                   assume ds:nothing
  2774 0000182E 72AD                    	jc BADBRK
  2775                                  .nocheck:
  2776                                  
  2777                                  GOODLD:
  2778 00001830 2EC606[2400]00          	mov byte [cs:cds_installed_last_unit_plus], 0
  2779                                  ;J.K. If it is IFS=, then we should set IFS_DOSCALL@ field in IFSHEADER.
  2780 00001836 2EF706[0000]0100        	test	word [cs:IFS_Flag], IS_IFS		;AN000;
  2781 0000183D 7422                    	jz	Skip_IFSHEADER_Set		;AN000;
  2782 0000183F 06                      	push	es				;AN000;
  2783 00001840 57                      	push	di				;AN000;
  2784 00001841 1E                      	push	ds				;AN000;
  2785 00001842 2E8B1E[0200]            	mov	bx, word ptr [cs:ENTRY_POINT+2] ;AN000;
  2786 00001847 8EDB                    	mov	ds, bx				;AN000; DS:0 will be the header
  2787                                   assume ds:nothing
  2788                                  DosInfo equ DOSINFO	; NASM port label
  2789 00001849 2EC43E[0000]            	les	di, [cs:DosInfo]		;AN000;
  2790                                   assume es:DOSGROUP
  2791 0000184E 268B5D37                	mov	bx, word ptr [es:di + SYSI_IFS_DOSCALL@]	 ;AN000;
  2792 00001852 891E1000                	mov	word ptr [IFS_DOSCALL@], bx		 ;AN000;
  2793 00001856 268B5D39                	mov	bx, word ptr [es:di + SYSI_IFS_DOSCALL@ + 2] ;AN000;
  2794 0000185A 891E1200                	mov	word ptr [IFS_DOSCALL@ + 2], bx	 ;AN000;
  2795 0000185E 1F                      	pop	ds				;AN000;
  2796                                   assume ds:nothing
  2797 0000185F 5F                      	pop	di				;AN000;
  2798 00001860 07                      	pop	es				;AN000;
  2799                                   assume ds:nothing, es:nothing
  2800                                  Skip_IFSHEADER_Set:				;AN000;
  2801 00001861 0656                    	SaveReg <ES,SI> 		;INITIALIZE THE DEVICE
  2802                                  ;	 call	 Chk_IBMCACHE		 ;AN024 IBMCACHE.SYS problem.;AN026;IBMDOS will handles this thru 4Bh call.
  2803 00001863 268A1C                  .Restore:MOV	BL,[ES:SI]		;   while ((c=*p) != 0)
  2804 00001866 84DB                    	test	BL,BL
  2805 00001868 7403                    	JZ	.Got
  2806 0000186A 46                      	INC	SI			;	p++;
  2807 0000186B EBF6                    	JMP	.Restore
  2808 0000186D 26C60420                .Got:	MOV	BYTE PTR [ES:SI],' '	;   *p = ' ';
  2809 00001871 0656                    	SaveReg <ES,SI>
  2810 00001873 0E                      	PUSH	CS
  2811 00001874 07                      	POP	ES
  2812                                   assume es:SYSINITGROUP
  2813                                  
  2814 00001875 2EF706[0000]0100        	test	word [cs:IFS_Flag], IS_IFS	;AN000;
  2815 0000187C 7408                    	jz	Got_Device_Com		;AN000;
  2816 0000187E BB1400                  	mov	bx, IFS_CALL@		;AN000; offset from the start of IFSHEADER
  2817 00001881 E8A607                  	call	sysinit_CallIFS		;AN000;
  2818 00001884 EB6F                    	jmp	short End_Init_Call
  2819                                  Got_Device_Com:
  2820 00001886 1E                      	push	ds			;AN017;
  2821 00001887 56                      	push	si			;AN017;
  2822 00001888 2EC536[0000]            	lds	si, [cs:ENTRY_POINT]	;AN017; Peeks the header attribute
  2823                                   assume ds:nothing
  2824 0000188D F744040080              	test	word ptr [si + SDEVATT], DEVTYP  ;AN017;Block device driver?
  2825 00001892 7512                    	jnz	Got_Device_Com_Cont		  ;AN017;No.
  2826 00001894 2EC536[0000]            	lds	si, [cs:DOSINFO]	;AN017; DS:SI -> SYS_VAR
  2827                                   assume ds:DOSGROUP
  2828 00001899 807C2020                	cmp	byte [si + SYSI_NUMIO], 32	;AN017; No more than 26 drive number (CDS limit)
  2829 0000189D 7207                    	jb	Got_Device_Com_Cont	;AN017;
  2830 0000189F 5E                      	pop	si			;AN017;
  2831 000018A0 1F                      	pop	ds			;AN017;
  2832                                   assume ds:nothing
  2833 000018A1 5E                      	pop	si			;AN017;clear the stack
  2834 000018A2 07                      	pop	es			;AN017;
  2835                                   assume es:nothing
  2836 000018A3 E98301                  	jmp	BadNumBlock		;AN017;
  2837                                  Got_Device_Com_Cont:			;AN017;
  2838 000018A6 5E                      	pop	si			;AN017;
  2839 000018A7 1F                      	pop	ds			;AN017;
  2840                                   assume ds:nothing
  2841                                  
  2842 000018A8 2ED006[0000]            	rol byte [cs:MultDeviceFlag], 1
  2843 000018AD 723A                    	jc .keepbreak
  2844 000018AF 2EA1[1600]              	mov ax, word [cs:devicehighafter]
  2845                                  %if 0
  2846                                  	rol byte [cs:devicehighflag], 1
  2847                                  	jc .common3
  2848                                  .low3:
  2849                                  alloclim equ ALLOCLIM	; NASM port label
  2850                                  	mov ax, [cs:alloclim]
  2851                                  %endif
  2852                                  .common3:
  2853                                  
  2854 000018B3 1E                      	push ds
  2855 000018B4 56                      	push si
  2856 000018B5 50                      	push ax
  2857 000018B6 2ED006[3200]            	rol byte [cs:reinitcds_option], 1
  2858 000018BB 730A                    	jnc .find
  2859 000018BD 2EC536[0000]            	lds si, [cs:DOSINFO]
  2860 000018C2 8A7C20                  	mov bh, [si + SYSI_NUMIO]
  2861 000018C5 EB07                    	jmp @F
  2862                                  .find:
  2863 000018C7 2EA0[2400]              	mov al, byte [cs:cds_installed_last_unit_plus]
  2864                                   extern cds_first_unused
  2865 000018CB E8(0000)                	call cds_first_unused
  2866                                  @@:
  2867                                  DriveNumber equ DRIVENUMBER	; NASM port label
  2868 000018CE 2E883E[0000]            	mov byte [cs:DriveNumber], bh
  2869 000018D3 2E883E[2300]            	mov [cs:devicefirstnewdrive], bh
  2870 000018D8 58                      	pop ax
  2871 000018D9 5E                      	pop si
  2872 000018DA 1F                      	pop ds
  2873                                  
  2874                                  Break_addr equ BREAK_ADDR	; NASM port label
  2875 000018DB 2E8326[0000]00          	and word ptr [cs:Break_addr], 0
  2876 000018E1 2EA3[0200]              	mov word ptr [cs:Break_addr+2], ax
  2877 000018E5 2EA3[1800]              	mov word [cs:deviceafter], ax
  2878                                  .keepbreak:
  2879 000018E9 BB0600                  	MOV	BX,SDEVSTRAT
  2880 000018EC E8(0000)                	invoke	CALLDEV			;   CallDev (SDevStrat);
  2881                                   assume ds:nothing, es:nothing
  2882 000018EF BB0800                  	MOV	BX,SDEVINT
  2883 000018F2 E8(0000)                	invoke	CALLDEV			;   CallDev (SDevInt);
  2884                                   assume ds:nothing, es:nothing
  2885                                  	debugnumber 'rt'
  2886                                  End_Init_Call:
  2887 000018F5 5E1F                    	RestoreReg  <SI,DS>
  2888                                   assume ds:nothing
  2889 000018F7 C60400                  	MOV	BYTE PTR [SI],0		;   *p = 0;
  2890                                  
  2891 000018FA 0E                      	PUSH	CS
  2892 000018FB 1F                      	POP	DS
  2893                                   assume ds:SYSINITGROUP
  2894                                  
  2895 000018FC F706[0000]0100          	test	word [IFS_Flag], IS_IFS	;AN000;
  2896 00001902 7503E99200              	jz	Was_Device_Com		;AN000;
  2897 00001907 803E[0300]00            	cmp	byte [ifs_rh + IFSR_RETCODE], 0 ;AN000; Was a success ?
  2898                                  Erase_Dev_do equ ERASE_DEV_do	; NASM port label
  2899 0000190C 753C                    	jne	Erase_Dev_do		;AN000;
  2900 0000190E 5E                      	pop	si			;AN000; restore es:si to clean up the
  2901 0000190F 07                      	pop	es			;AN000; stack for Set_Break call.
  2902                                   assume es:nothing
  2903                                  Entry_Point equ ENTRY_POINT	; NASM port label
  2904 00001910 A1[0200]                	mov	ax, word ptr [Entry_Point+2]	   ;AN000; Get the loaded segment
  2905 00001913 0306[1A00]              	add	ax, word ptr [ifs_rh + IFSR_RESSIZE] ;AN000;
  2906 00001917 8326[0000]00            	and	word ptr [Break_addr], 0	   ;AN000;
  2907 0000191C A3[0200]                	mov	word ptr [Break_addr+2], ax	   ;AN000;
  2908 0000191F E8(0000)                	invoke	Set_Break		;AN000; Will also check the memory size too.
  2909 00001922 06                      	push	es			;AN000; Save it again, in case, for Erase_Dev_Do.
  2910 00001923 56                      	push	si			;AN000;
  2911 00001924 7224                    	jc	Erase_Dev_do		;AN000;
  2912                                  Link_IFS:				;AN000;
  2913                                  dosinfo equ DOSINFO	; NASM port label
  2914 00001926 2EC43E[0000]            	les	di, [cs:dosinfo]	;AN000;
  2915                                   assume es:DOSGROUP
  2916 0000192B 268B4D3B                	mov	cx, word ptr [es:di + SYSI_IFS]	;AN000; save old pointer
  2917 0000192F 268B553D                	mov	dx, word ptr [es:di + SYSI_IFS+2] ;AN000;
  2918 00001933 2EC536[0000]            	lds	si, [cs:Entry_Point]		;AN000;
  2919                                   assume ds:nothing
  2920 00001938 2689753B                	mov	word ptr [es:di + SYSI_IFS],si	;AN000;
  2921 0000193C 268C5D3D                	mov	word ptr [es:di + SYSI_IFS+2], ds ;AN000;
  2922 00001940 890C                    	mov	word ptr [si], cx		;AN000; We don't permit multiple IFSs.
  2923 00001942 895402                  	mov	word ptr [si+2], dx		;AN000;
  2924 00001945 5E                      	pop	si			;AN000; Restore es:si for the next command.
  2925 00001946 07                      	pop	es			;AN000;
  2926                                   assume es:nothing
  2927                                  ;	 mov	 [cs:IFS_Flag], HAD_IFS  ;AN014; Set the flag.
  2928 00001947 E945F7                  	jmp	COFF			;AN000;
  2929                                  
  2930                                  ERASE_DEV_do:				;AC000;; Modified to show message "Error in CONFIG.SYS..."
  2931 0000194A 5E                      	pop	si
  2932 0000194B 07                      	pop	es
  2933                                   assume es:nothing
  2934 0000194C 0E                      	push	cs
  2935 0000194D 1F                      	pop	ds
  2936                                   assume ds:SYSINITGROUP
  2937                                  
  2938 0000194E F606[0300]01            	test	byte [SetDevMarkFlag],SETBRKDONE ;AN004;If already Set_Break is done,
  2939 00001953 7503                    	jnz	Skip1_ResetMEMHI	;AN004; then do not
  2940                                  	; dec	word [MEMHI] 		;AN004;Adjust MEMHI by a paragrah of DEVMARK.
  2941 00001955 E80D00                  	call release_device_memory
  2942                                  Skip1_ResetMEMHI:
  2943 00001958 833E[0000]00            	cmp	word [ConfigMsgFlag], 0	;AN015;
  2944 0000195D 7403                    	je	No_Error_Line_Msg	;AN015;
  2945 0000195F E88D06                  	call	Error_Line		;AN021; No "Error in CONFIG.SYS" msg for device driver. DCR D493
  2946                                  No_Error_Line_Msg:			;AN015;
  2947 00001962 E96302                  	JMP	COFF_relocate
  2948                                  
  2949                                  release_device_memory:
  2950 00001965 1E                      	push ds
  2951 00001966 0E                      	 push cs
  2952 00001967 1F                      	 pop ds
  2953                                   assume ds:SYSINITGROUP
  2954                                  	; rol byte [devicehighflag], 1
  2955                                  	; jnc .low2
  2956                                  .high2:
  2957 00001968 06                      	push es
  2958 00001969 50                      	push ax
  2959 0000196A 53                      	push bx
  2960                                  
  2961 0000196B A1[1000]                	mov ax, word [devicehighsd]
  2962 0000196E 40                      	inc ax				; => SD MCB's data
  2963 0000196F 8B1E[1200]              	mov bx, word [devicehighdata]
  2964 00001973 85DB                    	test bx, bx
  2965 00001975 741D                    	jz .ret
  2966 00001977 4B                      	dec bx				; => sub-MCB
  2967 00001978 8EC0                    	mov es, ax
  2968                                   assume es:nothing
  2969 0000197A 29C3                    	sub bx, ax			; = size of SD to keep
  2970 0000197C 7412                    	jz @F				; if to free -->
  2971 0000197E B44A                    	mov ah, 4Ah
  2972 00001980 CD21                    	int 21h				; shrink SD MCB, cannot fail
  2973 00001982 8CC0                    	mov ax, es
  2974 00001984 48                      	dec ax
  2975 00001985 8EC0                    	mov es, ax			; => SD MCB
  2976                                   assume es:MCB
  2977 00001987 26C70601000800          	mov word [es:mcbOwner], 8	; reset owner changed by 21.4A
  2978 0000198E EB04                    	jmp @FF
  2979                                  @@:
  2980 00001990 B449                    	mov ah, 49h
  2981 00001992 CD21                    	int 21h				; free SD MCB
  2982                                  @@:
  2983                                  .ret:
  2984 00001994 5B                      	pop bx
  2985 00001995 58                      	pop ax
  2986 00001996 07                      	pop es
  2987                                   assume es:nothing
  2988 00001997 1F                      	pop ds
  2989                                   assume ds:nothing
  2990 00001998 C3                      	retn
  2991                                  %if 0
  2992                                  .low2:
  2993                                  	dec word [MEMHI]		; Adjust MEMHI by a paragraph of DEVMARK.
  2994                                  	pop ds
  2995                                  	retn
  2996                                  %endif
  2997                                  
  2998                                  Was_Device_Com:				;AN000;
  2999                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  3000                                  break_addr equ BREAK_ADDR	; NASM port label
  3001 00001999 A1[0000]                	mov ax, word ptr [break_addr]
  3002 0000199C E8(0000)                	call ParaRound
  3003 0000199F 0306[0200]              	add ax, word ptr [break_addr + 2]
  3004 000019A3 7206                    	jc .bad
  3005 000019A5 3B06[1800]              	cmp ax, word [deviceafter]
  3006 000019A9 7605                    	jbe BREAKOK
  3007                                  .bad:
  3008 000019AB 5E                      	POP	SI
  3009 000019AC 07                      	POP	ES
  3010                                   assume es:nothing
  3011 000019AD E92DFE                  	JMP	BADBRK
  3012                                  
  3013                                  BREAKOK:
  3014 000019B0 A3[1800]                	mov word [deviceafter], ax	; for multi device drivers
  3015 000019B3 C516[0000]              	LDS	DX,[ENTRY_POINT]	;SET DS:DX TO HEADER
  3016                                   assume ds:nothing
  3017 000019B7 89D6                    	MOV	SI,DX
  3018 000019B9 83C604                  	ADD	SI,SDEVATT		;DS:SI POINTS TO ATTRIBUTES
  3019 000019BC 2EC43E[0000]            	LES	DI,[CS:DOSINFO] 	;ES:DI POINT TO DOS INFO
  3020                                   assume es:DOSGROUP
  3021 000019C1 8B04                    	MOV	AX,[SI]		;GET ATTRIBUTES
  3022 000019C3 A90080                  	TEST	AX,DEVTYP		;TEST IF BLOCK DEV
  3023 000019C6 7425                    	JZ	ISBLOCK
  3024 000019C8 E8(0000)                	invoke	Set_Break		; Go ahead and alloc mem for device
  3025 000019CB 7303E97AFF              	jc	Erase_Dev_do		;device driver's Init routien failed.
  3026 000019D0 A90100                  	TEST	AX,ISCIN		;IS IT A CONSOLE IN?
  3027 000019D3 7408                    	JZ	TRYCLK
  3028 000019D5 2689550C                	MOV	WORD PTR [ES:DI + SYSI_CON],DX
  3029 000019D9 268C5D0E                	MOV	WORD PTR [ES:DI + SYSI_CON+2],DS
  3030                                  
  3031 000019DD A90800                  TRYCLK: TEST	AX,ISCLOCK		;IS IT A CLOCK DEVICE?
  3032 000019E0 7408                    	JZ	GOLINK
  3033 000019E2 26895508                	MOV	WORD PTR [ES:DI+SYSI_CLOCK],DX
  3034 000019E6 268C5D0A                	MOV	WORD PTR [ES:DI+SYSI_CLOCK+2],DS
  3035 000019EA E9A201                  GOLINK: JMP	LINKIT
  3036                                  
  3037                                  ISBLOCK:
  3038 000019ED 2EA0[0000]              	MOV	AL,[CS:UNITCOUNT]	;IF NO UNITS FOUND, erase the device
  3039 000019F1 84C0                    	test al, al
  3040 000019F3 7503E952FF              	jz	Erase_Dev_do
  3041                                  ;	 JNZ	 PERDRV
  3042                                  ;	 MOV	 AX, -1
  3043                                  ;	 JMP	 ENDDEV
  3044                                  
  3045                                  PERDRV:
  3046 000019F8 B400                    	mov ah, 0
  3047 000019FA 89C1                    	MOV	CX,AX
  3048 000019FC B600                    	mov dh, 0
  3049 000019FE 1E                      	push ds
  3050 000019FF 56                      	push si
  3051 00001A00 50                      	push ax
  3052 00001A01 2ED006[3200]            	rol byte [cs:reinitcds_option], 1
  3053 00001A06 730A                    	jnc .find
  3054 00001A08 2EC536[0000]            	lds si, [cs:DOSINFO]
  3055 00001A0D 8A7C20                  	mov bh, [si + SYSI_NUMIO]
  3056 00001A10 EB07                    	jmp @F
  3057                                  .find:
  3058 00001A12 2EA0[2400]              	mov al, byte [cs:cds_installed_last_unit_plus]
  3059                                   extern cds_first_unused
  3060 00001A16 E8(0000)                	call cds_first_unused
  3061                                  @@:
  3062 00001A19 58                      	pop ax
  3063 00001A1A 5E                      	pop si
  3064 00001A1B 1F                      	pop ds
  3065 00001A1C 88FA                    	mov dl, bh
  3066 00001A1E 88D4                    	MOV	AH,DL
  3067 00001A20 00C4                    	ADD	AH,AL			; Check for too many devices
  3068 00001A22 7205                    	jc BadNumBlock
  3069 00001A24 80FC20                  	CMP	AH,32			; 'A' - 'Z' is 26 devices (CDS limit)
  3070 00001A27 760B                    	JBE	OK_BLOCK
  3071                                  BadNumBlock:				;AN017;
  3072 00001A29 0E                      	PUSH	CS
  3073 00001A2A 1F                      	POP	DS
  3074                                   assume ds:SYSINITGROUP
  3075 00001A2B BA[0000]                	MOV	DX,OFFSET BADBLOCK
  3076 00001A2E E8(0000)                	invoke	PRINT
  3077 00001A31 E916FF                  	JMP	ERASE_DEV_do
  3078                                  
  3079                                  OK_BLOCK:
  3080                                   assume ds:nothing
  3081 00001A34 E8(0000)                	invoke	SET_BREAK		; Alloc the device
  3082 00001A37 26004520                	ADD	[ES:DI + SYSI_NUMIO],AL	;UPDATE THE AMOUNT
  3083 00001A3B 2EC51E[0000]            	LDS	BX,[CS:BPB_ADDR]	;POINT TO BPB ARRAY
  3084                                   assume ds:nothing
  3085                                  sysconf_PERUNIT:
  3086 00001A40 2EC42E[0000]            	LES	BP,[CS:DOSINFO]
  3087                                   assume es:DOSGROUP
  3088 00001A45 26C46E00                	LES	BP,[ES:BP + SYSI_DPB]	;GET FIRST DPB
  3089                                   assume es:DPB
  3090                                  
  3091                                  DPB_NEXT_DPB equ dpb_next_dpb	; NASM port equate
  3092 00001A49 26837E19FF              SCANDPB:CMP	WORD PTR [ES:BP + DPB_NEXT_DPB],-1
  3093 00001A4E 7406                    	JZ	FOUNDPB
  3094 00001A50 26C46E19                	LES	BP,[ES:BP + DPB_NEXT_DPB]
  3095 00001A54 EBF3                    	JMP	SCANDPB
  3096                                  FOUNDPB:
  3097 00001A56 52                      	push dx
  3098 00001A57 53                      	push bx
  3099 00001A58 51                      	push cx
  3100                                  
  3101 00001A59 1E                      	push ds
  3102 00001A5A 56                      	push si
  3103 00001A5B 06                      	push es
  3104 00001A5C 57                      	push di
  3105                                  
  3106 00001A5D 2EC43E[1A00]            	les di, [cs:devicelastdpb]
  3107                                   assume es:nothing
  3108 00001A62 83FFFF                  	cmp di, -1
  3109 00001A65 750B                    	jne .try_extend
  3110                                  .alloc:
  3111 00001A67 B82100                  	mov ax, DPBSIZ
  3112 00001A6A BE[0000]                	mov si, alloc_dpb_no_hma
  3113 00001A6D E8(0000)                	call allocate_relocate_block
  3114 00001A70 EB03                    	jmp @F
  3115                                  
  3116                                  .try_extend:
  3117 00001A72 83C721                  	add di, DPBSIZ
  3118                                  @@:
  3119 00001A75 2E893E[1A00]            	mov word [cs:devicelastdpb], di
  3120 00001A7A 2E8C06[1C00]            	mov word [cs:devicelastdpb + 2], es
  3121                                  
  3122 00001A7F 2E833E[1E00]FF          	cmp word [cs:devicefirstnewdpb], -1
  3123 00001A85 750A                    	jne .gotfirst
  3124 00001A87 2E893E[1E00]            	mov word [cs:devicefirstnewdpb], di
  3125 00001A8C 2E8C06[2000]            	mov word [cs:devicefirstnewdpb + 2], es
  3126                                  .gotfirst:
  3127                                  
  3128 00001A91 8D4D0F                  	lea cx, [di + 15]
  3129 00001A94 D1E9                    	shr cx, 1
  3130 00001A96 D1E9                    	shr cx, 1
  3131 00001A98 D1E9                    	shr cx, 1
  3132 00001A9A D1E9                    	shr cx, 1		; old size (must succeed)
  3133                                  
  3134 00001A9C 8D5D30                  	lea bx, [di + DPBSIZ + 15]
  3135 00001A9F D1EB                    	shr bx, 1
  3136 00001AA1 D1EB                    	shr bx, 1
  3137 00001AA3 D1EB                    	shr bx, 1
  3138 00001AA5 D1EB                    	shr bx, 1		; new size
  3139 00001AA7 B44A                    	mov ah, 4Ah
  3140 00001AA9 CD21                    	int 21h			; can we have it ?
  3141 00001AAB 7314                    	jnc .extended		; yes -->
  3142 00001AAD 89CB                    	mov bx, cx
  3143 00001AAF B44A                    	mov ah, 4Ah
  3144 00001AB1 CD21                    	int 21h			; restore to old size
  3145 00001AB3 8CC0                    	mov ax, es
  3146 00001AB5 48                      	dec ax
  3147 00001AB6 8EC0                    	mov es, ax
  3148                                   assume es:MCB
  3149 00001AB8 26C70601000800          	mov word [es:mcbOwner], 8	; reset owner
  3150 00001ABF EBA6                    	jmp .alloc
  3151                                  
  3152                                  .extended:
  3153 00001AC1 8CC0                    	mov ax, es
  3154 00001AC3 48                      	dec ax
  3155 00001AC4 8EC0                    	mov es, ax
  3156                                   assume es:MCB
  3157 00001AC6 26C70601000800          	mov word [es:mcbOwner], 8	; reset owner
  3158                                  
  3159 00001ACD 5F                      	pop	di			;AN004;
  3160 00001ACE 07                      	pop	es			;AN004;
  3161                                   assume es:DPB
  3162 00001ACF 5E                      	pop	si			;AN004;
  3163 00001AD0 1F                      	pop	ds			;AN004;
  3164                                   assume ds:nothing, es:DPB
  3165                                  
  3166 00001AD1 59                      	pop cx
  3167 00001AD2 5B                      	pop bx
  3168 00001AD3 5A                      	pop dx
  3169                                  
  3170 00001AD4 2EA1[1A00]              	MOV	AX,[cs:devicelastdpb]
  3171 00001AD8 26894619                	MOV	WORD PTR [ES:BP + DPB_NEXT_DPB],AX
  3172 00001ADC 2EA1[1C00]              	MOV	AX,[cs:devicelastdpb + 2]
  3173 00001AE0 2689461B                	MOV	WORD PTR [ES:BP + DPB_NEXT_DPB+2],AX
  3174 00001AE4 2EC42E[1A00]            	LES	BP,[cs:devicelastdpb]
  3175 00001AE9 26834E19FF              	or	WORD PTR [ES:BP + DPB_NEXT_DPB],-1
  3176                                  DPB_FIRST_ACCESS equ dpb_first_access	; NASM port equate
  3177 00001AEE 26C64618FF              	MOV	byte [ES:BP + DPB_FIRST_ACCESS],-1
  3178                                   assume es:DPB
  3179                                  
  3180 00001AF3 8B37                    	MOV	SI,[BX]			;DS:SI POINTS TO BPB
  3181 00001AF5 43                      	INC	BX
  3182 00001AF6 43                      	INC	BX			;POINT TO NEXT GUY
  3183 00001AF7 1E                      	push ds
  3184 00001AF8 56                      	push si
  3185 00001AF9 50                      	push ax
  3186 00001AFA 53                      	push bx
  3187 00001AFB 2EA0[2400]              	mov al, byte [cs:cds_installed_last_unit_plus]
  3188 00001AFF 2ED006[3200]            	rol byte [cs:reinitcds_option], 1
  3189 00001B04 7316                    	jnc .find
  3190 00001B06 2EC536[0000]            	lds si, [cs:DOSINFO]
  3191 00001B0B 88C7                    	mov bh, al
  3192 00001B0D 2E803E[2200]00          	cmp byte [cs:deviceamountnew], 0
  3193 00001B13 750A                    	jne @F
  3194 00001B15 2E8A3E[2300]            	mov bh, [cs:devicefirstnewdrive]
  3195 00001B1A EB03                    	jmp @F
  3196                                  .find:
  3197                                   extern cds_first_unused
  3198 00001B1C E8(0000)                	call cds_first_unused
  3199                                  @@:
  3200 00001B1F 88FA                    	mov dl, bh
  3201 00001B21 FEC7                    	inc bh
  3202 00001B23 2E883E[2400]            	mov byte [cs:cds_installed_last_unit_plus], bh
  3203 00001B28 80FF20                  	cmp bh, 32			; CDS limit
  3204 00001B2B 7747                    	ja BadNumBlock_2
  3205 00001B2D 2EFE06[2200]            	inc byte [cs:deviceamountnew]
  3206 00001B32 2E883E[2500]            	mov byte [cs:cds_amount_wanted], bh
  3207 00001B37 5B                      	pop bx
  3208 00001B38 58                      	pop ax
  3209 00001B39 5E                      	pop si
  3210 00001B3A 1F                      	pop ds
  3211                                  DPB_DRIVE equ dpb_drive	; NASM port equate
  3212 00001B3B 26895600                	MOV	WORD PTR [ES:BP + DPB_DRIVE],DX
  3213                                  SETDPB equ SetDPB	; NASM port equate
  3214 00001B3F B453                    	MOV	AH,SETDPB		;HIDDEN SYSTEM CALL
  3215 00001B41 CD21                    	INT	21H
  3216                                  DPB_SECTOR_SIZE equ dpb_sector_size	; NASM port equate
  3217 00001B43 268B4602                	MOV	AX,[ES:BP + DPB_SECTOR_SIZE]
  3218 00001B47 06                      	PUSH	ES
  3219 00001B48 2EC43E[0000]            	LES	DI,[CS:DOSINFO] 	;ES:DI POINT TO DOS INFO
  3220                                   assume es:DOSGROUP
  3221 00001B4D 263B4510                	CMP	AX,[ES:DI + SYSI_MAXSEC]
  3222 00001B51 07                      	POP	ES
  3223                                   assume es:DPB
  3224 00001B52 7603E98200              	ja	Bad_BPB_Size_Sector
  3225 00001B57 1E                      	PUSH	DS
  3226 00001B58 52                      	PUSH	DX
  3227 00001B59 2EC516[0000]            	LDS	DX,[CS:ENTRY_POINT]
  3228                                   assume ds:nothing
  3229                                  DPB_DRIVER_ADDR equ dpb_driver_addr	; NASM port equate
  3230 00001B5E 26895613                	MOV	WORD PTR [ES:BP + DPB_DRIVER_ADDR],DX
  3231 00001B62 268C5E15                	MOV	WORD PTR [ES:BP + DPB_DRIVER_ADDR+2],DS
  3232 00001B66 5A                      	POP	DX
  3233 00001B67 1F                      	POP	DS
  3234                                   assume ds:nothing
  3235 00001B68 42                      	INC	DX
  3236 00001B69 FEC6                    	INC	DH
  3237 00001B6B E21F                    	LOOP	j_sysconf_PERUNIT
  3238                                  @@:
  3239 00001B6D 0E                      	PUSH	CS
  3240 00001B6E 1F                      	POP	DS
  3241                                   assume ds:SYSINITGROUP
  3242 00001B6F E8(0000)                	CALL	TEMPCDS_after_block_device
  3243                                  					; Set CDS for new drives
  3244 00001B72 EB1B                    	jmp LINKIT
  3245                                  
  3246                                  BadNumBlock_2:
  3247 00001B74 5B                      	pop bx
  3248 00001B75 58                      	pop ax
  3249 00001B76 5E                      	pop si
  3250 00001B77 1F                      	pop ds
  3251 00001B78 0E                      	PUSH	CS
  3252 00001B79 1F                      	POP	DS
  3253                                   assume ds:SYSINITGROUP
  3254 00001B7A BA[0000]                	MOV	DX,OFFSET BADBLOCK
  3255 00001B7D E8(0000)                	invoke	PRINT
  3256                                  
  3257 00001B80 803E[2200]00            	cmp byte [deviceamountnew], 0
  3258 00001B85 7703E9C0FD              	jbe ERASE_DEV_do
  3259 00001B8A EBE1                    	jmp @B
  3260                                  
  3261                                  
  3262                                  j_sysconf_PERUNIT:
  3263 00001B8C E9B1FE                  	jmp sysconf_PERUNIT
  3264                                  
  3265                                  LINKIT:
  3266 00001B8F 2EC43E[0000]            	LES	DI,[CS:DOSINFO] 	;ES:DI = DOS TABLE
  3267                                   assume es:DOSGROUP
  3268 00001B94 268B4D22                	MOV	CX,WORD PTR [ES:DI + SYSI_DEV]	;DX:CX = HEAD OF LIST
  3269 00001B98 268B5524                	MOV	DX,WORD PTR [ES:DI + SYSI_DEV+2]
  3270                                  
  3271 00001B9C 2EC536[0000]            	LDS	SI,[CS:ENTRY_POINT]	;DS:SI = DEVICE LOCATION
  3272                                   assume ds:nothing
  3273 00001BA1 26897522                	MOV	WORD PTR [ES:DI + SYSI_DEV],SI	;SET HEAD OF LIST IN DOS
  3274 00001BA5 268C5D24                	MOV	WORD PTR [ES:DI + SYSI_DEV+2],DS
  3275 00001BA9 8B04                    	MOV	AX,[SI]		;GET POINTER TO NEXT DEVICE
  3276 00001BAB 2EA3[0000]              	MOV	WORD PTR [CS:ENTRY_POINT],AX	;AND SAVE IT
  3277                                  
  3278 00001BAF 890C                    	MOV	WORD PTR [SI],CX	;LINK IN THE DRIVER
  3279 00001BB1 895402                  	MOV	WORD PTR [SI+2],DX
  3280                                  ENDDEV:
  3281 00001BB4 5E                      	POP	SI
  3282 00001BB5 07                      	POP	ES
  3283                                   assume es:nothing
  3284 00001BB6 40                      	INC	AX			;AX = FFFF (no more devs if YES)?
  3285 00001BB7 7409                    	JZ	COFFJ3
  3286 00001BB9 2EC606[0000]FF          	mov	byte [cs:MultDeviceFlag], -1	;AN001; Possibly multiple device driver.
  3287 00001BBF E96EFC                  	JMP	GOODLD			;OTHERWISE PRETEND WE LOADED IT IN
  3288                                  COFFJ3:
  3289 00001BC2 2EC606[0000]00          	mov	byte [cs:MultDeviceFlag], 0	;AN001; Reset the flag
  3290                                  
  3291                                  COFF_relocate:
  3292 00001BC8 2E8326[0000]00          	and word [cs:ConfigMsgFlag], 0	; Set the default value again.
  3293 00001BCE 06                      	push es
  3294 00001BCF B8FFFF                  	mov ax, -1
  3295 00001BD2 E8(0000)                	call init2_relocate_device
  3296 00001BD5 07                      	pop es
  3297                                   assume es:nothing
  3298 00001BD6 E9B6F4                  	JMP	COFF
  3299                                  
  3300                                  Bad_BPB_Size_Sector:
  3301 00001BD9 5E                      	POP	SI
  3302 00001BDA 07                      	POP	ES
  3303                                   assume es:nothing
  3304 00001BDB BA[0000]                	MOV	DX,OFFSET BADSIZ_PRE
  3305                                  ;	 MOV	 BX,OFFSET BADSIZ_POST
  3306 00001BDE BB[0000]                	mov	bx, offset CRLFM	;AN???;
  3307 00001BE1 E8(0000)                	invoke	PRNERR
  3308                                  %if 0		; flag is never clear here
  3309                                  	test	byte [SetDevMarkFlag],SETBRKDONE ;AN004;If already Set_Break is done,
  3310                                  	jnz	Skip2_ResetMEMHI	;AN004; then do not
  3311                                  	; dec	word [MEMHI] 		;AN004;Adjust MEMHI by a paragrah of DEVMARK.
  3312                                  	call release_device_memory
  3313                                  Skip2_ResetMEMHI:
  3314                                  %endif
  3315 00001BE4 E9A8F4                  	JMP	COFF
  3316                                  
  3317                                  
  3318                                  ;------------------------------------------------------------------------------
  3319                                  ; Country command
  3320                                  ; J.K. The syntax is:
  3321                                  ;	COUNTRY=country id {,codepage {,path}}
  3322                                  ;	COUNTRY=country id {,,path}	:Default CODEPAGE ID in DOS
  3323                                  ;------------------------------------------------------------------------------
  3324                                  TRYQ:
  3325 00001BE7 80FC51                  	CMP	AH,'Q'
  3326 00001BEA 7403                    	JZ	TRYQ_CONT
  3327 00001BEC E93A01                  	JMP	TRYF
  3328                                  TRYQ_CONT:
  3329                                  
  3330                                  ;	 invoke  GETNUM
  3331                                  ;	 JZ	 TryQBad		 ; 0 is never a valid code, or number is
  3332                                  ;					 ;   bad
  3333                                  ;	 MOV	 BX,AX			 ; Country code in BX
  3334                                  ;
  3335                                  ;					 ;J.K. 5/26/86
  3336                                  ;	 MOV	 DX,0			 ; assume no code page id
  3337                                  ;
  3338                                  ;	 invoke  skip_delim		 ;skip the delimeters after the first num
  3339                                  ;	 jc	 TryQ_Def_File		 ;no more characters left? then use default file
  3340                                  ;	 cmp	 al, CR 		 ;
  3341                                  ;	 je	 TryQ_Def_File
  3342                                  ;	 cmp	 al, LF
  3343                                  ;	 jne	 TRYQ_YES_EXTENDED
  3344                                  ;	 inc	 [COUNT]		 ;This is for NEWLINE routine in COFF.
  3345                                  ;	 dec	 [CHRPTR]
  3346                                  ;COFFJ41:
  3347                                  ;	 JMP	 TryQ_Def_File		 ;O.K. no code page, no path specified. Use default path.
  3348                                  ;
  3349                                  ;TRYQ_YES_EXTENDED:
  3350                                  ;	 cmp	 al, ','		 ;was the second comma?
  3351                                  ;	 jne	 TryQ_GETNUM
  3352                                  ;	 invoke  skip_delim		 ;Yes, skip ',' and other possible delim
  3353                                  ;	 jmp	 short TRYQ_PATH	 ;and No code page id entered.
  3354                                  ;TRYQ_GETNUM:
  3355                                  ;	 invoke  GETNUM
  3356                                  ;	 jc	 TryQBadCOM		 ;"Country=xxx,path" will not be accepted.
  3357                                  ;;	 jc	 TRYQ_PATH		 ;Codepage is not specified. No code page.
  3358                                  ;;					 ;At this point, AL already contain the
  3359                                  ;;					 ;first char of the PATH.
  3360                                  ;	 jz	 TryQBad		 ;codepage=0 entered. Error
  3361                                  ;	 mov	 DX, AX 		 ;save code page in DX
  3362                                  ;	 invoke  skip_delim		 ;move CHRPTR to the path string
  3363                                  ;	 jc	 TryQ_Def_File		 ;no more char? then use default filename
  3364                                  ;	 cmp	 al, CR
  3365                                  ;	 je	 TryQ_Def_File
  3366                                  ;	 cmp	 al, LF
  3367                                  ;	 jne	 TryQ_PATH		 ;path entered.
  3368                                  ;	 inc	 [COUNT]
  3369                                  ;	 dec	 [CHRPTR]
  3370                                  ;TryQ_Def_File:
  3371                                  ;	 push	 dx			 ;save code page
  3372                                  ;	 mov	 cs:CNTRY_DRV, 0	 ;flag that the default path has been used!!!
  3373                                  ;	 mov	 dx, offset CNTRY_ROOT	 ;the default path
  3374                                  ;	 jmp	 TRYQ_OPEN
  3375                                  ;
  3376                                  ;TryQBad:				 ;"Invalid country code or code page"
  3377                                  ;	STC
  3378                                  ;	MOV	DX,OFFSET BADCOUNTRY
  3379                                  ;	 jmp	 TryQChkErr
  3380                                  ;
  3381                                  ;TryQBadCOM:				 ;Error in COUNTRY command
  3382                                  ;	 STC
  3383                                  ;	 MOV	 DX,OFFSET BADCOUNTRYCOM
  3384                                  ;	 jmp	 TryQChkErr
  3385                                  ;
  3386                                  ;TRYQ_PATH:				 ;DS - sysinitseg, ES - CONFBOT,
  3387                                  ;	 mov	 CX, [COUNT]		 ;AL - the first char of path
  3388                                  ;	 inc	 CX			 ;BX - country id, DX - codepage id, 0 = No code page
  3389                                  ;	 mov	 DI, SI
  3390                                  ;TRYQ_PATH_LOOP:			 ;find the end of path to put 0 after that.
  3391                                  ;	 mov	 AL, byte ptr [ES:DI]
  3392                                  ;	 call	 delim
  3393                                  ;	 jz	 TRYQ_PATH_END
  3394                                  ;	 cmp	 al, 13
  3395                                  ;	 jz	 TRYQ_PATH_END
  3396                                  ;	 inc	 DI
  3397                                  ;	 jmp	 short TRYQ_PATH_LOOP
  3398                                  ;TryQBad_Brg:jmp short TryQBad
  3399                                  ;TRYQ_PATH_END:
  3400                                  ;	 mov	 byte ptr [es:di], 0	 ;make it a ASCIIZ string. (Organize did not handle this string)
  3401                                  ;	 push	 ds			 ;switch ds,es
  3402                                  ;	 push	 es
  3403                                  ;	 pop	 ds
  3404                                  ;	 pop	 es
  3405                                  ;
  3406                                  ;	 mov	 di, offset  CNTRY_DRV	 ;move the user specified path to CNTRY_DRV
  3407                                  ;	 call	 Move_ASCIIZ
  3408                                  ;
  3409                                  ;	 push	 ds			 ;restore ds,es
  3410                                  ;	 push	 es
  3411                                  ;	 pop	 ds
  3412                                  ;	 pop	 es
  3413                                  ;
  3414                                  ;;	  call	  Set_Country_Path	  ;set CNTRY_DRV
  3415                                  ;
  3416                                  ;	 push	 dx			 ;save DX
  3417                                  ;	 mov	 dx, offset CNTRY_DRV	 ;Now DS:DX -> CNTRY_DRV
  3418                                  
  3419                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  3420 00001BEF C606[0000]00            	mov	byte [Cntry_Drv], 0		;AN000; Reset the drive,path to default value.
  3421 00001BF4 C706[3B0D]0000          	mov	word [P_Code_Page],0		;AN000;
  3422 00001BFA BF[040D]                	mov	di, offset Cntry_Parms	;AN000;
  3423 00001BFD 31C9                    	xor	cx,cx			;AN000;
  3424 00001BFF 89CA                    	mov	dx,cx			;AN000;
  3425                                  ;	$SEARCH 			;AN000;
  3426                                  DD_DO49:
  3427 00001C01 E89BF6                  	    call   Sysinit_Parse	;AN000;
  3428                                  ;	$EXITIF    C			;AN000; Parse error, check the error code and
  3429 00001C04 730B                    	JNC DD_IF49
  3430 00001C06 E80C01                  	    call   Cntry_Error		;AN000;  Show message and end the serach loop.
  3431 00001C09 C706[390D]FFFF          	    mov    word [P_Cntry_Code], -1	;AN000; Signals that parse error.
  3432                                  ;	$ORELSE 			;AN000;
  3433 00001C0F EB34                    	JMP SHORT DD_SR49
  3434                                  DD_IF49:
  3435 00001C11 83F8FF                  	    cmp    ax, D_P_RC_EOL	;AN000; End of Line?
  3436                                  ;	$LEAVE	   E			;AN000;  then end the $SEARCH LOOP
  3437 00001C14 742F                    	JE DD_EN49
  3438                                  D_P_NUMBER equ D_P_Number	; NASM port equate
  3439                                  D_P_TYPE equ D_P_Type	; NASM port equate
  3440 00001C16 803E[D60C]01            	    cmp    byte [Result_Val + D_P_TYPE], D_P_NUMBER		;AN000; Numeric?
  3441                                  ;	    $IF    E						;AN000;
  3442 00001C1B 7512                    	    JNE DD_IF53
  3443 00001C1D A1[DA0C]                		   mov	  ax, word ptr [Result_Val + D_P_PICKED_VAL] ;AN000;
  3444 00001C20 83F901                  		   cmp	    cx, 1				;AN000;
  3445                                  ;		   $IF	 E					;AN000;
  3446 00001C23 7505                    		   JNE DD_IF54
  3447 00001C25 A3[390D]                			 mov   [P_Cntry_Code], ax 		;AN000;
  3448                                  ;		   $ELSE					;AN000;
  3449 00001C28 EB03                    		   JMP SHORT DD_EN54
  3450                                  DD_IF54:
  3451 00001C2A A3[3B0D]                			 mov   [P_Code_Page], ax			;AN000;
  3452                                  ;		   $ENDIF					;AN000;
  3453                                  DD_EN54:
  3454                                  ;	    $ELSE				;AN000; Path entered.
  3455 00001C2D EB14                    	    JMP SHORT DD_EN53
  3456                                  DD_IF53:
  3457 00001C2F 1E                      		   push ds			;AN000;
  3458 00001C30 06                      		   push es			;AN000;
  3459 00001C31 56                      		   push si			;AN000;
  3460 00001C32 57                      		   push di			;AN000;
  3461 00001C33 0E                      		   push cs			;AN000;
  3462 00001C34 07                      		   pop	es			;AN000;
  3463                                   assume es:SYSINITGROUP
  3464 00001C35 C536[DA0C]              		   lds	si, [RV_Dword]		;AN000; Move the path to known place.
  3465                                   assume ds:nothing
  3466                                  CNTRY_Drv equ Cntry_Drv	; NASM port label
  3467 00001C39 BF[0000]                		   mov	di, offset CNTRY_Drv	;AN000; access with es
  3468 00001C3C E8(0000)                		   call Move_ASCIIZ		;AN000;
  3469 00001C3F 5F                      		   pop	di			;AN000;
  3470 00001C40 5E                      		   pop	si			;AN000;
  3471 00001C41 07                      		   pop	es			;AN000;
  3472 00001C42 1F                      		   pop	ds			;AN000;
  3473                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  3474                                  ;	    $ENDIF				;AN000;
  3475                                  DD_EN53:
  3476                                  ;	$ENDLOOP
  3477 00001C43 EBBC                    	JMP SHORT DD_DO49
  3478                                  DD_EN49:
  3479                                  ;	$ENDSRCH				;AN000;
  3480                                  DD_SR49:
  3481 00001C45 833E[390D]FF            	cmp	word [P_Cntry_Code], -1		;AN000; Had a parse error?
  3482 00001C4A 750A                    	jne	TRYQ_OPEN			;AN000;
  3483 00001C4C E940F4                  	jmp	Coff				;AN000;
  3484                                  
  3485                                  TryQBad:				;"Invalid country code or code page"
  3486 00001C4F F9                             STC
  3487 00001C50 BA[0000]                       MOV     DX,OFFSET BADCOUNTRY
  3488 00001C53 E99100                         jmp     TryQChkErr
  3489                                  
  3490                                  TRYQ_OPEN:
  3491 00001C56 803E[0000]00            	cmp	byte [CNTRY_Drv], 0		;AC000;
  3492 00001C5B 7406                    	je	TRYQ_Def		;AC000;
  3493 00001C5D BA[0000]                	mov	dx, offset CNTRY_Drv	;AC000;
  3494 00001C60 EB04                    	jmp	TryQ_Openit		;AC000;
  3495 00001C62 90                      	nop	; identicalise
  3496                                  TRYQ_Def:				;AC000;
  3497                                  CNTRY_Root equ Cntry_Root	; NASM port label
  3498 00001C63 BA[0000]                	mov	dx, offset CNTRY_Root	;AC000;
  3499                                  TryQ_Openit:
  3500 00001C66 B8003D                  	mov	ax, 3d00h		;open a file
  3501 00001C69 F9                      	stc
  3502 00001C6A CD21                    	int	21h
  3503 00001C6C 7257                    	jc	TryQFileBad		;open failure
  3504                                  
  3505                                  CntryFileHandle equ CNTRYFILEHANDLE	; NASM port label
  3506 00001C6E 2EA3[0000]              	mov	[cs:CntryFileHandle], ax	;save file handle
  3507 00001C72 89C3                    	mov	bx, ax
  3508 00001C74 2EA1[390D]              	mov	ax, [cs:P_Cntry_Code]	   ;AN000;
  3509 00001C78 2E8B16[3B0D]            	mov	dx, [cs:P_Code_Page]	   ;AN000; Now, AX=country id, bx=filehandle
  3510                                  ;	 xchg	 ax, bx 		 ;now, AX = country id, BX = file handle
  3511                                  
  3512 00001C7D 50                      	push ax
  3513 00001C7E 53                      	push bx
  3514 00001C7F 52                      	push dx
  3515 00001C80 1E                      	push ds
  3516 00001C81 06                      	push es
  3517 00001C82 BE[0000]                	mov si, alloc_init
  3518 00001C85 B80008                  	mov ax, 2048			;I need 2K buffer to handle COUNTRY.SYS
  3519 00001C88 31D2                    	xor dx, dx
  3520 00001C8A E8(0000)                	call allocate_temporary_block.large_allow_error
  3521 00001C8D 8CC1                    	mov cx, es
  3522 00001C8F 07                      	pop es
  3523 00001C90 1F                      	pop ds
  3524                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  3525 00001C91 5A                      	pop dx
  3526 00001C92 5B                      	pop bx
  3527 00001C93 58                      	pop ax
  3528 00001C94 724D                    	jc TryQMemory			;cannot allocate the buffer for country.sys
  3529 00001C96 2E890E[0800]            	mov word [cs:country_block], cx
  3530                                  
  3531                                  CNTRY_DRV equ Cntry_Drv	; NASM port label
  3532 00001C9B BE[0000]                	mov	si, offset CNTRY_DRV	;DS:SI -> CNTRY_DRV
  3533 00001C9E 803C00                  	cmp	byte ptr [si],0 	;default path?
  3534 00001CA1 7502                    	jne	TRYQ_Set_for_DOS
  3535 00001CA3 46                      	inc	si
  3536 00001CA4 46                      	inc	si			;DS:SI -> CNTRY_ROOT
  3537                                  TRYQ_Set_for_DOS:
  3538                                  SYSI_Country equ SYSI_COUNTRY	; NASM port label
  3539 00001CA5 2EC43E[0000]            	les	di, [cs:SYSI_Country]	;ES:DI -> country info tab in DOS
  3540                                   assume es:DOSGROUP
  3541 00001CAA 57                      	push	di			;save di
  3542 00001CAB 83C708                  	add	di, ccPath_CountrySys
  3543                                  MOVE_ASCIIZ equ Move_ASCIIZ	; NASM port label
  3544 00001CAE E8(0000)                	call	MOVE_ASCIIZ		;Set the path to COUNTRY.SYS in DOS.
  3545 00001CB1 5F                      	pop	di			;ES:DI -> country info tab again.
  3546 00001CB2 2E8B0E[0800]            	mov cx, word [cs:country_block]
  3547 00001CB7 8ED9                    	mov	ds, cx
  3548                                   assume ds:nothing
  3549 00001CB9 31F6                    	xor	si, si			;DS:SI -> 2K buffer to be used.
  3550 00001CBB E8(0000)                	call	SetDOSCountryInfo	;now do the job!!!
  3551                                  TryQchkERR equ TryQChkErr	; NASM port label
  3552 00001CBE 7327                    	jnc	TryQchkERR		;read error or could not find country,code page combination
  3553 00001CC0 83F9FF                  	cmp	cx, -1			;Could not find matching country_id,code page?
  3554 00001CC3 748A                    	je	TryQBad 		;then "Invalid country code or code page"
  3555                                  TryQFileBad:
  3556 00001CC5 0E                      	push	cs			;AN000;
  3557 00001CC6 07                      	pop	es			;AN000;
  3558                                   assume es:SYSINITGROUP
  3559 00001CC7 2E803E[0000]00          	cmp	byte [cs:CNTRY_DRV],0		;Is the default file used?
  3560 00001CCD 7405                    	je	TryQDefBad
  3561                                  ;	 mov	 si, [cs:CONFBOT]
  3562                                  ;	 mov	 es, si
  3563                                  ;	 mov	 si, [cs:CHRPTR]
  3564                                  ;	 dec	 si			 ;ES:SI -> path in CONFBOT
  3565 00001CCF BE[0000]                	mov	si, offset CNTRY_Drv
  3566 00001CD2 EB03                    	jmp	short TryQBADLOAD
  3567                                  TryQDefBad:				;Default file has been used.
  3568                                  ;	 push	 cs
  3569                                  ;	 pop	 es
  3570                                  CNTRY_ROOT equ Cntry_Root	; NASM port label
  3571 00001CD4 BE[0000]                	mov	si, offset CNTRY_ROOT	;ES:SI -> \COUNTRY.SYS in SYSINIT_SEG
  3572                                  TryQBADLOAD:
  3573 00001CD7 E8(0000)                	call	BADLOAD 		;DS will be restored to SYSINIT_SEG
  3574 00001CDA 2E8B0E[0000]            	mov	cx, [cs:config_block]
  3575 00001CDF 8EC1                    	mov	es, cx			;Restore ES -> CONFBOT.
  3576                                   assume es:nothing
  3577 00001CE1 EB15                    	jmp	short CoffJ4
  3578                                  TryQMemory:
  3579 00001CE3 F9                      	stc
  3580 00001CE4 BA[0000]                	MOV	DX,OFFSET INSUFMEMORY
  3581                                  TryQChkErr:
  3582 00001CE7 2E8B0E[0000]            	mov	cx, [cs:config_block]
  3583 00001CEC 8EC1                    	mov	es, cx			;restore ES -> CONFBOT seg
  3584                                   assume es:nothing
  3585 00001CEE 0E                      	push	cs
  3586 00001CEF 1F                      	pop	ds			;retore DS to SYSINIT_SEG
  3587                                   assume ds:SYSINITGROUP
  3588 00001CF0 7306                    	jnc	CoffJ4			;if no error, then exit
  3589 00001CF2 E8(0000)                	invoke	PRINT			;else show error message
  3590 00001CF5 E8F702                  	call	Error_Line		;AN000;
  3591                                  CoffJ4:
  3592 00001CF8 31C0                    	xor ax, ax
  3593 00001CFA 8706[0800]              	xchg ax, word [country_block]
  3594 00001CFE 85C0                    	test ax, ax
  3595 00001D00 7408                    	jz @F
  3596 00001D02 06                      	push es
  3597 00001D03 8EC0                    	mov es, ax
  3598                                   assume es:nothing
  3599 00001D05 B449                    	mov ah, 49h
  3600 00001D07 CD21                    	int 21h
  3601 00001D09 07                      	pop es
  3602                                   assume es:nothing
  3603                                  @@:
  3604 00001D0A 8B1E[0000]              	mov	bx, [CntryFileHandle]
  3605 00001D0E B43E                    	mov	ah, 3eh
  3606 00001D10 CD21                    	int	21h			;close a file. Don't care even if it fails.
  3607 00001D12 E97AF3                  	JMP	COFF
  3608                                  
  3609                                  Cntry_Error	proc	near
  3610                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  3611                                  ;Function: Show "Invalid country code or code page" messages, or
  3612                                  ;		"Error in COUNTRY command" depending on the error code
  3613                                  ;		in AX returned by SYSPARSE;
  3614                                  ;In:	AX - error code
  3615                                  ;	DS - Sysinitseg
  3616                                  ;	ES - CONFBOT
  3617                                  ;Out:	Show message.  DX destroyed.
  3618                                  
  3619                                  D_P_OUT_OF_RANGE equ D_P_Out_Of_Range	; NASM port equate
  3620 00001D15 83F806                  	cmp	ax, D_P_OUT_OF_RANGE
  3621                                  ;	$IF	E
  3622 00001D18 7505                    	JNE DD_IF61
  3623                                  BadCountry equ BADCOUNTRY	; NASM port label
  3624 00001D1A BA[0000]                	     mov	dx, offset BadCountry ;"Invalid country code or code page"
  3625                                  ;	$ELSE
  3626 00001D1D EB03                    	JMP SHORT DD_EN61
  3627                                  DD_IF61:
  3628                                  BadCountryCom equ BADCOUNTRYCOM	; NASM port label
  3629 00001D1F BA[0000]                	     mov	dx, offset BadCountryCom ;"Error in CONTRY command"
  3630                                  ;	$ENDIF
  3631                                  DD_EN61:
  3632 00001D22 E8(0000)                	invoke	Print
  3633 00001D25 E8C702                  	call	Error_Line
  3634 00001D28 C3                      	ret
  3635                                  Cntry_Error	endp
  3636                                  
  3637                                  ;------------------------------------------------------------------------------
  3638                                  ; Files command
  3639                                  ;------------------------------------------------------------------------------
  3640                                  ;*******************************************************************************
  3641                                  ; Function: Parse the parameters of FILES= command.			       *
  3642                                  ;									       *
  3643                                  ; Input :								       *
  3644                                  ;	ES:SI -> parameters in command line.				       *
  3645                                  ; Output:								       *
  3646                                  ;	Variable FILES set.						       *
  3647                                  ;									       *
  3648                                  ; Subroutines to be called:						       *
  3649                                  ;	Sysinit_Parse							       *
  3650                                  ; Logic:								       *
  3651                                  ; {									       *
  3652                                  ;	Set DI points to FILES_Parms;					       *
  3653                                  ;	Set DX,CX to 0; 						       *
  3654                                  ;	While (End of command line)					       *
  3655                                  ;	{ Sysinit_parse;						       *
  3656                                  ;	  if (no error) then						       *
  3657                                  ;	     Files = Result_Val.D_P_Picked_Val				       *
  3658                                  ;	  else								       *
  3659                                  ;	     Error Exit;						       *
  3660                                  ;	};								       *
  3661                                  ; };									       *
  3662                                  ;									       *
  3663                                  ;*******************************************************************************
  3664                                  TRYF:
  3665 00001D29 80FC46                  	CMP	AH,'F'
  3666 00001D2C 7527                    	JNZ	TRYL
  3667                                  
  3668                                  ;	 invoke  GETNUM
  3669                                  ;	 CMP	 AX,5			 ;j.k. change it to 8!!!!!!!!
  3670                                  ;	 JB	 TryFBad		 ; Gotta have at least 5
  3671                                  ;	 CMP	 AX,256
  3672                                  ;	 JAE	 TryFBad		 ; Has to be a byte
  3673                                  ;	 MOV	 [FILES],AL
  3674                                  ;CoffJ5: JMP	 COFF
  3675                                  ;TryFBad:JMP	 BadOp
  3676                                  
  3677 00001D2E BF[3D0D]                	mov	di, offset Files_Parms	;AN000;
  3678 00001D31 31C9                    	xor	cx, cx			;AN000;
  3679 00001D33 89CA                    	mov	dx, cx			;AN000;
  3680                                  
  3681                                  ;	$SEARCH 			;AN000;
  3682                                  DD_DO64:
  3683 00001D35 E867F5                  	    call   Sysinit_Parse	;AN000;
  3684                                  ;	$EXITIF    C			;AN000; Parse Error,
  3685 00001D38 7305                    	JNC DD_IF64
  3686 00001D3A E824F1                  	    call   Badparm_p		;AN007;   and Show messages and end the search loop.
  3687                                  ;	$ORELSE 			;AN000;
  3688 00001D3D EB13                    	JMP SHORT DD_SR64
  3689                                  DD_IF64:
  3690 00001D3F 83F8FF                  	    cmp    ax, D_P_RC_EOL	;AN000; End of Line?
  3691                                  ;	$LEAVE	   E			;AN000;  then end the $ENDLOOP
  3692 00001D42 7408                    	JE DD_EN64
  3693 00001D44 A0[DA0C]                	    mov    al, byte ptr [Result_Val + D_P_PICKED_VAL] ;AN000;
  3694 00001D47 A2[5C0D]                	    mov    [P_Files], al		;AN000; Save it temporarily
  3695                                  ;	$ENDLOOP			;AN000;
  3696 00001D4A EBE9                    	JMP SHORT DD_DO64
  3697                                  DD_EN64:
  3698 00001D4C A0[5C0D]                	    mov    al, [P_Files]		;AN000;
  3699                                  Files equ FILES	; NASM port label
  3700 00001D4F A2[0000]                	    mov    [Files], al		;AN000; No error. Really set the value now.
  3701                                  ;	$ENDSRCH			;AN000;
  3702                                  DD_SR64:
  3703 00001D52 E93AF3                  	jmp	Coff
  3704                                  
  3705                                  ;------------------------------------------------------------------------------
  3706                                  ; LastDrive command
  3707                                  ;------------------------------------------------------------------------------
  3708                                  ;*******************************************************************************
  3709                                  ; Function: Parse the parameters of LASTDRIVE= command. 		       *
  3710                                  ;									       *
  3711                                  ; Input :								       *
  3712                                  ;	ES:SI -> parameters in command line.				       *
  3713                                  ; Output:								       *
  3714                                  ;	Set the variable NUM_CDS.					       *
  3715                                  ;									       *
  3716                                  ; Subroutines to be called:						       *
  3717                                  ;	Sysinit_Parse							       *
  3718                                  ; Logic:								       *
  3719                                  ; {									       *
  3720                                  ;	Set DI points to LDRV_Parms;					       *
  3721                                  ;	Set DX,CX to 0; 						       *
  3722                                  ;	While (End of command line)					       *
  3723                                  ;	{ Sysinit_Parse;						       *
  3724                                  ;	  if (no error) then						       *
  3725                                  ;	     Set NUM_CDS to the returned value; 			       *
  3726                                  ;	  else	/*Error exit*/						       *
  3727                                  ;	     Error Exit;						       *
  3728                                  ;	};								       *
  3729                                  ; };									       *
  3730                                  ;									       *
  3731                                  ;*******************************************************************************
  3732                                  TRYL:
  3733 00001D55 80FC4C                  	CMP	AH,'L'
  3734 00001D58 7403E99D00              	JNZ	TRYP
  3735 00001D5D 1E                      	push ds
  3736 00001D5E 06                      	push es
  3737 00001D5F 56                      	push si
  3738 00001D60 06                      	 push es
  3739 00001D61 1F                      	 pop ds
  3740                                   assume ds:nothing
  3741 00001D62 0E                      	 push cs
  3742 00001D63 07                      	 pop es
  3743                                   assume es:SYSINITGROUP
  3744 00001D64 AD                      	lodsw
  3745 00001D65 80FC3A                  	cmp ah, ':'
  3746 00001D68 7419                    	je .trydrive
  3747 00001D6A 80FC20                  	cmp ah, 32
  3748 00001D6D 7414                    	je .trydrive
  3749 00001D6F 80FC09                  	cmp ah, 9
  3750 00001D72 740F                    	je .trydrive
  3751 00001D74 80FC0D                  	cmp ah, 13
  3752 00001D77 740A                    	je .trydrive
  3753 00001D79 80FC0A                  	cmp ah, 10
  3754 00001D7C 7405                    	je .trydrive
  3755 00001D7E 80FC00                  	cmp ah, 0
  3756 00001D81 7518                    	jne .number
  3757                                  .trydrive:
  3758 00001D83 E8B103                  	call capitalise
  3759 00001D86 3C41                    	cmp al, 'A'
  3760 00001D88 7211                    	jb .number
  3761 00001D8A 3C60                    	cmp al, '`'		; CDS limit
  3762 00001D8C 770D                    	ja .number
  3763 00001D8E 2C40                    	sub al, 'A' - 1
  3764 00001D90 B302                    	mov bl, 2
  3765 00001D92 80FC3A                  	cmp ah, ':'
  3766 00001D95 7401                    	je @F
  3767 00001D97 4E                      	dec si
  3768                                  @@:
  3769 00001D98 92                      	xchg dx, ax
  3770 00001D99 EB10                    	jmp .got
  3771                                  
  3772                                  .number:
  3773 00001D9B 4E                      	dec si
  3774 00001D9C 31DB                    	xor bx, bx
  3775                                  	; cmp al, '+'
  3776                                  	; je @F
  3777 00001D9E 43                      	inc bx
  3778                                  	; cmp al, '-'
  3779                                  	; je @F
  3780 00001D9F 43                      	inc bx
  3781 00001DA0 4E                      	dec si
  3782                                  @@:
  3783 00001DA1 E8(0000)                	call ldos_getnum
  3784                                  		; OUT:	NC if success,
  3785                                  		;	 dx = number
  3786                                  		;	 bl = 0 if +, 1 if -, 2 else
  3787 00001DA4 721A                    	jc .error
  3788 00001DA6 83FA20                  	cmp dx, 32		; CDS limit
  3789 00001DA9 7715                    	ja .error
  3790                                  .got:
  3791                                  @@:
  3792 00001DAB AC                      	lodsb
  3793 00001DAC 3C20                    	cmp al, 32
  3794 00001DAE 74FB                    	je @B
  3795 00001DB0 3C09                    	cmp al, 9
  3796 00001DB2 74F7                    	je @B
  3797 00001DB4 3C0D                    	cmp al, 13
  3798 00001DB6 740E                    	je .done
  3799 00001DB8 3C0A                    	cmp al, 10
  3800 00001DBA 740A                    	je .done
  3801 00001DBC 3C00                    	cmp al, 0
  3802 00001DBE 7406                    	je .done
  3803                                  .error:
  3804 00001DC0 5E                      	pop si
  3805 00001DC1 07                      	pop es
  3806 00001DC2 1F                      	pop ds
  3807                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  3808 00001DC3 E983F0                  	jmp BADOP
  3809                                  
  3810                                  .done:
  3811                                   assume es:nothing
  3812 00001DC6 36C43E[0000]            	LES	DI,[ss:DOSINFO]
  3813                                   assume es:DOSGROUP
  3814 00001DCB 268A4521                	mov al, [es:di + SYSI_NCDS]
  3815 00001DCF 88C4                    	mov ah, al
  3816                                  
  3817 00001DD1 80FB01                  	cmp bl, 1
  3818 00001DD4 7206                    	jb .plus
  3819 00001DD6 7411                    	je .minus
  3820                                  .set:
  3821 00001DD8 88D4                    	mov ah, dl
  3822 00001DDA EB13                    	jmp .common
  3823                                  
  3824                                  .plus:
  3825 00001DDC 00D4                    	add ah, dl
  3826 00001DDE 7205                    	jc .max
  3827 00001DE0 80FC20                  	cmp ah, 32		; CDS limit
  3828 00001DE3 760A                    	jna .common
  3829                                  .max:
  3830 00001DE5 B420                    	mov ah, 32		; CDS limit
  3831 00001DE7 EB06                    	jmp .common
  3832                                  
  3833                                  .minus:
  3834 00001DE9 28D4                    	sub ah, dl
  3835 00001DEB 7302                    	jnc .common
  3836                                  .min:
  3837 00001DED B400                    	mov ah, 0
  3838                                  .common:
  3839 00001DEF 2E8826[0000]            	mov byte [cs:NUM_CDS], ah
  3840                                  
  3841 00001DF4 5E                      	pop si
  3842 00001DF5 07                      	pop es
  3843 00001DF6 1F                      	pop ds
  3844                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  3845 00001DF7 E995F2                  	jmp COFF
  3846                                  
  3847                                  ;-------------------------------------------------------------------------------
  3848                                  ; Setting Drive Parameters
  3849                                  ;-------------------------------------------------------------------------------
  3850                                  TRYP:
  3851 00001DFA 80FC50                  	CMP	AH,'P'
  3852 00001DFD 7513                    	JNZ	TRYK
  3853 00001DFF E8(0000)                	invoke	PARSELINE
  3854 00001E02 720B                    	JC	TryPBad
  3855 00001E04 E8(0000)                	invoke	SETPARMS
  3856 00001E07 E8(0000)                	INVOKE	sysinit_DIDDLEBACK
  3857 00001E0A 7203                    	jc	TryPBad
  3858 00001E0C E980F2                  	JMP	COFF
  3859                                  Badop equ BADOP	; NASM port label
  3860 00001E0F E937F0                  TryPBad:jmp	Badop
  3861                                  ;-------------------------------------------------------------------------------
  3862                                  ; Setting Internal Stack Parameters
  3863                                  ; STACKS=M,N where
  3864                                  ;	M is the number of stacks (range 8 to 64, default 9)
  3865                                  ;	N is the stack size (range 32 to 512 bytes, default 128)
  3866                                  ; J.K. 5/5/86: STACKS=0,0 implies no stack installation.
  3867                                  ;	Any combinations that are not within the specified limits will
  3868                                  ;	result in "Unrecognized command" error.
  3869                                  ;-------------------------------------------------------------------------------
  3870                                  ;*******************************************************************************
  3871                                  ;									       *
  3872                                  ; Function: Parse the parameters of STACKS= command.			       *
  3873                                  ;	    The minimum value for "number of stacks" and "stack size" is       *
  3874                                  ;	    8 and 32 each.  In the definition of SYSPARSE value list, they     *
  3875                                  ;	    are set to 0.  This is for accepting the exceptional case of       *
  3876                                  ;	    STACKS=0,0 case (,which means do not install the stack.)	       *
  3877                                  ;	    So, after SYSPARSE is done, we have to check if the entered        *
  3878                                  ;	    values (STACK_COUNT, STACK_SIZE) are within the actual range,      *
  3879                                  ;	    (or if "0,0" pair has been entered.)			       *
  3880                                  ; Input :								       *
  3881                                  ;	ES:SI -> parameters in command line.				       *
  3882                                  ; Output:								       *
  3883                                  ;	Set the variables STACK_COUNT, STACK_SIZE.			       *
  3884                                  ;									       *
  3885                                  ; Subroutines to be called:						       *
  3886                                  ;	Sysinit_Parse							       *
  3887                                  ; Logic:								       *
  3888                                  ; {									       *
  3889                                  ;	Set DI points to STKS_Parms;					       *
  3890                                  ;	Set DX,CX to 0; 						       *
  3891                                  ;	While (End of command line)					       *
  3892                                  ;	{ Sysinit_Parse;						       *
  3893                                  ;	  if (no error) then						       *
  3894                                  ;	     { if (CX == 1) then /* first positional = stack count */	       *
  3895                                  ;		   P_Stack_Count = Result_Val.D_P_Picked_Val;		       *
  3896                                  ;	       if (CX == 2) then /* second positional = stack size */	       *
  3897                                  ;		   P_Stack_Size = Result_Val.D_P_Picked_Val;		       *
  3898                                  ;	     }								       *
  3899                                  ;	  else	/*Error exit*/						       *
  3900                                  ;	     Error Exit;						       *
  3901                                  ;	};								       *
  3902                                  ;	Here check P_STACK_COUNT,P_STACK_SIZE if it meets the condition;       *
  3903                                  ;	If O.K., then set Stack_Count, Stack_Size;			       *
  3904                                  ;	 else Error_Exit;						       *
  3905                                  ; };									       *
  3906                                  ;*******************************************************************************
  3907                                  TRYK:
  3908 00001E12 80FC4B                  	CMP	AH,'K'
  3909 00001E15 7403                    	JE	Do_TryK
  3910 00001E17 E99100                  	jmp	TRYS
  3911                                  
  3912                                  		%IF	STACKSW
  3913                                  
  3914                                  ;	 MOV	 SepChr,','
  3915                                  ;	 INVOKE  GetNum 		 ; Get number of stacks
  3916                                  ;	 MOV	 SepChr,0
  3917                                  ;	 cmp	 ax, 0			 ;J.K. 5/5/86
  3918                                  ;	 je	 TRYK_0 		 ;J.K. Let's accept 0.
  3919                                  ;	 CMP	 AX, MinCount		 ; 8 <= Number of Stacks <= 64
  3920                                  ;	 JB	 TryKBad
  3921                                  ;	 CMP	 AX, MaxCount
  3922                                  ;	 JA	 TryKBad
  3923                                  ;TRYK_0:
  3924                                  ;	 MOV	 [STACK_COUNT], AX
  3925                                  ;
  3926                                  ; Skip delimiters after the first number.
  3927                                  ;
  3928                                  ;	 invoke  Skip_delim		 ;J.K.
  3929                                  ;	 JC	 TryKBad
  3930                                  ;
  3931                                  ;	 INVOKE  GetNum 		 ; Get size of individual stack
  3932                                  ;	 JC	 TryKBad		 ; Number bad
  3933                                  ;
  3934                                  ;	 cmp	 ax, 0			 ;J.K. 5/5/86
  3935                                  ;	 je	 TRYK_SIZE0		 ;J.K. 5/5/86. Accept 0
  3936                                  ;
  3937                                  ;	 CMP	 AX, MinSize		 ; 32 <= Stack Size <= 512
  3938                                  ;	 JB	 TryKBad
  3939                                  ;	 CMP	 AX, MaxSize
  3940                                  ;	 JA	 TryKBad
  3941                                  ;TRYK_SIZE0:
  3942                                  ;	 MOV	 [STACK_SIZE], AX
  3943                                  ;	 cmp	 ax,0
  3944                                  ;	 je	 TRYK_BOTH0
  3945                                  ;TRYK_OK:
  3946                                  ;	 mov	 word ptr [stack_addr], -1 ;set the flag that the user entered stacks= command.
  3947                                  ;	JMP	COFF
  3948                                  ;TRYK_BOTH0:
  3949                                  ;	 cmp	 [STACK_COUNT],0	 ;stack_size = 0. Stack_Count = 0 too?
  3950                                  ;	 je	 TRYK_OK		 ;yes. accepted.
  3951                                  ;TryKBad:
  3952                                  ;	 MOV	 DX, OFFSET BADSTACK	 ;J.K. 5/26/86 "Invalid stack parameter"
  3953                                  ;	 invoke  PRINT
  3954                                  ;	 JMP	 COFF
  3955                                  
  3956                                  Do_TryK:
  3957 00001E1A BF[940D]                	mov	di, offset STKS_Parms	;AN000;
  3958 00001E1D 31C9                    	xor	cx, cx			;AN000;
  3959 00001E1F 89CA                    	mov	dx, cx			;AN000;
  3960                                  
  3961                                  ;	$SEARCH 			;AN000;
  3962                                  DD_DO76:
  3963 00001E21 E87BF4                  	    call   Sysinit_Parse	;AN000;
  3964                                  ;	$EXITIF    C			;AN000; Parse Error,
  3965 00001E24 730B                    	JNC DD_IF76
  3966                                  BadStack equ BADSTACK	; NASM port label
  3967 00001E26 BA[0000]                	    mov    dx, offset BadStack	;AN000; "Invalid stack parameter"
  3968 00001E29 E8(0000)                	    call   Print		;AN000;   and Show messages and end the search loop.
  3969 00001E2C E8C001                  	    call   Error_Line		;AN006;
  3970                                  ;	$ORELSE 			;AN000;
  3971 00001E2F EB77                    	JMP SHORT DD_SR76
  3972                                  DD_IF76:
  3973 00001E31 83F8FF                  	    cmp    ax, D_P_RC_EOL	;AN000; End of Line?
  3974                                  ;	$LEAVE	   E			;AN000;  then end the $ENDLOOP
  3975 00001E34 7412                    	JE DD_EN76
  3976 00001E36 A1[DA0C]                	    mov    ax, word ptr [Result_Val + D_P_PICKED_VAL]   ;AN000;
  3977 00001E39 83F901                  	    cmp    cx, 1				   ;AN000;
  3978                                  ;	    $IF    E					   ;AN000;
  3979 00001E3C 7505                    	    JNE DD_IF80
  3980 00001E3E A3[C90D]                		 mov   [P_Stack_Count], ax		   ;AN000;
  3981                                  ;	    $ELSE					   ;AN000;
  3982 00001E41 EB03                    	    JMP SHORT DD_EN80
  3983                                  DD_IF80:
  3984 00001E43 A3[CB0D]                		 mov   [P_Stack_Size], ax 		   ;AN000;
  3985                                  ;	    $ENDIF					   ;AN000;
  3986                                  DD_EN80:
  3987                                  ;	$ENDLOOP					   ;AN000;
  3988 00001E46 EBD9                    	JMP SHORT DD_DO76
  3989                                  DD_EN76:
  3990 00001E48 833E[C90D]00            	    cmp    word [P_Stack_Count], 0			   ;AN000;
  3991                                  ;	    $IF    NE					   ;AN000;
  3992 00001E4D 7416                    	    JE DD_IF84
  3993                                  MINCOUNT equ MinCount	; NASM port equate
  3994 00001E4F 833E[C90D]08            		 cmp	word [P_Stack_Count], MINCOUNT 	   ;AN000;
  3995                                  ;		 $IF	B,OR				   ;AN000;
  3996 00001E54 7207                    		 JB DD_LL85
  3997                                  MINSIZE equ MinSize	; NASM port equate
  3998 00001E56 833E[CB0D]20            		 cmp	word [P_Stack_Size], MINSIZE		   ;AN000;
  3999                                  ;		 $IF	B				   ;AN000;
  4000 00001E5B 7306                    		 JNB DD_IF85
  4001                                  DD_LL85:
  4002 00001E5D C706[C90D]FFFF          			mov  word [P_Stack_Count], -1		   ;AN000; Invalid
  4003                                  ;		 $ENDIF 				   ;AN000;
  4004                                  DD_IF85:
  4005                                  ;	    $ELSE					   ;AN000;
  4006 00001E63 EB0D                    	    JMP SHORT DD_EN84
  4007                                  DD_IF84:
  4008 00001E65 833E[CB0D]00            		 cmp	word [P_Stack_Size], 0 		   ;AN000;
  4009                                  ;		 $IF	NE				   ;AN000;
  4010 00001E6A 7406                    		 JE DD_IF88
  4011 00001E6C C706[C90D]FFFF          			mov  word [P_Stack_Count], -1		   ;AN000; Invalid
  4012                                  ;		 $ENDIF 				   ;AN000;
  4013                                  DD_IF88:
  4014                                  ;	    $ENDIF					   ;AN000;
  4015                                  DD_EN84:
  4016 00001E72 833E[C90D]FF            	    cmp  word [P_Stack_Count], -1			   ;AN000; Invalid?
  4017                                  ;	    $IF  E					   ;AN000;
  4018 00001E77 751D                    	    JNE DD_IF91
  4019                                  Stack_Count equ stack_count	; NASM port label
  4020                                  DEFAULTCOUNT equ DefaultCount	; NASM port equate
  4021 00001E79 C706[0000]0900          		 mov	word [Stack_Count], DEFAULTCOUNT	   ;AN000;Reset to default value.
  4022                                  Stack_Size equ stack_size	; NASM port label
  4023                                  DEFAULTSIZE equ DefaultSize	; NASM port equate
  4024 00001E7F C706[0000]8000          		 mov	word [Stack_Size], DEFAULTSIZE 	   ;AN000;
  4025                                  STACK_ADDR equ stack_addr	; NASM port label
  4026 00001E85 C706[0000]0000          		 mov	word [STACK_ADDR], 0		   ;AN000;
  4027 00001E8B BA[0000]                		 mov	dx, offset BadStack		   ;AN000;
  4028 00001E8E E8(0000)                		 call	Print				   ;AN000;
  4029 00001E91 E85B01                  		 call	Error_Line			   ;AN006;
  4030                                  ;	    $ELSE					   ;AN000;
  4031 00001E94 EB12                    	    JMP SHORT DD_EN91
  4032                                  DD_IF91:
  4033 00001E96 A1[C90D]                		 mov	ax, [P_Stack_Count]		   ;AN000;
  4034 00001E99 A3[0000]                		 mov	[Stack_Count], ax 		   ;AN000;
  4035 00001E9C A1[CB0D]                		 mov	ax, [P_Stack_Size]		   ;AN000;
  4036 00001E9F A3[0000]                		 mov	[Stack_Size], ax			   ;AN000;
  4037                                  Stack_Addr equ stack_addr	; NASM port label
  4038 00001EA2 C706[0000]FFFF          		 mov	word [Stack_Addr], -1 	   ;AN000;STACKS= been accepted.
  4039                                  ;	    $ENDIF					   ;AN000;
  4040                                  DD_EN91:
  4041                                  ;	$ENDSRCH					   ;AN000;
  4042                                  DD_SR76:
  4043 00001EA8 E9E4F1                  	jmp	Coff
  4044                                  		%ENDIF
  4045                                  ;------------------------------------------------------------------------------
  4046                                  ; Switch command		;No longer supported.
  4047                                  ;------------------------------------------------------------------------------
  4048                                  ;TRYW:
  4049                                  ;	 CMP	 AH,'W'
  4050                                  ;	 JNZ	 TRYA
  4051                                  ;	 JMP	 BadOp			 ; no longer implemented
  4052                                  ;	MOV	DL,AL
  4053                                  ;	MOV	AX,(CHAR_OPER SHL 8) OR 1      ;SET SWITCH CHARACTER
  4054                                  ;	MOV	[COMMAND_LINE+1],DL
  4055                                  ;	INT	21H
  4056                                  ;	JMP	COFF
  4057                                  ;------------------------------------------------------------------------------
  4058                                  ; Availdev command		;No longer supported.
  4059                                  ;------------------------------------------------------------------------------
  4060                                  ;TRYA:
  4061                                  ;	 CMP	 AH,'A'
  4062                                  ;	 JNZ	 TRYS
  4063                                  ;	 JMP	 BadOp			 ; NO LONGER IMPLEMENTED
  4064                                  ;	CMP	AL,'F'			;FIRST LETTER OF "FALSE"
  4065                                  ;	JNZ	COFFJ7
  4066                                  ;	MOV	AX,(CHAR_OPER SHL 8) OR 3 ;TURN ON "/DEV" PREFIX
  4067                                  ;	XOR	DL,DL
  4068                                  ;	INT	21H
  4069                                  ;COFFJ7: JMP	 COFF
  4070                                  
  4071                                  ;------------------------------------------------------------------------------
  4072                                  ; shell command
  4073                                  ;------------------------------------------------------------------------------
  4074                                  TRYS:
  4075 00001EAB 80FC73                  	cmp ah, 's'
  4076 00001EAE 7508                    	jne @F
  4077 00001EB0 2EC606[2700]FF          	mov byte [cs:shellhighflag], -1
  4078 00001EB6 EB0B                    	jmp .shell
  4079                                  @@:
  4080 00001EB8 80FC53                  	CMP	AH,'S'
  4081 00001EBB 7542                    	JNZ	TRYX
  4082 00001EBD 2EC606[2700]00          	mov byte [cs:shellhighflag], 0
  4083                                  .shell:
  4084 00001EC3 C606[0100]00            	MOV	byte [COMMAND_LINE+1],0
  4085 00001EC8 BF[0000]                	MOV	DI,OFFSET COMMND
  4086 00001ECB EB03                    	jmp @F
  4087                                  STORESHELL:
  4088 00001ECD E8F900                  	CALL	GETCHR
  4089                                  @@:
  4090 00001ED0 84C0                    	test al, al
  4091 00001ED2 7419                    	JZ	GETSHPARMS
  4092 00001ED4 3C20                    	CMP	AL," "
  4093 00001ED6 7205                    	JB	ENDSH
  4094 00001ED8 8805                    	MOV	[DI],AL
  4095 00001EDA 47                      	INC	DI
  4096 00001EDB EBF0                    	JMP	STORESHELL
  4097                                  
  4098                                  ENDSH:
  4099 00001EDD C60500                  	MOV	BYTE PTR [DI],0
  4100 00001EE0 E8E600                  	CALL	GETCHR
  4101 00001EE3 3C0A                    	CMP	AL,LF
  4102 00001EE5 7503                    	JNZ	CONV
  4103 00001EE7 E8DF00                  	CALL	GETCHR
  4104 00001EEA E960F1                  CONV:	JMP	CONFLP
  4105                                  
  4106                                  GETSHPARMS:
  4107 00001EED C60500                  	MOV	BYTE PTR [DI],0
  4108 00001EF0 BF[0100]                	MOV	DI,OFFSET COMMAND_LINE+1
  4109                                  PARMLOOP:
  4110 00001EF3 E8D300                  	CALL	GETCHR
  4111 00001EF6 3C20                    	CMP	AL," "
  4112 00001EF8 72E3                    	JB	ENDSH
  4113 00001EFA 8805                    	MOV	[DI],AL
  4114 00001EFC 47                      	INC	DI
  4115 00001EFD EBF4                    	JMP	PARMLOOP
  4116                                  
  4117                                  ;------------------------------------------------------------------------------
  4118                                  ; FCBS Command
  4119                                  ;------------------------------------------------------------------------------
  4120                                  ;*******************************************************************************
  4121                                  ; Function: Parse the parameters of FCBS= command.			       *
  4122                                  ;									       *
  4123                                  ; Input :								       *
  4124                                  ;	ES:SI -> parameters in command line.				       *
  4125                                  ; Output:								       *
  4126                                  ;	Set the variables FCBS, KEEP.					       *
  4127                                  ;									       *
  4128                                  ; Subroutines to be called:						       *
  4129                                  ;	Sysinit_Parse							       *
  4130                                  ; Logic:								       *
  4131                                  ; {									       *
  4132                                  ;	Set DI points to FCBS_Parms;					       *
  4133                                  ;	Set DX,CX to 0; 						       *
  4134                                  ;	While (End of command line)					       *
  4135                                  ;	{ SYSPARSE;							       *
  4136                                  ;	  if (no error) then						       *
  4137                                  ;	     { if (CX == 1) then /* first positional = FCBS */		       *
  4138                                  ;		   FCBS = Result_Val.D_P_Picked_Val;			       *
  4139                                  ;	       if (CX == 2) then /* second positional = KEEP */ 	       *
  4140                                  ;		   KEEP = Result_Val.D_P_Picked_Val;			       *
  4141                                  ;	     }								       *
  4142                                  ;	  else	/*Error exit*/						       *
  4143                                  ;	     Error Exit;						       *
  4144                                  ;	};								       *
  4145                                  ; };									       *
  4146                                  ;*******************************************************************************
  4147                                  TRYX:
  4148 00001EFF 80FC58                  	CMP	AH,'X'
  4149 00001F02 7547                    	JNZ	TRYY
  4150                                  ;	 invoke  GETNUM
  4151                                  ;	 JZ	 TryXBad		 ; gotta have at least one
  4152                                  ;	 CMP	 AX,256
  4153                                  ;	 JAE	 TryXBad		 ; Can't be more than 8 bits worth
  4154                                  ;	 MOV	 [FCBS],AL
  4155                                  ;
  4156                                  ; Skip delimiters after the first number including ","
  4157                                  ;
  4158                                  ;	 invoke  Skip_delim		 ;J.K.
  4159                                  ;	 jc	 tryxbad
  4160                                  ;	 invoke  GetNum
  4161                                  ;	 JC	 TryXBad		 ; Number bad (Zero is OK here)
  4162                                  ;	 CMP	 AX,256
  4163                                  ;	 JAE	 TryXBad
  4164                                  ;	 CMP	 AL,FCBS
  4165                                  ;	 JA	 TryXBad
  4166                                  ;	 MOV	 Keep,AL
  4167                                  ;	 JMP	 COFF
  4168                                  ;TryXBad:JMP	 BadOp
  4169                                  
  4170 00001F04 BF[5D0D]                	mov	di, offset FCBS_Parms	;AN000;
  4171 00001F07 31C9                    	xor	cx, cx			;AN000;
  4172 00001F09 89CA                    	mov	dx, cx			;AN000;
  4173                                  
  4174                                  ;	$SEARCH 			;AN000;
  4175                                  DD_DO95:
  4176 00001F0B E891F3                  	    call   Sysinit_Parse	;AN000;
  4177                                  ;	$EXITIF    C			;AN000; Parse Error,
  4178 00001F0E 7305                    	JNC DD_IF95
  4179 00001F10 E84EEF                  	    call   Badparm_p		;AN007;   and Show messages and end the search loop.
  4180                                  ;	$ORELSE 			;AN000;
  4181 00001F13 EB33                    	JMP SHORT DD_SR95
  4182                                  DD_IF95:
  4183 00001F15 83F8FF                  	    cmp    ax, D_P_RC_EOL	;AN000; End of Line?
  4184                                  ;	$LEAVE	   E			;AN000;  then end the $ENDLOOP
  4185 00001F18 7412                    	JE DD_EN95
  4186 00001F1A A0[DA0C]                	    mov    al, byte ptr [Result_Val + D_P_PICKED_VAL]  ;AN000;
  4187 00001F1D 83F901                  	    cmp    cx, 1		;AN000; The first positional?
  4188                                  ;	    $IF    E			;AN000;
  4189 00001F20 7505                    	    JNE DD_IF99
  4190 00001F22 A2[920D]                		mov   [P_Fcbs], al	;AN000;
  4191                                  ;	    $ELSE			;AN000;
  4192 00001F25 EB03                    	    JMP SHORT DD_EN99
  4193                                  DD_IF99:
  4194 00001F27 A2[930D]                		mov   [P_Keep], al	;AN000;
  4195                                  ;	    $ENDIF			;AN000;
  4196                                  DD_EN99:
  4197                                  ;	$ENDLOOP			;AN000;
  4198 00001F2A EBDF                    	JMP SHORT DD_DO95
  4199                                  DD_EN95:
  4200 00001F2C A0[920D]                	    mov    al, [P_Fcbs]		;AN005;make sure P_Fcbs >= P_Keep
  4201 00001F2F 3A06[930D]              	    cmp    al, [P_Keep]		;AN005;
  4202                                  ;	    $IF    B			;AN005;
  4203 00001F33 730A                    	    JNB DD_IF103
  4204                                  ;		 call  Badop_p		 ;AN005;
  4205 00001F35 E829EF                  		call  Badparm_p 	;AN011;show "Bad parameter -" msg.
  4206 00001F38 C606[930D]00            		mov   byte [P_Keep], 0 	;AN005;
  4207                                  ;	    $ELSE			;AN005;
  4208 00001F3D EB09                    	    JMP SHORT DD_EN103
  4209                                  DD_IF103:
  4210                                  Fcbs equ FCBS	; NASM port label
  4211 00001F3F A2[0000]                		mov    [Fcbs], al 	    ;AN000; No error. Really set the value now.
  4212 00001F42 A0[930D]                		mov    al, [P_Keep]	    ;AN000;
  4213                                  Keep equ KEEP	; NASM port label
  4214 00001F45 A2[0000]                		mov    [Keep], al 	    ;AN000;
  4215                                  ;	    $ENDIF			;AN005;
  4216                                  DD_EN103:
  4217                                  ;	$ENDSRCH			;AN000;
  4218                                  DD_SR95:
  4219 00001F48 E944F1                  	jmp	Coff
  4220                                  
  4221                                  ;------------------------------------------------------------------------------
  4222                                  ; Comment= Do nothing. Just decrese CHRPTR, and increase COUNT for correct
  4223                                  ;		line number
  4224                                  ;------------------------------------------------------------------------------
  4225                                  TRYY:					;AN000;
  4226 00001F4B 80FC59                  	cmp	ah, 'Y' 		;AN000;
  4227 00001F4E 750B                    	jne	Try0			;AN000;
  4228                                  DoNothing:
  4229 00001F50 FF0E[0000]              	dec	word [CHRPTR]			;AN000;
  4230 00001F54 FF06[0000]              	inc	word [COUNT]			;AN000;
  4231 00001F58 E934F1                  	jmp	COFF			;AN000;
  4232                                  
  4233                                  ;------------------------------------------------------------------------------
  4234                                  ; REM command
  4235                                  ;------------------------------------------------------------------------------
  4236                                  Try0:					;AN003;do nothing with this line.
  4237 00001F5B 80FC30                  	cmp	ah, '0' 		;AN003;
  4238 00001F5E 74F0                    	je	DoNothing		;AN003;
  4239                                  
  4240                                  ;------------------------------------------------------------------------------
  4241                                  ; SWITCHES command
  4242                                  ;------------------------------------------------------------------------------
  4243                                  ;*******************************************************************************
  4244                                  ;									       *
  4245                                  ; Function: Parse the option switches specified.			       *
  4246                                  ; Note - This command is intended for the future use also.  When we need to    *
  4247                                  ; to set system data flag, use this command.				       *
  4248                                  ;									       *
  4249                                  ; Input :								       *
  4250                                  ;	ES:SI -> parameters in command line.				       *
  4251                                  ; Output:								       *
  4252                                  ;	P_Swit_K set if /K option chosen.				       *
  4253                                  ;									       *
  4254                                  ; Subroutines to be called:						       *
  4255                                  ;	Sysinit_Parse							       *
  4256                                  ; Logic:								       *
  4257                                  ; {									       *
  4258                                  ;	Set DI points to Swit_Parms;  /*Parse control definition*/	       *
  4259                                  ;	Set DX,CX to 0; 						       *
  4260                                  ;	While (End of command line)					       *
  4261                                  ;	{ Sysinit_parse;						       *
  4262                                  ;	  if (no error) then						       *
  4263                                  ;	       if (Result_Val.D_P_SYNONYM_ptr == Swit_K) then		       *
  4264                                  ;		    P_Swit_K = 1					       *
  4265                                  ;	       endif							       *
  4266                                  ;	  else {Show Error message;Error Exit}				       *
  4267                                  ;	};								       *
  4268                                  ; };									       *
  4269                                  ;									       *
  4270                                  ;*******************************************************************************
  4271                                  
  4272 00001F60 80FC31                  	cmp	ah, '1' 		;AN019;Switches= command entered?
  4273                                  Tryz equ TRYZ	; NASM port label
  4274 00001F63 753E                    	jne	Tryz			;AN019;
  4275                                  
  4276 00001F65 BF[F70D]                	mov	di, offset Swit_Parms	;AN019;
  4277 00001F68 31C9                    	xor	cx, cx			;AN019;
  4278 00001F6A 89CA                    	mov	dx, cx			;AN019;
  4279                                  
  4280                                  ;	$SEARCH 			;AN019;
  4281                                  DD_DO107:
  4282 00001F6C E830F3                  	    call   Sysinit_Parse	;AN019;
  4283                                  ;	$EXITIF    C			;AN019; Parse Error,
  4284 00001F6F 7305                    	JNC DD_IF107
  4285 00001F71 E8EDEE                  	    call   Badparm_p		;AN019;   and Show messages and end the search loop.
  4286                                  ;	$ORELSE 			;AN019;
  4287 00001F74 EB2A                    	JMP SHORT DD_SR107
  4288                                  DD_IF107:
  4289 00001F76 83F8FF                  	    cmp    ax, D_P_RC_EOL	;AN019; End of Line?
  4290                                  ;	$LEAVE	   E			;AN019;  then jmp to $Endloop for semantic check.
  4291 00001F79 740F                    	JE DD_EN107
  4292 00001F7B 813E[D80C][0B0E]        	    cmp    word [Result_Val + D_P_SYNONYM_PTR], offset Swit_K   ;AN019;
  4293                                  ;	    $IF    E					      ;AN019;
  4294 00001F81 7505                    	    JNE DD_IF111
  4295 00001F83 C606[0E0E]01            		mov	byte [P_Swit_K], 1			      ;AN019; set the flag
  4296                                  ;	    $ENDIF					      ;AN019;
  4297                                  DD_IF111:
  4298                                  ;	$ENDLOOP			;AN019;
  4299 00001F88 EBE2                    	JMP SHORT DD_DO107
  4300                                  DD_EN107:
  4301 00001F8A 803E[0E0E]01            	    cmp    byte [P_Swit_K], 1		;AN019;If /K entered,
  4302 00001F8F 1E                      	    push   ds			;AN019;
  4303 00001F90 E8(0000)                	call sysinit_get_ds_dosbiodata
  4304                                   assume ds:DOSGROUP
  4305                                  ;	    $IF    E			;AN019;
  4306 00001F93 750A                    	    JNE DD_IF114
  4307 00001F95 C606[0000]00            	       mov    byte [KEYRD_Func], 0	;AN019;Use the conventional keyboard functions
  4308 00001F9A C606[0000]01            	       mov    byte [KEYSTS_Func], 1	;AN019;
  4309                                  ;	    $ENDIF			;AN019;
  4310                                  DD_IF114:
  4311 00001F9F 1F                      	    pop    ds			;AN019;
  4312                                   assume ds:SYSINITGROUP			;AN019;
  4313                                  ;	$ENDSRCH			;AN019;
  4314                                  DD_SR107:
  4315 00001FA0 E9ECF0                  	jmp	Coff			;AN019;
  4316                                  
  4317                                  ;------------------------------------------------------------------------------
  4318                                  ; Bogus command
  4319                                  ;------------------------------------------------------------------------------
  4320                                  TRYZ:
  4321 00001FA3 80FC32                  	cmp ah, '2'
  4322 00001FA6 741F                    	je TryFF
  4323 00001FA8 80FC37                  	cmp ah, '7'
  4324 00001FAB 741A                    	je TryFF
  4325 00001FAD 80FC38                  	cmp ah, '8'
  4326 00001FB0 7415                    	je TryFF
  4327 00001FB2 80FC39                  	cmp ah, '9'
  4328 00001FB5 7410                    	je TryFF
  4329 00001FB7 80FCFF                  	cmp	ah, 0FFh		;AN029;
  4330 00001FBA 740B                    	je	TryFF			;AN029;
  4331 00001FBC FF0E[0000]              	dec	word [CHRPTR]
  4332 00001FC0 FF06[0000]              	inc	word [COUNT]
  4333 00001FC4 E982EE                  	JMP	BADOP
  4334                                  
  4335                                  ;------------------------------------------------------------------------------
  4336                                  ; Null command
  4337                                  ;------------------------------------------------------------------------------
  4338                                  TryFF:					;AN029;Skip this command.
  4339 00001FC7 EB87                    	jmp	DoNothing		;AN029;
  4340                                  
  4341                                  GETCHR:
  4342                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  4343 00001FC9 51                      	PUSH	CX
  4344 00001FCA 8B0E[0000]              	MOV	CX,[COUNT]
  4345 00001FCE E312                    	JCXZ	NOCHAR
  4346 00001FD0 8B36[0000]              	MOV	SI,[CHRPTR]
  4347 00001FD4 268A04                  	MOV	AL,[ES:SI]
  4348 00001FD7 FF0E[0000]              	DEC	word [COUNT]
  4349 00001FDB FF06[0000]              	INC	word [CHRPTR]
  4350 00001FDF F8                      	CLC
  4351                                  GET_RET:
  4352 00001FE0 59                      	POP	CX
  4353 00001FE1 C3                      	return
  4354 00001FE2 F9                      NOCHAR: STC
  4355 00001FE3 EBFB                    	JMP	SHORT GET_RET
  4356                                  
  4357                                  Incorrect_Order proc	near		;AN000;
  4358                                  ;Show "Incorrect order in CONFIG.SYS ..." message.
  4359                                  BADORDER equ BadOrder	; NASM port label
  4360 00001FE5 BA[0000]                	mov	dx, offset BADORDER	;AN000;
  4361                                  print equ Print	; NASM port label
  4362 00001FE8 E8(0000)                	call	print			;AN000;
  4363 00001FEB E80D00                  	call	ShowLineNum		;AN000;
  4364 00001FEE C3                      	ret				;AN000;
  4365                                  Incorrect_Order endp			;AN000;
  4366                                  ;
  4367                                  	public	Error_Line
  4368                                  Error_Line	proc	near		;AN000;
  4369                                  ;Show "Error in CONFIG.SYS ..." message.
  4370 00001FEF 0E                      	push	cs			;AN000;
  4371 00001FF0 1F                      	pop	ds			;AN000;
  4372                                   assume ds:SYSINITGROUP, es:nothing, ss:nothing
  4373                                  ErrorCmd equ Errorcmd	; NASM port label
  4374 00001FF1 BA[0000]                	mov	dx, offset ErrorCmd	;AN000; access with ds
  4375 00001FF4 E8(0000)                	call	print			;AN000;
  4376 00001FF7 E80100                  	call	ShowLineNum		;AN000;
  4377 00001FFA C3                      	ret				;AN000;
  4378                                  Error_Line	endp			;AN000;
  4379                                  ;
  4380                                  ShowLineNum	proc	near		;AN000;
  4381                                  ;J.K. Convert the binary LineCount to Decimal ASCII string in ShowCount
  4382                                  ;and Display Showcount at the current curser position.
  4383                                  ;In.) LineCount
  4384                                  ;
  4385                                  ;Out) the number is printed.
  4386 00001FFB 06                      	push	es			;AN000;
  4387 00001FFC 1E                      	push	ds			;AN000;
  4388 00001FFD 57                      	push	di			;AN000;
  4389                                  
  4390 00001FFE 0E                      	push	cs			;AN000;
  4391 00001FFF 07                      	pop	es			;AN000; es=cs
  4392                                   assume es:SYSINITGROUP
  4393 00002000 0E                      	push	cs			;AN000;
  4394 00002001 1F                      	pop	ds			;AN000;
  4395                                   assume ds:SYSINITGROUP, es:SYSINITGROUP, ss:nothing
  4396                                  
  4397                                  ;	 mov	 ax, '  '
  4398                                  ;	 mov	 di, offset ShowCount	 ;clean it up.
  4399                                  ;	 stosw
  4400                                  ;	 stosw
  4401                                  ;	 stosb				 ;lenght of ShowCount is 5.
  4402                                  ;	 dec	 di			 ;let DI points to the least significant ASCII field.
  4403                                  
  4404 00002002 BF[0400]                	mov	di, offset ShowCount+4	;AN000; DI -> the least significant decimal field.
  4405 00002005 B90A00                  	mov	cx, 10			;AN000; decimal devide factor
  4406 00002008 2EA1[0000]              	mov	ax, [cs:LineCount]	;AN000;
  4407                                  SLN_Loop:				;AN000;
  4408 0000200C 83F80A                  	cmp	ax, 10			;AN000; < 10?
  4409 0000200F 720C                    	jb	SLN_Last		;AN000;
  4410 00002011 31D2                    	xor	dx,dx			;AN000;
  4411 00002013 F7F1                    	div	cx			;AN000;
  4412 00002015 80CA30                  	or	dl, 30h 		;AN000; add "0" (= 30h) to make it an ascii.
  4413 00002018 8815                    	mov	[di],dl 		;AN000;
  4414 0000201A 4F                      	dec	di			;AN000;
  4415 0000201B EBEF                    	jmp	SLN_Loop		;AN000;
  4416                                  SLN_Last:				;AN000;
  4417 0000201D 0C30                    	or	al, 30h 		;AN000;
  4418 0000201F 8805                    	mov	[di],al 		;AN000;
  4419 00002021 89FA                    	mov	dx, di			;AN000;
  4420 00002023 E8(0000)                	call	print			;AN000; show it.
  4421 00002026 5F                      	pop	di			;AN000;
  4422 00002027 1F                      	pop	ds			;AN000;
  4423 00002028 07                      	pop	es			;AN000;
  4424                                   assume ds:nothing, es:nothing
  4425 00002029 C3                      	ret				;AN000;
  4426                                  ShowLineNum	endp			;AN000;
  4427                                  
  4428                                  
  4429                                  sysinit_CallIFS proc	near			;AN000;
  4430                                  ;*******************************************************************************
  4431                                  ; Function: Interface to IFS call. This procedure will call IFS_CALL@	       *
  4432                                  ;									       *
  4433                                  ; Input :								       *
  4434                                  ;	    Entry_Point - Segment:Offset of loaded IFS. 		       *
  4435                                  ;	    BX = IFS_CALL@ (offset of IFS_CALL@ from the IFS header)	       *
  4436                                  ;	    ES = Segment of IFS request header				       *
  4437                                  ;	    IFS_Packet - IFS Request packet				       *
  4438                                  ;									       *
  4439                                  ; Output:   Nothing							       *
  4440                                  ;*******************************************************************************
  4441 0000202A 50                      	push	ax				;AN000;
  4442 0000202B 2E8E1E[0200]            	mov	ds, word ptr [cs:Entry_Point+2] ;AN000;
  4443                                   assume ds:nothing
  4444 00002030 2E031E[0000]            	add	bx, word ptr [cs:Entry_Point]	;AN000; [DS:BX] = Real IFS_CALL@ addr.
  4445 00002035 8B07                    	mov	ax, [bx]			;AN000; save it
  4446 00002037 2EFF36[0000]            	push	word ptr [cs:Entry_Point]	;AN000; save Entry point offset
  4447 0000203C 2EA3[0000]              	mov	word ptr [cs:Entry_Point], ax	;AN000; set for the call
  4448 00002040 BB[0000]                	mov	bx, offset IFS_RH		;AN000; Now, ES:BX -> Request packet
  4449 00002043 2EFF1E[0000]            	call	far [cs:Entry_Point]		;AN000; Far call
  4450 00002048 2E8F06[0000]            	pop	word ptr [cs:Entry_Point]	;AN000; Restore Entry point offset
  4451 0000204D 58                      	pop	ax				;AN000;
  4452 0000204E C3                      	ret					;AN000;
  4453                                  sysinit_CallIFS endp
  4454                                  
  4455                                  
  4456                                  %if 0
  4457                                  Set_DevMark	proc	near			;AN004;
  4458                                  ;*******************************************************************************
  4459                                  ; Function: Set a paragraph of informations infront of a Device file or        *
  4460                                  ;	    an IFS file to be loaded for MEM command.			       *
  4461                                  ;	    The structure is:						       *
  4462                                  ;	      DEVMARK_ID	byte "D" for device, "I" for IFS	       *
  4463                                  ;	      DEVMARK_SIZE	size in para for the device loaded	       *
  4464                                  ;	      DEVMARK_FILENAME	11 bytes. Filename			       *
  4465                                  ;									       *
  4466                                  ; Input :								       *
  4467                                  ;	    [MEMHI] = address to set up DEVMARK.			       *
  4468                                  ;	    [MEMLO] = 0 						       *
  4469                                  ;	    ES:SI -> pointer to [drive][path]filename,0 		       *
  4470                                  ;	    [IFS_Flag] = IS_IFS bit set if IFS= command.		       *
  4471                                  ;									       *
  4472                                  ; Output:   DEVMARK_ID, DEVMARK_FILENAME set				       *
  4473                                  ;	    [cs:DevMark_addr] set.					       *
  4474                                  ;	    AX, CX register destroyed.					       *
  4475                                  ;*******************************************************************************
  4476                                  	push	ds			;AN004;
  4477                                  	push	si			;AN004;
  4478                                  	push	es			;AN004;
  4479                                  	push	di			;AN004;
  4480                                  
  4481                                  	mov	di, [cs:MEMHI]		;AN004;
  4482                                  	mov	ds, di			;AN004;
  4483                                  	assume	ds:nothing		;AN004;
  4484                                  	mov	[cs:DevMark_Addr], di	;AN004; save the DEVMARK address for the future.
  4485                                  	test	word [cs:IFS_Flag], IS_IFS	;AN004;
  4486                                  	jnz	SDVMK_IFS		;AN004;
  4487                                  	mov	al, DEVMARK_DEVICE	;AN004; ='D'
  4488                                  	jmp	short SDVMK_ID		;AN004;
  4489                                  SDVMK_IFS:
  4490                                  	mov	al, DEVMARK_IFS 	;AN004; ='I'
  4491                                  SDVMK_ID:				;AN004;
  4492                                  	mov	[DEVMARK_ID], al	;AN004;
  4493                                  	inc	di			;AN008;
  4494                                  	mov	[DEVMARK_SEG], di	;AN008;
  4495                                  	call get_device_mcb_name
  4496                                  	pop	di			;AN004;
  4497                                  	pop	es			;AN004;
  4498                                  	pop	si			;AN004;
  4499                                  	pop	ds			;AN004;
  4500                                  	ret				;AN004;
  4501                                  Set_DevMark	endp			;AN004;
  4502                                  %endif
  4503                                  
  4504                                  		; INP:	es:si -> pathname
  4505                                  		;	ds => sub-MCB
  4506                                  		; CHG:	si, di, ds, es, cx, ax
  4507                                  get_device_mcb_name:
  4508 0000204F 30C0                    	xor	al,al			;AN004;
  4509 00002051 56                      	push	si			;AN004;
  4510 00002052 5F                      	pop	di			;AN004; now es:si = es:di = [path]filename,0
  4511 00002053 B98000                  	mov	cx, 128 		;AN004; Maximum 128 char
  4512 00002056 F2AE                    	repnz	scasb			;AN004; find 0
  4513 00002058 4F                      	dec	di			;AN020; Now es:di-> 0
  4514                                  SDVMK_Backward: 			;AN004; find the pointer to the start of the filename.
  4515 00002059 268A05                  	mov	al, byte ptr [es:di]	;AN004;;AN020;We do this by check es:di backward until
  4516 0000205C 3C5C                    	cmp	al, '\' 		;AN004;;AN020; DI = SI or DI -> '\' or DI -> ':'.
  4517 0000205E 740B                    	je	SDVMK_GotFile		;AN004;;AN020;
  4518 00002060 3C3A                    	cmp	al, ':' 		;AN004;
  4519 00002062 7407                    	je	SDVMK_GotFile		;AN004;
  4520 00002064 39F7                    	cmp	di, si			;AN004;
  4521 00002066 7404                    	je	SDVMK_FilePtr		;AN004;
  4522 00002068 4F                      	dec	di			;AN004;
  4523                                  SDVMK_BackWard equ SDVMK_Backward	; NASM port label
  4524 00002069 EBEE                    	jmp	SDVMK_BackWard		;AN004;
  4525                                  SDVMK_GotFile:				;AN004;
  4526 0000206B 47                      	inc	di			;AN004;
  4527                                  SDVMK_FilePtr:				;AN004; now es:di -> start of file name
  4528 0000206C 57                      	push	di			;AN004;
  4529 0000206D 5E                      	pop	si			;AN004; save di to si.
  4530 0000206E 1E                      	push	ds			;AN004; switch es, ds
  4531 0000206F 06                      	push	es			;AN004;
  4532 00002070 1F                      	pop	ds			;AN004;
  4533 00002071 07                      	pop	es			;AN004; now, ds:si -> start of filename
  4534                                   assume es:nothing, ds:nothing
  4535 00002072 BF0800                  	mov	di, DEVMARK_FILENAME	;AN004;
  4536 00002075 57                      	push	di			;AN004;
  4537 00002076 B020                    	mov	al, ' ' 		;AN004;
  4538 00002078 B90800                  	mov	cx, 8			;AN004;
  4539 0000207B F3AA                    	rep	stosb			;AN004; Clean up Memory.
  4540 0000207D 5F                      	pop	di			;AN004;
  4541 0000207E B90800                  	mov	cx, 8			;AN004; Max 8 char. only
  4542                                  SDVMK_Loop:				;AN004;
  4543 00002081 AC                      	lodsb				;AN004;
  4544 00002082 3C2E                    	cmp	al, '.' 		;AN004;
  4545 00002084 7407                    	je	SDVMK_Done		;AN004;
  4546 00002086 3C00                    	cmp	al, 0			;AN004;
  4547 00002088 7403                    	je	SDVMK_Done		;AN004;
  4548 0000208A AA                      	stosb				;AN004;
  4549 0000208B E2F4                    	loop	SDVMK_Loop		;AN004;
  4550                                  SDVMK_Done:				;AN004;
  4551 0000208D C3                      	retn
  4552                                  
  4553                                  Chk_XMAEM	proc	near		;AN029;
  4554                                  ;Function: Check XMAEM.SYS file name.
  4555                                  ;In: ES:SI -> path, filename, 0
  4556                                  ;out: if XMAEM.SYS, then zero flag set.
  4557                                  
  4558 0000208E 06                      	push	es			;AN029;
  4559 0000208F 56                      	push	si			;AN029;
  4560 00002090 1E                      	push	ds			;AN029;
  4561 00002091 57                      	push	di			;AN029;
  4562 00002092 51                      	push	cx			;AN029;
  4563 00002093 89F7                    	mov	di, si			;AN029;save current starting pointer
  4564                                  CX_Cmp: 				;AN029;
  4565 00002095 26803C00                	cmp	byte ptr [es:si], 0	;AN029;
  4566 00002099 7403                    	je	CX_Endfile		;AN029;
  4567 0000209B 46                      	inc	si			;AN029;
  4568 0000209C EBF7                    	jmp	CX_Cmp			;AN029;
  4569                                  CX_Endfile:				;AN029;
  4570 0000209E 4E                      	dec	si			;AN029;
  4571 0000209F 26803C5C                	cmp	byte ptr [es:si], '\'	;AN029;
  4572 000020A3 740C                    	je	CX_Got_Tail		;AN029;
  4573 000020A5 26803C3A                	cmp	byte ptr [es:si], ':'	;AN029;
  4574 000020A9 7406                    	je	CX_Got_Tail		;AN029;
  4575 000020AB 39F7                    	cmp	di, si			;AN029;
  4576 000020AD 7403                    	je	CX_Got_Tail0		;AN029;
  4577 000020AF EBED                    	jmp	CX_Endfile		;AN029;
  4578                                  CX_Got_Tail:				;AN029;
  4579 000020B1 46                      	inc	si			;AN029;
  4580                                  CX_Got_Tail0:				;AN029;
  4581 000020B2 0E                      	push	cs			;AN029;
  4582 000020B3 1F                      	pop	ds			;AN029;
  4583                                   assume ds:SYSINITGROUP
  4584 000020B4 56                      	push	si			;AN029;
  4585 000020B5 5F                      	pop	di			;AN029;now es:di -> filename,0
  4586 000020B6 B90900                  	mov	cx, 9			;AN029;
  4587                                  XMAEM_File equ XMAEM_file	; NASM port label
  4588 000020B9 BE[B503]                	mov	si, offset XMAEM_File	;AN029;ds:si -> XMAEM.SYS,0
  4589 000020BC F3A6                    	repe	cmpsb			;AN029;
  4590                                  CX_Ret: 				;AN029;
  4591 000020BE 59                      	pop	cx			;AN029;
  4592 000020BF 5F                      	pop	di			;AN029;
  4593 000020C0 1F                      	pop	ds			;AN029;
  4594                                   assume ds:nothing
  4595 000020C1 5E                      	pop	si			;AN029;
  4596 000020C2 07                      	pop	es			;AN029;
  4597                                   assume es:nothing
  4598 000020C3 C3                      	ret				;AN029;
  4599                                  Chk_XMAEM	endp
  4600                                  
  4601                                  ;Chk_IBMCACHE	 proc	 near		 ;AN024;AN026; Don't need this any more.
  4602                                  					 ; IBMDOS is going to handle this through 4Bh call.
  4603                                  ;Function: IBMCACHE.SYS does not handle a DOS version 4.0 or above.
  4604                                  ;	   So, this procedure will check if the device driver is IBMCACHE.SYS.
  4605                                  ;	   If it is, through new INT 2fh interface "Set/Restore DOS version"
  4606                                  ;		AX=122Fh
  4607                                  ;		DX= 0 ; reset
  4608                                  ;		    otherwise ; DH = minor version, DL = major version
  4609                                  ;		INT 2fh
  4610                                  ;In: ES:SI -> path, filename, 0
  4611                                  ;out: if IBMCACHE.SYS, then DOS version changed to 4.00 temporarily.
  4612                                  ;     Reset_Dos_Version proc will later reset it back to current DOS version 4.0.
  4613                                  
  4614                                  ;	 push	 es			 ;AN024;
  4615                                  ;	 push	 si			 ;AN024;
  4616                                  ;	 push	 ds			 ;AN024;
  4617                                  ;	 push	 di			 ;AN024;
  4618                                  ;	 push	 cx			 ;AN024;
  4619                                  ;	 mov	 di, si 		 ;AN024;save current starting pointer
  4620                                  ;CIC_Cmp:				 ;AN024;
  4621                                  ;	 cmp	 byte ptr [es:si], 0	 ;AN024;
  4622                                  ;	 je	 CIC_Endfile		 ;AN024;
  4623                                  ;	 inc	 si			 ;AN024;
  4624                                  ;	 jmp	 CIC_Cmp		 ;AN024;
  4625                                  ;CIC_Endfile:				 ;AN024;
  4626                                  ;	 dec	 si			 ;AN024;
  4627                                  ;	 cmp	 byte ptr [es:si], '\'	 ;AN024;
  4628                                  ;	 je	 CIC_Got_Tail		 ;AN024;
  4629                                  ;	 cmp	 byte ptr [es:si], ':'	 ;AN024;
  4630                                  ;	 je	 CIC_Got_Tail		 ;AN024;
  4631                                  ;	 cmp	 di, si 		 ;AN024;
  4632                                  ;	 je	 CIC_Got_Tail0		 ;AN024;
  4633                                  ;	 jmp	 CIC_Endfile		 ;AN024;
  4634                                  ;CIC_Got_Tail:				 ;AN024;
  4635                                  ;	 inc	 si			 ;AN024;
  4636                                  ;CIC_Got_Tail0: 			 ;AN024;
  4637                                  ;	 push	 cs			 ;AN024;
  4638                                  ;	 pop	 ds			 ;AN024;
  4639                                  ;	 push	 si			 ;AN024;
  4640                                  ;	 pop	 di			 ;AN024;now es:di -> filename,0
  4641                                  ;	 mov	 cx, 12 		 ;AN024;
  4642                                  ;	 mov	 si, offset IBMCACHE_File ;AN024;ds:si -> IBMCACHE.SYS,0
  4643                                  ;	 repe	 cmpsb			 ;AN024;
  4644                                  ;	 jnz	 CIC_ret		 ;AN024;
  4645                                  ;	 mov	 ax, 122Fh		 ;AN024;Change DOS version to
  4646                                  ;	 mov	 dx, 2803h		 ;AN024; DOS 3.4 temporarily.
  4647                                  ;	 int	 2fh			 ;AN024;
  4648                                  ;CIC_Ret:				 ;AN024;
  4649                                  ;	 pop	 cx			 ;AN024;
  4650                                  ;	 pop	 di			 ;AN024;
  4651                                  ;	 pop	 ds			 ;AN024;
  4652                                  ;	 pop	 si			 ;AN024;
  4653                                  ;	 pop	 es			 ;AN024;
  4654                                  ;	 ret				 ;AN024;
  4655                                  ;Chk_IBMCACHE	 endp
  4656                                  ;
  4657                                  
  4658                                  Reset_DOS_Version	proc	near	;AN024;
  4659                                  ;Function: issue AX=122Fh, DX=0, INT 2fh to restore the DOS version.
  4660 000020C4 50                      	push	ax			;AN024;
  4661 000020C5 52                      	push	dx			;AN024;
  4662 000020C6 B82F12                  	mov	ax, 122Fh		;AN024;
  4663 000020C9 BA0000                  	mov	dx, 0			;AN024;
  4664 000020CC CD2F                    	int	2fh			;AN024;
  4665 000020CE 5A                      	pop	dx			;AN024;
  4666 000020CF 58                      	pop	ax			;AN024;
  4667 000020D0 C3                      	ret				;AN024;
  4668                                  Reset_DOS_Version	endp
  4669                                  
  4670                                  
  4671                                  %ifndef BUF2
  4672                                  ;Int 2F EMS handler + Int 67h handler for EMS
  4673                                  ;=========================================================================
  4674                                  ; Int_2F_EMS		- This routine provides support for VDISK,
  4675                                  ;			  FASTOPEN, and BUFFERS to determine the physical
  4676                                  ;			  EMS pages available for their usage.
  4677                                  ;
  4678                                  ;	Inputs	: AH - Function code (18h) to return available phys. page
  4679                                  ;		  DI - FEh (Signals to return useable page for VDISK & FASTOPEN)
  4680                                  ;		       FFh (Signals to return useable page for BUFFERS)
  4681                                  ;
  4682                                  ;		  AL = 0 is for installation check. - J.K.
  4683                                  ;
  4684                                  ;	Outputs : ES - Segment value for physical page
  4685                                  ;		  DI - Physical Page number
  4686                                  ;		  AH - Non-zero (physical page not available)
  4687                                  ;		       Zero (valid physical page data returned)
  4688                                  ;
  4689                                  ;		  For installation check, AL = 0FFh for being present. - J.K.
  4690                                  ;		  For the other functions, AX = 0 for successful op.
  4691                                  ;					   AX = -1 for an error.
  4692                                  ;
  4693                                  ;	Date	: 5/5/88
  4694                                  ;	Release : DOS 4.0
  4695                                  ;=========================================================================
  4696                                  
  4697                                  ;Int_2F_Handler  proc			 ;traps Int_2f and checks for EMS	 ;an000; dms;
  4698                                  
  4699                                  EMS_STUB_START label byte		;AN030;J.K.
  4700                                  ;Dummy DEVICE HEADER for other dummy	;AN031; Symphony assumes int 67h handler seg as a device driver!
  4701                                  	DD	-1			;AN031;becomes pointer to next device header
  4702                                  	DW	0C040H			;AN031;attribute (character device)
  4703                                  	DW	0000			;AN031;pointer to harzard area. System will hang.
  4704                                  	DW	0000			;AN031;pointer to harzard area. System will hang.
  4705                                  	DB	'EMMXXXX0'		;AN031;device name
  4706                                  
  4707                                  INTV2F	equ $-EMS_STUB_START		;AN030;J.K.pointer to old 2Fh handler		  ;an000; dms;
  4708                                  IntV2FO DW	?			;AN030;;offset				       ;an000; dms;
  4709                                  IntV2FS DW	?			;AN030;;segment 			       ;an000; dms;
  4710                                  
  4711                                  OLDINT67_VECTOR equ $-EMS_STUB_START	;AN030;J.K.
  4712                                  OldInt67	dd	?		;AN030;; save pointer to old INT 67 handler here
  4713                                  
  4714                                  %IF	BUFFERFLAG
  4715                                  
  4716                                  LOCKFLAG	equ $-EMS_STUB_START
  4717                                  LOCK_FLAG	db  ?
  4718                                  
  4719                                  %ELSE
  4720                                  
  4721                                  EMSPAGE_CNT	equ	$-EMS_STUB_START ;AN030;J.K.
  4722                                  EMSPageCount	dw	?		;AN030;; save count of EMS mappable pages here
  4723                                  
  4724                                  EMSReservedArray_X label word		;AN030;;J.K. For initialization routine
  4725                                  EMSRESERVEDARRAY equ $-EMS_STUB_START	;AN030;;J.K.
  4726                                  		 dw	0ffffh,0ffffh	;AN030;; array of reserved pages
  4727                                  		 dw	0ffffh,0ffffh	;AN030;; phys_page_segment, phys_page_number * 2 entries
  4728                                  MappableArray_X label  word		;AN030;;J.K. for initialization routine
  4729                                  MAPPABLEARRAY	equ  $-EMS_STUB_START	;AN030;;J.K.
  4730                                  		dw	64 dup (0,0)	;AN030;; table to get addresses from old INT 67 handler
  4731                                  
  4732                                  %ENDIF
  4733                                  					; 64 entries * 2 words
  4734                                  NEWEMS2F_OFF	equ	$-EMS_STUB_START;AN030;
  4735                                  Int_2F_EMS:				;AN030;;J.K. Name changed.
  4736                                  	cmp	ah,1Bh			;AN030;;AN032;2Fh trap for Mappable Phys. Add. Array ;an000; dms;
  4737                                  	je	Int_2F_EMS_MINE 	;AN030;;This one we want		       ;an000; dms;
  4738                                  
  4739                                  IntV2F equ INTV2F	; NASM port equate
  4740                                  	jmp	far [cs:IntV2F]	;AN030;;go to old interrupt handler	       ;an000; dms;
  4741                                  
  4742                                  Int_2F_EMS_MINE:			;AN030;
  4743                                  	or	al, al			;AN030;;J.K. Installation check?
  4744                                  	jnz	Int_2F_5800_Func	;AN030;;J.K.
  4745                                  	mov	al, 0FFh		;AN030;;J.K. Yes, I am here!
  4746                                  	iret				;AN030;;J.K.
  4747                                  
  4748                                  Int_2F_5800_Func:			;AN030;
  4749                                  
  4750                                  %IF	BUFFERFLAG
  4751                                  ;	int	3
  4752                                  	cmp	di, 80h
  4753                                  	jne	st_flag
  4754                                  	mov	byte [cs:LOCKFLAG], 0
  4755                                  Int_2f_5800_Good_Exit equ Int_2F_5800_Good_Exit	; NASM port label
  4756                                  	jmp	Int_2f_5800_Good_Exit
  4757                                  	nop	; identicalise
  4758                                  st_flag:
  4759                                  	cmp	di, 81h
  4760                                  Int_2f_5800_Err_Exit equ Int_2F_5800_Err_Exit	; NASM port label
  4761                                  	jne	Int_2f_5800_Err_Exit
  4762                                  	mov	byte [cs:LOCKFLAG], 1
  4763                                  	jmp	Int_2f_5800_Good_Exit
  4764                                  	nop	; identicalise
  4765                                  %ELSE
  4766                                  
  4767                                  	push	si			;AN030;;				       ;an000; dms;
  4768                                  
  4769                                  ;	 mov	 si,offset EMSReservedArray ;point to array containing pages	 ;an000; dms;
  4770                                  	mov	si, EMSRESERVEDARRAY	;AN030;;J.K.
  4771                                  
  4772                                  	cmp	di,0feh 		;AN030;;VDISK or FASTOPEN request?	       ;an000; dms;
  4773                                  	jne	Int_2F_5800_Buff_Ck	;AN030;;no - check for buffers		       ;an000; dms;
  4774                                  
  4775                                  	cmp	word ptr [cs:si],0ffffh  ;AN030;;valid entry?				;an000; dms;
  4776                                  	je	Int_2F_5800_Err_Exit	;AN030;;no - exit			       ;an000; dms;
  4777                                  
  4778                                  	mov	es,word ptr [cs:si]	;AN030;;get segment value		       ;an000; dms;
  4779                                  	mov	di,word ptr [cs:si+2]	;AN030;;get physical page value 	       ;an000; dms;
  4780                                  	jmp	Int_2F_5800_Good_Exit	;AN030;;exit routine			       ;an000; dms;
  4781                                  
  4782                                  Int_2F_5800_Buff_Ck:			;AN030;
  4783                                  
  4784                                  	cmp	di,0ffh 		;AN030;;BUFFERS request?		       ;an000; dms;
  4785                                  	jne	Int_2F_5800_Err_Exit	;AN030;;no - exit with error		       ;an000; dms;
  4786                                  
  4787                                  	add	si,4			;AN030;;point to second element in array       ;an000; dms;
  4788                                  
  4789                                  	cmp	word ptr [cs:si],0ffffh  ;AN034;;valid entry?				;an000; dms;
  4790                                  	je	Int_2F_5800_Err_Exit	;AN034;;no - exit			       ;an000; dms;
  4791                                  
  4792                                  	mov	es,word ptr [cs:si]	;AN030;;get segment value		       ;an000; dms;
  4793                                  	mov	di,word ptr [cs:si+2]	;AN030;;get physical page value 	       ;an000; dms;
  4794                                  
  4795                                  %ENDIF
  4796                                  
  4797                                  Int_2F_5800_Good_Exit:			;AN030;
  4798                                  
  4799                                  	xor	ax,ax			;AN030;;signal good return		       ;an000; dms;
  4800                                  	jmp	Int_2F_Exit		;AN030;;exit routine			       ;an000; dms;
  4801                                  	nop	; identicalise
  4802                                  
  4803                                  Int_2F_5800_Err_Exit:			;AN030;
  4804                                  
  4805                                  	mov	ax,0ffffh		 ;AN030;;signal error				;an000; dms;
  4806                                  
  4807                                  Int_2F_Exit:				;AN030;
  4808                                  
  4809                                  
  4810                                  %IFN BUFFERFLAG
  4811                                  	pop	si			;AN030;;restore regs			       ;an000; dms;
  4812                                  %ENDIF
  4813                                  	iret				;AN030;;return to caller		       ;an000; dms;
  4814                                  
  4815                                  
  4816                                  
  4817                                  ;-------------------------------------------------------------------
  4818                                  ;
  4819                                  ;	INT 67h Filter
  4820                                  ;
  4821                                  ;	This routine filters INT 67's looking for AH=58h.  When initialized,
  4822                                  ;	the original INT 67 handler is called and the mappable address array
  4823                                  ;	is changed to "reserve" two pages for DOS use.	This new array is
  4824                                  ;	then returned to the calling program when INT 67 AH=58h is found.
  4825                                  ;
  4826                                  ;	Information about the two pages "reserved" for DOS is returned
  4827                                  ;	via an unpublished INT 2Fh interface.
  4828                                  ;
  4829                                  ;	5/10/88 for DOS 4.0.
  4830                                  ;-------------------------------------------------------------------
  4831                                  
  4832                                  %IFN BUFFERFLAG
  4833                                  
  4834                                  GetMappableArray equ	58h		; INT 67 function code for Get Mappable Array
  4835                                  GetPageFrame	equ	41h		; function code for getting the page frame address
  4836                                  null		equ	0		; zero value
  4837                                  I67Error8F	equ	8fh		;AN031;; invalid sub-function error
  4838                                  
  4839                                  %ENDIF
  4840                                  
  4841                                  ;-------------------------------------------------------------------
  4842                                  NEW67_OFFSET	equ	$-EMS_STUB_START	;J.K.
  4843                                  Int67Filter:				;AN030;
  4844                                  
  4845                                  %IF	BUFFERFLAG
  4846                                  ;	int	3
  4847                                  	cmp	byte [cs:LOCKFLAG], 1
  4848                                  	jne	PassThru
  4849                                  	mov	ah, 80h
  4850                                  	stc
  4851                                  	iret
  4852                                  %ELSE
  4853                                  GETMAPPABLEARRAY equ GetMappableArray	; NASM port equate
  4854                                  	cmp	ah,GETMAPPABLEARRAY	;AN030;; is this the INT 67 call we are interested in?
  4855                                  	jne	PassThru		;AN030;; no, pass it to old INT 67 handler
  4856                                  					;AN030;; yes ...
  4857                                  	cmp	al,0			;AN031;; AL=0 return count and table
  4858                                  	je	I67Fcn0
  4859                                  
  4860                                  	cmp	al,1			;AN031;; AL=1 return count only
  4861                                  	jne	I67Error		;AN031;; otherwise, error
  4862                                  
  4863                                  
  4864                                  ;	return count of mappable pages
  4865                                  
  4866                                  	sti				;AN031;; turn interrupts on
  4867                                  
  4868                                  	mov	cx,word ptr [cs:EMSPAGE_CNT]    ;AN031;J.K. get number of mappable pages in fake table
  4869                                  	xor	ah,ah			;AN031;; good return code
  4870                                  	iret
  4871                                  
  4872                                  ;	return invalid sub-function code
  4873                                  
  4874                                  I67Error:
  4875                                  	sti				;AN031;; turn interrupts on
  4876                                  	mov	ah,I67Error8F		;AN031;; invalid sub-function error
  4877                                  	iret
  4878                                  
  4879                                  
  4880                                  I67Fcn0:				;AN031
  4881                                  
  4882                                  ;	copy the fake table to user's buffer
  4883                                  
  4884                                  	sti				;AN030;; turn interrupts on
  4885                                  
  4886                                  	push	ds			;AN030; save some regs
  4887                                  	push	di			;AN030;
  4888                                  	push	si			;AN030;
  4889                                  
  4890                                  	mov	cx,word ptr [cs:EMSPAGE_CNT]    ;AN030;J.K. get number of mappable pages in fake table
  4891                                  	shl	cx,1			;AN030;; count * 2 = number of words to copy
  4892                                  
  4893                                  	push	cs			;AN030;; point DS:SI to fake table
  4894                                  	pop	ds			;AN030;
  4895                                  ;	 lea	 si,MappableArray
  4896                                  	mov	si, MAPPABLEARRAY	;AN030;;J.K.
  4897                                  
  4898                                  	rep	movsw			;AN030;; copy CX words from DS:SI to ES:DI
  4899                                  
  4900                                  	xor	ah,ah			;AN030;; good return code
  4901                                  	mov	cx,word ptr [cs:EMSPAGE_CNT] ;AN030;; page count returned to user in CX
  4902                                  
  4903                                  
  4904                                  	pop	si			;AN030;; restore some regs
  4905                                  	pop	di			;AN030;
  4906                                  	pop	ds			;AN030;
  4907                                  
  4908                                  	iret				;AN030;; end of INT 67 filter routine
  4909                                  
  4910                                  %ENDIF
  4911                                  
  4912                                  ;-------------------------------------------------------------------
  4913                                  ;
  4914                                  ;	PassThru - send request to old INT 67 handler
  4915                                  ;
  4916                                  ;-------------------------------------------------------------------
  4917                                  
  4918                                  PassThru:
  4919                                  OldINT67_VECTOR equ OLDINT67_VECTOR	; NASM port equate
  4920                                  	jmp	far [cs:OldINT67_VECTOR] ;AN030;;J.K. jump to old INT 67 handler
  4921                                  					; (IRET will return to calling program)
  4922                                  
  4923                                  
  4924                                  EMS_STUB_END	label	byte		;AN030;
  4925                                  ;-------------------------------------------------------------------
  4926                                  
  4927                                  %IFN BUFFERFLAG
  4928                                  ;-------------------------------------------------------------------
  4929                                  ;
  4930                                  ;	Int67FilterInit - This routine is called to initialize the INT 67
  4931                                  ;	filter. It should be called as soon as possible after installation.
  4932                                  ;
  4933                                  ;-------------------------------------------------------------------
  4934                                  
  4935                                  Int67FilterInit:			;AN030;
  4936                                  	push	es			;AN030;; save caller's ES:DI
  4937                                  	push	di			;AN030;
  4938                                  
  4939                                  	push	cs			;AN030;; make ES:DI point to our array
  4940                                  	pop	es			;AN030;
  4941                                  	mov	di,offset MappableArray_X   ;AN030;
  4942                                  
  4943                                  ;	 call	 dword ptr cs:OldInt67	    ; get mappable array from EMS DD
  4944                                  
  4945                                  	mov	ah, GetMappableArray	;AN030;
  4946                                  	xor	al,al			;AN030;
  4947                                  	int 67h 			;AN030;;J.K.
  4948                                  
  4949                                  
  4950                                  ;------------------------
  4951                                  ; scan table looking for highest phys_page_number
  4952                                  
  4953                                  	xor	ax,ax			;AN030;;
  4954                                  
  4955                                  	cmp	cx,0			;AN033;; are the any pages left?
  4956                                  	je	NoMoreEMSPages		;AN033;; no, don't bother looking any more
  4957                                  
  4958                                  	call	GetHighestPage		;AN030;; get highest entry from table
  4959                                  
  4960                                  	mov	[cs:EMSReservedArray_X+4],bx   ;AN030;; phys_page_segment
  4961                                  	mov	[cs:EMSReservedArray_X+6],ax   ;AN030;; phys_page_number
  4962                                  
  4963                                  	cmp	cx,0			;AN033;; are the any pages left?
  4964                                  	je	NoMoreEMSPages		;AN033;; no, don't bother looking any more
  4965                                  
  4966                                  	call	GetHighestPage		;AN030;; get next highest entry from table
  4967                                  
  4968                                  	mov	[cs:EMSReservedArray_X+0],bx   ;AN030;; phys_page_segment
  4969                                  	mov	[cs:EMSReservedArray_X+2],ax   ;AN030;; phys_page_number
  4970                                  
  4971                                  NoMoreEMSPages: 			;AN033;;
  4972                                  	mov	[cs:EMSPageCount],cx 	;AN030;; save new page count for INT 67 filter
  4973                                  
  4974                                  	pop	di
  4975                                  	pop	es
  4976                                  	ret				;AN030;; return to calling program
  4977                                  
  4978                                  
  4979                                  ;	page
  4980                                  ;-------------------------------------------------------------------
  4981                                  ;
  4982                                  ;	GetHighestPage - returns highest physical page number in AX
  4983                                  ;	and segment for it in BX.  A -1 means no valid page found.
  4984                                  ;
  4985                                  ;-------------------------------------------------------------------
  4986                                  GetHighestPage:
  4987                                  
  4988                                  	xor	ax,ax			;AN030;; zero candidate register
  4989                                  	mov	bx,ax			;AN030;; zero pointer to candidate page
  4990                                  
  4991                                  	push	cx			;AN030;; save count
  4992                                  	push	dx			;AN030;
  4993                                  	push	di			;AN030;; save pointer
  4994                                  
  4995                                  PageScanLoop:				;AN030;
  4996                                  	cmp	ax,[ES:di+2]		;AN030;; get phys_page_number
  4997                                  	ja	LookAtNextPage		;AN030;; this one is lower than the one we are holding
  4998                                  
  4999                                  	cmp	word [es:di], 0a000h 	; Only reserve pages in memory above 640K..
  5000                                  	jb	LookAtNextPage		; fix for ps2emm and m20emm with motherboard
  5001                                  					; disabled. 7/25/88. HKN.
  5002                                  
  5003                                  	mov	ax,[ES:di+2]		;AN030;; this one is higher, make it new candidate
  5004                                  	mov	bx,di			;AN030;; pointer to new candidate page, used to zero
  5005                                  					; it later so we don't get the same one again
  5006                                  	mov	dx,cx			;AN030;; save count where we found candidate
  5007                                  
  5008                                  LookAtNextPage: 			;AN030;
  5009                                  	add	di,4			;AN030;; point to next entry in mappable table
  5010                                  
  5011                                  	loop	PageScanLoop		;AN030;; look at next entry
  5012                                  
  5013                                  	cmp	bx,null 		;AN030;; did we find any pages?
  5014                                  	jne	FoundOne		;AN030;; yes, exit
  5015                                  
  5016                                  	jmp	ReturnError		;AN030;
  5017                                  
  5018                                  ;------------------------
  5019                                  FoundOne:				;AN030;
  5020                                  	cmp	ax,3			;AN030;; could the one we found be part of a page frame
  5021                                  NotFrame equ Notframe	; NASM port label
  5022                                  	ja	NotFrame		;AN030;; no, carry on
  5023                                  
  5024                                  ;	yes, find out if it is part of frame
  5025                                  
  5026                                  	push	ax			;AN030;; save physical page number
  5027                                  	push	bx			;an030;; dms; bx destroyed by call
  5028                                  	mov	ah,GetPageFrame 	;AN030;; function code to get page frame ...
  5029                                  ;	 call	 dword ptr cs:OldInt67	    ; ... from the EMS DD
  5030                                  	int	67h			;AN030;;J.K.
  5031                                  	or	ah,ah			;an030;;dms; error?
  5032                                  	pop	bx			;an030;;dms; restore bx
  5033                                  	pop	ax			;AN030;; restore phys page number
  5034                                  	jnz	NotFrame		;AN030;; no frame available, carry on
  5035                                  
  5036                                  ;	there is a frame, this page is part of frame, so return -1's
  5037                                  
  5038                                  ReturnError:				;AN030;
  5039                                  	mov	ax,0ffffh		;AN030;; indicate failure
  5040                                  	mov	bx,ax			;AN030;; ax and bx = -1
  5041                                  
  5042                                  	pop	di			;AN030;; restore pointer
  5043                                  	pop	dx
  5044                                  	pop	cx			;AN030;; restore count
  5045                                  
  5046                                  	jmp	GHPExit 		;AN030;
  5047                                  
  5048                                  
  5049                                  
  5050                                  
  5051                                  ;------------------------
  5052                                  ;	Found a page, and it is not part of a page frame, so re-pack table
  5053                                  ;	and return info.  The entry we "reserve" for DOS must be removed
  5054                                  ;	from the table and the other entries moved up to repack the table.
  5055                                  ;	The count must be reduced by 1 to reflect this change.
  5056                                  
  5057                                  Notframe:				;AN030;
  5058                                  
  5059                                  	mov	di,bx			;AN030;; make ES:DI point to highest page table entry
  5060                                  
  5061                                  	mov	bx,[ES:di]		;AN030;; get segment address of page
  5062                                  
  5063                                  	mov	cx,dx			;AN030;; get count from candidate page
  5064                                  
  5065                                  	push ax 			;AN030;
  5066                                  PackLoop:				;AN030;
  5067                                  	mov	ax, [es:di+4]		;AN030;
  5068                                  	mov	[es:di+0], ax		;AN030;
  5069                                  	mov	ax, [es:di+6]		;AN030;
  5070                                  	mov	[es:di+2], ax		;AN030;
  5071                                  	add	di, 4			;AN030;
  5072                                  	loop	PackLoop		;AN030;; do it until done
  5073                                  	pop  ax 			;AN030;
  5074                                  
  5075                                  	pop	di			;AN030;; restore pointer
  5076                                  	pop	dx			;AN030;
  5077                                  	pop	cx			;AN030;; restore count
  5078                                  
  5079                                  	sub	cx,1			;AN030;; reduce count by one, one less page in table now
  5080                                  
  5081                                  GHPExit:				;AN030;
  5082                                  
  5083                                  	ret				;AN030;; return to caller
  5084                                  
  5085                                  %ENDIF
  5086                                  
  5087                                  ;=========================================================================
  5088                                  ; EMS_Install_Check	: THIS MODULE DETERMINES WHETHER OR NOT EMS IS
  5089                                  ;			  INSTALLED FOR THIS SESSION.
  5090                                  ;
  5091                                  ;	INPUTS		: NONE
  5092                                  ;
  5093                                  ;	OUTPUTS 	: ES:BX - FRAME ARRAY
  5094                                  ;			  CY	- EMS NOT AVAILABLE
  5095                                  ;			  NC	- EMS AVAILABLE
  5096                                  ;
  5097                                  ;	Date	: 5/6/88
  5098                                  ;=========================================================================
  5099                                  
  5100                                  EMS_Install_Check	proc	near	;AN030;; check if EMS is installed	       ;an000; dms;
  5101                                  
  5102                                  	push	ax			;AN030;; save regs			       ;an000; dms;
  5103                                  
  5104                                  	push	ds			;AN030;; save ds			       ;an000; dms;
  5105                                  	xor	ax,ax			;AN030;; set ax to 0			       ;an000; dms;
  5106                                  	mov	ds,ax			;AN030;; set ds to 0			       ;an000; dms;
  5107                                  	cmp	word ptr [067h*4+0],0 ;AN030;; see if int 67h is there	       ;an000; dms;
  5108                                  	pop	ds			;AN030;; restore ds			       ;an000; dms;
  5109                                  	je	EMS_Install_Ck_Err_Exit ;AN030;; exit routine - EMS not loaded	       ;an000; dms;
  5110                                  
  5111                                  	mov	ah,40h			;AN030;; Get Status function		       ;an000; dms;
  5112                                  	xor	al,al			;AN030;; clear al			       ;an000; dms;
  5113                                  	int	67h			;AN030;;				       ;an000; dms;
  5114                                  	or	ah,ah			;AN030;; EMS installed? 		       ;an000; dms;
  5115                                  	jnz	EMS_Install_Ck_Err_Exit ;AN030;; exit routine - EMS not loaded	       ;an000; dms;
  5116                                  
  5117                                  	mov	ah,46h			;AN030;; Get Version number		       ;an000; dms;
  5118                                  	xor	al,al			;AN030;; clear al			       ;an000; dms;
  5119                                  	int	67h			;AN030;;				       ;an000; dms;
  5120                                  	cmp	al,40h			;AN030;; Version 4.0?			       ;an000; dms;
  5121                                  	jb	EMS_Install_Ck_Err_Exit ;AN030;; exit routine - wrong EMS loaded       ;an000; dms;
  5122                                  
  5123                                  	clc				;AN030;; signal EMS loaded		       ;an000; dms;
  5124                                  	jmp	EMS_Install_Ck_Exit	;AN030;; exit routine			       ;an000; dms;
  5125                                  	nop	; identicalise
  5126                                  
  5127                                  EMS_Install_Ck_Err_Exit:		;AN030;
  5128                                  
  5129                                  	stc				;AN030;; signal EMS not loaded		       ;an000; dms;
  5130                                  
  5131                                  EMS_Install_Ck_Exit:			;AN030;
  5132                                  
  5133                                  	pop	ax			;AN030;; restore regs			       ;an000; dms;
  5134                                  
  5135                                  	ret				;AN030;; return to caller		       ;an000; dms;
  5136                                  
  5137                                  EMS_Install_Check	endp		;					;an000; dms;
  5138                                  
  5139                                  EMS_Stub_Handler	proc	near	;AN030;
  5140                                  ;At the request of Architecture Group, this logic is implemented.
  5141                                  ;Function: If (Buffer_Slash_X <> 0 and EMS_Stub_Installed == 0),
  5142                                  ;	    then { call Chk_EMS;
  5143                                  ;		   if EMS is there, then install EMS_Stub dynamically
  5144                                  ;		    and initialize it.}
  5145                                  ;      Note: EMS_Stub consists of INT 2fh EMS handler and INT 67h handler.
  5146                                  ;	   When EMS_Stub is installed, EMS_Stub_Installed will be set to 1.
  5147                                  
  5148                                  	push	es			;AN030;
  5149                                  	push	si			;AN030;
  5150                                  	push	ds			;AN030;
  5151                                  	push	di			;AN030;
  5152                                  	push	ax			;AN030;
  5153                                  	push	cx			;AN030;
  5154                                  	cmp	byte [cs:EMS_Stub_Installed], 0	;AN030;
  5155                                  	je	EMS_Stub_X		;AN030;
  5156                                  	jmp short EMS_SH_Ret		;AN030;
  5157                                  	nop	; identicalise
  5158                                  EMS_Stub_X:				;AN030;
  5159                                  	cmp	byte [cs:Buffer_Slash_X], 0	;AN030;
  5160                                  	je     EMS_SH_Ret		;AN030;
  5161                                  	call	EMS_Install_Check	;AN030;
  5162                                  	jc	EMS_SH_Ret		;AN030;
  5163                                  ;Install EMS_Stub.			;AN030;
  5164                                  EMS_Stub_Do:
  5165                                  	push	es			;AN030;
  5166                                  	xor	ax,ax			;AN030;save current Int 2fh, 67h vectors.
  5167                                  	mov	es, ax			;AN030;
  5168                                  	mov	ax, word ptr [es:2fh*4] ;AN030;
  5169                                  	mov	[cs:IntV2FO], ax		;AN030;
  5170                                  	mov	ax, word ptr [es:2fh*4+2]	;AN030;
  5171                                  	mov	[cs:IntV2FS], ax			;AN030;
  5172                                  	mov	ax, word ptr [es:67h*4] 	;AN030;
  5173                                  	mov	word ptr [cs:OldInt67], ax	;AN030;
  5174                                  	mov	ax, word ptr [es:67h*4+2]	;AN030;
  5175                                  	mov	word ptr [cs:OldInt67+2], ax	;AN030;
  5176                                  	pop	es				;AN030;
  5177                                  
  5178                                  %IFN BUFFERFLAG
  5179                                  ;initalize tables in INT 67h handler
  5180                                  	call	Int67FilterInit 		;AN030;
  5181                                  	cmp	ax, 0ffffh			; if the page found was part of a lim 4.0 page frame
  5182                                  EMS_SH_ret equ EMS_SH_Ret	; NASM port label
  5183                                  	je	EMS_SH_ret			;	do not install stub.  7/24/88. HKN
  5184                                  %ENDIF
  5185                                  Round equ ROUND	; NASM port label
  5186                                  	call	Round				;AN030;
  5187                                  	mov	ax, DEVMARK_EMS_STUB		;AN030;
  5188                                  	call	SetDevMark			;AN030;
  5189                                  memhi equ MEMHI	; NASM port label
  5190                                  	mov	ax, [cs:memhi]			;AN030;
  5191                                  	mov	es, ax				;AN030;
  5192                                  	assume	es:nothing			;AN030;
  5193                                  	xor	di, di				;AN030;
  5194                                  	push	cs				;AN030;
  5195                                  	pop	ds				;AN030;
  5196                                  	mov	cx, offset EMS_STUB_END 	;AN030;
  5197                                  	mov	si, offset EMS_STUB_START	;AN030;
  5198                                  	sub	cx, si				;AN030;cx = size in byte
  5199                                  memlo equ MEMLO	; NASM port label
  5200                                  	mov	[cs:memlo], cx			;AN030;
  5201                                  	rep	movsb				;AN030;
  5202                                  	or	byte [cs:SetDevMarkFlag], FOR_DEVMARK	;AN030;set the devmark_size for MEM command.
  5203                                  	call	Round				;AN030;and get the next [memhi] avaiable.
  5204                                  	mov	byte [cs:EMS_Stub_Installed], 1		;AN030;
  5205                                  
  5206                                  	xor	ax, ax				;AN030;
  5207                                  	mov	ds, ax				;AN030;
  5208                                  	cli					;AN030;
  5209                                  	mov	word ptr [2Fh*4],NEWEMS2F_OFF;AN030;set the new int 2fh, 67h vectors.
  5210                                  	mov	word ptr [2Fh*4+2], es	;AN030;
  5211                                  	mov	word ptr [67h*4],NEW67_OFFSET;AN030;
  5212                                  	mov	word ptr [67h*4+2], es	;AN030;
  5213                                  	sti					;AN030;
  5214                                  EMS_SH_Ret:					;AN030;
  5215                                  	pop	cx				;AN030;
  5216                                  	pop	ax				;AN030;
  5217                                  	pop	di				;AN030;
  5218                                  	pop	ds				;AN030;
  5219                                  	pop	si				;AN030;
  5220                                  	pop	es				;AN030;
  5221                                  	ret					;AN030;
  5222                                  
  5223                                  EMS_Stub_Handler	endp			;AN030;
  5224                                  %endif	; BUF2
  5225                                  
  5226                                  
  5227                                   global ldos_getnum_far
  5228                                   extern ldos_getnum
  5229                                  ldos_getnum_far:
  5230 000020D1 E8(0000)                	call ldos_getnum
  5231 000020D4 CB                      	retf
  5232                                  
  5233                                   global isstring?, skipcomma, skipcomm0, skipwhite, skipwh0
  5234                                  skipcomma:
  5235 000020D5 AC                      	lodsb
  5236                                  skipcomm0:
  5237 000020D6 E80600                  	call skipwh0
  5238 000020D9 3C2C                    	cmp al, ','
  5239 000020DB 7401                    	je skipwhite
  5240 000020DD C3                      	retn
  5241                                  
  5242                                  skipwhite:
  5243 000020DE AC                      	lodsb
  5244                                  skipwh0:
  5245 000020DF 3C20                    	cmp al, 32
  5246 000020E1 74FB                    	je skipwhite
  5247 000020E3 3C09                    	cmp al, 9
  5248 000020E5 74F7                    	je skipwhite
  5249 000020E7 C3                      	retn
  5250                                  
  5251                                  
  5252                                  		; Check for given string (cap-insensitive)
  5253                                  		;
  5254                                  		; INP:	ds:si -> input string to check (either cap),
  5255                                  		;	 terminated by CR (13), NUL, semicolon, space,
  5256                                  		;	 tab, dot, comma, equals, colon, [, ], (, or )
  5257                                  		;	es:dx -> ASCIZ string to check (all-caps)
  5258                                  		; OUT:	Iff string matches,
  5259                                  		;	 ZR, NC
  5260                                  		;	 si -> at separator that terminates the keyword
  5261                                  		;	else,
  5262                                  		;	 NZ, CY
  5263                                  		;	 si = input si
  5264                                  		; CHG:	dx, al
  5265                                  isstring?:
  5266 000020E8 56                      	push si
  5267 000020E9 87D7                    	xchg dx, di
  5268                                  .loop:
  5269 000020EB AC                      	lodsb
  5270 000020EC E84800                  	call capitalise
  5271 000020EF AE                      	scasb
  5272 000020F0 7506                    	jne .mismatch
  5273 000020F2 84C0                    	test al, al		; NC
  5274 000020F4 75F5                    	jne .loop
  5275                                  				; ZR
  5276 000020F6 EB39                    	jmp .matched_zr_nc
  5277                                  
  5278                                  .mismatch:
  5279 000020F8 E84700                  	call iseol?
  5280 000020FB 742D                    	je .checkend
  5281 000020FD 3C20                    	cmp al, 32
  5282 000020FF 7429                    	je .checkend
  5283 00002101 3C09                    	cmp al, 9
  5284 00002103 7425                    	je .checkend
  5285 00002105 3C2E                    	cmp al, '.'
  5286 00002107 7421                    	je .checkend
  5287 00002109 3C2C                    	cmp al, ','
  5288 0000210B 741D                    	je .checkend
  5289 0000210D 3C3D                    	cmp al, '='
  5290 0000210F 7419                    	je .checkend
  5291 00002111 3C3A                    	cmp al, ':'
  5292 00002113 7415                    	je .checkend
  5293 00002115 3C5B                    	cmp al, '['
  5294 00002117 7411                    	je .checkend
  5295 00002119 3C5D                    	cmp al, ']'
  5296 0000211B 740D                    	je .checkend
  5297 0000211D 3C28                    	cmp al, '('
  5298 0000211F 7409                    	je .checkend
  5299 00002121 3C29                    	cmp al, ')'
  5300 00002123 7405                    	je .checkend
  5301                                  .ret_nz:	; NZ
  5302 00002125 5E                      	pop si
  5303 00002126 F9                      	stc			; CY
  5304                                  .ret:
  5305 00002127 87D7                    	xchg dx, di
  5306 00002129 C3                      	retn
  5307                                  
  5308                                  .checkend:
  5309 0000212A 26807DFF00              	cmp byte [es:di - 1], 0
  5310 0000212F 75F4                    	jne .ret_nz
  5311                                  				; ZR, NC
  5312                                  .matched_zr_nc:	; ZR, NC
  5313 00002131 5F                      	pop di			; (discard)
  5314 00002132 8D74FF                  	lea si, [si - 1]	; -> separator (preserve ZR)
  5315 00002135 EBF0                    	jmp .ret
  5316                                  
  5317                                  
  5318                                  capitalise:
  5319 00002137 3C61                    	cmp al, 'a'
  5320 00002139 7206                    	jb .ret
  5321 0000213B 3C7A                    	cmp al, 'z'
  5322 0000213D 7702                    	ja .ret
  5323 0000213F 24DF                    	and al, ~ 20h
  5324                                  .ret:
  5325 00002141 C3                      	retn
  5326                                  
  5327                                  iseol?:
  5328 00002142 3C3B                    	cmp al, ';'
  5329 00002144 740A                    	je .ret
  5330                                  .notsemicolon:
  5331 00002146 3C0D                    	cmp al, 13
  5332 00002148 7406                    	je .ret
  5333 0000214A 3C0A                    	cmp al, 10
  5334 0000214C 7402                    	je .ret
  5335 0000214E 3C00                    	cmp al, 0
  5336                                  .ret:
  5337 00002150 C3                      	retn
  5338                                  
  5339                                  
  5340                                  ; (no prior section) ; SYSINITSEG	ENDS
  5341                                  	END
  5342                                  
  5343                                  
