     1                                  ;	Title	Share_2
     2                                  ;				   $SALUT (0,36,41,44)
     3                                  				   %include "sharehdr.mac"
     1                              <1> ;        page    80,132
     2                              <1> ;******************* START OF SPECIFICATIONS ***********************************
     3                              <1> ;
     4                              <1> ; MODULE NAME:          SHARE.EXE     (a true EXE file)
     5                              <1> ;
     6                              <1> ; DESCRIPTIVE NAME:     SHARE resident service routines - part 1 - GSHARE.SAL
     7                              <1> ;                                                       - part 2 - GSHARE2.SAL
     8                              <1> ;                                                       - part 3 - SHARESR.SAL
     9                              <1> ;
    10                              <1> ; FUNCTION:             Provide file sharing services for DOS
    11                              <1> ;
    12                              <1> ; ENTRY POINT:          DOS Jump Table - installed by SHARE at initalization
    13                              <1> ;
    14                              <1> ;                             MFT_Enter          1
    15                              <1> ;                             MFTClose           2
    16                              <1> ;                             MFTClu             3
    17                              <1> ;                             MFTCloseP          4
    18                              <1> ;                             MFTCloN            5
    19                              <1> ;                             Set_Mult_Block     6
    20                              <1> ;                             Clr_Mult_Block     7
    21                              <1> ;                             Chk_Block          8
    22                              <1> ;                             MFT_Get            9
    23                              <1> ;
    24                              <1> ; INPUT:                See Prolog to individual entry points
    25                              <1> ;
    26                              <1> ; EXIT NORMAL:          CF = 0 and requested task performed.
    27                              <1> ;
    28                              <1> ; EXIT ERROR:           CF = 1 ans error code in AX
    29                              <1> ;
    30                              <1> ; INTERNAL REFERENCES:
    31                              <1> ;
    32                              <1> ;       ROUTINES:       Set_Block               BCS
    33                              <1> ;                       Clr_Block               CSL
    34                              <1> ;                       CLP                     CUC
    35                              <1> ;                       Load_Regs               CSI
    36                              <1> ;                       ASC                     GOM
    37                              <1> ;
    38                              <1> ;       DATA AREAS:
    39                              <1> ;
    40                              <1> ; EXTERNAL REFERENCES:  INT 21       INT 2F
    41                              <1> ;     together with:
    42                              <1> ;
    43                              <1> ;     fnm:near, rsc:near, rmn:near, cps:near, ofl:near, sle:near, interr:near
    44                              <1> ;
    45                              <1> ;       ROUTINES:
    46                              <1> ;
    47                              <1> ;       DATA AREAS:
    48                              <1> ;
    49                              <1> ; NOTES:                The second part of this utility is GSHARE2.ASM
    50                              <1> ;
    51                              <1> ; REVISION HISTORY:       Version 1.0  09/09/83 - first release              GL
    52                              <1> ;                                      09/13/83 - Installability             MZ
    53                              <1> ;                                      01/11/84 - FCB compatability changes  MZ
    54                              <1> ;                         PTM P000438  08/21/86 - SFT LCK FIELDS not 0 error DL
    55                              <1> ;                   Ax000 Ver 4.0      04/15/87 - changed:- Set_Block        FJG
    56                              <1> ;                                                         - Clr_Block        FJG
    57                              <1> ;                                                         - Chk_Block        FJG
    58                              <1> ;                                                         - CLP              FJG
    59                              <1> ;                                                  new:   - Set_Mult_Block   FJG
    60                              <1> ;                                                         - Clr_Mult_Block   FJG
    61                              <1> ;                                                         - Load_Regs        FJG
    62                              <1> ;                                                         - Clr_List         FJG
    63                              <1> ;                   Ax002  PTM P001658  10/15/87 - changed I/F to IBMDOS     FJG
    64                              <1> ;                   Ax003  PTM P002064  10/15/87 - ShSU SFT - IFS call error FJG
    65                              <1> ;                   Ax004  PTM P002121  10/29/87 - Clr_Mult_Block cx=-1 err  FJG
    66                              <1> ;                   Ax005  PTM P002322  11/06/87 - Call_IFS - 2F semaphore   FJG
    67                              <1> ;                   Ax006  DCR D000494  12/17/87 - DOS 4.00 function reductionFJG
    68                              <1> ;                   Ax007  PTM P003841  03/17/88 - access error for Turbo L  FJG
    69                              <1> ;                   Ax008  PTM P003880  03/17/88 - duped handle error        FJG
    70                              <1> ;                   Ax009  PTM P003910  03/17/88 - wrong parse error format  FJG
    71                              <1> ;                   Ax010  DCR D000526  04/27/88 - add /nc switch support    FJG
    72                              <1> ;                   Ax011  PTM P004546  05/03/88 - add /nc support to fShare FJG
     4                                  ;
     5                                  ;     Label: "The DOS SHARE Utility"
     6                                  ;	     "Version 4.00 (C) Copyright 1988 Microsoft"
     7                                  ;	     "Licenced Material - Program Property of Microsoft"
     8                                  ;
     9                                  ;******************* END OF SPECIFICATIONS *************************************
    10                                  
    11                                  section SHARE align=1 PUBLIC class=SHARE
    12                                  
    13                                  ;				   NAME Sharer2
    14                                  
    15                                  					   ;  INCLUDE DOSSYM.INC
    16                                  					   ;  INCLUDE SYSMSG.INC
    17                                  				   [list -]
    17          ******************       warning: out: ... for DOS Version 4.00 ... [-w+user]
    17          ******************       warning: out: BPB.INC... [-w+user]
    17          ******************       warning: out: ... CLONE version build switch on ... [-w+user]
    17          ******************       warning: out: ... for DOS Version 4.00 ... [-w+user]
    22                                  ;				   .cref
    23                                  				   [list +]
    24                                  ;				   page 80,132
    25                                  
    26                                  				   MSG_UTILNAME <SHARE>
   303                              <1>  stripangles %defstr %%string, %1
   304                              <1> %strlen %%length %%string
   305                              <1> %assign %%ii 1
   306                              <1> %define %%name ""
   307                              <1> %rep %%length
   308                              <1>  %substr %%cc %%string %%ii
   309                              <1>  %assign %%ii %%ii + 1
   310                              <1>  %if %%cc >= 'A' && %%cc <= 'Z'
   311                              <1>  %substr %%cc "abcdefghijklmnopqrstuvwxyz" (%%cc - 'A' + 1)
   312                              <1>  %endif
   313                              <1>  %strcat %%name %%name,%%cc
   314                              <1> %endrep
   308                              <2>  %substr %%cc %%string %%ii
   309                              <2>  %assign %%ii %%ii + 1
   310                              <2>  %if %%cc >= 'A' && %%cc <= 'Z'
   311                              <2>  %substr %%cc "abcdefghijklmnopqrstuvwxyz" (%%cc - 'A' + 1)
   312                              <2>  %endif
   313                              <2>  %strcat %%name %%name,%%cc
   308                              <2>  %substr %%cc %%string %%ii
   309                              <2>  %assign %%ii %%ii + 1
   310                              <2>  %if %%cc >= 'A' && %%cc <= 'Z'
   311                              <2>  %substr %%cc "abcdefghijklmnopqrstuvwxyz" (%%cc - 'A' + 1)
   312                              <2>  %endif
   313                              <2>  %strcat %%name %%name,%%cc
   308                              <2>  %substr %%cc %%string %%ii
   309                              <2>  %assign %%ii %%ii + 1
   310                              <2>  %if %%cc >= 'A' && %%cc <= 'Z'
   311                              <2>  %substr %%cc "abcdefghijklmnopqrstuvwxyz" (%%cc - 'A' + 1)
   312                              <2>  %endif
   313                              <2>  %strcat %%name %%name,%%cc
   308                              <2>  %substr %%cc %%string %%ii
   309                              <2>  %assign %%ii %%ii + 1
   310                              <2>  %if %%cc >= 'A' && %%cc <= 'Z'
   311                              <2>  %substr %%cc "abcdefghijklmnopqrstuvwxyz" (%%cc - 'A' + 1)
   312                              <2>  %endif
   313                              <2>  %strcat %%name %%name,%%cc
   308                              <2>  %substr %%cc %%string %%ii
   309                              <2>  %assign %%ii %%ii + 1
   310                              <2>  %if %%cc >= 'A' && %%cc <= 'Z'
   311                              <2>  %substr %%cc "abcdefghijklmnopqrstuvwxyz" (%%cc - 'A' + 1)
   312                              <2>  %endif
   313                              <2>  %strcat %%name %%name,%%cc
   315                              <1> %strcat %%name %%name,".ctl"
   316                              <1> %unimacro equ 1+.nolist
   317                              <1> %imacro equ 1+.nolist
   318                              <1>  %defstr %%string %00
   319                              <1>  %substr %%cc %%string 1
   320                              <1>  %ifidni %%cc, "$"
   321                              <1>  %iassign %00 %1
   322                              <1>  %else
   323                              <1>  %00 equ %1
   324                              <1>  %endif
   325                              <1> %endmacro
   326                              <1>  %include %%name
     1                              <2> $M_NUM_CLS  EQU 1
   327                              <1> %unimacro equ 1+.nolist
   328                              <1> %iassign $M_STRUC TRUE
   329                              <1> 
   330                              <1>  %include "msgserv.nas"
     1                              <2> ;=== Push trace listing source: msgserv.nas
     2                              <2> 
     3                              <2> ; * * * * * * * * * * * * START OF SPECIFICATIONS * * * * * * * * * * * * * * *
     4                              <2> ;
     5                              <2> ; MODULE NAME: MSGSERV.SAL
     6                              <2> ;
     7                              <2> ; DESCRIPTIVE NAME: Message Services SALUT file
     8                              <2> ;
     9                              <2> ; FUNCTION: This module incorporates all the messages services and
    10                              <2> ;	    is called upon at build time to INCLUDE the code requested
    11                              <2> ;	    by a utility. Code is requested using the macro MSG_SERVICES.
    12                              <2> ;
    13                              <2> ; ENTRY POINT: Since this a collection of subroutines, entry point is at
    14                              <2> ;	    requested procedure.
    15                              <2> ;
    16                              <2> ; INPUT: Since this a collection of subroutines, input is dependent on function
    17                              <2> ;	    requested.
    18                              <2> ;
    19                              <2> ; EXIT-NORMAL: In all cases, CARRY FLAG = 0
    20                              <2> ;
    21                              <2> ; EXIT-ERROR: In all cases, CARRY FLAG = 1
    22                              <2> ;
    23                              <2> ; INTERNAL REFERENCES: (list of included subroutines)
    24                              <2> ;
    25                              <2> ;	- SYSLOADMSG
    26                              <2> ;	- SYSDISPMSG
    27                              <2> ;	- SYSGETMSG
    28                              <2> ;
    29                              <2> ;
    30                              <2> ; EXTERNAL REFERENCES: None
    31                              <2> ;
    32                              <2> ; NOTES: At build time, some modules must be included. These are only included
    33                              <2> ;	 once using assembler switches. Other logic is included at the request
    34                              <2> ;	 of the utility.
    35                              <2> ;
    36                              <2> ;	 COMR and COMT are assembler switches to conditionally assemble code
    37                              <2> ;	 for RESIDENT COMMAND.COM and TRANSIENT COMMAND.COM to reduce resident
    38                              <2> ;	 storage and multiple EQUates.
    39                              <2> ;
    40                              <2> ; REVISION HISTORY: Created MAY 1987
    41                              <2> ;
    42                              <2> ;     Label: DOS - - Message Retriever
    43                              <2> ;	     (c) Copyright 1988 Microsoft
    44                              <2> ;
    45                              <2> ;
    46                              <2> ; * * * * * * * * * * * * END OF SPECIFICATIONS * * * * * * * * * * * * * * * *
    47                              <2> ; Page 
    48                              <2> 
    49                              <2> ;   $SALUT	     $M  (2,5,22,62)			     ;;AN000;; Set SALUT formatting
    50                              <2> 
    51                              <2> %IF  $M_STRUC						     ;;AN000;; IF we haven't included the structures yet THEN
    52                              <2>     %iassign $M_STRUC	FALSE				     ;;AN000;;	 Let the assembler know that we have
    53                              <2> 							     ;;AN000;;	   and include them
    54                              <2> 
    55                              <2> ;    PAGE
    56                              <2> ;    SUBTTL	     DOS - Message Retriever - MSGSTR.INC Module
    57                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    58                              <2> ;;
    59                              <2> ;; STRUCTURE: $M_SUBLIST_STRUC
    60                              <2> ;;
    61                              <2> ;; Replacable parameters are described by a sublist structure
    62                              <2> ;;
    63                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    64                              <2> 							     ;;
    65                              <2> $M_SUBLIST_STRUC STRUC					     ;;AN000;;
    66                              <2> 							     ;;
    67 00000000 ??                  <2>     $M_S_SIZE	     DB        ? ;11			     ;;AN000;; SUBLIST size  (PTR to next SUBLIST)
    68 00000001 ??                  <2>     $M_S_RESV	     DB        ? ;0			     ;;AN000;; RESERVED
    69 00000002 ????????            <2>     $M_S_VALUE	     DD        ?			     ;;AN000;; Time, Date or PTR to data item
    70 00000006 ??                  <2>     $M_S_ID	     DB        ?			     ;;AN000;; n of %n
    71 00000007 ??                  <2>     $M_S_FLAG	     DB        ?			     ;;AN000;; Data-type flags
    72 00000008 ??                  <2>     $M_S_MAXW	     DB        ?			     ;;AN000;; Maximum field width
    73 00000009 ??                  <2>     $M_S_MINW	     DB        ?			     ;;AN000;; Minimum field width
    74 0000000A ??                  <2>     $M_S_PAD	     DB        ?			     ;;AN000;; Character for Pad field
    75                              <2> 							     ;;
    76                              <2> $M_SUBLIST_STRUC ENDS					     ;;AN000;;
    77                              <2> 							     ;;
    78                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    79                              <2> ;;
    80                              <2> ;; STRUCTURE: $M_CLASS_ID
    81                              <2> ;;
    82                              <2> ;; Each class will be defined by this structure.
    83                              <2> ;;
    84                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    85                              <2> 							     ;;
    86                              <2> EXPECTED_VERSION equ expected_version	; NASM port equate
    87                              <2> 
    88                              <2> $M_CLASS_ID STRUC					     ;;AN000;;
    89                              <2> 							     ;;
    90 00000000 ??                  <2>     $M_CLS_ID	     DB        ? ;-1			     ;;AN000;; Class identifer
    91 00000001 ????                <2>     $M_COMMAND_VER   DW        ? ;EXPECTED_VERSION 	     ;;AN003;; COMMAND.COM version check
    92 00000003 ??                  <2>     $M_NUM_CLS_MSG   DB        ? ;0			     ;;AN000;; Total number of message in class
    93                              <2> 							     ;;
    94                              <2> $M_CLASS_ID ENDS					     ;;
    95                              <2> 							     ;;AN000;;
    96                              <2>     $M_CLASS_ID_SZ   EQU       $M_CLASS_ID_struc_size 	     ;;AN000;;
    97                              <2> 							     ;;
    98                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    99                              <2> ;;
   100                              <2> ;; STRUCTURE: $M_ID_STRUC
   101                              <2> ;;
   102                              <2> ;; Each message will be defined by this structure.
   103                              <2> ;;
   104                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   105                              <2> 							     ;;
   106                              <2> $M_ID STRUC						     ;;AN000;;
   107                              <2> 							     ;;
   108 00000000 ????                <2>     $M_NUM	     DW        ? ;-1			     ;;AN000;; Message Number
   109 00000002 ????                <2>     $M_TXT_PTR	     DW        ?			     ;;AN000;; Pointer to message text
   110                              <2> 							     ;;
   111                              <2> $M_ID ENDS						     ;;AN000;;
   112                              <2> 							     ;;AN000;; Status Flag Values:
   113                              <2>     $M_ID_SZ	     EQU       $M_ID_struc_size		     ;;AN000;;
   114                              <2> 							     ;;
   115                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   116                              <2> ;;
   117                              <2> ;; STRUCTURE: $M_RES_ADDRS
   118                              <2> ;;
   119                              <2> ;; Resident data area definition of variables
   120                              <2> ;;
   121                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   122                              <2> 							     ;;
   123                              <2> $M_RES_ADDRS STRUC					     ;;AN000;;
   124                              <2> 							     ;;
   125 00000000 ????????            <2>     $M_EXT_ERR_ADDRS DD        ? ;0			     ;;AN000;; Allow pointers to THREE Extended error locations
   126 00000004 ????????            <2>     $M_EXT_FILE      DD        ? ;0			     ;;AN001;;
   127 00000008 ????????            <2>     $M_EXT_COMMAND   DD        ? ;0			     ;;AN000;;
   128 0000000C ????????            <2>     $M_EXT_TERM      DD        ? ;-1			     ;;AN000;;
   129 00000010 ????????            <2>     $M_PARSE_COMMAND DD        ? ;0			     ;;AN000;;
   130 00000014 ????????            <2>     $M_PARSE_ADDRS   DD        ? ;0			     ;;AN000;; Allow pointers to TWO Parse error locations
   131 00000018 ????????            <2>     $M_PARSE_TERM    DD        ? ;-1			     ;;AN000;;
   132 0000001C ????????            <2>     $M_CRIT_ADDRS    DD        ? ;0			     ;;AN000;; Allow pointers to TWO Critical error locations
   133 00000020 ????????            <2>     $M_CRIT_COMMAND  DD        ? ;0			     ;;AN000;;
   134 00000024 ????????            <2>     $M_CRIT_TERM     DD        ? ;-1			     ;;AN000;;
   135 00000028 ????????            <2>     $M_DISK_PROC_ADDR DD       ? ;-1			     ;;AN004;; Address of READ_DISK_PROC
   136 0000002C ????????            <2>     $M_CLASS_ADDRS   DD        $M_NUM_CLS DUP (?) ;(0)	     ;;AN000;; Allow pointers to specified classes
   137 00000030 ????????            <2>     $M_CLS_TERM      DD        ? ;-1			     ;;AN000;;
   138 00000034 ????????            <2>     $M_DBCS_VEC      DD        ? ;0			     ;;AN000;; Save DBCS vector
   139 00000038 ????                <2>     $M_HANDLE	     DW        ?			     ;;AN000;;
   140 0000003A ??                  <2>     $M_SIZE	     DB        ? ;0			     ;;AN000;;
   141 0000003B ????                <2>     $M_CRLF	     DB        ?,? ;0DH,0AH			     ;;AN004;; CR LF message
   142 0000003D ??                  <2>     $M_CLASS	     DB        ?			     ;;AN004;; Saved class
   143 0000003E ????                <2>     $M_RETURN_ADDR   DW        ?			     ;;AN000;;
   144 00000040 ????                <2>     $M_MSG_NUM	     DW        ? ;$M_NULL			     ;;AN000;;
   145 00000042 ????                <2>     $M_DIVISOR	     DW        ? ;10			     ;;AN000;; Default = 10 (must be a WORD for division)
   146 00000044 <res 40h>           <2>     $M_TEMP_BUF      DB        $M_TEMP_BUF_SZ DUP (?) ;("$")	     ;;AN000;; Temporary buffer
   147 00000084 ??                  <2>     $M_BUF_TERM      DB        ? ;"$"			     ;;AN000;;
   148                              <2> 
   149                              <2> $M_RES_ADDRS ENDS					     ;;AN000;;
   150                              <2> 							     ;;
   151                              <2> $M_RES_ADDRS_SZ EQU  $M_RES_ADDRS_struc_size			     ;;AN000;;
   152                              <2> 							     ;;
   153                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   154                              <2> ;;
   155                              <2> ;; STRUCTURE: $M_COUNTRY_INFO
   156                              <2> ;;
   157                              <2> ;; Important fields of the Get Country Information call
   158                              <2> ;;
   159                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   160                              <2> 							     ;;
   161                              <2> $M_COUNTRY_INFO STRUC					     ;;AN000;; Expected Country infomation
   162                              <2> 							     ;;
   163 00000000 <res 44h>           <2>     $M_HEADER	     DB       $M_RES_ADDRS_SZ-$M_TEMP_BUF_SZ-1 DUP(?) ;;AN000;; Go past first part of struc
   164 00000044 ????                <2>     $M_DATE_FORMAT   DW       ? 			     ;;AN000;; <------- Date Format
   165 00000046 ??????????          <2>     $M_CURR_SEPARA   DB       5 DUP(?)			     ;;AN000;;
   166 0000004B ????                <2>     $M_THOU_SEPARA   DB       ?,? ;?,0			     ;;AN000;; <------- Thou Separator
   167 0000004D ????                <2>     $M_DECI_SEPARA   DB       ?,? ;?,0			     ;;AN000;; <------- Decimal Separator
   168 0000004F ????                <2>     $M_DATE_SEPARA   DB       ?,? ;?,0			     ;;AN000;; <------- Date Separator
   169 00000051 ????                <2>     $M_TIME_SEPARA   DB       ?,? ;?,0			     ;;AN000;; <------- Time Separator
   170 00000053 ??                  <2>     $M_CURR_FORMAT   DB       ? 			     ;;AN000;;
   171 00000054 ??                  <2>     $M_SIG_DIGS_CU   DB       ? 			     ;;AN000;;
   172 00000055 ??                  <2>     $M_TIME_FORMAT   DB       ? 			     ;;AN000;; <------- Time Format
   173                              <2> 							     ;;
   174                              <2> $M_COUNTRY_INFO ENDS					     ;;AN000;;
   175                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   176                              <2> 							     ;;
   177                              <2> %ELSE							     ;;AN000;;	ELSE if we have already included the STRUCTURES
   178                              <2> ; 
   179                              <2> ;   $SALUT  $M	(2,5,13,62)				     ;;AN000;;	Set SALUT formatting for code section
   180                              <2> 
   181                              <2>     %IF	    MSGDATA					     ;;AN000;;	IF this is a request to include the data area
   182                              <2>       %iassign MSGDATA  FALSE					     ;;AN000;;	  Let the assembler know not to include it again
   183                              <2> 							     ;;AN000;;	  and include it
   184                              <2> ;      PAGE
   185                              <2> ;      SUBTTL  DOS - Message Retriever - MSGRES.TAB Module
   186                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   187                              <2> ;;
   188                              <2> ;;	DATA NAME: $M_RES_TABLE
   189                              <2> ;;
   190                              <2> ;;	REFERENCE LABEL: $M_RT
   191                              <2> ;;
   192                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   193                              <2> 
   194                              <2> %if 0 ; disabled for now, figure out later
   195                              <2> %IF    COMR						     ;;AN000;; Since COMMAND.COM includes this twice
   196                              <2>       $M_RT   EQU	       $M_RT2			     ;;AN000;;	we must redefine the label so no
   197                              <2>       $M_RT2  LABEL  BYTE				     ;;AN000;;	 assembly errors occur
   198                              <2>       $M_ALTLABEL equ TRUE				     ;;AN000;; Flag that label was changed
   199                              <2> %ELSE							     ;;AN000;;
   200                              <2>       $M_RT   LABEL   BYTE				     ;;AN000;;
   201                              <2> %ENDIF
   202                              <2> %endif
   203                              <2> $M_RT: ; NASM structure instance
   204                              <2> $M_RES_ADDRS_size equ $M_RES_ADDRS_struc_size	; NASM port equate
   205                              <2> istruc $M_RES_ADDRS
   206                              <2> at $M_EXT_ERR_ADDRS
   207                              <2> 	dd 0
   208                              <2> at $M_EXT_FILE
   209                              <2> 	dd 0
   210                              <2> at $M_EXT_COMMAND
   211                              <2> 	dd 0
   212                              <2> at $M_EXT_TERM
   213                              <2> 	dd -1
   214                              <2> at $M_PARSE_COMMAND
   215                              <2> 	dd 0
   216                              <2> at $M_PARSE_ADDRS
   217                              <2> 	dd 0
   218                              <2> at $M_PARSE_TERM
   219                              <2> 	dd -1
   220                              <2> at $M_CRIT_ADDRS
   221                              <2> 	dd 0
   222                              <2> at $M_CRIT_COMMAND
   223                              <2> 	dd 0
   224                              <2> at $M_CRIT_TERM
   225                              <2> 	dd -1
   226                              <2> at $M_DISK_PROC_ADDR
   227                              <2> 	dd -1
   228                              <2> at $M_CLASS_ADDRS
   229                              <2> 	times $M_NUM_CLS dd 0
   230                              <2> at $M_CLS_TERM
   231                              <2> 	dd -1
   232                              <2> at $M_DBCS_VEC
   233                              <2> 	dd 0
   234                              <2> at $M_HANDLE
   235                              <2> 	dw 0
   236                              <2> at $M_SIZE
   237                              <2> 	db 0
   238                              <2> at $M_CRLF
   239                              <2> 	db 0Dh, 0Ah
   240                              <2> at $M_CLASS
   241                              <2> 	db 0
   242                              <2> at $M_RETURN_ADDR
   243                              <2> 	dw 0
   244                              <2> at $M_MSG_NUM
   245                              <2> 	dw 0
   246                              <2> at $M_DIVISOR
   247                              <2> 	dw 10
   248                              <2> at $M_TEMP_BUF
   249                              <2> 	times $M_TEMP_BUF_SZ db "$"
   250                              <2> at $M_BUF_TERM
   251                              <2> 	db "$"
   252                              <2> iend
   253                              <2> 							     ;;
   254                              <2>       %include "copyrigh.mac"				     ;;AN001;; Include Copyright 1988 Microsoft
   255                              <2> 							     ;;
   256                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   257                              <2>     %ENDIF						     ;;AN000;; END of include of Data table
   258                              <2> 
   259                              <2> ; 
   260                              <2>     %IFN  $M_MSGDATA_ONLY			     ;;AN000;; IF this was a request for only the data table THEN
   261                              <2> 							     ;; 	don't include any more code
   262                              <2> 							     ;;AN000;; Figure out what other code to include
   263                              <2>       %IF      DISK_PROC 				     ;;AN003;;	 Is the request to include the READ_DISK code
   264                              <2> 	%IF	COMR					     ;;AN003;;	 (Only Resident COMMAND.COM should ask for it)
   265                              <2> 	  $M_RT   EQU		   $M_RT2		     ;;AN003;;
   266                              <2> 	%ENDIF
   267                              <2> 	%iassign DISK_PROC FALSE				     ;;AN003;;	 Yes, THEN include it and reset flag
   268                              <2> ;	PAGE
   269                              <2> ;	SUBTTL	DOS - Message Retriever - DISK_PROC Module
   270                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   271                              <2> ;;
   272                              <2> ;;	PROC NAME: DISK_PROC
   273                              <2> ;;
   274                              <2> ;;	FUNCTION: Used in COMMAND.COM if we need to access the Parse or Extended
   275                              <2> ;;		  errors from disk\diskette
   276                              <2> ;;	INPUTS: AX has the message number
   277                              <2> ;;		DX has the message class
   278                              <2> ;;		AND ... the COMMAND.COM Variable RESGROUP:COMSPEC is
   279                              <2> ;;		assumed to be set!!
   280                              <2> ;;
   281                              <2> ;;	OUTPUTS: ES:DI points to message length (BYTE) followed by text
   282                              <2> ;;
   283                              <2> ;;
   284                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   285                              <2> 							     ;;
   286                              <2> 	PUBLIC	READ_DISK_PROC				     ;;
   287                              <2> 							     ;;
   288                              <2> READ_DISK_PROC PROC FAR 				     ;;AN003;;
   289                              <2> 
   290                              <2> 	PUSH	AX					     ;;AN003;; Save everything
   291                              <2> 	PUSH	BX					     ;;AN003;;
   292                              <2> 	PUSH	DX					     ;;AN003;;
   293                              <2> 	PUSH	SI					     ;;AN003;;
   294                              <2> 	PUSH	BP					     ;;AN003;;
   295                              <2> 	PUSH	DS					     ;;AN003;;
   296                              <2> 	PUSH	DI					     ;;AN003;;
   297                              <2> 	MOV	BP,AX					     ;;AN003;; Save message number
   298                              <2> 	MOV	AX,DOS_EXTENDED_OPEN			     ;;AN003;; Set INT 21 function
   299                              <2> 	LEA	SI,[COMSPEC wrt RESGROUP]			     ;;AN003;; Get addressibilty to COMMAND.COM
   300                              <2> 	PUSH	CS					     ;;AN003;;
   301                              <2> 	POP	DS					     ;;AN003;;
   302                              <2> 	MOV	DI,-1					     ;;AN003;; No extended attribute list
   303                              <2> 	MOV	BX,NO_CRIT_OPEN 			     ;;AN003;; Don't generate critical error
   304                              <2> 	MOV	DX,NOT_EX_FAIL_EX_OPEN			     ;;AN003;; Open Flag
   305                              <2> 	INT	21H					     ;;AN003;; Open the file
   306                              <2> 	POP	DI					     ;;AN003;; Retreive LSEEK pointer
   307                              <2> 							     ;;AN003;; Error ?
   308                              <2> ;	$IF	NC,LONG 				     ;;AN003;;	No,
   309                              <2> 	JNC $MXL1
   310                              <2> 	JMP $MIF1
   311                              <2> $MXL1:
   312                              <2> 	  PUSH	  DI					     ;;AN003;; Save LSEEK pointer
   313                              <2> 	  MOV	  BX,AX 				     ;;AN003;;	 Set handle in BX
   314                              <2> 	  MOV	  AX,DOS_LSEEK_FILE			     ;;AN003;;	 LSEEK to the errors
   315                              <2> 	  XOR	  CX,CX 				     ;;AN003;;	   Value has been set by COMMAND.COM
   316                              <2> 	  MOV	  DX,DI 				     ;;AN003;;
   317                              <2> 	  INT	  21H					     ;;AN003;;	 LSEEK the file
   318                              <2> 	  POP	  DX					     ;;AN003;; Retreive LSEEK pointer
   319                              <2> 							     ;;AN003;;	 Error ?
   320                              <2> ;	  $IF	  NC					     ;;AN003;;	  No,
   321                              <2> 	  JC $MIF2
   322                              <2> 	    INC     CX					     ;;AN003;;	   Set flag to first pass
   323                              <2> ;	    $DO 					     ;;AN003;;
   324                              <2> $MDO3:
   325                              <2> 	      PUSH    DX				     ;;AN003;;	   Save LSEEK pointer
   326                              <2> 	      PUSH    CX				     ;;AN003;;	   Save first pass flag
   327                              <2> 	      PUSH    AX				     ;;AN003;;	   Save number of messages (if set yet)
   328                              <2> 	      XOR     SI,SI				     ;;AN003;;	   Reset buffer index
   329                              <2> 	      MOV     AH,DOS_READ_BYTE			     ;;AN003;;	   Read
   330                              <2> 	      MOV     CX,$M_TEMP_BUF_SZ 		     ;;AN003;;	     the first part of the header
   331                              <2> 	      LEA     DX,[$M_RT + $M_TEMP_BUF]		     ;;AN003;;	       into the temp buffer
   332                              <2> 	      INT     21H				     ;;AN003;;	   Read it
   333                              <2> 	      MOV     DI,DX				     ;;AN003;;
   334                              <2> 	      POP     AX				     ;;AN003;;
   335                              <2> 	      POP     CX				     ;;AN003;;
   336                              <2> 	      OR      CX,CX				     ;;AN003;;
   337                              <2> ;	      $IF     NZ				     ;;AN003;;
   338                              <2> 	      JZ $MIF4
   339                              <2> 		XOR	CX,CX				     ;;AN003;;	   Set flag to second pass
   340                              <2> 		XOR	AH,AH				     ;;AN003;;	   Get number of messages in class
   341                              <2> 		MOV	AL,[DI + $M_NUM_CLS_MSG]	     ;;AN003;;
   342                              <2> 		MOV	SI,$M_CLASS_ID_SZ		     ;;AN003;;	   Initialize index
   343                              <2> 		CMP	word [DI + $M_COMMAND_VER],EXPECTED_VERSION ;;AN003;;  Is this the right version of COMMAND.COM?
   344                              <2> ;	      $ENDIF					     ;;AN003;;
   345                              <2> $MIF4:
   346                              <2> 	      POP     DX				     ;;AN003;;
   347                              <2> ;	      $IF     Z 				     ;;AN003;;	   Yes,
   348                              <2> 	      JNZ $MIF6
   349                              <2> ;		$SEARCH 				     ;;AN003;;
   350                              <2> $MDO7:
   351                              <2> 		  CMP	  BP,WORD PTR [$M_RT + $M_TEMP_BUF + SI]  ;;AN003;;	     Is this the message I'm looking for?
   352                              <2> ;		$EXITIF Z				     ;;AN003;;	     Yes, (ZF=1)
   353                              <2> 		JNZ $MIF7
   354                              <2> 		  CLC					     ;;AN003;;	      Reset carry, exit search
   355                              <2> ;		$ORELSE 				     ;;AN003;;	     No,  (ZF=0)
   356                              <2> 		JMP SHORT $MSR7
   357                              <2> $MIF7:
   358                              <2> 		  ADD	  SI,$M_ID_SZ			     ;;AN003;;	      Increment index
   359                              <2> 		  ADD	  DX,$M_ID_SZ			     ;;AN003;;	      Add offset of first header
   360                              <2> 		  DEC	  AX				     ;;AN003;;	      Decrement # of messages left
   361                              <2> ;		$LEAVE	Z				     ;;AN003;;	      Have we exhausted all messages?
   362                              <2> 		JZ $MEN7
   363                              <2> 		  CMP	  SI,$M_TEMP_BUF_SZ-1		     ;;AN003;;	       No, Have we exhausted the buffer?
   364                              <2> ;		$ENDLOOP A				     ;;AN003;;		No, Check next message (ZF=1)
   365                              <2> 		JNA $MDO7
   366                              <2> $MEN7:
   367                              <2> 		  STC					     ;;AN003;;	       Yes, (ZF=0) set error (ZF=0)
   368                              <2> ;		$ENDSRCH				     ;;AN003;;
   369                              <2> $MSR7:
   370                              <2> ;	      $ELSE					     ;;AN003;;	   No,
   371                              <2> 	      JMP SHORT $MEN6
   372                              <2> $MIF6:
   373                              <2> 		XOR	CX,CX				     ;;AN003;;	     Set Zero flag to exit READ Loop
   374                              <2> 		STC					     ;;AN003;;	     Set Carry
   375                              <2> ;	      $ENDIF					     ;;AN003;;
   376                              <2> $MEN6:
   377                              <2> ;	    $ENDDO  Z					     ;;AN003;;	       Get next buffer full if needed
   378                              <2> 	    JNZ $MDO3
   379                              <2> 							     ;;AN003;; Error ?
   380                              <2> ;	    $IF     NC					     ;;AN003;;	No,
   381                              <2> 	    JC $MIF16
   382                              <2> 	      MOV     AX,DOS_LSEEK_FILE 		     ;;AN003;;	 Prepare to LSEEK to the specific message
   383                              <2> 	      XOR     CX,CX				     ;;AN003;;	 Value has been set by COMMAND.COM
   384                              <2> 	      ADD     DX,$M_CLASS_ID_SZ 		     ;;AN003;;	 Add offset of first header
   385                              <2> 	      ADD     DX,WORD PTR [$M_RT + $M_TEMP_BUF + SI + 2]    ;;AN003;;	 Add offset from msg structure
   386                              <2> 	      INT     21H				     ;;AN003;;	 LSEEK the file
   387                              <2> 	      MOV     AH,DOS_READ_BYTE			     ;;AN003;;	   Read
   388                              <2> 	      MOV     CX,$M_TEMP_BUF_SZ 		     ;;AN003;;	     the message
   389                              <2> 	      LEA     DX,[$M_RT + $M_TEMP_BUF]		     ;;AN003;;	       into the temp buffer
   390                              <2> 	      INT     21H				     ;;AN003;;	   Read it
   391                              <2> 	      MOV     DI,DX				     ;;AN003;;	       into the temp buffer
   392                              <2> 	      PUSH    DS				     ;;AN003;;	       into the temp buffer
   393                              <2> 	      POP     ES				     ;;AN003;;	       into the temp buffer
   394                              <2> ;	    $ENDIF					     ;;AN003;;
   395                              <2> $MIF16:
   396                              <2> ;	  $ENDIF					     ;;AN003;;
   397                              <2> $MIF2:
   398                              <2> 	  PUSHF 					     ;;AN003;;	   Close file handle
   399                              <2> 	  MOV	  AH,DOS_CLOSE_FILE			     ;;AN003;;	   Close file handle
   400                              <2> 	  INT	  21H					     ;;AN003;;
   401                              <2> 	  $M_POPF					     ;;AN003;;
   402                              <2> ;	$ENDIF						     ;;AN003;; Yes there was an error,
   403                              <2> $MIF1:
   404                              <2> 	POP	DS					     ;;AN003;;
   405                              <2> 	POP	BP					     ;;AN003;;
   406                              <2> 	POP	SI					     ;;AN003;;
   407                              <2> 	POP	DX					     ;;AN003;;
   408                              <2> 	POP	BX					     ;;AN003;;
   409                              <2> 	POP	AX					     ;;AN003;;
   410                              <2> 							     ;;AN003;;	     abort everything
   411                              <2> 	RET						     ;;AN003;;
   412                              <2> 
   413                              <2> READ_DISK_PROC ENDP					     ;;AN003;;
   414                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   415                              <2>       %ENDIF						     ;;AN003;; END of include for DISK_PROC
   416                              <2> ;
   417                              <2> 
   418                              <2>       %IF      SETSTDIO					     ;;AN000;;	 Is the request to include the code for SETSTDIO
   419                              <2> 	%iassign SETSTDIO FALSE				     ;;AN000;;	 Yes, THEN include it and reset flag
   420                              <2> ;	PAGE
   421                              <2> ;	SUBTTL	DOS - Message Retriever - SETSTDIO Module
   422                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   423                              <2> ;;
   424                              <2> ;;	PROC NAME: SETSTDIO
   425                              <2> ;;
   426                              <2> ;;	FUNCTION:
   427                              <2> ;;	INPUTS:
   428                              <2> ;;
   429                              <2> ;;	OUPUTS:
   430                              <2> ;;
   431                              <2> ;;
   432                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   433                              <2> 							     ;;
   434                              <2> %IF	FARmsg						     ;AN001;
   435                              <2> 	SETSTDINON PROC FAR				     ;AN001;
   436                              <2> %ELSE							     ;AN001;
   437                              <2> 	SETSTDINON PROC NEAR				     ;AN001;
   438                              <2> %ENDIF							     ;AN001;
   439                              <2> 	PUSH	AX					     ;AN002; Save changed regs
   440                              <2> 	PUSH	BX					     ;AN002;
   441                              <2> 	PUSH	DX					     ;AN002;
   442                              <2> 	MOV	AX,DOS_IOCTL_GET_INFO			     ;AN001; Get info using IOCTL
   443                              <2> 	MOV	BX,STDIN				     ;AN001;
   444                              <2> 	XOR	DX,DX					     ;AN001;
   445                              <2> 	INT	21H					     ;AN001;
   446                              <2> 
   447                              <2> 	OR	DH,$M_CRIT_ERR_MASK			     ;AN001; Turn on bit
   448                              <2> 	MOV	AX,DOS_IOCTL_SET_INFO			     ;AN001; Set info using IOCTL
   449                              <2> 	INT	21H					     ;AN001;
   450                              <2> 	POP	DX					     ;AN002; Restore Regs
   451                              <2> 	POP	BX					     ;AN002;
   452                              <2> 	POP	AX					     ;AN002;
   453                              <2> 
   454                              <2> 	RET						     ;AN001;
   455                              <2> 							     ;AN001;
   456                              <2> 	SETSTDINON ENDP 				     ;AN001;
   457                              <2> 
   458                              <2> %IF	FARmsg						     ;AN001;
   459                              <2> 	SETSTDINOFF PROC FAR				     ;AN001;
   460                              <2> %ELSE							     ;AN001;
   461                              <2> 	SETSTDINOFF PROC NEAR				     ;AN001;
   462                              <2> %ENDIF							     ;AN001;
   463                              <2> 
   464                              <2> 	PUSH	AX					     ;AN002; Save changed regs
   465                              <2> 	PUSH	BX					     ;AN002;
   466                              <2> 	PUSH	DX					     ;AN002;
   467                              <2> 	MOV	AX,DOS_IOCTL_GET_INFO			     ;AN001; Get info using IOCTL
   468                              <2> 	MOV	BX,STDIN				     ;AN001;
   469                              <2> 	XOR	DX,DX					     ;AN001;
   470                              <2> 	INT	21H					     ;AN001;
   471                              <2> 
   472                              <2> 	AND	DH,~ $M_CRIT_ERR_MASK 		     ;AN001; Turn off bit
   473                              <2> 	MOV	AX,DOS_IOCTL_SET_INFO			     ;AN001; Set info using IOCTL
   474                              <2> 	INT	21H					     ;AN001;
   475                              <2> 	POP	DX					     ;AN002; Restore Regs
   476                              <2> 	POP	BX					     ;AN002;
   477                              <2> 	POP	AX					     ;AN002;
   478                              <2> 
   479                              <2> 	RET						     ;AN001;
   480                              <2> 
   481                              <2> 	SETSTDINOFF ENDP				     ;AN001;
   482                              <2> 
   483                              <2> %IF	FARmsg						     ;AN001;
   484                              <2> 	SETSTDOUTON PROC FAR				     ;AN001;
   485                              <2> %ELSE							     ;AN001;
   486                              <2> 	SETSTDOUTON PROC NEAR				     ;AN001;
   487                              <2> %ENDIF							     ;AN001;
   488                              <2> 
   489                              <2> 	PUSH	AX					     ;AN002; Save changed regs
   490                              <2> 	PUSH	BX					     ;AN002;
   491                              <2> 	PUSH	DX					     ;AN002;
   492                              <2> 	MOV	AX,DOS_IOCTL_GET_INFO			     ;AN001; Get info using IOCTL
   493                              <2> 	MOV	BX,STDOUT				     ;AN001;
   494                              <2> 	XOR	DX,DX					     ;AN001;
   495                              <2> 	INT	21H					     ;AN001;
   496                              <2> 
   497                              <2> 	OR	DH,$M_CRIT_ERR_MASK			     ;AN001; Turn on bit
   498                              <2> 	MOV	AX,DOS_IOCTL_SET_INFO			     ;AN001; Set info using IOCTL
   499                              <2> 	INT	21H					     ;AN001;
   500                              <2> 	POP	DX					     ;AN002; Restore Regs
   501                              <2> 	POP	BX					     ;AN002;
   502                              <2> 	POP	AX					     ;AN002;
   503                              <2> 
   504                              <2> 	RET						     ;AN001;
   505                              <2> 
   506                              <2> 	SETSTDOUTON ENDP				     ;AN001;
   507                              <2> 
   508                              <2> %IF	FARmsg						     ;AN001;
   509                              <2> 	SETSTDOUTOFF PROC FAR				     ;AN001;
   510                              <2> %ELSE							     ;AN001;
   511                              <2> 	SETSTDOUTOFF PROC NEAR
   512                              <2> %ENDIF							     ;AN001;
   513                              <2> 
   514                              <2> 	PUSH	AX					     ;AN002; Save changed regs
   515                              <2> 	PUSH	BX					     ;AN002;
   516                              <2> 	PUSH	DX					     ;AN002;
   517                              <2> 	MOV	AX,DOS_IOCTL_GET_INFO			     ;AN001; Get info using IOCTL
   518                              <2> 	MOV	BX,STDOUT				     ;AN001;
   519                              <2> 	XOR	DX,DX					     ;AN001;
   520                              <2> 	INT	21H					     ;AN001;
   521                              <2> 
   522                              <2> 	AND	DH,~ $M_CRIT_ERR_MASK 		     ;AN001; Turn off bit
   523                              <2> 	MOV	AX,DOS_IOCTL_SET_INFO			     ;AN001; Set info using IOCTL
   524                              <2> 	INT	21H					     ;AN001;
   525                              <2> 	POP	DX					     ;AN002; Restore Regs
   526                              <2> 	POP	BX					     ;AN002;
   527                              <2> 	POP	AX					     ;AN002;
   528                              <2> 
   529                              <2> 	RET						     ;AN001;
   530                              <2> 
   531                              <2> 	SETSTDOUTOFF ENDP				     ;AN001;
   532                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   533                              <2>       %ENDIF						     ;;AN000;; END of include for SETSTDIO
   534                              <2> ; 
   535                              <2>       %IF      LOADmsg					     ;;AN000;;	 Is the request to include the code for SYSLOADMSG ?
   536                              <2> 	%IF	COMR					     ;;AN000;;
   537                              <2> 	  $M_RT   EQU		   $M_RT2		     ;;AN000;;
   538                              <2> 	%ENDIF
   539                              <2> 	%iassign LOADmsg FALSE 				     ;;AN000;;	 Yes, THEN include it and reset flag
   540                              <2> ;	PAGE
   541                              <2> ;	SUBTTL	DOS - Message Retriever - LOADMSG.ASM Module
   542                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   543                              <2> ;;
   544                              <2> ;;	PROC NAME: SYSLOADMSG
   545                              <2> ;;
   546                              <2> ;;	FUNCTION:
   547                              <2> ;;	INPUTS:
   548                              <2> ;;
   549                              <2> ;;	OUPUTS:
   550                              <2> ;;
   551                              <2> ;;
   552                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   553                              <2> 							     ;;
   554                              <2> %IF	FARmsg						     ;;AN000;;
   555                              <2> 	SYSLOADMSG PROC FAR				     ;;AN000;;
   556                              <2> %ELSE							     ;;AN000;;
   557                              <2> 	SYSLOADMSG PROC NEAR				     ;;AN000;;
   558                              <2> %ENDIF							     ;;AN000;;
   559                              <2> 	PUSH	AX					     ;;AN000;
   560                              <2> 	PUSH	BX					     ;;AN000;
   561                              <2> 	PUSH	DX					     ;;AN000;
   562                              <2> 	PUSH	ES					     ;;AN000;
   563                              <2> 	PUSH	DI					     ;;AN000;
   564                              <2> 	XOR	CX,CX					     ;;AN000;  Reset to zero
   565                              <2> 	MOV	ES,CX					     ;;AN000;
   566                              <2> 	XOR	DI,DI					     ;;AN000;
   567                              <2> 	MOV	AX,DOS_GET_EXT_PARSE_ADD		     ;;AN000;; 2FH Interface
   568                              <2> 	MOV	DL,DOS_GET_EXTENDED			     ;;AN000;; Where are the Extended errors in COMMAND.COM
   569                              <2> 	INT	2FH					     ;;AN000;; Private interface
   570                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_EXT_COMMAND+2],ES	     ;;AN000;;	Move into first avaliable table location
   571                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_EXT_COMMAND],DI	     ;;AN000;;
   572                              <2> 							     ;;
   573                              <2> 	MOV	AX,DOS_GET_EXT_PARSE_ADD		     ;;AN000;; 2FH Interface
   574                              <2> 	MOV	DL,DOS_GET_PARSE			     ;;AN000;; Where are the Parse errors in COMMAND.COM
   575                              <2> 	INT	2FH					     ;;AN000;; Private interface
   576                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_PARSE_COMMAND+2],ES	     ;;AN000;;	Move into first avaliable table location
   577                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_PARSE_COMMAND],DI	     ;;AN000;;
   578                              <2> 							     ;;
   579                              <2> 	MOV	AX,DOS_GET_EXT_PARSE_ADD		     ;;AN000;; 2FH Interface
   580                              <2> 	MOV	DL,DOS_GET_CRITICAL			     ;;AN000;; Where are the Critical errors in COMMAND.COM
   581                              <2> 	INT	2FH					     ;;AN000;; Private interface
   582                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_CRIT_COMMAND+2],ES	     ;;AN000;;	Move into first avaliable table location
   583                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_CRIT_COMMAND],DI	     ;;AN000;;
   584                              <2> 
   585                              <2> 	MOV	AX,DOS_GET_EXT_PARSE_ADD		     ;;AN001;; 2FH Interface
   586                              <2> 	MOV	DL,DOS_GET_FILE 			     ;;AN001;; Where are the FILE dependant in IFSFUNC.EXE
   587                              <2> 	INT	2FH					     ;;AN001;; Private interface
   588                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_EXT_FILE+2],ES 	     ;;AN001;;	Move into first avaliable table location
   589                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_EXT_FILE],DI		     ;;AN001;;
   590                              <2> 
   591                              <2> %IF	COMR						     ;;  ** Special case for RESIDENT COMMAND.COM
   592                              <2> 	    Extrn   READ_DISK_PROC:Far			     ;;AN003;;
   593                              <2> %ELSE							     ;;
   594                              <2> 	%IF	FARmsg					     ;;AN000;;
   595                              <2> 	  CALL	  FAR PTR $M_MSGSERV_1			     ;;AN000;; Get addressibilty to MSGSERV CLASS 1 (EXTENDED Errors)
   596                              <2> 	%ELSE						     ;;AN000;;
   597                              <2> 	  CALL	  $M_MSGSERV_1				     ;;AN000;; Get addressibilty to MSGSERV CLASS 1 (EXTENDED Errors)
   598                              <2> 	%ENDIF						     ;;AN000;;
   599                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_EXT_ERR_ADDRS+2],ES	     ;;AN000;; Move into first avaliable table location
   600                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_EXT_ERR_ADDRS],DI	     ;;AN000;;
   601                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_CRIT_ADDRS+2],ES	     ;;AN000;; Move into first avaliable table location
   602                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_CRIT_ADDRS],DI 	     ;;AN000;;
   603                              <2> 							     ;;
   604                              <2> 	%IF	FARmsg					     ;;AN000;;
   605                              <2> 	  CALL	  FAR PTR $M_MSGSERV_2			     ;;AN000;; Get addressibilty to MSGSERV CLASS 2 (PARSE Errors)
   606                              <2> 	%ELSE						     ;;AN000;;
   607                              <2> 	  CALL	  $M_MSGSERV_2				     ;;AN000;; Get addressibilty to MSGSERV CLASS 2 (PARSE Errors)
   608                              <2> 	%ENDIF						     ;;AN000;;
   609                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_PARSE_ADDRS+2],ES	     ;;AN000;; Move into first avaliable table location
   610                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_PARSE_ADDRS],DI	     ;;AN000;;
   611                              <2> %ENDIF							     ;;
   612                              <2> 							     ;;
   613                              <2> 	MOV	AX,DOS_GET_EXT_PARSE_ADD		     ;;AN001;; 2FH Interface
   614                              <2> 	MOV	DL,DOS_GET_ADDR 			     ;;AN001;; Where is the READ_DISK_PROC in COMMAND.COM
   615                              <2> 	INT	2FH					     ;;AN001;; Private interface
   616                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_DISK_PROC_ADDR+2],ES	     ;;AN001;;	Move into first avaliable table location
   617                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_DISK_PROC_ADDR],DI	     ;;AN001;;
   618                              <2> 
   619                              <2> 	$M_BUILD_PTRS $M_NUM_CLS			     ;;AN000;; Build all utility classes
   620                              <2> 							     ;;AN000;;
   621                              <2> 	CALL	$M_GET_DBCS_VEC 			     ;;AN000;; Save the DBCS vector
   622                              <2> 
   623                              <2> %IFN	NOCHECKSTDIN				     ;;AN000;; IF EOF check is not to be suppressed
   624                              <2> 	CALL	$M_CHECKSTDIN				     ;;AN000;;	 Set EOF CHECK
   625                              <2> %ENDIF							     ;;AN000;;
   626                              <2> 							     ;;AN000;;
   627                              <2> %IFN	NOCHECKSTDOUT				     ;;AN000;; IF Disk Full check is not to be suppressed
   628                              <2> 	CALL	$M_CHECKSTDOUT				     ;;AN000;;	 Set Disk Full CHECK
   629                              <2> %ENDIF							     ;;AN000;;
   630                              <2> 							     ;;AN000;;
   631                              <2> %IF	NOVERCHECKmsg					     ;;AN000;; IF version check is to be supressed
   632                              <2> 	CLC						     ;;AN000;;	 Make sure carry is clear
   633                              <2> %ELSE							     ;;AN000;; ELSE
   634                              <2> 	PUSH	CX					     ;;AN000;;
   635                              <2> 	CALL	$M_VERSION_CHECK			     ;;AN000;;	 Check Version
   636                              <2> %ENDIF							     ;;AN000;;
   637                              <2> 							     ;;        Error ?
   638                              <2> ;	$IF	NC					     ;;AN000;; No.
   639                              <2> 	JC $MIF20
   640                              <2> %IFN	  NOVERCHECKmsg 			     ;;AN000;;	IF version check was not supressed
   641                              <2> 	  POP	  CX					     ;;AN000;;	Reset stack
   642                              <2> %ENDIF							     ;;AN000;;
   643                              <2> 	  POP	  DI					     ;;AN000;;	Restore REGS
   644                              <2> 	  POP	  ES					     ;;AN000;;
   645                              <2> 	  POP	  DX					     ;;AN000;;
   646                              <2> 	  POP	  BX					     ;;AN000;;
   647                              <2> 	  POP	  AX					     ;;AN000;;
   648                              <2> ;	$ELSE						     ;;AN000;; Yes,
   649                              <2> 	JMP SHORT $MEN20
   650                              <2> $MIF20:
   651                              <2> %IF	  NOVERCHECKmsg 				     ;;AN000;;	IF version check is to be supressed
   652                              <2> 	  ADD	  SP,10 				     ;;AN000;;
   653                              <2> 	  STC						     ;;AN000;;	Reset carry flag
   654                              <2> %ELSE							     ;;AN000;;	IF version check is to be supressed
   655                              <2> 	  ADD	  SP,12 				     ;;AN000;;
   656                              <2> 	  STC						     ;;AN000;;	Reset carry flag
   657                              <2> %ENDIF							     ;;AN000;;	IF version check is to be supressed
   658                              <2> ;	$ENDIF						     ;;AN000;;
   659                              <2> $MEN20:
   660                              <2> 	RET						     ;;AN000;;
   661                              <2> 							     ;;
   662                              <2> 	SYSLOADMSG ENDP 				     ;;AN000;;
   663                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   664                              <2> ;	PAGE
   665                              <2> ;	SUBTTL	DOS - Message Retriever - $M_VERSION_CHECK Proc
   666                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   667                              <2> ;;
   668                              <2> ;;  Proc Name:	$M_GET_DBCS_VEC
   669                              <2> ;;
   670                              <2> ;;  Function:	Get the DBCS vector and save it for later use
   671                              <2> ;;
   672                              <2> ;;  Inputs:	None
   673                              <2> ;;
   674                              <2> ;;  Outputs:	None
   675                              <2> ;;
   676                              <2> ;;  Regs Changed:
   677                              <2> ;;
   678                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   679                              <2> 							     ;;
   680                              <2> $M_GET_DBCS_VEC PROC NEAR				     ;;AN000;;
   681                              <2> 							     ;;
   682                              <2> 	PUSH	AX					     ;;AN000;; Save character to check
   683                              <2> 	PUSH	SI					     ;;AN000;;
   684                              <2> 	PUSH	DS					     ;;AN000;;
   685                              <2> 	MOV	AX,DOS_GET_DBCS_INFO			     ;;AN000;; DOS function to get DBSC environment
   686                              <2> 	INT	21H					     ;;AN000;; Get environment pointer
   687                              <2> 	PUSH	DS					     ;;AN000;; Get environment pointer
   688                              <2> 	POP	ES					     ;;AN000;; Get environment pointer
   689                              <2> 	POP	DS					     ;;AN000;; Get environment pointer
   690                              <2> ;	$IF	NC					     ;;AN000;;
   691                              <2> 	JC $MIF23
   692                              <2> 	  MOV	  WORD PTR [cs:$M_RT + $M_DBCS_VEC],SI 	     ;;AN000;; Save DBCS Vector
   693                              <2> 	  MOV	  WORD PTR [cs:$M_RT + $M_DBCS_VEC+2],ES	     ;;AN000;;
   694                              <2> ;	$ENDIF						     ;;AN000;;
   695                              <2> $MIF23:
   696                              <2> 	POP	SI					     ;;AN000;;
   697                              <2> 	POP	AX					     ;;AN000;; Retrieve character to check
   698                              <2> 	RET						     ;;AN000;; Return
   699                              <2> 							     ;;
   700                              <2> $M_GET_DBCS_VEC ENDP					     ;;
   701                              <2> 							     ;;
   702                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   703                              <2> 	%IF	NOCHECKSTDIN				     ;AN001; Are we suppose to include the code for Checking EOF ?
   704                              <2> 	%ELSE						     ;AN001; Yes, THEN include it
   705                              <2> ;	  PAGE
   706                              <2> ;	  SUBTTL  DOS - Message Retriever - $M_CHECKSTDIN Proc
   707                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   708                              <2> ;;
   709                              <2> ;;  Proc Name:	$M_CHECKSTDIN
   710                              <2> ;;
   711                              <2> ;;  Function:
   712                              <2> ;;
   713                              <2> ;;  Inputs:	None
   714                              <2> ;;
   715                              <2> ;;  Outputs:
   716                              <2> ;;
   717                              <2> ;;  Regs Changed:
   718                              <2> ;;
   719                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   720                              <2> 							     ;;
   721                              <2> $M_CHECKSTDIN PROC NEAR 				     ;AN001;
   722                              <2> 
   723                              <2> 	  MOV	  AX,DOS_IOCTL_GET_INFO 		     ;AN001; Get info using IOCTL
   724                              <2> 	  MOV	  BX,STDIN				     ;AN001;
   725                              <2> 	  XOR	  DX,DX 				     ;AN001;
   726                              <2> 	  INT	  21H					     ;AN001;
   727                              <2> 
   728                              <2> 	  OR	  DH,$M_CRIT_ERR_MASK			     ;AN001; Turn on bit
   729                              <2> 	  MOV	  AX,DOS_IOCTL_SET_INFO 		     ;AN001; Set info using IOCTL
   730                              <2> 	  INT	  21H					     ;AN001;
   731                              <2> 
   732                              <2> 	  RET						     ;AN001;
   733                              <2> 
   734                              <2> $M_CHECKSTDIN ENDP					     ;AN001;
   735                              <2> 							     ;;
   736                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   737                              <2> 	%ENDIF						     ;AN001; END of include for EOF Check
   738                              <2> 	%IF	NOCHECKSTDOUT				     ;AN001; Are we suppose to include the code for Checking Disk Full?
   739                              <2> 	%ELSE						     ;AN001; Yes, THEN include it
   740                              <2> ;	  PAGE
   741                              <2> ;	  SUBTTL  DOS - Message Retriever - $M_CHECKSTDOUT Proc
   742                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   743                              <2> ;;
   744                              <2> ;;  Proc Name:	$M_CHECKSTDOUT
   745                              <2> ;;
   746                              <2> ;;  Function:
   747                              <2> ;;
   748                              <2> ;;  Inputs:	None
   749                              <2> ;;
   750                              <2> ;;  Outputs:
   751                              <2> ;;
   752                              <2> ;;  Regs Changed:
   753                              <2> ;;
   754                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   755                              <2> 							     ;;
   756                              <2> $M_CHECKSTDOUT PROC NEAR				     ;AN001;
   757                              <2> 
   758                              <2> 	  MOV	  AX,DOS_IOCTL_GET_INFO 		     ;AN001; Get info using IOCTL
   759                              <2> 	  MOV	  BX,STDOUT				     ;AN001;
   760                              <2> 	  XOR	  DX,DX 				     ;AN001;
   761                              <2> 	  INT	  21H					     ;AN001;
   762                              <2> 
   763                              <2> 	  OR	  DH,$M_CRIT_ERR_MASK			     ;AN001; Turn on bit
   764                              <2> 	  MOV	  AX,DOS_IOCTL_SET_INFO 		     ;AN001; Set info using IOCTL
   765                              <2> 	  INT	  21H					     ;AN001;
   766                              <2> 
   767                              <2> 	  RET						     ;AN001;
   768                              <2> 
   769                              <2> $M_CHECKSTDOUT ENDP					     ;AN001;
   770                              <2> 							     ;;
   771                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   772                              <2> 	%ENDIF						     ;AN001;  END of include for Disk Full Check
   773                              <2> 	%IF	NOVERCHECKmsg				     ;;AN000;; Are we suppose to include the code for DOS version check?
   774                              <2> 	%ELSE						     ;;AN000;; Yes, THEN include it
   775                              <2> ;	  PAGE
   776                              <2> ;	  SUBTTL  DOS - Message Retriever - $M_VERSION_CHECK Proc
   777                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   778                              <2> ;;
   779                              <2> ;;  Proc Name:	$M_VERSION_CHECK
   780                              <2> ;;
   781                              <2> ;;  Function:	Determine if DOS version is within allowable limits
   782                              <2> ;;
   783                              <2> ;;  Inputs:	None
   784                              <2> ;;
   785                              <2> ;;  Outputs:	CARRY_FLAG = 1 if Incorrect DOS version
   786                              <2> ;;		Registers set for SYSDISPMSG
   787                              <2> ;;		CARRY_FLAG = 0 if Correct DOS version
   788                              <2> ;;
   789                              <2> ;;  Regs Changed: AX
   790                              <2> ;;
   791                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   792                              <2> 
   793                              <2> check_amis:
   794                              <2> 	push ax
   795                              <2> 	push ds
   796                              <2> 	push si
   797                              <2> 	push es
   798                              <2> 	push di
   799                              <2> 	push dx
   800                              <2> 	push ax				; version number, last on stack
   801                              <2> 
   802                              <2> 	mov ah, 0			; multiplex number = 0
   803                              <2> .loop:
   804                              <2> 	mov al, 0
   805                              <2> 	int 2Dh				; installation check
   806                              <2> 	cmp al, -1			; multiplexer installed ?
   807                              <2> 	jne .next			; no -->
   808                              <2> 	 push cs
   809                              <2> 	 pop ds
   810                              <2> 	mov si, offset amis_sign	; ds:si -> amis_sign (for lDOS)
   811                              <2> 	mov es, dx			; es:di -> multiplexer's sign
   812                              <2> 	mov cx, 8			; 16 bytes
   813                              <2> 	repe cmpsw			; compare
   814                              <2> 	jne .next			; not us -->
   815                              <2> 	mov dx, cs			; dx:si -> amis_id
   816                              <2> 	mov al, 11h
   817                              <2> 	int 2Dh				; CHG: al, bx, cx, dx, si, di
   818                              <2> 	cmp al, 0			; id call supported ?
   819                              <2> 	je .unsup			; no, allow if alt version -->
   820                              <2> 	pop dx
   821                              <2> 	xor dx, dx			; 2D.MM11 supported, mark that we need it
   822                              <2> 	push dx
   823                              <2> 	cmp al, 0F0h			; CY if below 0F0h
   824                              <2> 	jmp .done
   825                              <2> 
   826                              <2> .next:
   827                              <2> 	inc ah				; next multiplex number
   828                              <2> 	jnz .loop			; ZR if done, NZ if more to check -->
   829                              <2> .unsup:
   830                              <2> 	stc				; multiplexer not found
   831                              <2> 					;  or function not supported
   832                              <2> .done:
   833                              <2> 		; CY if not an lDOS revision with our id supported,
   834                              <2> 		;  on stack: alt_expected_version if it's fine and either
   835                              <2> 		;   no multiplexer or func 11h not supported
   836                              <2> 		;  new_expected_version if not fine and either
   837                              <2> 		;   no multiplexer or func 11h not suppprted,
   838                              <2> 		;  0 if multiplexer found, func 11h supported, but
   839                              <2> 		;   our id is unsupported
   840                              <2> 		; NC if lDOS revision with multiplexer and our id supported
   841                              <2> 	pop bx
   842                              <2> 	pop dx
   843                              <2> 	pop di
   844                              <2> 	pop es
   845                              <2> 	pop si
   846                              <2> 	pop ds
   847                              <2> 	pop ax
   848                              <2> 	jnc alt_good_DOS		; id is supported -->
   849                              <2> 	cmp bx, alt_expected_version	; is it fine ?
   850                              <2> 	je alt_good_DOS			; yes --> (NC)
   851                              <2> 	jmp $MIF25			; no, cancel program -->
   852                              <2> 
   853                              <2> $M_VERSION_CHECK PROC NEAR				     ;;AN000;;
   854                              <2> 							     ;;
   855                              <2> 	  MOV	  AH,DOS_GET_VERSION			     ;;AN000;; Check that version matches VERSIONA.INC
   856                              <2> 	  INT	  21H					     ;;AN000;;
   857                              <2> 							     ;;
   858                              <2> 	cmp	ax,new_expected_version	; compare with DOS version
   859                              <2> 	je check_amis
   860                              <2> 	cmp	ax,alt_expected_version	; compare with DOS version
   861                              <2> 	je check_amis
   862                              <2> 	  CMP	  AX,EXPECTED_VERSION			     ;;AN000;; IF DOS_MAJOR is correct
   863                              <2> ;	  $IF	  E					     ;;AN000;;
   864                              <2> 	  JNE $MIF25
   865                              <2> alt_good_DOS:
   866                              <2> 	    CLC 					     ;;AN000;;	 Clear the carry flag
   867                              <2> ;	  $ELSE 					     ;;AN000;; ELSE
   868                              <2> 	  JMP SHORT $MEN25
   869                              <2> $MIF25:
   870                              <2> %IFN     COMR				     ;;  ** Special case for RESIDENT COMMAND.COM
   871                              <2> 	    CMP     AX,LOWEST_4CH_VERSION		     ;;AN000;; Does this version support AH = 4CH
   872                              <2> ;	    $IF     B					     ;;AN000;; No,
   873                              <2> 	    JNB $MIF27
   874                              <2> 	      MOV     BX,NO_HANDLE			     ;;AN000;;	 No handle (version doesn't support)
   875                              <2> ;	    $ELSE					     ;;AN000;; Yes,
   876                              <2> 	    JMP SHORT $MEN27
   877                              <2> $MIF27:
   878                              <2> 	      MOV     BX,STDERR 			     ;;AN000;;	 Standard Error
   879                              <2> ;	    $ENDIF					     ;;AN000;;
   880                              <2> $MEN27:
   881                              <2> %ELSE
   882                              <2> 	    MOV     BX,NO_HANDLE			     ;;AN000;;	 No handle
   883                              <2> %ENDIF
   884                              <2> 	    MOV     AX,1				     ;;AN000;; Set message # 1
   885                              <2> 	    MOV     CX,NO_REPLACE			     ;;AN000;; No replacable parms
   886                              <2> 	    MOV     DL,NO_INPUT 			     ;;AN000;; No input
   887                              <2> 	    MOV     DH,UTILITY_MSG_CLASS		     ;;AN000;; Utility class message
   888                              <2> 	    STC 					     ;;AN000;; Set Carry Flag
   889                              <2> ;	  $ENDIF					     ;;AN000;;
   890                              <2> $MEN25:
   891                              <2> 							     ;;
   892                              <2> 	  RET						     ;;AN000;; Return
   893                              <2> 							     ;;
   894                              <2> $M_VERSION_CHECK ENDP					     ;;
   895                              <2> 							     ;;
   896                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   897                              <2> 	%ENDIF						     ;;AN000;; END of include for DOS version check
   898                              <2>       %ENDIF						     ;;AN000;; END of include for SYSLOADMSG
   899                              <2> ; 
   900                              <2>       %IF      GETmsg					     ;;AN000;; Is the request to include the code for SYSGETMSG ?
   901                              <2> 	%IF	COMR					     ;;AN000;;
   902                              <2> 	  $M_RT   EQU		   $M_RT2		     ;;AN000;;
   903                              <2> 	%ENDIF						     ;;AN000;;
   904                              <2> 	GETmsg	equ      FALSE				     ;;AN000;; Yes, THEN include it and reset flag
   905                              <2> ;	PAGE
   906                              <2> ;	SUBTTL	DOS - Message Retriever - GETMSG.ASM Module
   907                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   908                              <2> ;;
   909                              <2> ;;  Proc Name:	SYSGETMSG
   910                              <2> ;;
   911                              <2> ;;  Function:	The GET service returns the segment, offset and size of the
   912                              <2> ;;		message text to the caller based on a message number.
   913                              <2> ;;		The GET function will not display the message thus assumes
   914                              <2> ;;		caller will handle replaceable parameters.
   915                              <2> ;;
   916                              <2> ;;  Inputs:
   917                              <2> ;;
   918                              <2> ;;  Outputs:
   919                              <2> ;;
   920                              <2> ;;  Psuedocode:
   921                              <2> ;;		Call $M_GET_MSG_ADDRESS
   922                              <2> ;;		IF MSG_NUM exists THEN
   923                              <2> ;;		   Set DS:SI = MSG_TXT_PTR + 1
   924                              <2> ;;		   CARRY_FLAG = 0
   925                              <2> ;;		ELSE
   926                              <2> ;;		   CARRY_FLAG = 1
   927                              <2> ;;		ENDIF
   928                              <2> ;;
   929                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   930                              <2> 							     ;;
   931                              <2> %IF	FARmsg						     ;;AN000;;
   932                              <2> 	SYSGETMSG PROC	FAR				     ;;AN000;;
   933                              <2> %ELSE							     ;;AN000;;
   934                              <2> 	SYSGETMSG PROC	NEAR				     ;;AN000;;
   935                              <2> %ENDIF							     ;;AN000;;
   936                              <2> 							     ;;
   937                              <2> ;; Save registers needed later
   938                              <2> 
   939                              <2> 	PUSH	AX					     ;;AN000;; Save changed regs
   940                              <2> 	PUSH	ES					     ;;AN000;;
   941                              <2> 	PUSH	DI					     ;;AN000;;
   942                              <2> 	PUSH	BP					     ;;AN000;;
   943                              <2> 							     ;;
   944                              <2> %IF	FARmsg						     ;;AN000;;
   945                              <2> 	CALL	FAR PTR $M_GET_MSG_ADDRESS		     ;;AN000;; Scan thru classes to find message
   946                              <2> %ELSE							     ;;AN000;;
   947                              <2> 	CALL	$M_GET_MSG_ADDRESS			     ;;AN000;; Scan thru classes to find message
   948                              <2> %ENDIF							     ;;AN000;; Return message in ES:DI
   949                              <2> ;	$IF	NC					     ;;AN000;; Message found?
   950                              <2> 	JC $MIF31
   951                              <2> 	  CMP	  DH,UTILITY_MSG_CLASS
   952                              <2> 	  CLC						     ;;AN000;;
   953                              <2> ;	  $IF	  NE
   954                              <2> 	  JE $MIF32
   955                              <2> 	    PUSH    ES					     ;;AN000;;
   956                              <2> 	    POP     DS					     ;;AN000;;	   Return message in DS:SI
   957                              <2> ;	  $ELSE
   958                              <2> 	  JMP SHORT $MEN32
   959                              <2> $MIF32:
   960                              <2> %IF	    FARmsg					     ;;AN000;;	 Yes,
   961                              <2> 	    PUSH    ES					     ;;AN000;;
   962                              <2> 	    POP     DS					     ;;AN000;;	   Return message in DS:SI
   963                              <2> %ELSE							     ;;AN000;;
   964                              <2> 	    PUSH    CS					     ;;AN000;;	   Return message in DS:SI
   965                              <2> 	    POP     DS					     ;;AN000;;
   966                              <2> %ENDIF							     ;;AN000;;
   967                              <2> ;	  $ENDIF					     ;;AN000;;
   968                              <2> $MEN32:
   969                              <2> 	  MOV	  SI,DI 				     ;;AN000;;	   Return message in DS:SI
   970                              <2> ;	$ENDIF						     ;;AN000;;
   971                              <2> $MIF31:
   972                              <2> 							     ;;
   973                              <2> 	POP	BP					     ;;AN000;; Restore changed regs
   974                              <2> 	POP	DI					     ;;AN000;;
   975                              <2> 	POP	ES					     ;;AN000;;
   976                              <2> 	POP	AX					     ;;AN000;;
   977                              <2> 							     ;;
   978                              <2> 	RET						     ;;AN000;;	  Return
   979                              <2> 							     ;;
   980                              <2> 	SYSGETMSG ENDP					     ;;
   981                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   982                              <2> 	%IF	$M_SUBS 				     ;;AN000;; Include the common subroutines if they haven't yet
   983                              <2> 	  %iassign $M_SUBS FALSE				     ;;AN000;; No, then include and reset the flag
   984                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   985                              <2> ;;
   986                              <2> ;;	PROC NAME: $M_GET_MSG_ADDRESS
   987                              <2> ;;
   988                              <2> ;;	FUNCTION:  To scan thru classes to return pointer to the message header
   989                              <2> ;;	INPUTS:    Access to $M_RES_ADDRESSES
   990                              <2> ;;	OUPUTS:    IF CX = 0 THEN Message was not found
   991                              <2> ;;		   IF CX > 1 THEN ES:DI points to the specified message
   992                              <2> ;;	REGS CHANGED: ES,DI,CX
   993                              <2> ;;
   994                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   995                              <2> 							     ;;
   996                              <2> %IF	  FARmsg					     ;;AN000;;
   997                              <2> 	  $M_GET_MSG_ADDRESS PROC FAR			     ;;AN000;;
   998                              <2> %ELSE							     ;;AN000;;
   999                              <2> 	  $M_GET_MSG_ADDRESS PROC NEAR			     ;;AN000;;
  1000                              <2> %ENDIF							     ;;AN000;;
  1001                              <2> 							     ;;
  1002                              <2> 	  PUSH	  SI					     ;;AN000;;
  1003                              <2> 	  PUSH	  BX					     ;;AN000;;
  1004                              <2> 	  XOR	  SI,SI 				     ;;AN000;; Use SI as an index
  1005                              <2> 	  XOR	  CX,CX 				     ;;AN000;; Use CX as an size
  1006                              <2> ;	  $DO						     ;;AN000;;
  1007                              <2> $MDO36:
  1008                              <2> 	    CMP     DH,UTILITY_MSG_CLASS		     ;;AN000;; Were utility messages requested?
  1009                              <2> ;	    $IF     E					     ;;AN000;; Yes,
  1010                              <2> 	    JNE $MIF37
  1011                              <2> 	      %IF      FARmsg				     ;;AN000;;
  1012                              <2> 		LES	DI,[$M_RT + $M_CLASS_ADDRS + SI] ;;AN000;;  Get address of class
  1013                              <2> 		MOV	BX,ES				     ;;AN000;
  1014                              <2> 	      %ELSE					     ;;AN000;;
  1015                              <2> 		MOV	DI,WORD PTR [$M_RT + $M_CLASS_ADDRS + SI] ;;AN000;;	 Get address of class
  1016                              <2> 		MOV	BX,DI				     ;;AN000;
  1017                              <2> 	      %ENDIF					     ;;AN000;;
  1018                              <2> ;	    $ELSE					     ;;AN000;; No,
  1019                              <2> 	    JMP SHORT $MEN37
  1020                              <2> $MIF37:
  1021                              <2> 	      TEST    DH,PARSE_ERR_CLASS		     ;;AN000;;	 Were parse errors requested?
  1022                              <2> ;	      $IF     NE				     ;;AN000;;	 Yes,
  1023                              <2> 	      JE $MIF39
  1024                              <2> 		LES	DI,[$M_RT + $M_PARSE_COMMAND + SI] ;;AN000;;   Get address of class
  1025                              <2> 		MOV	BX,ES				     ;;AN000;
  1026                              <2> ;	      $ELSE					     ;;AN000;;	 No, extended errors were specified
  1027                              <2> 	      JMP SHORT $MEN39
  1028                              <2> $MIF39:
  1029                              <2> 		CMP	AX,$M_CRIT_LO			     ;;AN000;;	   Is this a critical error?
  1030                              <2> ;		$IF	AE,AND				     ;;AN000;;
  1031                              <2> 		JNAE $MIF41
  1032                              <2> 		CMP	AX,$M_CRIT_HI			     ;;AN000;;
  1033                              <2> ;		$IF	BE				     ;;AN000;;	    Yes,
  1034                              <2> 		JNBE $MIF41
  1035                              <2> 		  LES	  DI,[$M_RT + $M_CRIT_ADDRS + SI] ;;AN000;; Get address of class
  1036                              <2> 		  MOV	  BX,ES 			     ;;AN000;
  1037                              <2> ;		$ELSE					     ;;AN000;;
  1038                              <2> 		JMP SHORT $MEN41
  1039                              <2> $MIF41:
  1040                              <2> 		  LES	  DI,[$M_RT + $M_EXT_ERR_ADDRS + SI] ;;AN000;; Get address of class
  1041                              <2> 		  MOV	  BX,ES 			     ;;AN000;
  1042                              <2> ;		$ENDIF					     ;;AN000;;
  1043                              <2> $MEN41:
  1044                              <2> ;	      $ENDIF					     ;;AN000;;
  1045                              <2> $MEN39:
  1046                              <2> ;	    $ENDIF					     ;;AN000;;
  1047                              <2> $MEN37:
  1048                              <2> 							     ;;
  1049                              <2> 	    CMP     BX,$M_TERMINATING_FLAG		     ;;AN000;; Are we finished all classes?
  1050                              <2> ;	    $IF     E					     ;;AN000;; Yes,
  1051                              <2> 	    JNE $MIF46
  1052                              <2> 	      CMP     DH,UTILITY_MSG_CLASS		     ;;AN000;;	  Was it a UTILITY class?
  1053                              <2> ;	      $IF     E 				     ;;AN000;;	  Yes,
  1054                              <2> 	      JNE $MIF47
  1055                              <2> 		STC					     ;;AN000;;	    Set the carry flag
  1056                              <2> ;	      $ELSE					     ;;AN000;;	  No,
  1057                              <2> 	      JMP SHORT $MEN47
  1058                              <2> $MIF47:
  1059                              <2> 		MOV	[$M_RT + $M_MSG_NUM],AX		     ;;AN000;;	    Save message number
  1060                              <2> 		MOV	AX,$M_SPECIAL_MSG_NUM		     ;;AN000;;	    Set special message number
  1061                              <2> 		MOV	BP,$M_ONE_REPLACE		     ;;AN000;;	    Set one replace in message
  1062                              <2> 		XOR	SI,SI				     ;;AN000;;	    Reset the SI index to start again
  1063                              <2> 		CLC					     ;;AN000;;
  1064                              <2> ;	      $ENDIF					     ;;AN000;; No,
  1065                              <2> $MEN47:
  1066                              <2> ;	    $ELSE					     ;;AN000;;
  1067                              <2> 	    JMP SHORT $MEN46
  1068                              <2> $MIF46:
  1069                              <2> 	      CMP     BX,$M_CLASS_NOT_EXIST		     ;;AN000;;	 Does this class exist?
  1070                              <2> ;	      $IF     NE				     ;;AN001;;	 Yes,
  1071                              <2> 	      JE $MIF51
  1072                              <2> 		CALL	$M_FIND_SPECIFIED_MSG		     ;;AN000;;	   Try to find the message
  1073                              <2> ;	      $ENDIF					     ;;AN000;;
  1074                              <2> $MIF51:
  1075                              <2> 	      ADD     SI,$M_ADDR_SZ_FAR 		     ;;AN000;;	     Get next class
  1076                              <2> 	      CLC					     ;;AN000;;
  1077                              <2> ;	    $ENDIF					     ;;AN000;;
  1078                              <2> $MEN46:
  1079                              <2> ;	  $LEAVE  C					     ;;AN000;;
  1080                              <2> 	  JC $MEN36
  1081                              <2> 	    OR	    CX,CX				     ;;AN000;;	   Was the message found?
  1082                              <2> ;	  $ENDDO  NZ,LONG				     ;;AN000;;
  1083                              <2> 	  JNZ $MXL2
  1084                              <2> 	  JMP $MDO36
  1085                              <2> $MXL2:
  1086                              <2> $MEN36:
  1087                              <2> 
  1088                              <2> 	  PUSHF 					     ;;AN006;; Save the flag state
  1089                              <2> 	  CMP	  DH,EXT_ERR_CLASS			     ;;AN006;; Was an extended error requested?
  1090                              <2> ;	  $IF	  E					     ;;AN006;; Yes,
  1091                              <2> 	  JNE $MIF56
  1092                              <2> 	    PUSH    DX					     ;;AN006;;	Save all needed registers
  1093                              <2> 	    PUSH    BP					     ;;AN006;;
  1094                              <2> 	    PUSH    CX					     ;;AN006;;
  1095                              <2> 	    PUSH    ES					     ;;AN006;;
  1096                              <2> 	    PUSH    DI					     ;;AN006;;
  1097                              <2> 	    PUSH    AX					     ;;AN006;;
  1098                              <2> 
  1099                              <2> 	    MOV     AX,IFSFUNC_INSTALL_CHECK		     ;;AN006;;	Check if IFSFUNC is installed
  1100                              <2> 	    INT     2FH 				     ;;AN006;;
  1101                              <2> 	    CMP     AL,IFSFUNC_INSTALLED		     ;;AN006;;	Is it installed?
  1102                              <2> 	    POP     AX					     ;;AN006;;	Restore msg number
  1103                              <2> ;	    $IF     E					     ;;AN006;;	 Yes,
  1104                              <2> 	    JNE $MIF57
  1105                              <2> 	      MOV     BX,AX				     ;;AN006;;	  BX is the extended error number
  1106                              <2> 	      MOV     AX,IFS_GET_ERR_TEXT		     ;;AN006;;	  AX is the muliplex number
  1107                              <2> 	      INT     2FH				     ;;AN006;;	  Call IFSFUNC
  1108                              <2> ;	    $ELSE					     ;;AN006;;	 No,
  1109                              <2> 	    JMP SHORT $MEN57
  1110                              <2> $MIF57:
  1111                              <2> 	      STC					     ;;AN006;;	  Carry conditon
  1112                              <2> ;	    $ENDIF					     ;;AN006;;
  1113                              <2> $MEN57:
  1114                              <2> 
  1115                              <2> ;	    $IF     C					     ;;AN006;;	Was there an update?
  1116                              <2> 	    JNC $MIF60
  1117                              <2> 	      POP     DI				     ;;AN006;;	No,
  1118                              <2> 	      POP     ES				     ;;AN006;;	 Restore old pointer
  1119                              <2> 	      POP     CX				     ;;AN006;;
  1120                              <2> ;	    $ELSE					     ;;AN006;;	Yes
  1121                              <2> 	    JMP SHORT $MEN60
  1122                              <2> $MIF60:
  1123                              <2> 	      ADD     SP,6				     ;;AN006;;	 Throw away old pointer
  1124                              <2> 	      CALL    $M_SET_LEN_IN_CX			     ;;AN006;;	 Get the length of the ASCIIZ string
  1125                              <2> ;	    $ENDIF					     ;;AN006;;
  1126                              <2> $MEN60:
  1127                              <2> 	    POP     BP					     ;;AN006;;	Restore other Regs
  1128                              <2> 	    POP     DX					     ;;AN006;;
  1129                              <2> ;	  $ENDIF					     ;;AN006;;
  1130                              <2> $MIF56:
  1131                              <2> 	  $M_POPF					     ;;AN006;; Restore the flag state
  1132                              <2> 
  1133                              <2> 	  POP	  BX					     ;;AN000;;
  1134                              <2> 	  POP	  SI					     ;;AN000;;
  1135                              <2> 	  RET						     ;;AN000;; Return ES:DI pointing to the message
  1136                              <2> 							     ;;
  1137                              <2> $M_GET_MSG_ADDRESS ENDP 				     ;;
  1138                              <2> 							     ;;
  1139                              <2> $M_SET_LEN_IN_CX PROC NEAR				     ;;
  1140                              <2> 							     ;;
  1141                              <2> 	  PUSH	  DI					     ;;AN006;; Save position
  1142                              <2> 	  PUSH	  AX					     ;;AN006;;
  1143                              <2> 	  MOV	  CX,-1 				     ;;AN006;; Set CX for decrements
  1144                              <2> 	  XOR	  AL,AL 				     ;;AN006;; Prepare compare register
  1145                              <2> 	  REPNE   SCASB 				     ;;AN006;; Scan for zero
  1146                              <2> 	  NOT	  CX					     ;;AN006;; Change decrement into number
  1147                              <2> 	  DEC	  CX					     ;;AN006;; Don't include the zero
  1148                              <2> 	  POP	  AX					     ;;AN006;;
  1149                              <2> 	  POP	  DI					     ;;AN006;; Restore position
  1150                              <2> 	  RET						     ;;AN006;;
  1151                              <2> 							     ;;
  1152                              <2> $M_SET_LEN_IN_CX ENDP					     ;;
  1153                              <2> 							     ;;
  1154                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1155                              <2> ;;
  1156                              <2> ;;	PROC NAME: $M_FIND_SPECIFIED_MSG
  1157                              <2> ;;
  1158                              <2> ;;	FUNCTION:  To scan thru message headers until message is found
  1159                              <2> ;;	INPUTS:    ES:DI points to beginning of msg headers
  1160                              <2> ;;		   CX contains the number of messages in class
  1161                              <2> ;;		   DH contains the message class
  1162                              <2> ;;	OUPUTS:    IF CX = 0 THEN Message was not found
  1163                              <2> ;;		   IF CX > 1 THEN ES:DI points to header of specified message
  1164                              <2> ;;
  1165                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1166                              <2> 							     ;;
  1167                              <2> $M_FIND_SPECIFIED_MSG PROC NEAR 			     ;;AN000;;
  1168                              <2> 							     ;;
  1169                              <2> 	  CMP	  BX,1					     ;;AN004;;	Do we have an address to CALL?
  1170                              <2> ;	  $IF	  E,AND 				     ;;AN004;;	Yes,
  1171                              <2> 	  JNE $MIF64
  1172                              <2> 	  CMP	  WORD [cs:$M_RT + $M_DISK_PROC_ADDR],-1	     ;;AN004;;	Do we have an address to CALL?
  1173                              <2> ;	  $IF	  NE					     ;;AN004;;	Yes,
  1174                              <2> 	  JE $MIF64
  1175                              <2> 	    CMP     AX,$M_SPECIAL_MSG_NUM		     ;;AN004;; Are we displaying a default Ext Err?
  1176                              <2> ;	    $IF     E					     ;;AN004;;	. . . and . . .
  1177                              <2> 	    JNE $MIF65
  1178                              <2> 	      PUSH    AX				     ;;AN004;;	 Reset the special message number
  1179                              <2> 	      MOV     AX,[$M_RT + $M_MSG_NUM]		     ;;AN004;;	 Get the old message number
  1180                              <2> 	      CALL    far [$M_RT + $M_DISK_PROC_ADDR]      ;;AN004;;	 Call the READ_DISK_PROC to get error text
  1181                              <2> 	      POP     AX				     ;;AN004;;	 Reset the special message number
  1182                              <2> ;	    $ELSE					     ;;AN004;;	 Get the old message number
  1183                              <2> 	    JMP SHORT $MEN65
  1184                              <2> $MIF65:
  1185                              <2> 	      CALL    far [$M_RT + $M_DISK_PROC_ADDR]      ;;AN004;;	 Call the READ_DISK_PROC to get error text
  1186                              <2> ;	    $ENDIF					     ;;AN004;;	 Get the old message number
  1187                              <2> $MEN65:
  1188                              <2> ;	  $ELSE 					     ;;AN004;;
  1189                              <2> 	  JMP SHORT $MEN64
  1190                              <2> $MIF64:
  1191                              <2> 	    XOR     CX,CX				     ;;AN002;;	 CX = 0 will allow us to
  1192                              <2> 	    CMP     DH,UTILITY_MSG_CLASS		     ;;AN001;;
  1193                              <2> ;	    $IF     NE					     ;;AN001;;
  1194                              <2> 	    JE $MIF69
  1195                              <2> 	      MOV     CL,BYTE PTR [ES:DI + $M_NUM_CLS_MSG]     ;;AN001;;	 Get number of messages in class
  1196                              <2> ;	    $ELSE					     ;;AN001;;
  1197                              <2> 	    JMP SHORT $MEN69
  1198                              <2> $MIF69:
  1199                              <2> %IF	      FARmsg					     ;;AN001;;
  1200                              <2> 	      CMP     BYTE PTR [ES:DI + $M_CLASS_ID],DH	     ;;AN002;; Check if class still exists at
  1201                              <2> %ELSE
  1202                              <2> 	      CMP     BYTE PTR [CS:DI + $M_CLASS_ID],DH	     ;;AN002;; Check if class still exists at
  1203                              <2> %ENDIF
  1204                              <2> ;	      $IF     E 				     ;;AN002;;	pointer (hopefully)
  1205                              <2> 	      JNE $MIF71
  1206                              <2> %IF		FARmsg					     ;;AN001;;
  1207                              <2> 		MOV	CL,BYTE PTR [ES:DI + $M_NUM_CLS_MSG]   ;;AN000;;	   Get number of messages in class
  1208                              <2> %ELSE
  1209                              <2> 		MOV	CL,BYTE PTR [CS:DI + $M_NUM_CLS_MSG]   ;;AN000;;	   Get number of messages in class
  1210                              <2> %ENDIF
  1211                              <2> ;	      $ENDIF					     ;;AN002;;	  go on to the next class
  1212                              <2> $MIF71:
  1213                              <2> ;	    $ENDIF					     ;;AN001;;
  1214                              <2> $MEN69:
  1215                              <2> 	    ADD     DI,$M_CLASS_ID_SZ			     ;;AN000;;	   Point past the class header
  1216                              <2> 	    STC 					     ;;AN004;;	 Flag that we haven't found anything yet
  1217                              <2> ;	  $ENDIF					     ;;AN004;;
  1218                              <2> $MEN64:
  1219                              <2> 
  1220                              <2> ;	  $IF	  C					     ;;AN004;; Have we found anything yet?
  1221                              <2> 	  JNC $MIF75
  1222                              <2> 	    CLC 					     ;;AN004;; No, reset carry
  1223                              <2> ;	    $SEARCH					     ;;AN000;;
  1224                              <2> $MDO76:
  1225                              <2> 	      OR      CX,CX				     ;;AN000;;	  Do we have any to check?
  1226                              <2> ;	    $LEAVE  Z					     ;;AN000;;	     No, return with CX = 0
  1227                              <2> 	    JZ $MEN76
  1228                              <2> 	      CMP     DH,UTILITY_MSG_CLASS		     ;;AN001;;
  1229                              <2> ;	      $IF     NE				     ;;AN001;;
  1230                              <2> 	      JE $MIF78
  1231                              <2> 		CMP	AX,WORD PTR [ES:DI + $M_NUM]	     ;;AN001;; Is this the message requested?
  1232                              <2> ;	      $ELSE					     ;;AN001;;
  1233                              <2> 	      JMP SHORT $MEN78
  1234                              <2> $MIF78:
  1235                              <2> %IF		FARmsg					     ;;AN001;;
  1236                              <2> 		CMP	AX,WORD PTR [ES:DI + $M_NUM]	     ;;AN000;; Is this the message requested?
  1237                              <2> %ELSE
  1238                              <2> 		CMP	AX,WORD PTR [CS:DI + $M_NUM]	     ;;AN000;; Is this the message requested?
  1239                              <2> %ENDIF
  1240                              <2> ;	      $ENDIF
  1241                              <2> $MEN78:
  1242                              <2> ;	    $EXITIF E					     ;;AN000;;
  1243                              <2> 	    JNE $MIF76
  1244                              <2> ;	    $ORELSE					     ;;AN000;
  1245                              <2> 	    JMP SHORT $MSR76
  1246                              <2> $MIF76:
  1247                              <2> 	      DEC     CX				     ;;AN000;;	  No, well do we have more to check?
  1248                              <2> ;	    $LEAVE  Z					     ;;AN000;;	     No, return with CX = 0
  1249                              <2> 	    JZ $MEN76
  1250                              <2> 	      ADD     DI,$M_ID_SZ			     ;;AN000;;	     Yes, skip past msg header
  1251                              <2> ;	    $ENDLOOP					     ;;AN000;;
  1252                              <2> 	    JMP SHORT $MDO76
  1253                              <2> $MEN76:
  1254                              <2> 	      STC					     ;;AN000;;
  1255                              <2> ;	    $ENDSRCH					     ;;AN000;;	     Check next message
  1256                              <2> $MSR76:
  1257                              <2> ;	    $IF     NC					     ;;AN000;;	 Did we find the message?
  1258                              <2> 	    JC $MIF86
  1259                              <2> 	      CMP     DH,UTILITY_MSG_CLASS		     ;;AN001;;	 Yes, is it a utility message?
  1260                              <2> 	      CLC					     ;;AN001;;
  1261                              <2> ;	      $IF     E 				     ;;AN001;;
  1262                              <2> 	      JNE $MIF87
  1263                              <2> %IF		FARmsg					     ;;AN001;;
  1264                              <2> %ELSE							     ;;AN000;;
  1265                              <2> 		PUSH	CS				     ;;AN000;;
  1266                              <2> 		POP	ES				     ;;AN000;;	 Return ES:DI pointing to the message
  1267                              <2> %ENDIF
  1268                              <2> ;	      $ENDIF					     ;;AN001;;
  1269                              <2> $MIF87:
  1270                              <2> 	      ADD     DI,WORD PTR [ES:DI + $M_TXT_PTR]	     ;;AN000;; Prepare ES:DI pointing to the message
  1271                              <2> ;	    $ENDIF					     ;;AN004;;
  1272                              <2> $MIF86:
  1273                              <2> ;	  $ENDIF					     ;;AN004;;
  1274                              <2> $MIF75:
  1275                              <2> 							     ;; 	  Yes, great we can return with CX > 0
  1276                              <2> 
  1277                              <2> ;	  $IF	  NC					     ;;AN000;;	 Did we find the message?
  1278                              <2> 	  JC $MIF91
  1279                              <2> 	    XOR     CH,CH				     ;;AN000;;
  1280                              <2> 	    MOV     CL,BYTE PTR [ES:DI] 		     ;;AN000;;	 Move size into CX
  1281                              <2> 	    INC     DI					     ;;AN000;;	 Increment past length
  1282                              <2> ;	  $ENDIF					     ;;AN004;;
  1283                              <2> $MIF91:
  1284                              <2> 
  1285                              <2> 	  MOV	  byte [$M_RT + $M_SIZE],$M_NULL 		     ;;AN004;; Reset variable
  1286                              <2> 	  RET						     ;;AN000;; Return
  1287                              <2> 							     ;;
  1288                              <2> $M_FIND_SPECIFIED_MSG ENDP				     ;;AN000;;
  1289                              <2> 							     ;;
  1290                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1291                              <2> 	%ENDIF						     ;;AN000;; END of include of common subroutines
  1292                              <2>       %ENDIF						     ;;AN000;; END of include of SYSGETMSG
  1293                              <2> ; 
  1294                              <2>       %IF      DISPLAYmsg				     ;;AN000;; Is the request to include the code for SYSGETMSG ?
  1295                              <2> 	%IF	COMR					     ;;AN000;;
  1296                              <2> 	  $M_RT   EQU		   $M_RT2		     ;;AN000;;
  1297                              <2> 	%ENDIF						     ;;AN000;;
  1298                              <2> 	%iassign DISPLAYmsg  FALSE				     ;;AN000;; Yes, THEN include it and reset flag
  1299                              <2> ;	PAGE
  1300                              <2> ;	SUBTTL	DOS - Message Retriever - DISPMSG.ASM Module
  1301                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1302                              <2> ;;
  1303                              <2> ;;  Proc Name:	SYSDISPMSG
  1304                              <2> ;;
  1305                              <2> ;;  Function:	The DISPLAY service will output a defined message to a handle
  1306                              <2> ;;		requested by the caller. It also provides function to display
  1307                              <2> ;;		messages when handles are not applicable (ie. DOS function calls
  1308                              <2> ;;		00h to 0Ah) Replaceable parameters are allowed and are
  1309                              <2> ;;		defined previous to entry.
  1310                              <2> ;;
  1311                              <2> ;;		It is assumes that a PRELOAD function has already determined
  1312                              <2> ;;		the addressibilty internally to the message retriever services.
  1313                              <2> ;;  Inputs:
  1314                              <2> ;;
  1315                              <2> ;;  Outputs:
  1316                              <2> ;;
  1317                              <2> ;;  Psuedocode:
  1318                              <2> ;;		Save registers needed later
  1319                              <2> ;;		Get address of the message requested
  1320                              <2> ;;		IF Message number exists THEN
  1321                              <2> ;;		  IF replacable parameters were specified THEN
  1322                              <2> ;;		     Display message with replacable parms
  1323                              <2> ;;		  ELSE
  1324                              <2> ;;		     Display string without replacable parms
  1325                              <2> ;;		  ENDIF
  1326                              <2> ;;		  IF character input was requested THEN
  1327                              <2> ;;		     Wait for character input
  1328                              <2> ;;		  ENDIF
  1329                              <2> ;;		  Clear CARRY FLAG
  1330                              <2> ;;		ELSE
  1331                              <2> ;;		   Set CARRY FLAG
  1332                              <2> ;;		ENDIF
  1333                              <2> ;;		Return
  1334                              <2> ;;
  1335                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1336                              <2> 							     ;;
  1337                              <2> %IF	FARmsg						     ;;AN000;;
  1338                              <2> 	SYSDISPMSG PROC FAR				     ;;AN000;;
  1339                              <2> %ELSE							     ;;AN000;;
  1340                              <2> 	SYSDISPMSG PROC NEAR				     ;;AN000;;
  1341                              <2> %ENDIF							     ;;AN000;;
  1342                              <2> 							     ;;
  1343                              <2> ;; Save registers and values needed later
  1344                              <2> 
  1345                              <2> 	PUSH	AX					     ;;AN000;; Save changed REGs
  1346                              <2> 	PUSH	BX					     ;;AN000;;
  1347                              <2> 	PUSH	CX					     ;;AN000;;
  1348                              <2> 	PUSH	BP					     ;;AN000;;
  1349                              <2> 	PUSH	DI					     ;;AN000;; Save pointer to input buffer (offset)
  1350                              <2> 	PUSH	ES					     ;;AN000;; Save pointer to input buffer (segment)
  1351                              <2> 	PUSH	DX					     ;;AN000;; Save Input/Class request
  1352                              <2> 
  1353                              <2> 	MOV	BP,CX					     ;;AN000;; Use BP to hold replace count
  1354                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_HANDLE],BX		     ;;AN000;; Save handle
  1355                              <2> 	MOV	BYTE PTR [cs:$M_RT + $M_CLASS],DH		     ;;AN004;; Save class
  1356                              <2> 
  1357                              <2> ;; Get address of the message requested
  1358                              <2> 
  1359                              <2> %IF	FARmsg						     ;;AN000;;
  1360                              <2> 	CALL	FAR PTR $M_GET_MSG_ADDRESS		     ;;AN000;; Scan thru classes to find message
  1361                              <2> %ELSE							     ;;AN000;;
  1362                              <2> 	CALL	$M_GET_MSG_ADDRESS			     ;;AN000;; Scan thru classes to find message
  1363                              <2> %ENDIF							     ;;AN000;;
  1364                              <2> 	OR	CX,CX					     ;;AN000;; Was message found?
  1365                              <2> ;	$IF	NZ					     ;;AN000;;	 YES, Message address in ES:DI
  1366                              <2> 	JZ $MIF93
  1367                              <2> 
  1368                              <2> ;; Test if replacable parameters were specified
  1369                              <2> 
  1370                              <2> 	  OR	  BP,BP 				     ;;AN000;;	 Were replacable parameters requested
  1371                              <2> ;	  $IF	  Z					     ;;AN000;;
  1372                              <2> 	  JNZ $MIF94
  1373                              <2> 
  1374                              <2> ;; Display string without replacable parms
  1375                              <2> 
  1376                              <2> 	    CALL    $M_DISPLAY_STRING			     ;;AN000;; No, great . . . Display message
  1377                              <2> ;	  $ELSE 					     ;;AN000;;
  1378                              <2> 	  JMP SHORT $MEN94
  1379                              <2> $MIF94:
  1380                              <2> %IF	    $M_REPLACE					     ;;AN000;;
  1381                              <2> 
  1382                              <2> ;; Display message with replacable parms
  1383                              <2> 
  1384                              <2> 	    CALL    $M_DISPLAY_MESSAGE			     ;;AN000;;	 Display the message with substitutions
  1385                              <2> %ENDIF							     ;;AN000;;
  1386                              <2> ;	  $ENDIF					     ;;AN000;;
  1387                              <2> $MEN94:
  1388                              <2> ;	  $IF	  NC
  1389                              <2> 	  JC $MIF97
  1390                              <2> 
  1391                              <2> 	    POP     DX					     ;;AN000;; Get Input/Class request
  1392                              <2> 
  1393                              <2> 	    CALL    $M_ADD_CRLF 			     ;;AN004;; Check if we need to add the CR LF chars.
  1394                              <2> 
  1395                              <2> 	    POP     ES					     ;;AN000;; Get location of input buffer (if specified)
  1396                              <2> 	    POP     DI					     ;;AN000;;
  1397                              <2> 
  1398                              <2> ;; Test if character input was requested
  1399                              <2> 
  1400                              <2> %IF	    INPUTmsg					     ;;AN000;;
  1401                              <2> 	    OR	    DL,DL				     ;;AN000;; Was Wait-For-Input requested?
  1402                              <2> ;	    $IF     NZ					     ;;AN000;;
  1403                              <2> 	    JZ $MIF98
  1404                              <2> 	      CALL    $M_WAIT_FOR_INPUT 		     ;;AN000;;
  1405                              <2> ;	    $ENDIF					     ;;AN000;;
  1406                              <2> $MIF98:
  1407                              <2> %ENDIF							     ;;AN000;;
  1408                              <2> ;	  $ELSE 					     ;;AN000;;
  1409                              <2> 	  JMP SHORT $MEN97
  1410                              <2> $MIF97:
  1411                              <2> 	    ADD     SP,6				     ;;AN000;;
  1412                              <2> 	    STC 					     ;;AN000;; Reset carry flag
  1413                              <2> ;	  $ENDIF					     ;;AN000;;
  1414                              <2> $MEN97:
  1415                              <2> ;	$ELSE						     ;;AN000;; No,
  1416                              <2> 	JMP SHORT $MEN93
  1417                              <2> $MIF93:
  1418                              <2> 	  POP	  ES					     ;;AN000;;	 Get pointer to input buffer (segment)
  1419                              <2> 	  POP	  DI					     ;;AN000;;	 Get base pointer to first sublist (offset)
  1420                              <2> 	  POP	  DX					     ;;AN000;;	 Get base pointer to first sublist (segment)
  1421                              <2> 	  STC						     ;;AN000;;	 Set carry flag
  1422                              <2> ;	$ENDIF						     ;;AN000;;
  1423                              <2> $MEN93:
  1424                              <2> 							     ;;
  1425                              <2> ;	$IF	NC					     ;;AN000;; Was there an error?
  1426                              <2> 	JC $MIF104
  1427                              <2> 	  POP	  BP					     ;;AN000;; No,
  1428                              <2> 	  POP	  CX					     ;;AN000;;
  1429                              <2> 	  POP	  BX					     ;;AN000;;
  1430                              <2> %IF	  INPUTmsg					     ;;AN000;;
  1431                              <2> 	  ADD	  SP,2					     ;;AN000;;
  1432                              <2> %ELSE							     ;AN000;
  1433                              <2> 	  POP	  AX					     ;;AN000;;
  1434                              <2> %ENDIF							     ;;AN000;;
  1435                              <2> ;	$ELSE						     ;;AN000;;	Yes,
  1436                              <2> 	JMP SHORT $MEN104
  1437                              <2> $MIF104:
  1438                              <2> 	  ADD	  SP,8					     ;;AN000;;	   Eliminate from stack
  1439                              <2> 	  STC						     ;;AN000;;
  1440                              <2> ;	$ENDIF						     ;;AN000;;
  1441                              <2> $MEN104:
  1442                              <2> 							     ;;
  1443                              <2> 	RET						     ;;AN000;; Return
  1444                              <2> 							     ;;
  1445                              <2> 	SYSDISPMSG ENDP 				     ;;AN000;;
  1446                              <2> 							     ;;
  1447                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1448                              <2> ; 
  1449                              <2> ;;
  1450                              <2> ;;	PROC NAME: $M_DISPLAY_STRING
  1451                              <2> ;;
  1452                              <2> ;;	FUNCTION:  Will display or write string
  1453                              <2> ;;	INPUTS:    ES:DI points to beginning of message
  1454                              <2> ;;		   CX contains the length of string to write (if applicable)
  1455                              <2> ;;	OUTPUTS:   None
  1456                              <2> ;;	REGS Revised: None
  1457                              <2> ;;
  1458                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1459                              <2> 							     ;;
  1460                              <2> $M_DISPLAY_STRING PROC NEAR				     ;;AN000;;
  1461                              <2> 							     ;;
  1462                              <2> 	PUSH	AX					     ;;AN000;;
  1463                              <2> 	PUSH	BX					     ;;AN000;;
  1464                              <2> 	PUSH	DX					     ;;AN000;;
  1465                              <2> 							     ;;
  1466                              <2> 	MOV	BX,[cs:$M_RT + $M_HANDLE]			     ;;AN000;; Retrieve handle
  1467                              <2> 							     ;;
  1468                              <2> %IF	COMR						     ;;  ** Special case for RESIDENT COMMAND.COM
  1469                              <2> 	CALL	$M_DISPLAY_$_STRING			     ;;AN000;; No, display $ terminated string
  1470                              <2> %ELSE
  1471                              <2> 	CMP	BX,$M_NO_HANDLE 			     ;;AN000;; Was there a handle specified?
  1472                              <2> ;	$IF	E					     ;;AN000;;
  1473                              <2> 	JNE $MIF107
  1474                              <2> 	  CALL	  $M_DISPLAY_$_STRING			     ;;AN000;; No, display $ terminated string
  1475                              <2> ;	$ELSE						     ;;AN000;;
  1476                              <2> 	JMP SHORT $MEN107
  1477                              <2> $MIF107:
  1478                              <2> 	  CALL	  $M_DISPLAY_H_STRING			     ;;AN000;; Yes, display string to handle
  1479                              <2> ;	$ENDIF						     ;;AN000;;
  1480                              <2> $MEN107:
  1481                              <2> 							     ;AN001;
  1482                              <2> ;	$IF	C					     ;;AN000;;	Was there an error?
  1483                              <2> 	JNC $MIF110
  1484                              <2> 	  MOV	  AH,DOS_GET_EXT_ERROR			     ;;AN000;;	Yes,
  1485                              <2> 	  MOV	  BX,DOS_GET_EXT_ERROR_BX		     ;;AN000;;	  Get extended error
  1486                              <2> 	  INT	  21H					     ;;AN000;;
  1487                              <2> 	  XOR	  AH,AH 				     ;;AN000;;	  Clear AH
  1488                              <2> 	  ADD	  SP,6					     ;;AN000;;	  Clean up stack
  1489                              <2> 	  STC						     ;;AN000;;	  Flag that there was an error
  1490                              <2> ;	$ELSE						     ;;AN000;;	No,
  1491                              <2> 	JMP SHORT $MEN110
  1492                              <2> $MIF110:
  1493                              <2> 	  CMP	  BX,$M_NO_HANDLE			     ;;AN000;; Was there a handle specified?
  1494                              <2> ;	  $IF	  NE					     ;;AN000;;
  1495                              <2> 	  JE $MIF112
  1496                              <2> 	    CMP     AX,CX				     ;AN001;	 Was it ALL written?
  1497                              <2> ;	    $IF     NE					     ;AN001;	 No,
  1498                              <2> 	    JE $MIF113
  1499                              <2> 	      CALL    $M_GET_EXT_ERR_39 		     ;AN001;	   Set Extended error
  1500                              <2> 	      ADD     SP,6				     ;AN001;	   Clean up stack
  1501                              <2> 	      STC					     ;AN001;	   Flag that there was an error
  1502                              <2> ;	    $ENDIF					     ;AN001;
  1503                              <2> $MIF113:
  1504                              <2> ;	  $ENDIF					     ;AN001;
  1505                              <2> $MIF112:
  1506                              <2> ;	$ENDIF						     ;;AN000;;
  1507                              <2> $MEN110:
  1508                              <2> %ENDIF
  1509                              <2> ;	$IF	NC					     ;;AN000;;	Was there ANY error?
  1510                              <2> 	JC $MIF117
  1511                              <2> 	  POP	  DX					     ;;AN000;;	Restore regs
  1512                              <2> 	  POP	  BX					     ;;AN000;;
  1513                              <2> 	  POP	  AX					     ;;AN000;;
  1514                              <2> ;	$ENDIF						     ;;AN000;;
  1515                              <2> $MIF117:
  1516                              <2> 	RET						     ;;AN000;; Return
  1517                              <2> 							     ;;
  1518                              <2> $M_DISPLAY_STRING ENDP					     ;;AN000;;
  1519                              <2> 							     ;;
  1520                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1521                              <2> ;;
  1522                              <2> ;;	PROC NAME: $M_DISPLAY_$_STRING
  1523                              <2> ;;
  1524                              <2> ;;	FUNCTION:  Will display a $ terminated string
  1525                              <2> ;;	INPUTS:    ES:DI points to beginning of message text (not the length)
  1526                              <2> ;;	OUPUTS:    None
  1527                              <2> ;;	REGS USED: AX,DX
  1528                              <2> ;;
  1529                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1530                              <2> 							     ;;
  1531                              <2> $M_DISPLAY_$_STRING PROC NEAR				     ;;AN000;;
  1532                              <2> 							     ;;
  1533                              <2> 	PUSH	DS					     ;;AN000;;
  1534                              <2> 	PUSH	ES					     ;;AN000;;
  1535                              <2> 	POP	DS					     ;;AN000;; Set DS to segment of message text
  1536                              <2> %IFN	COMR
  1537                              <2> 	CMP	CX,$M_SINGLE_CHAR			     ;;AN000;; Is this a single character?
  1538                              <2> ;	$IF	E					     ;;AN000;; Yes,
  1539                              <2> 	JNE $MIF119
  1540                              <2> 	  MOV	  AH,DOS_DISP_CHAR			     ;;AN000;;	 DOS Function to display CHARACTER
  1541                              <2> 	  MOV	  DL,BYTE PTR [ES:DI]			     ;;AN000;;	 Get the character
  1542                              <2> 	  INT	  21H					     ;;AN000;;	 Write character
  1543                              <2> 	  POP	  DS					     ;;AN000;; Set DS to segment of message text
  1544                              <2> 	  MOV	  AL,DL 				     ;;AN000;;	 Get the character in AL
  1545                              <2> 	  CALL	  $M_IS_IT_DBCS 			     ;;AN000;;	 Is this the first byte of a DB character
  1546                              <2> 	  PUSH	  DS					     ;;AN000;;
  1547                              <2> 	  PUSH	  ES					     ;;AN000;;
  1548                              <2> 	  POP	  DS					     ;;AN000;; Set DS to segment of message text
  1549                              <2> ;	  $IF	  C					     ;;AN000;;	 Yes,
  1550                              <2> 	  JNC $MIF120
  1551                              <2> 	    MOV     DL,BYTE PTR [ES:DI + 1]		     ;;AN000;; Get the next character
  1552                              <2> 	    INT     21H 				     ;;AN000;;	 Write character
  1553                              <2> 	    CLC 					     ;;AN000;;	 Clear the DBCS indicator
  1554                              <2> ;	  $ENDIF					     ;;AN000;;
  1555                              <2> $MIF120:
  1556                              <2> ;	$ELSE						     ;;AN000;; No,
  1557                              <2> 	JMP SHORT $MEN119
  1558                              <2> $MIF119:
  1559                              <2> %ENDIF
  1560                              <2> 	  MOV	  AH,DOS_DISP_CHAR			     ;;AN000;;	 DOS Function to display CHARACTER
  1561                              <2> ;	  $DO						     ;;AN002;; No,
  1562                              <2> $MDO123:
  1563                              <2> 	    OR	    CX,CX				     ;;AN002;;	 Are there any left to display?
  1564                              <2> ;	  $LEAVE  Z					     ;;AN002;;	 Yes,
  1565                              <2> 	  JZ $MEN123
  1566                              <2> 	    MOV     DL,BYTE PTR [ES:DI] 		     ;;AN002;;	   Get the character
  1567                              <2> 	    INT     21H 				     ;;AN002;;	   Display the character
  1568                              <2> 	    INC     DI					     ;;AN002;;	   Set pointer to next character
  1569                              <2> 	    DEC     CX					     ;;AN002;;	   Count this character
  1570                              <2> ;	  $ENDDO  Z					     ;;AN002;; No,
  1571                              <2> 	  JNZ $MDO123
  1572                              <2> $MEN123:
  1573                              <2> %IFN	  COMR
  1574                              <2> ;	$ENDIF						     ;;AN000;;
  1575                              <2> $MEN119:
  1576                              <2> %ENDIF
  1577                              <2> 	CLC						     ;;AN000;;	 Char functions used don't return carry as error
  1578                              <2> 	POP	DS					     ;;AN000;;
  1579                              <2> 	RET						     ;;AN000;;
  1580                              <2> 							     ;;
  1581                              <2> $M_DISPLAY_$_STRING ENDP				     ;;AN000;;
  1582                              <2> 							     ;;
  1583                              <2> %IFN	COMR
  1584                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1585                              <2> ;;
  1586                              <2> ;;	PROC NAME: $M_DISPLAY_H_STRING
  1587                              <2> ;;
  1588                              <2> ;;	FUNCTION:  Will display a string to a specified handle
  1589                              <2> ;;	INPUTS:    ES:DI points to beginning of message
  1590                              <2> ;;		   CX contains the number of bytes to write
  1591                              <2> ;;		   BX contains the handle to write to
  1592                              <2> ;;	OUPUTS:    None
  1593                              <2> ;;	REGS USED: AX,DX
  1594                              <2> ;;
  1595                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1596                              <2> 							     ;;
  1597                              <2> $M_DISPLAY_H_STRING PROC NEAR				     ;;AN000;;
  1598                              <2> 							     ;;
  1599                              <2> 	XOR	AX,AX					     ;;AN002;; Set number of bytes written to 0
  1600                              <2> 	OR	CX,CX					     ;;AN002;; For performance, don't write if not necessary
  1601                              <2> ;	$IF	NZ					     ;;AN002;; Any chars to write?
  1602                              <2> 	JZ $MIF127
  1603                              <2> 	  PUSH	  DS					     ;;AN000;; Yes,
  1604                              <2> 	  PUSH	  ES					     ;;AN000;;
  1605                              <2> 	  POP	  DS					     ;;AN000;;	 Set DS to segment of message text
  1606                              <2> 	  MOV	  AH,DOS_WRITE_HANDLE			     ;;AN000;;	 DOS function to write to a handle
  1607                              <2> 	  MOV	  DX,DI 				     ;;AN000;;	 Pointer to data to write
  1608                              <2> 	  CMP	  CX,$M_SINGLE_CHAR			     ;;AN000;;	 Is this a single character?
  1609                              <2> ;	  $IF	  E					     ;;AN000;;	 Yes,
  1610                              <2> 	  JNE $MIF128
  1611                              <2> 	    INT     21H 				     ;;AN000;;	   Write character
  1612                              <2> 	    POP     DS					     ;;AN000;;	     Set DS to segment of message text
  1613                              <2> 	    PUSH    AX					     ;;AN000;;
  1614                              <2> 	    MOV     AL,BYTE PTR [ES:DI] 		     ;;AN000;;	     Get the character
  1615                              <2> 	    CALL    $M_IS_IT_DBCS			     ;;AN000;;	     Is this the first byte of a DB character
  1616                              <2> 	    POP     AX					     ;;AN000;;	     Set DS to segment of message text
  1617                              <2> 	    PUSH    DS					     ;;AN000;;
  1618                              <2> 	    PUSH    ES					     ;;AN000;;
  1619                              <2> 	    POP     DS					     ;;AN000;;	     Set DS to segment of message text
  1620                              <2> ;	    $IF     C					     ;;AN000;;	     Yes,
  1621                              <2> 	    JNC $MIF129
  1622                              <2> 	      CLC					     ;;AN000;;	      Clear the DBCS indicator
  1623                              <2> 	      MOV     AH,DOS_WRITE_HANDLE		     ;;AN000;;	      DOS function to write to a handle
  1624                              <2> 	      INC     DX				     ;;AN000;;	      Point to next character
  1625                              <2> 	      INT     21H				     ;;AN000;;	      Write character
  1626                              <2> ;	    $ENDIF					     ;;AN000;;
  1627                              <2> $MIF129:
  1628                              <2> ;	  $ELSE 					     ;;AN000;;	 No,
  1629                              <2> 	  JMP SHORT $MEN128
  1630                              <2> $MIF128:
  1631                              <2> 	    INT     21H 				     ;;AN000;;	   Write String at DS:SI to handle
  1632                              <2> ;	  $ENDIF					     ;;AN000;;
  1633                              <2> $MEN128:
  1634                              <2> 	  POP	  DS					     ;;AN000;;
  1635                              <2> ;	$ENDIF						     ;;AN002;;
  1636                              <2> $MIF127:
  1637                              <2> 							     ;;
  1638                              <2> 	RET						     ;;AN000;;
  1639                              <2> 							     ;;
  1640                              <2> $M_DISPLAY_H_STRING ENDP				     ;;AN000;;
  1641                              <2> 							     ;;
  1642                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1643                              <2> ;;
  1644                              <2> ;;	PROC NAME: $M_GET_EXT_ERR_39
  1645                              <2> ;;
  1646                              <2> ;;	FUNCTION:  Will set registers for extended error #39
  1647                              <2> ;;	INPUTS:    None
  1648                              <2> ;;	OUPUTS:    AX,BX,CX set
  1649                              <2> ;;	REGS USED:
  1650                              <2> ;;
  1651                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1652                              <2> 							     ;;
  1653                              <2> $M_GET_EXT_ERR_39 PROC NEAR				     ;AN001;
  1654                              <2> 							     ;;
  1655                              <2> 	MOV	AX,EXT_ERR_39				     ;AN001; Set AX=39
  1656                              <2> 	MOV	BX,(ERROR_CLASS_39 >> 8) + ACTION_39	     ;AN001; Set BH=1 BL=4
  1657                              <2> 	MOV	CH,LOCUS_39				     ;AN001; Set CH=1
  1658                              <2> 							     ;AN001;
  1659                              <2> 	RET						     ;AN001;
  1660                              <2> 							     ;;
  1661                              <2> $M_GET_EXT_ERR_39 ENDP					     ;AN001;
  1662                              <2> 							     ;;
  1663                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1664                              <2> %ENDIF
  1665                              <2> ;;
  1666                              <2> ;;	PROC NAME: $M_ADD_CRLF
  1667                              <2> ;;
  1668                              <2> ;;	FUNCTION:  Will decide whether to display a CRLF
  1669                              <2> ;;	INPUTS:    DX contains the Input/Class requested
  1670                              <2> ;;	OUTPUTS:   None
  1671                              <2> ;;	REGS Revised: CX,ES,DI
  1672                              <2> ;;
  1673                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1674                              <2> 							     ;;
  1675                              <2> $M_ADD_CRLF PROC NEAR					     ;;AN004;;
  1676                              <2> 							     ;;
  1677                              <2> 	CMP	DH,UTILITY_MSG_CLASS			     ;;AN004;; Is it a utility message?
  1678                              <2> ;	$IF	NE					     ;;AN004;; No,
  1679                              <2> 	JE $MIF134
  1680                              <2> 	  TEST	  DH,$M_NO_CRLF_MASK			     ;;AN004;;	 Are we to supress the CR LF?
  1681                              <2> ;	  $IF	  Z					     ;;AN004;;	 No,
  1682                              <2> 	  JNZ $MIF135
  1683                              <2> 	    PUSH    DS					     ;;AN004;;
  1684                              <2> 	    POP     ES					     ;;AN004;;	  Set ES to data segment
  1685                              <2> 	    LEA     DI,[$M_RT + $M_CRLF]			     ;;AN004;;	  Point at CRLF message
  1686                              <2> 	    MOV     CX,$M_CRLF_SIZE			     ;;AN004;;	  Set the message size
  1687                              <2> 	    CALL    $M_DISPLAY_STRING			     ;;AN004;;	  Display the CRLF
  1688                              <2> ;	  $ENDIF					     ;;AN004;;
  1689                              <2> $MIF135:
  1690                              <2> ;	$ENDIF						     ;;AN004;;
  1691                              <2> $MIF134:
  1692                              <2> 	RET						     ;;AN004;; Return
  1693                              <2> 							     ;;
  1694                              <2> $M_ADD_CRLF ENDP					     ;;AN004;;
  1695                              <2> 							     ;;
  1696                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1697                              <2> ;;
  1698                              <2> ;;	PROC NAME: $M_IS_IT_DBCS
  1699                              <2> ;;
  1700                              <2> ;;	FUNCTION:  Will decide whether character is Single or Double Byte
  1701                              <2> ;;	INPUTS:    AL contains the byte to be checked
  1702                              <2> ;;	OUPUTS:    Carry flag = 0 if byte is NOT in DBCS range
  1703                              <2> ;;		   Carry flag = 1 if byte IS in DBCS range
  1704                              <2> ;;	REGS USED: All restored
  1705                              <2> ;;
  1706                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1707                              <2> 							     ;;
  1708                              <2> $M_IS_IT_DBCS PROC NEAR 				     ;;AN000;;
  1709                              <2> 							     ;;
  1710                              <2> 	PUSH	ES					     ;;AN000;; Save Extra segment register
  1711                              <2> 	PUSH	DI					     ;;AN000;; Save SI register
  1712                              <2> 							     ;;
  1713                              <2> 	LES	DI,[cs:$M_RT + $M_DBCS_VEC]			     ;;AN000;;
  1714                              <2> 	OR	DI,DI					     ;;AN000;; Was the DBCS vector set?
  1715                              <2> ;	$IF	NZ					     ;;AN000;;
  1716                              <2> 	JZ $MIF138
  1717                              <2> ;	  $DO						     ;;AN000;;
  1718                              <2> $MDO139:
  1719                              <2> 	    CMP     WORD PTR [ES:DI],$M_DBCS_TERM	     ;;AN000;; Is this the terminating flag?
  1720                              <2> 	    CLC 					     ;;AN000;;
  1721                              <2> ;	  $LEAVE  E					     ;;AN000;;
  1722                              <2> 	  JE $MEN139
  1723                              <2> 							     ;;        No,
  1724                              <2> 	    CMP     AL,BYTE PTR [ES:DI] 		     ;;AN000;;	  Does the character fall in the DBCS range?
  1725                              <2> ;	    $IF     AE,AND				     ;;AN000;;
  1726                              <2> 	    JNAE $MIF141
  1727                              <2> 	    CMP     AL,BYTE PTR [ES:DI + 1]		     ;;AN000;;	  Does the character fall in the DBCS range?
  1728                              <2> ;	    $IF     BE					     ;;AN000;;
  1729                              <2> 	    JNBE $MIF141
  1730                              <2> 	      STC					     ;;AN000;;	  Yes,
  1731                              <2> ;	    $ENDIF					     ;;AN000;;	     Set carry flag
  1732                              <2> $MIF141:
  1733                              <2> 	    INC     DI					     ;;AN000;;	  No,
  1734                              <2> 	    INC     DI					     ;;AN000;;	     Go to next vector
  1735                              <2> ;	  $ENDDO					     ;;AN000;;
  1736                              <2> 	  JMP SHORT $MDO139
  1737                              <2> $MEN139:
  1738                              <2> ;	$ENDIF						     ;;AN000;;
  1739                              <2> $MIF138:
  1740                              <2> 
  1741                              <2> 	POP	DI					     ;;AN000;;
  1742                              <2> 	POP	ES					     ;;AN000;; Restore SI register
  1743                              <2> 	RET						     ;;AN000;; Return
  1744                              <2> 							     ;;
  1745                              <2> $M_IS_IT_DBCS ENDP					     ;;AN000;;
  1746                              <2> 							     ;;
  1747                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1748                              <2> ;;
  1749                              <2> ;;	PROC NAME: $M_CONVERT2ASC
  1750                              <2> ;;
  1751                              <2> ;;	FUNCTION: Convert a binary number to a ASCII string
  1752                              <2> ;;	INPUTS: DX:AX contains the number to be converted
  1753                              <2> ;;		$M_RT_DIVISOR contains the divisor
  1754                              <2> ;;	OUPUTS: CX contains the number of characters
  1755                              <2> ;;		Top of stack  --> Last character
  1756                              <2> ;;				     . . .
  1757                              <2> ;;		Bot of stack  --> First character
  1758                              <2> ;;	REGS USED:
  1759                              <2> ;;
  1760                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1761                              <2> 							     ;;
  1762                              <2> $M_CONVERT2ASC PROC NEAR				     ;;AN000;;
  1763                              <2> 							     ;;
  1764                              <2> 	POP	word [cs:$M_RT + $M_RETURN_ADDR]			     ;;AN000;; Save Return Address
  1765                              <2> 	XOR	BX,BX					     ;;AN000;; Use BP as a swapping register
  1766                              <2> 							     ;;
  1767                              <2> 	XCHG	BX,AX					     ;;AN000;; Initialize - Low Word in BP
  1768                              <2> 	XCHG	AX,DX					     ;;AN000;;		  - High Word in AX
  1769                              <2> ;	$DO						     ;;AN000;; DO UNTIL Low Word becomes zero
  1770                              <2> $MDO145:
  1771                              <2> 	  DIV	  word [cs:$M_RT + $M_DIVISOR]			     ;;AN000;; Divide High Word by divisor
  1772                              <2> 	  XCHG	  BX,AX 				     ;;AN000;; Setup to divide Low Word using remainder
  1773                              <2> 							     ;; 	and save reduced High Word in BP
  1774                              <2> 	  DIV	  word [cs:$M_RT + $M_DIVISOR]			     ;;AN000;; Divide Low Word by divisor
  1775                              <2> 	  CMP	  DX,9					     ;;AN000;;	Make a digit of the remainder
  1776                              <2> ;	  $IF	  A					     ;;AN000;;	IF 10 to 15,
  1777                              <2> 	  JNA $MIF146
  1778                              <2> 	    ADD     DL,55				     ;;AN000;;	   Make A to F ASCII
  1779                              <2> ;	  $ELSE 					     ;;AN000;;	IF 0 to 9,
  1780                              <2> 	  JMP SHORT $MEN146
  1781                              <2> $MIF146:
  1782                              <2> 	    ADD     DL,'0'				     ;;AN000;;	   Make 0 to 9 ASCII
  1783                              <2> ;	  $ENDIF					     ;;AN000;;
  1784                              <2> $MEN146:
  1785                              <2> 	  PUSH	  DX					     ;;AN000;; Save the digit on the stack
  1786                              <2> 	  INC	  CX					     ;;AN000;; Count that digit
  1787                              <2> 	  OR	  AX,AX 				     ;;AN000;; Are we done?
  1788                              <2> ;	$LEAVE	Z,AND					     ;;AN000;;
  1789                              <2> 	JNZ $MLL149
  1790                              <2> 	  OR	  BX,BX 				     ;;AN000;; AX and BX must be ZERO!!
  1791                              <2> ;	$LEAVE	Z					     ;;AN000;; No,
  1792                              <2> 	JZ $MEN145
  1793                              <2> $MLL149:
  1794                              <2> %IFN	  COMR
  1795                              <2> 	  CMP	  CX,$M_FIRST_THOU			     ;;AN000;; Are we at the first thousands mark
  1796                              <2> ;	  $IF	  E					     ;;AN000;; Yes,
  1797                              <2> 	  JNE $MIF150
  1798                              <2> 	    CMP     byte [$M_SL + $M_S_PAD],$M_COMMA		     ;;AN000;; Is the pad character a comma?
  1799                              <2> ;	    $IF     E					     ;;AN000;; Yes,
  1800                              <2> 	    JNE $MIF151
  1801                              <2> 	      PUSH    WORD [cs:$M_RT + $M_THOU_SEPARA]	     ;;AN000;; Insert a thousand separator
  1802                              <2> 	      INC     CX				     ;;AN000;;
  1803                              <2> ;	    $ENDIF					     ;;AN000;;
  1804                              <2> $MIF151:
  1805                              <2> ;	  $ELSE 					     ;;AN000;; No,
  1806                              <2> 	  JMP SHORT $MEN150
  1807                              <2> $MIF150:
  1808                              <2> 	    CMP     CX,$M_SECOND_THOU			     ;;AN000;;	 Are we at the first thousands mark
  1809                              <2> ;	    $IF     E					     ;;AN000;;	      Yes,
  1810                              <2> 	    JNE $MIF154
  1811                              <2> 	      CMP     byte [$M_SL + $M_S_PAD],$M_COMMA		     ;;AN000;; Is the pad character a comma?
  1812                              <2> ;	      $IF     E 				     ;;AN000;; Yes,
  1813                              <2> 	      JNE $MIF155
  1814                              <2> 		PUSH	WORD [cs:$M_RT + $M_THOU_SEPARA]	     ;;AN000;; Insert a thousand separator
  1815                              <2> 		INC	CX				     ;;AN000;;
  1816                              <2> ;	      $ENDIF					     ;;AN000;;
  1817                              <2> $MIF155:
  1818                              <2> ;	    $ELSE					     ;;AN000;;	      No,
  1819                              <2> 	    JMP SHORT $MEN154
  1820                              <2> $MIF154:
  1821                              <2> 	      CMP     CX,$M_THIRD_THOU			     ;;AN000;;	 Are we at the first thousands mark
  1822                              <2> ;	      $IF     E 				     ;;AN000;;		Yes,
  1823                              <2> 	      JNE $MIF158
  1824                              <2> 		CMP	byte [$M_SL + $M_S_PAD],$M_COMMA 	     ;;AN000;; Is the pad character a comma?
  1825                              <2> ;		$IF	E				     ;;AN000;; Yes,
  1826                              <2> 		JNE $MIF159
  1827                              <2> 		  PUSH	  WORD [cs:$M_RT + $M_THOU_SEPARA]      ;;AN000;; Insert a thousand separator
  1828                              <2> 		  INC	  CX				     ;;AN000;;
  1829                              <2> ;		$ENDIF					     ;;AN000;;
  1830                              <2> $MIF159:
  1831                              <2> ;	      $ENDIF					     ;;AN000;;
  1832                              <2> $MIF158:
  1833                              <2> ;	    $ENDIF					     ;;AN000;;
  1834                              <2> $MEN154:
  1835                              <2> ;	  $ENDIF					     ;;AN000;;
  1836                              <2> $MEN150:
  1837                              <2> %ENDIF
  1838                              <2> 	  XCHG	  AX,BX 				     ;;AN000;;	 Setup to divide the reduced High Word
  1839                              <2> 							     ;;AN000;;	   and Revised Low Word
  1840                              <2> 	  XOR	  DX,DX 				     ;;AN000;;	 Reset remainder
  1841                              <2> ;	$ENDDO						     ;;AN000;;	 NEXT
  1842                              <2> 	JMP SHORT $MDO145
  1843                              <2> $MEN145:
  1844                              <2> 							     ;;AN000;; Yes,
  1845                              <2> 	XOR	DX,DX					     ;;AN000;;	 Reset remainder
  1846                              <2> 	XOR	AX,AX					     ;;AN000;;	 Reset remainder
  1847                              <2> 	PUSH	word [cs:$M_RT + $M_RETURN_ADDR]			     ;;AN000;;	 Restore Return Address
  1848                              <2> 	RET						     ;;AN000;;	 Return
  1849                              <2> 							     ;;
  1850                              <2> $M_CONVERT2ASC ENDP					     ;;AN000;;
  1851                              <2> 							     ;;
  1852                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1853                              <2> ;;
  1854                              <2> ;;	PROC NAME: $M_DISPLAY_MESSAGE
  1855                              <2> ;;
  1856                              <2> ;;	FUNCTION:  Will display or write entire message (with replacable parameters)
  1857                              <2> ;;	INPUTS:    ES:DI points to beginning of message
  1858                              <2> ;;		   DS:SI points to first sublist structure in chain
  1859                              <2> ;;		   BX contains the handle to write to (if applicable)
  1860                              <2> ;;		   CX contains the length of string to write (before substitutions)
  1861                              <2> ;;		   BP contains the count of replacables
  1862                              <2> ;;
  1863                              <2> ;;	OUTPUTS:
  1864                              <2> ;;	REGS USED: All
  1865                              <2> ;;
  1866                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1867                              <2> 							     ;;
  1868                              <2> $M_DISPLAY_MESSAGE PROC NEAR				     ;;AN000;;
  1869                              <2> 							     ;;
  1870                              <2> ;	$DO						     ;;AN000;; Note: DS:SI -> message
  1871                              <2> $MDO165:
  1872                              <2> 	  XOR	  DX,DX 				     ;;AN000;; Set size = 0
  1873                              <2> 	  OR	  CX,CX 				     ;;AN000;; Are we finished the message yet?
  1874                              <2> ;	  $IF	  NZ					     ;;AN000;; No,
  1875                              <2> 	  JZ $MIF166
  1876                              <2> 	    MOV     AH,"%"				     ;;AN000;;	 Prepare to scan for %
  1877                              <2> 	    MOV     AL,0				     ;;AN004;;
  1878                              <2> 							     ;;
  1879                              <2> ;	    $DO 					     ;;AN000;;	 Scan through string until %
  1880                              <2> $MDO167:
  1881                              <2> 	      CMP     BYTE PTR [ES:DI],AH		     ;;AN000;;	 Is this character NOT a %
  1882                              <2> ;	    $LEAVE  E,AND				     ;;AN000;;	 No,
  1883                              <2> 	    JNE $MLL168
  1884                              <2> 	      CMP     BYTE PTR [ES:DI+1],AH		     ;;AN000;;	   Is the next character also a %
  1885                              <2> ;	    $LEAVE  NE,AND				     ;;AN000;;	   No,
  1886                              <2> 	    JE $MLL168
  1887                              <2> 	      CMP     AL,AH				     ;;AN000;;	     Was the character before a %
  1888                              <2> ;	    $LEAVE  NE					     ;;AN000;;	     No, GREAT found it
  1889                              <2> 	    JNE $MEN167
  1890                              <2> $MLL168:
  1891                              <2> 	      MOV     AL,BYTE PTR [ES:DI]		     ;;AN004;;	 Yes, (to any of the above)
  1892                              <2> 	      CALL    $M_IS_IT_DBCS			     ;;AN004;;	   Is this character the first part of a DBCS?
  1893                              <2> ;	      $IF     C 				     ;;AN004;;	   Yes,
  1894                              <2> 	      JNC $MIF169
  1895                              <2> 		INC	DI				     ;;AN004;;	     Increment past second part
  1896                              <2> ;	      $ENDIF					     ;;AN004;;
  1897                              <2> $MIF169:
  1898                              <2> 	      INC     DI				     ;;AN000;;	     Next character in string
  1899                              <2> 	      INC     DX				     ;;AN000;;	     Size = Size + 1
  1900                              <2> 	      DEC     CX				     ;;AN000;;	     Decrement total size
  1901                              <2> ;	    $ENDDO  Z					     ;;AN000;;	 Exit scan if we're at the end of the line
  1902                              <2> 	    JNZ $MDO167
  1903                              <2> $MEN167:
  1904                              <2> ;	  $ENDIF					     ;;AN000;;
  1905                              <2> $MIF166:
  1906                              <2> 							     ;;
  1907                              <2> 	  PUSH	  SI					     ;;AN000;; Save beginning of sublists
  1908                              <2> 	  XCHG	  CX,DX 				     ;;AN000;; Get size of message to display (tot sz in DX)
  1909                              <2> 	  OR	  BP,BP 				     ;;AN000;; Do we have any replacables to do?
  1910                              <2> ;	  $IF	  NZ					     ;;AN000;; Yes,
  1911                              <2> 	  JZ $MIF173
  1912                              <2> 	    DEC     BP					     ;;AN000;;	 Decrement number of replacables
  1913                              <2> 
  1914                              <2> ;; Search through sublists to find applicable one
  1915                              <2> 
  1916                              <2> 	    CMP     word [cs:$M_RT + $M_MSG_NUM],$M_NULL		     ;;AN000;; Is this an Extended/Parse case
  1917                              <2> ;	    $IF     E					     ;;AN000;; No,
  1918                              <2> 	    JNE $MIF174
  1919                              <2> ;	      $SEARCH					     ;;AN000;;
  1920                              <2> $MDO175:
  1921                              <2> 		MOV	AL,[$M_SL + $M_S_ID]		     ;;AN000;;	 Get ID byte
  1922                              <2> 		ADD	AL,30H				     ;;AN000;;	 Convert to ASCII
  1923                              <2> 		CMP	AL,BYTE PTR [ES:DI + 1]		     ;;AN000;;	 Is this the right sublist?
  1924                              <2> ;	      $EXITIF E 				     ;;AN000;;
  1925                              <2> 	      JNE $MIF175
  1926                              <2> ;	      $ORELSE					     ;;AN000;;	 No,
  1927                              <2> 	      JMP SHORT $MSR175
  1928                              <2> $MIF175:
  1929                              <2> 		CMP	AL,$M_SPECIAL_CASE		     ;;AN000;;	   Does this sublist have ID = 0
  1930                              <2> ;	      $LEAVE  E,AND				     ;;AN000;;	   Yes,
  1931                              <2> 	      JNE $MLL178
  1932                              <2> 		OR	DX,DX				     ;;AN000;;	   Are we at the end of the message?
  1933                              <2> ;	      $LEAVE  Z 				     ;;AN000;;	   No,
  1934                              <2> 	      JZ $MEN175
  1935                              <2> $MLL178:
  1936                              <2> 		ADD	SI,WORD PTR [$M_SL + $M_S_SIZE]	     ;;AN000;;	     Next SUBLIST
  1937                              <2> ;	      $ENDLOOP					     ;;AN000;;	   Yes,
  1938                              <2> 	      JMP SHORT $MDO175
  1939                              <2> $MEN175:
  1940                              <2> 		CMP	byte [cs:$M_RT + $M_CLASS],UTILITY_MSG_CLASS     ;;AN004;;	     Is it a utility message?
  1941                              <2> ;		$IF	E				     ;;AN004;;	     Yes,
  1942                              <2> 		JNE $MIF180
  1943                              <2> 		  INC	  DX				     ;;AN000;;	       Remember to display CR,LF
  1944                              <2> 		  INC	  DX				     ;;AN000;;		 at the end of the message
  1945                              <2> 		  DEC	  CX				     ;;AN000;;	       Adjust message length
  1946                              <2> 		  DEC	  CX				     ;;AN000;;
  1947                              <2> 		  DEC	  DI				     ;;AN000;;	       Adjust ending address of message
  1948                              <2> 		  DEC	  DI				     ;;AN000;;
  1949                              <2> ;		$ELSE					     ;;AN004;;	     No,
  1950                              <2> 		JMP SHORT $MEN180
  1951                              <2> $MIF180:
  1952                              <2> 		  MOV	  DX,-1 			     ;;AN004;;	       Set special case
  1953                              <2> ;		$ENDIF					     ;;AN004;;
  1954                              <2> $MEN180:
  1955                              <2> ;	      $ENDSRCH					     ;;AN000;;
  1956                              <2> $MSR175:
  1957                              <2> ;	    $ENDIF					     ;;AN000;;
  1958                              <2> $MIF174:
  1959                              <2> ;	  $ENDIF					     ;;AN000;;
  1960                              <2> $MIF173:
  1961                              <2> 
  1962                              <2> ;; Prepare and display this part of message
  1963                              <2> 
  1964                              <2> 	  PUSH	  DI					     ;;AN000;; Save pointer to replace number
  1965                              <2> 	  SUB	  DI,CX 				     ;;AN000;; Determine beginning of string
  1966                              <2> 	  CALL	  $M_DISPLAY_STRING			     ;;AN000;; Display string until % (or end)
  1967                              <2> 	  POP	  DI					     ;;AN000;; Get back pointer to replace number
  1968                              <2> 	  POP	  CX					     ;;AN000;; Clean up stack in case error
  1969                              <2> ;	$LEAVE	C,LONG					     ;;AN000;; Fail if carry was set
  1970                              <2> 	JNC $MXL3
  1971                              <2> 	JMP $MEN165
  1972                              <2> 	nop	; identicalise
  1973                              <2> $MXL3:
  1974                              <2> 	  PUSH	  CX					     ;;AN000;;
  1975                              <2> 
  1976                              <2> ;; Save and reset pointer registers
  1977                              <2> 
  1978                              <2> 	  MOV	  CX,DX 				     ;;AN000;; Get the size of the rest of the message
  1979                              <2> 	  CMP	  byte [$M_SL + $M_S_ID],$M_SPECIAL_CASE-30H	     ;;AN000;; Is this the %0 case?
  1980                              <2> ;	  $IF	  NE					     ;;AN000;; No,
  1981                              <2> 	  JE $MIF187
  1982                              <2> 	    OR	    CX,CX				     ;;AN000;;	Are we finished the whole message?
  1983                              <2> ;	    $IF     NZ					     ;;AN000;;	No,
  1984                              <2> 	    JZ $MIF188
  1985                              <2> 	      DEC     CX				     ;;AN000;;	  Decrement total size (%)
  1986                              <2> 	      DEC     CX				     ;;AN000;;	  Decrement total size (#)
  1987                              <2> 	      INC     DI				     ;;AN000;;	  Go past %
  1988                              <2> 	      INC     DI				     ;;AN000;;	  Go past replace number
  1989                              <2> ;	    $ELSE					     ;;AN000;;	Yes, (Note this will not leave because INC)
  1990                              <2> 	    JMP SHORT $MEN188
  1991                              <2> $MIF188:
  1992                              <2> 	      POP     SI				     ;;AN000;;	  Get back pointer to beginning of SUBLISTs
  1993                              <2> ;	    $ENDIF					     ;;AN000;; Yes, Note this will not leave because INC
  1994                              <2> $MEN188:
  1995                              <2> ;	  $ELSE 					     ;;AN000;;
  1996                              <2> 	  JMP SHORT $MEN187
  1997                              <2> $MIF187:
  1998                              <2> 	    OR	    CX,CX				     ;;AN000;;	Are we finished the whole message?
  1999                              <2> ;	    $IF     Z					     ;;AN004;;	 No,
  2000                              <2> 	    JNZ $MIF192
  2001                              <2> 	      POP     SI				     ;;AN000;;	 Get back pointer to beginning of SUBLISTs
  2002                              <2> ;	    $ELSE					     ;;AN000;; No,
  2003                              <2> 	    JMP SHORT $MEN192
  2004                              <2> $MIF192:
  2005                              <2> 	      CMP     CX,-1				     ;;AN004;;	 Are we at the end of the message?
  2006                              <2> ;	      $IF     Z 				     ;;AN004;;	 No,
  2007                              <2> 	      JNZ $MIF194
  2008                              <2> 		XOR	CX,CX				     ;;AN004;;
  2009                              <2> ;	      $ENDIF					     ;;AN000;;
  2010                              <2> $MIF194:
  2011                              <2> 	      OR      DI,DI				     ;;AN004;;	Turn ZF off
  2012                              <2> ;	    $ENDIF					     ;;AN000;;
  2013                              <2> $MEN192:
  2014                              <2> ;	  $ENDIF					     ;;AN000;; Note this will not leave because INC
  2015                              <2> $MEN187:
  2016                              <2> ;	$LEAVE	Z					     ;;AN000;;
  2017                              <2> 	JZ $MEN165
  2018                              <2> 	  PUSH	  BP					     ;;AN000;;	 Save the replace count
  2019                              <2> 	  PUSH	  DI					     ;;AN000;;	 Save location to complete message
  2020                              <2> 	  PUSH	  ES					     ;;AN000;;
  2021                              <2> 	  PUSH	  CX					     ;;AN000;;	 Save size of the rest of the message
  2022                              <2> 	  XOR	  CX,CX 				     ;;AN000;;	 Reset CX used for character count
  2023                              <2> 
  2024                              <2> ;; Determine what action is required on parameter
  2025                              <2> 
  2026                              <2> 	  CMP	  word [cs:$M_RT + $M_MSG_NUM],$M_NULL		     ;;AN000;; Is this an Extended/Parse case
  2027                              <2> ;	  $IF	  E					     ;;AN000;;
  2028                              <2> 	  JNE $MIF199
  2029                              <2> 
  2030                              <2> %IF	    CHARmsg					     ;;AN000;; Was Char specified?
  2031                              <2> Char_Type equ Char_type	; NASM port equate
  2032                              <2> 	    TEST    BYTE [$M_SL + $M_S_FLAG],~ Char_Type & $M_TYPE_MASK ;;AN000;;
  2033                              <2> ;	    $IF     Z					     ;;AN000;;
  2034                              <2> 	    JNZ $MIF200
  2035                              <2> 
  2036                              <2> ;; Character type requested
  2037                              <2> 							     ;;AN000;;
  2038                              <2> 	      LES     DI,[$M_SL + $M_S_VALUE]	     ;;AN000;; Load pointer to replacing parameter
  2039                              <2> 	      CALL    $M_CHAR_REPLACE			     ;;AN000;;
  2040                              <2> ;	    $ELSE					     ;;AN000;;	 Get the rest of the message to display
  2041                              <2> 	    JMP SHORT $MEN200
  2042                              <2> $MIF200:
  2043                              <2> %ENDIF							     ;;AN000;;
  2044                              <2> %IF	      NUMmsg					     ;;AN000;; Was Nnmeric type specified?
  2045                              <2> 	      TEST    BYTE [$M_SL + $M_S_FLAG],~ Sgn_Bin_Type & $M_TYPE_MASK ;;AN000;;
  2046                              <2> ;	      $IF     Z,OR				     ;;AN000;;
  2047                              <2> 	      JZ $MLL202
  2048                              <2> 	      TEST    BYTE [$M_SL + $M_S_FLAG],~ Unsgn_Bin_Type & $M_TYPE_MASK ;;AN000;;
  2049                              <2> ;	      $IF     Z,OR				     ;;AN000;;
  2050                              <2> 	      JZ $MLL202
  2051                              <2> 	      TEST    BYTE [$M_SL + $M_S_FLAG],~ Bin_Hex_Type & $M_TYPE_MASK ;;AN000;;
  2052                              <2> ;	      $IF     Z 				     ;;AN000;;
  2053                              <2> 	      JNZ $MIF202
  2054                              <2> $MLL202:
  2055                              <2> 
  2056                              <2> ;; Numeric type requested
  2057                              <2> 
  2058                              <2> 		LES	DI,[$M_SL + $M_S_VALUE]	     ;;AN000;; Load pointer to replacing parameter
  2059                              <2> 		CALL	$M_BIN2ASC_REPLACE		     ;;AN000;;
  2060                              <2> ;	      $ELSE					     ;;AN000;; Get the rest of the message to display
  2061                              <2> 	      JMP SHORT $MEN202
  2062                              <2> $MIF202:
  2063                              <2> %ENDIF							     ;;AN000;;
  2064                              <2> %IF		DATEmsg 				     ;;AN000;; Was date specified?
  2065                              <2> 		TEST	BYTE [$M_SL + $M_S_FLAG],~ Date_Type & $M_TYPE_MASK ;;AN000;;
  2066                              <2> ;		$IF	E				     ;;AN000;;
  2067                              <2> 		JNE $MIF204
  2068                              <2> 
  2069                              <2> ;; Date type requested
  2070                              <2> 
  2071                              <2> 		  CALL	  $M_DATE_REPLACE		     ;;AN000;;
  2072                              <2> ;		$ELSE					     ;;AN000;; Get the rest of the message to display
  2073                              <2> 		JMP SHORT $MEN204
  2074                              <2> $MIF204:
  2075                              <2> %ENDIF							     ;;AN000;;
  2076                              <2> %IF		  TIMEmsg				     ;;AN000;;	Was time (12 hour format) specified?
  2077                              <2> 
  2078                              <2> ;; Time type requested (Default if we have not matched until here)
  2079                              <2> 
  2080                              <2> 		  CALL	  $M_TIME_REPLACE		     ;;AN000;;
  2081                              <2> %ENDIF							     ;;AN000;;
  2082                              <2> 
  2083                              <2> %IF		  DATEmsg				     ;;AN000;;
  2084                              <2> ;		$ENDIF					     ;;AN000;;
  2085                              <2> $MEN204:
  2086                              <2> %ENDIF							     ;;AN000;;
  2087                              <2> %IF		NUMmsg					     ;;AN000;;
  2088                              <2> ;	      $ENDIF					     ;;AN000;;
  2089                              <2> $MEN202:
  2090                              <2> %ENDIF							     ;;AN000;;
  2091                              <2> %IF	      CHARmsg					     ;;AN000;;
  2092                              <2> ;	    $ENDIF					     ;;AN000;;
  2093                              <2> $MEN200:
  2094                              <2> %ENDIF							     ;;AN000;;
  2095                              <2> 
  2096                              <2> %IF	    $M_REPLACE					     ;;AN000;;
  2097                              <2> ;; With the replace information of the Stack, display the replaceable field
  2098                              <2> 
  2099                              <2> 	    CALL    $M_DISPLAY_REPLACE			     ;;AN000;; Display the replace
  2100                              <2> %ENDIF							     ;;AN000;;
  2101                              <2> ;; None of the above - Extended/Parse replace
  2102                              <2> ;	  $ELSE 					     ;;AN000;;
  2103                              <2> 	  JMP SHORT $MEN199
  2104                              <2> $MIF199:
  2105                              <2> %IFN     COMR
  2106                              <2> 	    CALL    $M_EXT_PAR_REPLACE			     ;;AN000;;
  2107                              <2> %ENDIF
  2108                              <2> ;	  $ENDIF					     ;;AN000;;
  2109                              <2> $MEN199:
  2110                              <2> 
  2111                              <2> ;; We must go back and complete the message after the replacable parameter if there is any left
  2112                              <2> 
  2113                              <2> ;	  $IF	  NC					     ;;AN000;; IF there was an error displaying then EXIT
  2114                              <2> 	  JC $MIF211
  2115                              <2> 	    POP     CX					     ;;AN000;; Get size of the rest of the message
  2116                              <2> 	    POP     ES					     ;;AN000;; Get address of the rest of the message
  2117                              <2> 	    POP     DI					     ;;AN000;;
  2118                              <2> 	    POP     BP					     ;;AN000;; Get replacment count
  2119                              <2> 	    POP     SI					     ;;AN000;; ELSE get address of first sublist structure
  2120                              <2> ;	  $ELSE 					     ;;AN000;;
  2121                              <2> 	  JMP SHORT $MEN211
  2122                              <2> $MIF211:
  2123                              <2> 	    ADD     SP,10				     ;;AN000;; Clean up stack if error
  2124                              <2> 	    STC 					     ;;AN000;;
  2125                              <2> ;	  $ENDIF					     ;;AN000;;
  2126                              <2> $MEN211:
  2127                              <2> 	  CMP	  word [cs:$M_RT + $M_MSG_NUM],$M_NULL		     ;;AN000;; Is this an Extended/Parse case
  2128                              <2> ;	$ENDDO	NE,OR					     ;;AN000;;
  2129                              <2> 	JNE $MLL214
  2130                              <2> ;	$ENDDO	C,LONG					     ;;AN000;; Go back and display the rest of the message
  2131                              <2> 	JC $MXL4
  2132                              <2> 	JMP $MDO165
  2133                              <2> $MXL4:
  2134                              <2> $MLL214:
  2135                              <2> $MEN165:
  2136                              <2> 							     ;;        IF there was an error displaying then EXIT
  2137                              <2> 	MOV	word [cs:$M_RT + $M_MSG_NUM],0			     ;;AN000;; Reset message number to null
  2138                              <2> 	RET						     ;;AN000;; Return
  2139                              <2> 							     ;;
  2140                              <2> $M_DISPLAY_MESSAGE ENDP 				     ;;AN000;;
  2141                              <2> %IFN	COMR
  2142                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2143                              <2> ;;
  2144                              <2> ;;	PROC NAME: $M_EXT_PAR_REPLACE
  2145                              <2> ;;
  2146                              <2> ;;	FUNCTION:
  2147                              <2> ;;	INPUTS:
  2148                              <2> ;;	OUPUTS:
  2149                              <2> ;;
  2150                              <2> ;;	REGS USED:
  2151                              <2> ;;
  2152                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2153                              <2> 							     ;;
  2154                              <2> $M_EXT_PAR_REPLACE PROC NEAR				     ;;AN000;;
  2155                              <2> 							     ;;
  2156                              <2> 	XOR	DX,DX					     ;;AN000;; Prepare for get binary value (HIGH)
  2157                              <2> 	MOV	AX,[cs:$M_RT + $M_MSG_NUM]			     ;;AN000;; Prepare for get binary value (LOW)
  2158                              <2> 	MOV	word [cs:$M_RT + $M_DIVISOR],$M_BASE10		     ;;AN000;; Set default divisor
  2159                              <2> 							     ;;
  2160                              <2> 	CALL	$M_CONVERT2ASC				     ;;AN000;;
  2161                              <2> 							     ;;
  2162                              <2> ;	$DO						     ;;AN000;;
  2163                              <2> $MDO215:
  2164                              <2> 	  POP	  AX					     ;;AN000;;	 Get character in register
  2165                              <2> 	  MOV	  BYTE PTR [cs:$M_RT + $M_TEMP_BUF + BX],AL	     ;;AN000;;	Move char into the buffer
  2166                              <2> 	  INC	  BX					     ;;AN000;;	 Increase buffer count
  2167                              <2> 	  CMP	  BX,$M_TEMP_BUF_SZ			     ;;AN000;;	 Is buffer full?
  2168                              <2> ;	  $IF	  E					     ;;AN000;;	 Yes,
  2169                              <2> 	  JNE $MIF216
  2170                              <2> 	    CALL    $M_FLUSH_BUF			     ;;AN000;;	   Flush the buffer
  2171                              <2> ;	  $ENDIF					     ;;AN000;;
  2172                              <2> $MIF216:
  2173                              <2> 	  DEC	  CL					     ;;AN000;;	 Have we completed replace?
  2174                              <2> ;	$ENDDO	Z					     ;;AN000;;
  2175                              <2> 	JNZ $MDO215
  2176                              <2> 							     ;;
  2177                              <2> 	MOV	AX,$M_CR_LF				     ;;AN000;;	Move char into the buffer
  2178                              <2> 	MOV	WORD PTR [cs:$M_RT + $M_TEMP_BUF + BX],AX	     ;;AN000;;	Move char into the buffer
  2179                              <2> 	INC	BX					     ;;AN000;;	 Increase buffer count
  2180                              <2> 	INC	BX					     ;;AN000;;	 Increase buffer count
  2181                              <2> 	CALL	$M_FLUSH_BUF				     ;;AN000;;	   Flush the buffer
  2182                              <2> 	RET						     ;;AN000::
  2183                              <2> 							     ;;
  2184                              <2> $M_EXT_PAR_REPLACE ENDP 				     ;;AN000;;
  2185                              <2> 							     ;;
  2186                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2187                              <2> %ENDIF
  2188                              <2> 	%IF	$M_SUBS 				     ;;AN000;; Include the common subroutines if they haven't yet
  2189                              <2> 	  %iassign $M_SUBS FALSE				     ;;AN000;; No, then include and reset the flag
  2190                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2191                              <2> ;;
  2192                              <2> ;;	PROC NAME: $M_GET_MSG_ADDRESS
  2193                              <2> ;;
  2194                              <2> ;;	FUNCTION:  To scan thru classes to return pointer to the message header
  2195                              <2> ;;	INPUTS:    Access to $M_RES_ADDRESSES
  2196                              <2> ;;	OUPUTS:    IF CX = 0 THEN Message was not found
  2197                              <2> ;;		   IF CX > 1 THEN DS:SI points to the specified message
  2198                              <2> ;;	REGS CHANGED: ES,DI,CX,DS,SI
  2199                              <2> ;;
  2200                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2201                              <2> 							     ;;
  2202                              <2> %IF	  FARmsg					     ;;AN000;;
  2203                              <2> 	  $M_GET_MSG_ADDRESS PROC FAR			     ;;AN000;;
  2204                              <2> %ELSE							     ;;AN000;;
  2205                              <2> 	  $M_GET_MSG_ADDRESS PROC NEAR			     ;;AN000;;
  2206                              <2> %ENDIF							     ;;AN000;;
  2207                              <2> 							     ;;
  2208                              <2> 	  PUSH	  SI					     ;;AN000;;
  2209                              <2> 	  PUSH	  BX					     ;;AN000;;
  2210                              <2> 	  XOR	  SI,SI 				     ;;AN000;; Use SI as an index
  2211                              <2> 	  XOR	  CX,CX 				     ;;AN000;; Use CX as an size
  2212                              <2> ;	  $DO						     ;;AN000;;
  2213                              <2> $MDO219:
  2214                              <2> 	    CMP     DH,UTILITY_MSG_CLASS		     ;;AN000;; Were utility messages requested?
  2215                              <2> ;	    $IF     E					     ;;AN000;; Yes,
  2216                              <2> 	    JNE $MIF220
  2217                              <2> 	      %IF      FARmsg				     ;;AN000;;
  2218                              <2> 		LES	DI,[$M_RT + $M_CLASS_ADDRS + SI] ;;AN000;;  Get address of class
  2219                              <2> 		MOV	BX,ES				     ;;AN000;
  2220                              <2> 	      %ELSE					     ;;AN000;;
  2221                              <2> 		MOV	DI,WORD PTR [cs:$M_RT + $M_CLASS_ADDRS + SI] ;;AN000;;	 Get address of class
  2222                              <2> 		MOV	BX,DI				     ;;AN000;
  2223                              <2> 	      %ENDIF					     ;;AN000;;
  2224                              <2> ;	    $ELSE					     ;;AN000;; No,
  2225                              <2> 	    JMP SHORT $MEN220
  2226                              <2> $MIF220:
  2227                              <2> 	      TEST    DH,PARSE_ERR_CLASS		     ;;AN000;;	 Were parse errors requested?
  2228                              <2> ;	      $IF     NE				     ;;AN000;;	 Yes,
  2229                              <2> 	      JE $MIF222
  2230                              <2> 		LES	DI,[cs:$M_RT + $M_PARSE_COMMAND + SI] ;;AN000;;   Get address of class
  2231                              <2> 		MOV	BX,ES				     ;;AN000;
  2232                              <2> ;	      $ELSE					     ;;AN000;;	 No, extended errors were specified
  2233                              <2> 	      JMP SHORT $MEN222
  2234                              <2> $MIF222:
  2235                              <2> 		CMP	AX,$M_CRIT_LO			     ;;AN000;;	   Is this a critical error?
  2236                              <2> ;		$IF	AE,AND				     ;;AN000;;
  2237                              <2> 		JNAE $MIF224
  2238                              <2> 		CMP	AX,$M_CRIT_HI			     ;;AN000;;
  2239                              <2> ;		$IF	BE				     ;;AN000;;	    Yes,
  2240                              <2> 		JNBE $MIF224
  2241                              <2> 		  LES	  DI,[cs:$M_RT + $M_CRIT_ADDRS + SI] ;;AN000;; Get address of class
  2242                              <2> 		  MOV	  BX,ES 			     ;;AN000;
  2243                              <2> ;		$ELSE					     ;;AN000;;
  2244                              <2> 		JMP SHORT $MEN224
  2245                              <2> $MIF224:
  2246                              <2> 		  LES	  DI,[cs:$M_RT + $M_EXT_ERR_ADDRS + SI] ;;AN000;; Get address of class
  2247                              <2> 		  MOV	  BX,ES 			     ;;AN000;
  2248                              <2> ;		$ENDIF					     ;;AN000;;
  2249                              <2> $MEN224:
  2250                              <2> ;	      $ENDIF					     ;;AN000;;
  2251                              <2> $MEN222:
  2252                              <2> ;	    $ENDIF					     ;;AN000;;
  2253                              <2> $MEN220:
  2254                              <2> 							     ;;
  2255                              <2> 	    CMP     BX,$M_TERMINATING_FLAG		     ;;AN000;; Are we finished all classes?
  2256                              <2> ;	    $IF     E					     ;;AN000;; Yes,
  2257                              <2> 	    JNE $MIF229
  2258                              <2> 	      CMP     DH,UTILITY_MSG_CLASS		     ;;AN000;;	  Was it a UTILITY class?
  2259                              <2> ;	      $IF     E 				     ;;AN000;;	  Yes,
  2260                              <2> 	      JNE $MIF230
  2261                              <2> 		STC					     ;;AN000;;	    Set the carry flag
  2262                              <2> ;	      $ELSE					     ;;AN000;;	  No,
  2263                              <2> 	      JMP SHORT $MEN230
  2264                              <2> $MIF230:
  2265                              <2> 		MOV	[cs:$M_RT + $M_MSG_NUM],AX		     ;;AN000;;	    Save message number
  2266                              <2> 		MOV	AX,$M_SPECIAL_MSG_NUM		     ;;AN000;;	    Set special message number
  2267                              <2> 		MOV	BP,$M_ONE_REPLACE		     ;;AN000;;	    Set one replace in message
  2268                              <2> 		XOR	SI,SI				     ;;AN000;;	    Reset the SI index to start again
  2269                              <2> 		CLC					     ;;AN000;;
  2270                              <2> ;	      $ENDIF					     ;;AN000;; No,
  2271                              <2> $MEN230:
  2272                              <2> ;	    $ELSE					     ;;AN000;;
  2273                              <2> 	    JMP SHORT $MEN229
  2274                              <2> $MIF229:
  2275                              <2> 	      CMP     BX,$M_CLASS_NOT_EXIST		     ;;AN000;;	 Does this class exist?
  2276                              <2> ;	      $IF     NE				     ;;AN001;;	 Yes,
  2277                              <2> 	      JE $MIF234
  2278                              <2> 		CALL	$M_FIND_SPECIFIED_MSG		     ;;AN000;;	   Try to find the message
  2279                              <2> ;	      $ENDIF					     ;;AN000;;
  2280                              <2> $MIF234:
  2281                              <2> 	      ADD     SI,$M_ADDR_SZ_FAR 		     ;;AN000;;	     Get next class
  2282                              <2> 	      CLC					     ;;AN000;;
  2283                              <2> ;	    $ENDIF					     ;;AN000;;
  2284                              <2> $MEN229:
  2285                              <2> ;	  $LEAVE  C					     ;;AN000;;
  2286                              <2> 	  JC $MEN219
  2287                              <2> 	    OR	    CX,CX				     ;;AN000;;	   Was the message found?
  2288                              <2> ;	  $ENDDO  NZ,LONG				     ;;AN000;;
  2289                              <2> 	  JNZ $MXL5
  2290                              <2> 	  JMP $MDO219
  2291                              <2> $MXL5:
  2292                              <2> $MEN219:
  2293                              <2> 
  2294                              <2> 	  PUSHF 					     ;;AN006;; Save the flag state
  2295                              <2> 	  CMP	  DH,EXT_ERR_CLASS			     ;;AN006;; Was an extended error requested?
  2296                              <2> ;	  $IF	  E					     ;;AN006;; Yes,
  2297                              <2> 	  JNE $MIF239
  2298                              <2> 	    PUSH    DX					     ;;AN006;;	Save all needed registers
  2299                              <2> 	    PUSH    BP					     ;;AN006;;
  2300                              <2> 	    PUSH    CX					     ;;AN006;;
  2301                              <2> 	    PUSH    ES					     ;;AN006;;
  2302                              <2> 	    PUSH    DI					     ;;AN006;;
  2303                              <2> 	    PUSH    AX					     ;;AN006;;
  2304                              <2> 
  2305                              <2> 	    MOV     AX,IFSFUNC_INSTALL_CHECK		     ;;AN006;;	Check if IFSFUNC is installed
  2306                              <2> 	    INT     2FH 				     ;;AN006;;
  2307                              <2> 	    CMP     AL,IFSFUNC_INSTALLED		     ;;AN006;;	Is it installed?
  2308                              <2> 	    POP     AX					     ;;AN006;;	Restore msg number
  2309                              <2> ;	    $IF     E					     ;;AN006;;	 Yes,
  2310                              <2> 	    JNE $MIF240
  2311                              <2> 	      MOV     BX,AX				     ;;AN006;;	  BX is the extended error number
  2312                              <2> 	      MOV     AX,IFS_GET_ERR_TEXT		     ;;AN006;;	  AX is the muliplex number
  2313                              <2> 	      INT     2FH				     ;;AN006;;	  Call IFSFUNC
  2314                              <2> ;	    $ELSE					     ;;AN006;;	 No,
  2315                              <2> 	    JMP SHORT $MEN240
  2316                              <2> $MIF240:
  2317                              <2> 	      STC					     ;;AN006;;	  Carry conditon
  2318                              <2> ;	    $ENDIF					     ;;AN006;;
  2319                              <2> $MEN240:
  2320                              <2> 
  2321                              <2> ;	    $IF     C					     ;;AN006;;	Was there an update?
  2322                              <2> 	    JNC $MIF243
  2323                              <2> 	      POP     DI				     ;;AN006;;	No,
  2324                              <2> 	      POP     ES				     ;;AN006;;	 Restore old pointer
  2325                              <2> 	      POP     CX				     ;;AN006;;
  2326                              <2> ;	    $ELSE					     ;;AN006;;	Yes
  2327                              <2> 	    JMP SHORT $MEN243
  2328                              <2> $MIF243:
  2329                              <2> 	      ADD     SP,6				     ;;AN006;;	 Throw away old pointer
  2330                              <2> 	      CALL    $M_SET_LEN_IN_CX			     ;;AN006;;	 Get the length of the ASCIIZ string
  2331                              <2> ;	    $ENDIF					     ;;AN006;;
  2332                              <2> $MEN243:
  2333                              <2> 	    POP     BP					     ;;AN006;;	Restore other Regs
  2334                              <2> 	    POP     DX					     ;;AN006;;
  2335                              <2> ;	  $ENDIF					     ;;AN006;;
  2336                              <2> $MIF239:
  2337                              <2> 	  $M_POPF					     ;;AN006;; Restore the flag state
  2338                              <2> 
  2339                              <2> 	  POP	  BX					     ;;AN000;;
  2340                              <2> 	  POP	  SI					     ;;AN000;;
  2341                              <2> 	  RET						     ;;AN000;; Return ES:DI pointing to the message
  2342                              <2> 							     ;;
  2343                              <2> $M_GET_MSG_ADDRESS ENDP 				     ;;
  2344                              <2> 							     ;;
  2345                              <2> $M_SET_LEN_IN_CX PROC NEAR				     ;;
  2346                              <2> 							     ;;
  2347                              <2> 	  PUSH	  DI					     ;;AN006;; Save position
  2348                              <2> 	  PUSH	  AX					     ;;AN006;;
  2349                              <2> 	  MOV	  CX,-1 				     ;;AN006;; Set CX for decrements
  2350                              <2> 	  XOR	  AL,AL 				     ;;AN006;; Prepare compare register
  2351                              <2> 	  REPNE   SCASB 				     ;;AN006;; Scan for zero
  2352                              <2> 	  NOT	  CX					     ;;AN006;; Change decrement into number
  2353                              <2> 	  DEC	  CX					     ;;AN006;; Don't include the zero
  2354                              <2> 	  POP	  AX					     ;;AN006;;
  2355                              <2> 	  POP	  DI					     ;;AN006;; Restore position
  2356                              <2> 	  RET						     ;;AN006;;
  2357                              <2> 							     ;;
  2358                              <2> $M_SET_LEN_IN_CX ENDP					     ;;
  2359                              <2> 							     ;;
  2360                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2361                              <2> ;;
  2362                              <2> ;;	PROC NAME: $M_FIND_SPECIFIED_MSG
  2363                              <2> ;;
  2364                              <2> ;;	FUNCTION:  To scan thru message headers until message is found
  2365                              <2> ;;	INPUTS:    ES:DI points to beginning of msg headers
  2366                              <2> ;;		   CX contains the number of messages in class
  2367                              <2> ;;		   DH contains the message class
  2368                              <2> ;;	OUPUTS:    IF CX = 0 THEN Message was not found
  2369                              <2> ;;		   IF CX > 1 THEN ES:DI points to header of specified message
  2370                              <2> ;;
  2371                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2372                              <2> 							     ;;
  2373                              <2> $M_FIND_SPECIFIED_MSG PROC NEAR 			     ;;AN000;;
  2374                              <2> 							     ;;
  2375                              <2> 	  CMP	  BX,1					     ;;AN004;;	Do we have an address to CALL?
  2376                              <2> ;	  $IF	  E,AND 				     ;;AN004;;	Yes,
  2377                              <2> 	  JNE $MIF247
  2378                              <2> 	  CMP	  WORD [cs:$M_RT + $M_DISK_PROC_ADDR],-1	     ;;AN004;;	Do we have an address to CALL?
  2379                              <2> ;	  $IF	  NE					     ;;AN004;;	Yes,
  2380                              <2> 	  JE $MIF247
  2381                              <2> 	    CMP     AX,$M_SPECIAL_MSG_NUM		     ;;AN004;; Are we displaying a default Ext Err?
  2382                              <2> ;	    $IF     E					     ;;AN004;;	. . . and . . .
  2383                              <2> 	    JNE $MIF248
  2384                              <2> 	      PUSH    AX				     ;;AN004;;	 Reset the special message number
  2385                              <2> 	      MOV     AX,[cs:$M_RT + $M_MSG_NUM]		     ;;AN004;;	 Get the old message number
  2386                              <2> 	      CALL    far [cs:$M_RT + $M_DISK_PROC_ADDR]      ;;AN004;;	 Call the READ_DISK_PROC to get error text
  2387                              <2> 	      POP     AX				     ;;AN004;;	 Reset the special message number
  2388                              <2> ;	    $ELSE					     ;;AN004;;	 Get the old message number
  2389                              <2> 	    JMP SHORT $MEN248
  2390                              <2> $MIF248:
  2391                              <2> 	      CALL    far [cs:$M_RT + $M_DISK_PROC_ADDR]      ;;AN004;;	 Call the READ_DISK_PROC to get error text
  2392                              <2> ;	    $ENDIF					     ;;AN004;;	 Get the old message number
  2393                              <2> $MEN248:
  2394                              <2> ;	  $ELSE 					     ;;AN004;;
  2395                              <2> 	  JMP SHORT $MEN247
  2396                              <2> $MIF247:
  2397                              <2> 	    XOR     CX,CX				     ;;AN002;;	 CX = 0 will allow us to
  2398                              <2> 	    CMP     DH,UTILITY_MSG_CLASS		     ;;AN001;;
  2399                              <2> ;	    $IF     NE					     ;;AN001;;
  2400                              <2> 	    JE $MIF252
  2401                              <2> 	      MOV     CL,BYTE PTR [ES:DI + $M_NUM_CLS_MSG]     ;;AN001;;	 Get number of messages in class
  2402                              <2> ;	    $ELSE					     ;;AN001;;
  2403                              <2> 	    JMP SHORT $MEN252
  2404                              <2> $MIF252:
  2405                              <2> %IF	      FARmsg					     ;;AN001;;
  2406                              <2> 	      CMP     BYTE PTR [ES:DI + $M_CLASS_ID],DH	     ;;AN002;; Check if class still exists at
  2407                              <2> %ELSE
  2408                              <2> 	      CMP     BYTE PTR [CS:DI + $M_CLASS_ID],DH	     ;;AN002;; Check if class still exists at
  2409                              <2> %ENDIF
  2410                              <2> ;	      $IF     E 				     ;;AN002;;	pointer (hopefully)
  2411                              <2> 	      JNE $MIF254
  2412                              <2> %IF		FARmsg					     ;;AN001;;
  2413                              <2> 		MOV	CL,BYTE PTR [ES:DI + $M_NUM_CLS_MSG]   ;;AN000;;	   Get number of messages in class
  2414                              <2> %ELSE
  2415                              <2> 		MOV	CL,BYTE PTR [CS:DI + $M_NUM_CLS_MSG]   ;;AN000;;	   Get number of messages in class
  2416                              <2> %ENDIF
  2417                              <2> ;	      $ENDIF					     ;;AN002;;	  go on to the next class
  2418                              <2> $MIF254:
  2419                              <2> ;	    $ENDIF					     ;;AN001;;
  2420                              <2> $MEN252:
  2421                              <2> 	    ADD     DI,$M_CLASS_ID_SZ			     ;;AN000;;	   Point past the class header
  2422                              <2> 	    STC 					     ;;AN004;;	 Flag that we haven't found anything yet
  2423                              <2> ;	  $ENDIF					     ;;AN004;;
  2424                              <2> $MEN247:
  2425                              <2> 
  2426                              <2> ;	  $IF	  C					     ;;AN004;; Have we found anything yet?
  2427                              <2> 	  JNC $MIF258
  2428                              <2> 	    CLC 					     ;;AN004;; No, reset carry
  2429                              <2> ;	    $SEARCH					     ;;AN000;;
  2430                              <2> $MDO259:
  2431                              <2> 	      OR      CX,CX				     ;;AN000;;	  Do we have any to check?
  2432                              <2> ;	    $LEAVE  Z					     ;;AN000;;	     No, return with CX = 0
  2433                              <2> 	    JZ $MEN259
  2434                              <2> 	      CMP     DH,UTILITY_MSG_CLASS		     ;;AN001;;
  2435                              <2> ;	      $IF     NE				     ;;AN001;;
  2436                              <2> 	      JE $MIF261
  2437                              <2> 		CMP	AX,WORD PTR [ES:DI + $M_NUM]	     ;;AN001;; Is this the message requested?
  2438                              <2> ;	      $ELSE					     ;;AN001;;
  2439                              <2> 	      JMP SHORT $MEN261
  2440                              <2> $MIF261:
  2441                              <2> %IF		FARmsg					     ;;AN001;;
  2442                              <2> 		CMP	AX,WORD PTR [ES:DI + $M_NUM]	     ;;AN000;; Is this the message requested?
  2443                              <2> %ELSE
  2444                              <2> 		CMP	AX,WORD PTR [CS:DI + $M_NUM]	     ;;AN000;; Is this the message requested?
  2445                              <2> %ENDIF
  2446                              <2> ;	      $ENDIF
  2447                              <2> $MEN261:
  2448                              <2> ;	    $EXITIF E					     ;;AN000;;
  2449                              <2> 	    JNE $MIF259
  2450                              <2> ;	    $ORELSE					     ;;AN000;
  2451                              <2> 	    JMP SHORT $MSR259
  2452                              <2> $MIF259:
  2453                              <2> 	      DEC     CX				     ;;AN000;;	  No, well do we have more to check?
  2454                              <2> ;	    $LEAVE  Z					     ;;AN000;;	     No, return with CX = 0
  2455                              <2> 	    JZ $MEN259
  2456                              <2> 	      ADD     DI,$M_ID_SZ			     ;;AN000;;	     Yes, skip past msg header
  2457                              <2> ;	    $ENDLOOP					     ;;AN000;;
  2458                              <2> 	    JMP SHORT $MDO259
  2459                              <2> $MEN259:
  2460                              <2> 	      STC					     ;;AN000;;
  2461                              <2> ;	    $ENDSRCH					     ;;AN000;;	     Check next message
  2462                              <2> $MSR259:
  2463                              <2> ;	    $IF     NC					     ;;AN000;;	 Did we find the message?
  2464                              <2> 	    JC $MIF269
  2465                              <2> 	      CMP     DH,UTILITY_MSG_CLASS		     ;;AN001;;	 Yes, is it a utility message?
  2466                              <2> 	      CLC					     ;;AN001;;
  2467                              <2> ;	      $IF     E 				     ;;AN001;;
  2468                              <2> 	      JNE $MIF270
  2469                              <2> %IF		FARmsg					     ;;AN001;;
  2470                              <2> %ELSE							     ;;AN000;;
  2471                              <2> 		PUSH	CS				     ;;AN000;;
  2472                              <2> 		POP	ES				     ;;AN000;;	 Return ES:DI pointing to the message
  2473                              <2> %ENDIF
  2474                              <2> ;	      $ENDIF					     ;;AN001;;
  2475                              <2> $MIF270:
  2476                              <2> 	      ADD     DI,WORD PTR [ES:DI + $M_TXT_PTR]	     ;;AN000;; Prepare ES:DI pointing to the message
  2477                              <2> ;	    $ENDIF					     ;;AN004;;
  2478                              <2> $MIF269:
  2479                              <2> ;	  $ENDIF					     ;;AN004;;
  2480                              <2> $MIF258:
  2481                              <2> 							     ;; 	  Yes, great we can return with CX > 0
  2482                              <2> 
  2483                              <2> ;	  $IF	  NC					     ;;AN000;;	 Did we find the message?
  2484                              <2> 	  JC $MIF274
  2485                              <2> 	    XOR     CH,CH				     ;;AN000;;
  2486                              <2> 	    MOV     CL,BYTE PTR [ES:DI] 		     ;;AN000;;	 Move size into CX
  2487                              <2> 	    INC     DI					     ;;AN000;;	 Increment past length
  2488                              <2> ;	  $ENDIF					     ;;AN004;;
  2489                              <2> $MIF274:
  2490                              <2> 
  2491                              <2> 	  MOV	  byte [cs:$M_RT + $M_SIZE],$M_NULL 		     ;;AN004;; Reset variable
  2492                              <2> 	  RET						     ;;AN000;; Return
  2493                              <2> 							     ;;
  2494                              <2> $M_FIND_SPECIFIED_MSG ENDP				     ;;AN000;;
  2495                              <2> 							     ;;
  2496                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2497                              <2> 	%ENDIF						     ;;AN000;; END of include of common subroutines
  2498                              <2> ; 
  2499                              <2> 	%IF	$M_REPLACE				     ;;AN000;; Is the request to include the code for replaceable parms
  2500                              <2> 	  %iassign $M_REPLACE FALSE				     ;;AN000;;	   Tell the assembler we did
  2501                              <2> 							     ;;
  2502                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2503                              <2> $M_DISPLAY_REPLACE PROC NEAR				     ;;AN000;;
  2504                              <2> 							     ;;
  2505                              <2> 	  XOR	  BX,BX 				     ;;AN000;; Use BX for buffer count
  2506                              <2> %IFN	  COMR
  2507                              <2> 	  CMP	  byte [$M_SL + $M_S_ID],$M_SPECIAL_CASE-30H	     ;;AN000;; Is this the special case (convert to ASCII)
  2508                              <2> ;	  $IF	  E					     ;;AN000;; Yes,
  2509                              <2> 	  JNE $MIF276
  2510                              <2> 	    MOV     WORD PTR [cs:$M_RT + $M_TEMP_BUF + BX],$M_SPACE_HYP ;;AN000;; Move in a " -"
  2511                              <2> 	    INC     BX					     ;;AN000;;	   Increment count
  2512                              <2> 	    INC     BX					     ;;AN000;;	   Increment count
  2513                              <2> 	    MOV     BYTE PTR [cs:$M_RT + $M_TEMP_BUF + BX],$M_SPACE  ;;AN000;;	   Move in a " "
  2514                              <2> 	    INC     BX					     ;;AN000;;	   Increment count
  2515                              <2> 	    CALL    $M_FLUSH_BUF			     ;;AN000;;	   Write out " - " to prepare for special case
  2516                              <2> ;	  $ENDIF					     ;;AN000;;	   If it fails we will catch it later
  2517                              <2> $MIF276:
  2518                              <2> %ENDIF
  2519                              <2> 
  2520                              <2> 	  POP	  BP					     ;;AN000;; Remember the return address
  2521                              <2> 	  XOR	  BX,BX 				     ;;AN000;; Use BX for buffer count
  2522                              <2> 	  XOR	  DX,DX 				     ;;AN000;; Use DX for count of parms taken off the stack
  2523                              <2> 
  2524                              <2> 	  MOV	  [cs:$M_RT + $M_SIZE],CL			     ;;AN000;; Save size to later clear stack
  2525                              <2> 	  MOV	  AL,BYTE PTR [$M_SL + $M_S_MINW]		     ;;AN000;; Get the minimum width
  2526                              <2> 							     ;;
  2527                              <2> 	  CMP	  AL,CL 				     ;;AN000;; Do we need pad chars added?
  2528                              <2> ;	  $IF	  A					     ;;AN000;; Yes,
  2529                              <2> 	  JNA $MIF278
  2530                              <2> 	    SUB     AL,CL				     ;;AN000;;	 Calculate how many pad chars are needed.
  2531                              <2> 	    MOV     DH,AL				     ;;AN000;;	 Save the number of pad characters
  2532                              <2> 	    TEST    BYTE [$M_SL + $M_S_FLAG],Right_Align     ;;AN000;;	 Was replaceable parm to be right aligned?
  2533                              <2> ;	    $IF     NZ					     ;;AN000;;	 Yes,
  2534                              <2> 	    JZ $MIF279
  2535                              <2> ;	      $DO					     ;;AN000;;	   Begin filling buffer with pad chars
  2536                              <2> $MDO280:
  2537                              <2> 		MOV	AL,BYTE PTR [$M_SL + $M_S_PAD]	     ;;AN000;;
  2538                              <2> 		MOV	BYTE PTR [cs:$M_RT + $M_TEMP_BUF + BX],AL    ;;AN000;;	   Move in a pad char
  2539                              <2> 		INC	BX				     ;;AN000;;
  2540                              <2> 		CMP	BX,$M_TEMP_BUF_SZ		     ;;AN000;;	   Is buffer full?
  2541                              <2> ;		$IF	E				     ;;AN000;;	   Yes,
  2542                              <2> 		JNE $MIF281
  2543                              <2> 		  CALL	  $M_FLUSH_BUF			     ;;AN000;;	     Flush the buffer
  2544                              <2> ;		$ENDIF					     ;;AN000;;
  2545                              <2> $MIF281:
  2546                              <2> 		DEC	DH				     ;;AN000;;	   Have we filled with enough pad chars?
  2547                              <2> ;	      $ENDDO  Z 				     ;;AN000;;	   No, next pad character
  2548                              <2> 	      JNZ $MDO280
  2549                              <2> ;	    $ENDIF					     ;;AN000;;
  2550                              <2> $MIF279:
  2551                              <2> ;	  $ENDIF					     ;;AN000;;	   Yes,
  2552                              <2> $MIF278:
  2553                              <2> 							     ;;
  2554                              <2> 	  CMP	  BYTE [$M_SL + $M_S_MAXW],$M_UNLIM_W	     ;;AN000;; Is maximum width unlimited?
  2555                              <2> ;	  $IF	  NE					     ;;AN000;;
  2556                              <2> 	  JE $MIF286
  2557                              <2> 	    CMP     BYTE PTR [$M_SL + $M_S_MAXW],CL 	     ;;AN000;; Will we exceed maximum width?
  2558                              <2> ;	    $IF     B					     ;;AN000;; Yes,
  2559                              <2> 	    JNB $MIF287
  2560                              <2> 	      SUB     CL,BYTE PTR [$M_SL + $M_S_MAXW]	     ;;AN000;;	 Calculate how many extra chars
  2561                              <2> 	      MOV     DL,CL				     ;;AN000;;	 Remember how many chars to pop off
  2562                              <2> 	      MOV     CL,BYTE PTR [$M_SL + $M_S_MAXW]	     ;;AN000;;	 Set new string length
  2563                              <2> ;	    $ENDIF					     ;;AN000;;
  2564                              <2> $MIF287:
  2565                              <2> ;	  $ENDIF					     ;;AN000;;
  2566                              <2> $MIF286:
  2567                              <2> 	  OR	  CX,CX 				     ;;AN000;;
  2568                              <2> ;	  $IF	  NZ					     ;;AN000;;
  2569                              <2> 	  JZ $MIF290
  2570                              <2> ;	    $DO 					     ;;AN000;; Begin filling buffer with string
  2571                              <2> $MDO291:
  2572                              <2> 	      TEST    BYTE [$M_SL + $M_S_FLAG],~ Char_Type & $M_TYPE_MASK ;;AN000;;
  2573                              <2> ;	      $IF     Z,AND				     ;;AN000;;
  2574                              <2> 	      JNZ $MIF292
  2575                              <2> Char_field_ASCIIZ equ Char_Field_ASCIIZ	; NASM port equate
  2576                              <2> 	      TEST    byte [$M_SL + $M_S_FLAG],Char_field_ASCIIZ & $M_SIZE_MASK ;  Is this replace a ASCIIZ string?
  2577                              <2> ;	      $IF     NZ				     ;;AN000;; Yes,
  2578                              <2> 	      JZ $MIF292
  2579                              <2> 		MOV	AL,BYTE PTR [ES:DI]		     ;;AN000;;	 Get first character from string
  2580                              <2> 		INC	DI				     ;;AN000;;	 Next character in string
  2581                              <2> ;	      $ELSE					     ;;AN000;; No,
  2582                              <2> 	      JMP SHORT $MEN292
  2583                              <2> $MIF292:
  2584                              <2> 		POP	AX				     ;;AN000;;	 Get character in register
  2585                              <2> ;	      $ENDIF					     ;;AN000;;
  2586                              <2> $MEN292:
  2587                              <2> 	      MOV     BYTE PTR [cs:$M_RT + $M_TEMP_BUF + BX],AL      ;;AN000;;	Move char into the buffer
  2588                              <2> 	      INC     BX				     ;;AN000;;	 Increase buffer count
  2589                              <2> 	      CMP     BX,$M_TEMP_BUF_SZ 		     ;;AN000;;	 Is buffer full?
  2590                              <2> ;	      $IF     E 				     ;;AN000;;	 Yes,
  2591                              <2> 	      JNE $MIF295
  2592                              <2> 		CALL	$M_FLUSH_BUF			     ;;AN000;;	   Flush the buffer
  2593                              <2> ;	      $ENDIF					     ;;AN000;;
  2594                              <2> $MIF295:
  2595                              <2> 	      DEC     CL				     ;;AN000;;	 Have we completed replace?
  2596                              <2> ;	    $ENDDO  Z					     ;;AN000;;	   Test again
  2597                              <2> 	    JNZ $MDO291
  2598                              <2> ;	  $ENDIF					     ;;AN000;;
  2599                              <2> $MIF290:
  2600                              <2> 							     ;;
  2601                              <2> 	  TEST	  BYTE [$M_SL + $M_S_FLAG],Right_Align	     ;;AN000;;	 Was replaceable parm to be left aligned?
  2602                              <2> ;	  $IF	  Z					     ;;AN000;; Yes,
  2603                              <2> 	  JNZ $MIF299
  2604                              <2> 	    OR	    DH,DH				     ;;AN000;;	 Do we need pad chars added?
  2605                              <2> ;	    $IF     NZ					     ;;AN000;;	 Yes,
  2606                              <2> 	    JZ $MIF300
  2607                              <2> ;	      $DO					     ;;AN000;;	   Begin filling buffer with pad chars
  2608                              <2> $MDO301:
  2609                              <2> 		MOV	AL,BYTE PTR [$M_SL + $M_S_PAD]	     ;;AN000;;
  2610                              <2> 		MOV	BYTE PTR [cs:$M_RT + $M_TEMP_BUF + BX],AL    ;;AN000;;	   Move in a pad char
  2611                              <2> 		INC	BX				     ;;AN000;;
  2612                              <2> 		CMP	BX,$M_TEMP_BUF_SZ		     ;;AN000;;	   Is buffer full?
  2613                              <2> ;		$IF	E				     ;;AN000;;	   Yes,
  2614                              <2> 		JNE $MIF302
  2615                              <2> 		  CALL	  $M_FLUSH_BUF			     ;;AN000;;	     Flush the buffer
  2616                              <2> ;		$ENDIF					     ;;AN000;;
  2617                              <2> $MIF302:
  2618                              <2> 		DEC	DH				     ;;AN000;;	   Have we filled with enough pad chars?
  2619                              <2> ;	      $ENDDO  Z 				     ;;AN000;;	     Test again
  2620                              <2> 	      JNZ $MDO301
  2621                              <2> ;	    $ENDIF					     ;;AN000;;
  2622                              <2> $MIF300:
  2623                              <2> ;	  $ENDIF					     ;;AN000;;
  2624                              <2> $MIF299:
  2625                              <2> 							     ;;
  2626                              <2> 	  TEST	  BYTE [$M_SL + $M_S_FLAG],~ Char_Type & $M_TYPE_MASK ;;AN000;;
  2627                              <2> ;	  $IF	  Z,AND 				     ;;AN000;;
  2628                              <2> 	  JNZ $MIF307
  2629                              <2> 	  TEST	  byte [$M_SL + $M_S_FLAG],Char_field_ASCIIZ & $M_SIZE_MASK ;;AN000;;	Is this replace a ASCIIZ string?
  2630                              <2> ;	  $IF	  NZ					     ;;AN000;; Yes,
  2631                              <2> 	  JZ $MIF307
  2632                              <2> ;	  $ELSE 					     ;;AN000;;
  2633                              <2> 	  JMP SHORT $MEN307
  2634                              <2> $MIF307:
  2635                              <2> 	    OR	    DL,DL				     ;;AN000;;
  2636                              <2> ;	    $IF     NE					     ;;AN000;;
  2637                              <2> 	    JE $MIF309
  2638                              <2> ;	      $DO					     ;;AN000;;
  2639                              <2> $MDO310:
  2640                              <2> 		POP	word [cs:$M_RT + $M_RETURN_ADDR]		     ;;AN000;;	 Clean Up stack using spare variable
  2641                              <2> 		DEC	DL				     ;;AN000;;	 Are we done?
  2642                              <2> ;	      $ENDDO  Z 				     ;;AN000;;
  2643                              <2> 	      JNZ $MDO310
  2644                              <2> ;	    $ENDIF					     ;;AN000;;
  2645                              <2> $MIF309:
  2646                              <2> ;	  $ENDIF					     ;;AN000;;
  2647                              <2> $MEN307:
  2648                              <2> 	  CALL	  $M_FLUSH_BUF				     ;;AN000;;	     Flush the buffer for the final time
  2649                              <2> 	  PUSH	  BP					     ;;AN000;; Restore the return address
  2650                              <2> 							     ;;
  2651                              <2> 	  RET						     ;;AN000;;
  2652                              <2> 							     ;;
  2653                              <2> $M_DISPLAY_REPLACE ENDP 				     ;;AN000;;
  2654                              <2> 							     ;;
  2655                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2656                              <2> ;;
  2657                              <2> ;;	PROC NAME: $M_FLUSH_BUFFER
  2658                              <2> ;;
  2659                              <2> ;;	FUNCTION: Display the contents of the temporary buffer
  2660                              <2> ;;	INPUTS: DI contains the number of bytes to display
  2661                              <2> ;;	OUTPUTS: BX reset to zero
  2662                              <2> ;;
  2663                              <2> ;;	REGS USED:
  2664                              <2> ;;
  2665                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2666                              <2> 							     ;;
  2667                              <2> $M_FLUSH_BUF PROC NEAR					     ;;AN000;;
  2668                              <2> 							     ;;
  2669                              <2> 	  PUSH	  CX					     ;;AN000;; Save changed regs
  2670                              <2> 	  PUSH	  ES					     ;;AN000;;
  2671                              <2> 	  PUSH	  DI					     ;;AN000;;
  2672                              <2> 	  PUSH	  DS					     ;;AN000;; Set ES pointing to buffer
  2673                              <2> 	  POP	  ES					     ;;AN000;;
  2674                              <2> 							     ;;
  2675                              <2> 	  MOV	  CX,BX 				     ;;AN000;; Set number of bytes to display
  2676                              <2> 	  XOR	  BX,BX 				     ;;AN000;; Reset buffer counter
  2677                              <2> 	  LEA	  DI,[$M_RT + $M_TEMP_BUF]			     ;;AN000;; Reset buffer location pointer
  2678                              <2> 	  CALL	  $M_DISPLAY_STRING			     ;;AN000;; Display the buffer
  2679                              <2> 							     ;;
  2680                              <2> ;	  $IF	  NC					     ;;AN000;; Error?
  2681                              <2> 	  JC $MIF314
  2682                              <2> 	    POP     DI					     ;;AN000;; No, Restore changed regs
  2683                              <2> 	    POP     ES					     ;;AN000;;
  2684                              <2> 	    POP     CX					     ;;AN000;;
  2685                              <2> ;	  $ELSE 					     ;;AN000;; Yes,
  2686                              <2> 	  JMP SHORT $MEN314
  2687                              <2> $MIF314:
  2688                              <2> 	    ADD     SP,6				     ;;AN000;;	Fix stack
  2689                              <2> 	    STC 					     ;;AN000;;
  2690                              <2> ;	  $ENDIF					     ;;AN000;; Error?
  2691                              <2> $MEN314:
  2692                              <2> 							     ;;
  2693                              <2> 	  RET						     ;;AN000;; Return
  2694                              <2> 							     ;;
  2695                              <2> $M_FLUSH_BUF ENDP					     ;;AN000;;
  2696                              <2> 							     ;;
  2697                              <2> 							     ;;
  2698                              <2> 	  %IF	  CHARmsg				     ;;AN000;; Is the request to include the code for CHAR replace?
  2699                              <2> 	    %iassign $M_REPLACE  TRUE				     ;;AN000;; Yes, THEN include it and flag that we will need common
  2700                              <2> 	    %iassign $M_CHAR_ONLY TRUE 			     ;;AN000;;	 replacement code later
  2701                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2702                              <2> ;;
  2703                              <2> ;;	PROC NAME: $M_CHAR_REPLACE
  2704                              <2> ;;
  2705                              <2> ;;	FUNCTION: Will prepare a single char or ASCIIZ string for replace
  2706                              <2> ;;	INPUTS: DS:SI points at corresponding SUBLIST
  2707                              <2> ;;		ES:DI contains the VALUE from SUBLIST
  2708                              <2> ;;	OUTPUTS: CX contains number of characters on stack
  2709                              <2> ;;		 Top of stack  --> Last character
  2710                              <2> ;;					. . .
  2711                              <2> ;;		 Bot of stack  --> First character
  2712                              <2> ;;
  2713                              <2> ;;	OTHER REGS Revised: AX
  2714                              <2> ;;
  2715                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2716                              <2> 							     ;;
  2717                              <2> $M_CHAR_REPLACE PROC NEAR				     ;;AN000;;
  2718                              <2> 							     ;;
  2719                              <2> 	    POP     BP					     ;;AN000;; Save return address
  2720                              <2> 	    TEST    byte [$M_SL + $M_S_FLAG],~ Char_Field_Char & $M_SIZE_MASK ;;AN000;; Was Character specified?
  2721                              <2> ;	    $IF     Z					     ;;AN000;; Yes,
  2722                              <2> 	    JNZ $MIF317
  2723                              <2> 	      MOV     AL,BYTE PTR [ES:DI]		     ;;AN000;;	 Get the character
  2724                              <2> 	      PUSH    AX				     ;;AN000;;	 Put it on the stack
  2725                              <2> 	      INC     CX				     ;;AN000;;	 Increase the count
  2726                              <2> 	      CALL    $M_IS_IT_DBCS			     ;;AN000;;	 Is this the first byte of a DB character
  2727                              <2> ;	      $IF     C 				     ;;AN000;;	 Yes,
  2728                              <2> 	      JNC $MIF318
  2729                              <2> 		MOV	AL,BYTE PTR [ES:DI + 1]		     ;;AN000;;	   Get the next character
  2730                              <2> 		PUSH	AX				     ;;AN000;;	   Put it on the stack
  2731                              <2> 		CLC					     ;;AN000;;	   Clear the carry
  2732                              <2> ;	      $ENDIF					     ;;AN000;;
  2733                              <2> $MIF318:
  2734                              <2> ;	    $ELSE					     ;;AN000;; No, it was an ASCIIZ string
  2735                              <2> 	    JMP SHORT $MEN317
  2736                              <2> $MIF317:
  2737                              <2> ;	      $DO					     ;;AN000;;
  2738                              <2> $MDO321:
  2739                              <2> 		MOV	AL,BYTE PTR [ES:DI]		     ;;AN000;;	 Get the character
  2740                              <2> 		OR	AL,AL				     ;;AN000;;	 Is it the NULL?
  2741                              <2> ;	      $LEAVE  Z 				     ;;AN000;;	 No,
  2742                              <2> 	      JZ $MEN321
  2743                              <2> 		INC	DI				     ;;AN000;;	   Next character
  2744                              <2> 		INC	CX				     ;;AN000;;	   Increment the count
  2745                              <2> ;	      $ENDDO					     ;;AN000;;	 Yes,
  2746                              <2> 	      JMP SHORT $MDO321
  2747                              <2> $MEN321:
  2748                              <2> 	      SUB     DI,CX				     ;;AN000;;	 Set SI at the beginning of the string
  2749                              <2> ;	    $ENDIF					     ;;AN000;;
  2750                              <2> $MEN317:
  2751                              <2> 							     ;;AN000;;
  2752                              <2> 	    PUSH    BP					     ;;AN000;; Restore return address
  2753                              <2> 	    RET 					     ;;AN000;; Return
  2754                              <2> 							     ;;
  2755                              <2> $M_CHAR_REPLACE ENDP					     ;;AN000;;
  2756                              <2> 							     ;;
  2757                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2758                              <2> 	  %ENDIF 					     ;;AN000;; END of include of CHAR replace code
  2759                              <2> ; 
  2760                              <2> 	  %IF	  NUMmsg				     ;;AN000;; Is the request to include the code for NUM replace?
  2761                              <2> 	    %iassign $M_REPLACE TRUE				     ;;AN000;; Yes, THEN include it and flag that we will need common
  2762                              <2> 	    %iassign $M_CHAR_ONLY FALSE			     ;;AN000;;	 replacement code later
  2763                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2764                              <2> ;;
  2765                              <2> ;;	PROC NAME: $M_BIN2ASC_REPLACE
  2766                              <2> ;;
  2767                              <2> ;;	FUNCTION: Convert a signed or unsigned binary number to an ASCII string
  2768                              <2> ;;		  and prepare to display
  2769                              <2> ;;	INPUTS: DS:SI points at corresponding SUBLIST
  2770                              <2> ;;		ES:DI contains the VALUE from SUBLIST
  2771                              <2> ;;	OUTPUTS: CX contains number of characters on stack
  2772                              <2> ;;		 Top of stack  --> Last character
  2773                              <2> ;;					. . .
  2774                              <2> ;;		 Bot of stack  --> First character
  2775                              <2> ;;	OTHER REGS Revised: BX,DX,AX
  2776                              <2> ;;
  2777                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2778                              <2> 							     ;;
  2779                              <2> $M_BIN2ASC_REPLACE PROC NEAR				     ;;AN000;;
  2780                              <2> 							     ;;
  2781                              <2> 	    POP     BP					     ;;AN000;; Save return address
  2782                              <2> 							     ;;
  2783                              <2> 	    XOR     DX,DX				     ;;AN000;; Prepare for get binary value (HIGH)
  2784                              <2> 	    XOR     AX,AX				     ;;AN000;; Prepare for get binary value (LOW)
  2785                              <2> 	    MOV     word [$M_RT + $M_DIVISOR],$M_BASE16		     ;;AN000;; Set default divisor
  2786                              <2> 	    XOR     BX,BX				     ;;AN000;; Use BP as the NEG flag (if applicable)
  2787                              <2> %IFN     COMR
  2788                              <2> 	    TEST    byte [$M_SL + $M_S_FLAG],~ $M_BYTE & $M_SIZE_MASK ;;AN000;; Was BYTE specified?
  2789                              <2> ;	    $IF     Z					     ;;AN000;;
  2790                              <2> 	    JNZ $MIF325
  2791                              <2> 	      MOV     AL, BYTE PTR [ES:DI]		     ;;AN000;; Setup byte in AL
  2792                              <2> 	      TEST    byte [$M_SL + $M_S_FLAG],~ Sgn_Bin_Type & $M_TYPE_MASK ;;AN000;; Was Signed binary specified?
  2793                              <2> ;	      $IF     Z 				     ;;AN000;;
  2794                              <2> 	      JNZ $MIF326
  2795                              <2> 		TEST	AL,10000000b			     ;;AN000;; Is this number negative?
  2796                              <2> ;		$IF	NZ				     ;;AN000;;	 Yes,
  2797                              <2> 		JZ $MIF327
  2798                              <2> 		  INC	  BX				     ;;AN000;;	   Remember that it was negative
  2799                              <2> 		  AND	  AL,01111111b			     ;;AN000;;	   Make it positive
  2800                              <2> ;		$ENDIF					     ;;AN000;;
  2801                              <2> $MIF327:
  2802                              <2> 		MOV	word [$M_RT + $M_DIVISOR],$M_BASE10	     ;;AN000;;
  2803                              <2> ;	      $ENDIF					     ;;AN000;;
  2804                              <2> $MIF326:
  2805                              <2> 	      TEST    byte [$M_SL + $M_S_FLAG],~ Unsgn_Bin_Type & $M_TYPE_MASK ;;AN000;; Was Signed binary specified?
  2806                              <2> ;	      $IF     Z 				     ;;AN000;;
  2807                              <2> 	      JNZ $MIF330
  2808                              <2> 		MOV	word [$M_RT + $M_DIVISOR],$M_BASE10	     ;;AN000;;
  2809                              <2> ;	      $ENDIF					     ;;AN000;;
  2810                              <2> $MIF330:
  2811                              <2> ;	    $ELSE					     ;;AN000;;
  2812                              <2> 	    JMP SHORT $MEN325
  2813                              <2> $MIF325:
  2814                              <2> %ENDIF
  2815                              <2> 	      TEST    byte [$M_SL + $M_S_FLAG],~ $M_WORD & $M_SIZE_MASK ;;AN000;; Was WORD specified?
  2816                              <2> ;	      $IF     Z 				     ;;AN000;;
  2817                              <2> 	      JNZ $MIF333
  2818                              <2> 		MOV	AX, WORD PTR [ES:DI]		     ;;AN000;; Setup byte in AL
  2819                              <2> 		TEST	byte [$M_SL + $M_S_FLAG],~ Sgn_Bin_Type & $M_TYPE_MASK ;; AN000;; Was Signed binary specified?
  2820                              <2> ;		$IF	Z				     ;;AN000;;
  2821                              <2> 		JNZ $MIF334
  2822                              <2> 		  TEST	  AH,10000000b			     ;;AN000;; Is this number negative?
  2823                              <2> ;		  $IF	  NZ				     ;;AN000;;	 Yes,
  2824                              <2> 		  JZ $MIF335
  2825                              <2> 		    INC     BX				     ;;AN000;;	   Remember that it was negative
  2826                              <2> 		    AND     AH,01111111b		     ;;AN000;;	   Make it positive
  2827                              <2> ;		  $ENDIF				     ;;AN000;;
  2828                              <2> $MIF335:
  2829                              <2> 		  MOV	  word [$M_RT + $M_DIVISOR],$M_BASE10	     ;;AN000;;
  2830                              <2> ;		$ENDIF					     ;;AN000;;
  2831                              <2> $MIF334:
  2832                              <2> 		TEST	byte [$M_SL + $M_S_FLAG],~ Unsgn_Bin_Type & $M_TYPE_MASK ;;AN000;; Was Signed binary specified?
  2833                              <2> ;		$IF	Z				     ;;AN000;;
  2834                              <2> 		JNZ $MIF338
  2835                              <2> 		  MOV	  word [$M_RT + $M_DIVISOR],$M_BASE10	     ;;AN000;;
  2836                              <2> ;		$ENDIF					     ;;AN000;;
  2837                              <2> $MIF338:
  2838                              <2> ;	      $ELSE					     ;;AN000;;
  2839                              <2> 	      JMP SHORT $MEN333
  2840                              <2> $MIF333:
  2841                              <2> %IFN	COMR
  2842                              <2> 		MOV	AX, WORD PTR [ES:DI]		     ;;AN000;; Setup Double word in DX:AX
  2843                              <2> 		MOV	DX, WORD PTR [ES:DI + 2]		     ;;AN000;;
  2844                              <2> 		TEST	byte [$M_SL + $M_S_FLAG],~ Sgn_Bin_Type & $M_TYPE_MASK ;;AN000;; Was Signed binary specified?
  2845                              <2> ;		$IF	Z				     ;;AN000;;
  2846                              <2> 		JNZ $MIF341
  2847                              <2> 		  TEST	  DH,10000000b			     ;;AN000;; Is this number negative?
  2848                              <2> ;		  $IF	  NZ				     ;;AN000;;	 Yes,
  2849                              <2> 		  JZ $MIF342
  2850                              <2> 		    INC     BX				     ;;AN000;;	   Remember that it was negative
  2851                              <2> 		    AND     DH,01111111b		     ;;AN000;;	   Make it positive
  2852                              <2> ;		  $ENDIF				     ;;AN000;;
  2853                              <2> $MIF342:
  2854                              <2> 		  MOV	  word [$M_RT + $M_DIVISOR],$M_BASE10	     ;;AN000;;
  2855                              <2> ;		$ENDIF					     ;;AN000;;
  2856                              <2> $MIF341:
  2857                              <2> 		TEST	byte [$M_SL + $M_S_FLAG],~ Unsgn_Bin_Type & $M_TYPE_MASK ;;AN000;; Was Signed binary specified?
  2858                              <2> ;		$IF	Z				     ;;AN000;;
  2859                              <2> 		JNZ $MIF345
  2860                              <2> 		  MOV	  word [$M_RT + $M_DIVISOR],$M_BASE10	     ;;AN000;;
  2861                              <2> ;		$ENDIF					     ;;AN000;;
  2862                              <2> $MIF345:
  2863                              <2> %ENDIF
  2864                              <2> ;	      $ENDIF					     ;;AN000;;
  2865                              <2> $MEN333:
  2866                              <2> ;	    $ENDIF					     ;;AN000;;
  2867                              <2> $MEN325:
  2868                              <2> 							     ;;
  2869                              <2> 	    CALL    $M_CONVERT2ASC			     ;;AN000;; Convert to ASCII string
  2870                              <2> %IFN     COMR
  2871                              <2> 	    OR	    BX,BX				     ;;AN000;;
  2872                              <2> ;	    $IF     NZ					     ;;AN000;; Was number negative?
  2873                              <2> 	    JZ $MIF349
  2874                              <2> 	      XOR     DX,DX				     ;;AN000;; Yes,
  2875                              <2> 	      MOV     DL,$M_NEG_SIGN			     ;;AN000;;	 Put "-" on the stack with the number
  2876                              <2> 	      PUSH    DX				     ;;AN000;;
  2877                              <2> ;	    $ENDIF					     ;;AN000;; No,
  2878                              <2> $MIF349:
  2879                              <2> %ENDIF
  2880                              <2> 							     ;;
  2881                              <2> 	    PUSH    BP					     ;;AN000;; Restore return address
  2882                              <2> 	    RET 					     ;;AN000;; Return
  2883                              <2> 							     ;;
  2884                              <2> $M_BIN2ASC_REPLACE ENDP 				     ;;AN000;;
  2885                              <2> 							     ;;
  2886                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2887                              <2> 	  %ENDIF 					     ;;AN000;; END of include of NUM replace code
  2888                              <2> ; 
  2889                              <2> 	  %IF	  DATEmsg				     ;;AN000;; Is the request to include the code for DATE replace?
  2890                              <2> 	    %iassign $M_REPLACE TRUE				     ;;AN000;; Yes, THEN include it and flag that we will need common
  2891                              <2> 	    %iassign $M_CHAR_ONLY FALSE			     ;;AN000;;	  replacement code later
  2892                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2893                              <2> ;;
  2894                              <2> ;;	PROC NAME: $M_DATE_REPLACE
  2895                              <2> ;;
  2896                              <2> ;;	FUNCTION: Convert a date to a decimal ASCII string using current
  2897                              <2> ;;		  country format and prepare to display
  2898                              <2> ;;	INPUTS: DS:SI points at corresponding SUBLIST
  2899                              <2> ;;		ES:DI points at VALUE from SUBLIST
  2900                              <2> ;;	OUTPUTS: CX contains number of characters on stack
  2901                              <2> ;;		 Top of stack  --> Last character
  2902                              <2> ;;					. . .
  2903                              <2> ;;		 Bot of stack  --> First character
  2904                              <2> ;;	OTHER REGS Revised: DX, AX
  2905                              <2> ;;
  2906                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2907                              <2> 							     ;;
  2908                              <2> $M_DATE_REPLACE PROC NEAR				     ;;AN000;;
  2909                              <2> 							     ;;
  2910                              <2> 	    POP     BP					     ;;AN000;; Save return address
  2911                              <2> 	    MOV     word [$M_RT + $M_DIVISOR],$M_BASE10		     ;;AN000;; Set default divisor
  2912                              <2> 	    CALL    $M_GET_DATE 			     ;;AN000;; Set date format/separator in $M_RT
  2913                              <2> 							     ;;AN000;; All O.K.?
  2914                              <2> 	    XOR     DX,DX				     ;;AN000;; Reset DX value
  2915                              <2> 	    XOR     AX,AX				     ;;AN000;; Reset AX value
  2916                              <2> 	    CMP     WORD [$M_RT + $M_DATE_FORMAT],0	     ;;AN000;; USA Date Format
  2917                              <2> ;	    $IF     E					     ;;AN000;;	Beginning from end: (saved on the stack)
  2918                              <2> 	    JNE $MIF351
  2919                              <2> 	      CALL    $M_YEAR				     ;;AN000;;	 Get Year
  2920                              <2> 	      CALL    $M_CONVERTDATE			     ;;AN000;;	Convert it to an ASCII string
  2921                              <2> 	      PUSH    WORD [$M_RT + $M_DATE_SEPARA]	     ;;AN000;;
  2922                              <2> 	      INC     CX				     ;;AN000;; Increment count
  2923                              <2> 	      XOR     AX,AX				     ;;AN000;; Reset AX value
  2924                              <2> 	      MOV     AL,BYTE PTR [$M_SL + $M_S_VALUE+3]	     ;;AN000;;	Get Day
  2925                              <2> 	      CALL    $M_CONVERTDATE			     ;;AN000;;	Convert it to an ASCII string
  2926                              <2> 	      PUSH    WORD [$M_RT + $M_DATE_SEPARA]	     ;;AN000;;
  2927                              <2> 	      INC     CX				     ;;AN000;; Increment count
  2928                              <2> 	      MOV     AL,BYTE PTR [$M_SL + $M_S_VALUE+2]	     ;;AN000;;	Get Month
  2929                              <2> 	      CALL    $M_CONVERTDATE			     ;;AN000;;	Convert it to an ASCII string
  2930                              <2> ;	    $ENDIF					     ;;AN000;;
  2931                              <2> $MIF351:
  2932                              <2> 							     ;;
  2933                              <2> 	    CMP     WORD [$M_RT + $M_DATE_FORMAT],1	     ;;AN000;; EUROPE Date Format
  2934                              <2> ;	    $IF     E					     ;;AN000;;	Beginning from end: (saved on the stack)
  2935                              <2> 	    JNE $MIF353
  2936                              <2> 	      CALL    $M_YEAR				     ;;AN000;;	 Get Year
  2937                              <2> 	      CALL    $M_CONVERTDATE			     ;;AN000;;	Convert it to an ASCII string
  2938                              <2> 	      PUSH    WORD [$M_RT + $M_DATE_SEPARA]	     ;;AN000;;
  2939                              <2> 	      INC     CX				     ;;AN000;;
  2940                              <2> 	      XOR     AX,AX				     ;;AN000;; Reset AX
  2941                              <2> 	      MOV     AL,BYTE PTR [$M_SL + $M_S_VALUE+2]	     ;;AN000;;	Get Month
  2942                              <2> 	      CALL    $M_CONVERTDATE			     ;;AN000;;	Convert it to an ASCII string
  2943                              <2> 	      PUSH    WORD [$M_RT + $M_DATE_SEPARA]	     ;;AN000;;
  2944                              <2> 	      INC     CX				     ;;AN000;;
  2945                              <2> 	      MOV     AL,BYTE PTR [$M_SL + $M_S_VALUE+3]	     ;;AN000;;	Get Day
  2946                              <2> 	      CALL    $M_CONVERTDATE			     ;;AN000;;	Convert it to an ASCII string
  2947                              <2> ;	    $ENDIF					     ;;AN000;;
  2948                              <2> $MIF353:
  2949                              <2> 							     ;;
  2950                              <2> 	    CMP     WORD [$M_RT + $M_DATE_FORMAT],2	     ;;AN000;; JAPAN Date Format
  2951                              <2> ;	    $IF     E					     ;;AN000;;	Beginning from end: (saved on the stack)
  2952                              <2> 	    JNE $MIF355
  2953                              <2> 	      MOV     AL,BYTE PTR [$M_SL + $M_S_VALUE+3]	     ;;AN000;;	Get Day
  2954                              <2> 	      CALL    $M_CONVERTDATE			     ;;AN000;;	Convert it to an ASCII string
  2955                              <2> 	      PUSH    WORD [$M_RT + $M_DATE_SEPARA]	     ;;AN000;;
  2956                              <2> 	      INC     CX				     ;;AN000;;
  2957                              <2> 	      MOV     AL,BYTE PTR [$M_SL + $M_S_VALUE+2]	     ;;AN000;;	Get Month
  2958                              <2> 	      CALL    $M_CONVERTDATE			     ;;AN000;;	Convert it to an ASCII string
  2959                              <2> 	      PUSH    WORD [$M_RT + $M_DATE_SEPARA]	     ;;AN000;;
  2960                              <2> 	      INC     CX				     ;;AN000;;
  2961                              <2> 	      CALL    $M_YEAR				     ;;AN000;;	 Get Year
  2962                              <2> 	      CALL    $M_CONVERTDATE			     ;;AN000;;	Convert it to an ASCII string
  2963                              <2> ;	    $ENDIF					     ;;AN000;;
  2964                              <2> $MIF355:
  2965                              <2> 							     ;;
  2966                              <2> 	    PUSH    BP					     ;;AN000;; Restore return address
  2967                              <2> 	    RET 					     ;;AN000;; Return
  2968                              <2> 							     ;;
  2969                              <2> $M_DATE_REPLACE ENDP					     ;;AN000;;
  2970                              <2> 							     ;;
  2971                              <2> $M_GET_DATE PROC    NEAR				     ;;AN000;;
  2972                              <2> 	    MOV     AH,DOS_GET_COUNTRY			     ;;AN000;; Call DOS for country dependant info
  2973                              <2> 	    MOV     AL,0				     ;;AN000;; Get current country info
  2974                              <2> 	    LEA     DX,[$M_RT + $M_TEMP_BUF]		     ;;AN000;; Set up addressibility to buffer
  2975                              <2> 	    INT     21H 				     ;;AN000;;
  2976                              <2> ;	    $IF     C					     ;;AN000;; No,
  2977                              <2> 	    JNC $MIF357
  2978                              <2> 	      MOV     WORD [$M_RT + $M_DATE_FORMAT],$M_DEF_DATE_FORM ;;AN000;;	 Set default date format    (BH)
  2979                              <2> 	      MOV     BYTE [$M_RT + $M_DATE_SEPARA],$M_DEF_DATE_SEP ;;AN000;;	Set default date separator (BL)
  2980                              <2> ;	    $ENDIF					     ;;AN000;;
  2981                              <2> $MIF357:
  2982                              <2> 	    RET 					     ;;AN000;;
  2983                              <2> $M_GET_DATE ENDP					     ;;AN000;;
  2984                              <2> 							     ;;
  2985                              <2> $M_YEAR     PROC    NEAR				     ;;AN000;;
  2986                              <2> 	    MOV     AX,WORD PTR [$M_SL + $M_S_VALUE]	     ;;AN000;;	Get Year
  2987                              <2> 	    TEST    byte [$M_SL + $M_S_FLAG],Date_MDY_4 & $M_DATE_MASK ;;AN000;; Was Month/Day/Year (2 Digits) specified?
  2988                              <2> ;	    $IF     Z					     ;;AN000;;
  2989                              <2> 	    JNZ $MIF359
  2990                              <2> 	      CMP     AX,$M_MAX_2_YEAR			     ;;AN000;;	Get Year
  2991                              <2> ;	      $IF     A 				     ;;AN000;;
  2992                              <2> 	      JNA $MIF360
  2993                              <2> 		MOV	AX,$M_MAX_2_YEAR		     ;;AN000;;
  2994                              <2> ;	      $ENDIF					     ;;AN000;;
  2995                              <2> $MIF360:
  2996                              <2> ;	    $ENDIF					     ;;AN000;;
  2997                              <2> $MIF359:
  2998                              <2> 	    RET 					     ;;AN000;;
  2999                              <2> $M_YEAR     ENDP					     ;;AN000;;
  3000                              <2> 							     ;;
  3001                              <2> $M_CONVERTDATE PROC NEAR				     ;;AN000;;
  3002                              <2> 	    POP     WORD [$M_RT + $M_TEMP_BUF]		     ;;AN000;; Save return address
  3003                              <2> 	    MOV     [$M_RT + $M_SIZE],CL			     ;;AN000;; Save the size before conversion
  3004                              <2> 	    CALL    $M_CONVERT2ASC			     ;;AN000;; Convert it to an ASCII string
  3005                              <2> 	    DEC     CX					     ;;AN000;; Test if size only grew by 1
  3006                              <2> 	    CMP     CL,[$M_RT + $M_SIZE]			     ;;AN000;; Did size only grow by one
  3007                              <2> ;	    $IF     E					     ;;AN000;; Yes,
  3008                              <2> 	    JNE $MIF363
  3009                              <2> 	      MOV     AX,$M_TIMEDATE_PAD		     ;;AN000;;	 Get a pad character (0)
  3010                              <2> 	      PUSH    AX				     ;;AN000;;	 Save it
  3011                              <2> 	      INC     CX				     ;;AN000;;	 Count it
  3012                              <2> ;	    $ENDIF					     ;;AN000;;
  3013                              <2> $MIF363:
  3014                              <2> 	    INC     CX					     ;;AN000;; Restore CX
  3015                              <2> 	    PUSH    WORD [$M_RT + $M_TEMP_BUF]		     ;;AN000;; Save return address
  3016                              <2> 	    RET 					     ;;AN000;;
  3017                              <2> $M_CONVERTDATE ENDP					     ;;AN000;;
  3018                              <2> 							     ;;
  3019                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3020                              <2> 	  %ENDIF 					     ;;AN000;; END of include of DATE replace code
  3021                              <2> ; 
  3022                              <2> 	  %IF	  TIMEmsg				     ;;AN000;; Is the request to include the code for TIME replace?
  3023                              <2> 	    %iassign $M_REPLACE TRUE				     ;;AN000;; Yes, THEN include it and flag that we will need common
  3024                              <2> 	    %iassign $M_CHAR_ONLY FALSE			     ;;AN000;;	  replacement code later
  3025                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3026                              <2> ;;
  3027                              <2> ;;	PROC NAME: $M_TIME_REPLACE
  3028                              <2> ;;
  3029                              <2> ;;	FUNCTION: Convert a time to a decimal ASCII string
  3030                              <2> ;;		  and prepare to display
  3031                              <2> ;;	INPUTS: DS:SI points at corresponding SUBLIST
  3032                              <2> ;;		ES:DI points at VALUE from SUBLIST
  3033                              <2> ;;	OUTPUTS: CX contains number of characters on stack
  3034                              <2> ;;		 Top of stack  --> Last character
  3035                              <2> ;;					. . .
  3036                              <2> ;;		 Bot of stack  --> First character
  3037                              <2> ;;	REGS USED: BP,CX,AX
  3038                              <2> ;;
  3039                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3040                              <2> 							     ;;
  3041                              <2> $M_TIME_REPLACE PROC NEAR				     ;;AN000;;
  3042                              <2> 							     ;;
  3043                              <2> 	    POP     BP					     ;;AN000;; Save return address
  3044                              <2> 	    MOV     word [$M_RT + $M_DIVISOR],$M_BASE10		     ;;AN000;; Set default divisor
  3045                              <2> 	    CALL    $M_GET_TIME 			     ;;AN000;; All O.K.?
  3046                              <2> 	    TEST    byte [$M_SL + $M_S_FLAG],Time_Cty_Type & $M_TIME_MASK ;;AN000;; Is this a request for current country info?
  3047                              <2> ;	    $IF     NZ					     ;;AN000;; Yes,
  3048                              <2> 	    JZ $MIF365
  3049                              <2> 	      CMP     BYTE [$M_RT + $M_TIME_FORMAT],0	     ;;AN000;; Is the current country format 12 Hour?
  3050                              <2> ;	      $IF     E 				     ;;AN000;; Yes,
  3051                              <2> 	      JNE $MIF366
  3052                              <2> 		MOV	AL,BYTE PTR [$M_SL + $M_S_VALUE]	     ;;AN000;;	Get Hours
  3053                              <2> 		CMP	AL,12				     ;;AN000;;	Is hour 12 or less?
  3054                              <2> ;		$IF	L,OR				     ;;AN000;;	 or
  3055                              <2> 		JL $MLL367
  3056                              <2> 		CMP	AL,23				     ;;AN000;;	  Is hour 24 or greater?
  3057                              <2> ;		$IF	G				     ;;AN000;;	Yes,
  3058                              <2> 		JNG $MIF367
  3059                              <2> $MLL367:
  3060                              <2> 		  MOV	  AL,$M_AM			     ;;AN000;;
  3061                              <2> 		  PUSH	  AX				     ;;AN000;;	  Push an "a" to represent AM.
  3062                              <2> 		  INC	  CX				     ;;AN000;;
  3063                              <2> ;		$ELSE					     ;;AN000;;	No,
  3064                              <2> 		JMP SHORT $MEN367
  3065                              <2> $MIF367:
  3066                              <2> 		  MOV	  AL,$M_PM			     ;;AN000;;
  3067                              <2> 		  PUSH	  AX				     ;;AN000;;	  Push an "p" to represent PM.
  3068                              <2> 		  INC	  CX				     ;;AN000;;
  3069                              <2> ;		$ENDIF					     ;;AN000;;
  3070                              <2> $MEN367:
  3071                              <2> ;	      $ENDIF					     ;;AN000;;
  3072                              <2> $MIF366:
  3073                              <2> ;	    $ENDIF					     ;;AN000;;
  3074                              <2> $MIF365:
  3075                              <2> 							     ;;
  3076                              <2> 	    XOR     AX,AX				     ;;AN000;;
  3077                              <2> 	    XOR     DX,DX				     ;;AN000;;
  3078                              <2> 	    TEST    byte [$M_SL + $M_S_FLAG],Time_HHMMSSHH_Cty & $M_SIZE_MASK ;;AN000;; Was Hour/Min/Sec/Hunds (12 Hour) specified?
  3079                              <2> ;	    $IF     NZ					     ;;AN000;;
  3080                              <2> 	    JZ $MIF372
  3081                              <2> 	      MOV     AL,BYTE PTR [$M_SL + $M_S_VALUE+3]	     ;;AN000;;	Get Hundreds
  3082                              <2> 	      CALL    $M_CONVERTTIME			     ;;AN000;;
  3083                              <2> 	      PUSH    WORD [$M_RT + $M_DECI_SEPARA]	     ;;AN000;;
  3084                              <2> 	      INC     CX				     ;;AN000;;
  3085                              <2> ;	    $ENDIF					     ;;AN000;;
  3086                              <2> $MIF372:
  3087                              <2> 	    TEST    byte [$M_SL + $M_S_FLAG],Time_HHMMSSHH_Cty & $M_SIZE_MASK ;;AN000;; Was Hour/Min/Sec/Hunds (12 Hour) specified?
  3088                              <2> ;	    $IF     NZ,OR				     ;;AN000;;
  3089                              <2> 	    JNZ $MLL374
  3090                              <2> 	    TEST    byte [$M_SL + $M_S_FLAG],Time_HHMMSS_Cty & $M_SIZE_MASK ;;AN000;; Was Hour/Min/Sec (12 Hour) specified?
  3091                              <2> ;	    $IF     NZ					     ;;AN000;;
  3092                              <2> 	    JZ $MIF374
  3093                              <2> $MLL374:
  3094                              <2> 	      MOV     AL,BYTE PTR [$M_SL + $M_S_VALUE+2]	     ;;AN000;;	Get Seconds
  3095                              <2> 	      CALL    $M_CONVERTTIME			     ;;AN000;;
  3096                              <2> 	      PUSH    WORD [$M_RT + $M_TIME_SEPARA]	     ;;AN000;;
  3097                              <2> 	      INC     CX				     ;;AN000;;
  3098                              <2> ;	    $ENDIF					     ;;AN000;;
  3099                              <2> $MIF374:
  3100                              <2> 							     ;;        Do Hour/Min (12 Hour)
  3101                              <2> 	    MOV     AL,BYTE PTR [$M_SL + $M_S_VALUE+1]	     ;;AN000;;	Get Minutes
  3102                              <2> 	    CALL    $M_CONVERTTIME			     ;;AN000;;
  3103                              <2> 	    PUSH    WORD [$M_RT + $M_TIME_SEPARA]	     ;;AN000;;
  3104                              <2> 	    INC     CX					     ;;AN000;;
  3105                              <2> 							     ;;
  3106                              <2> 	    MOV     AL,BYTE PTR [$M_SL + $M_S_VALUE]	     ;;AN000;;	Get Hours
  3107                              <2> 	    TEST    byte [$M_SL + $M_S_FLAG],Time_Cty_Type & $M_TIME_MASK ;;AN000;; Is this a request for current country info?
  3108                              <2> ;	    $IF     NZ					     ;;AN000;; Yes,
  3109                              <2> 	    JZ $MIF376
  3110                              <2> 	      CMP     BYTE [$M_RT + $M_TIME_FORMAT],0	     ;;AN000;; Is the current country format 12 Hour?
  3111                              <2> ;	      $IF     E 				     ;;AN000;; Yes,
  3112                              <2> 	      JNE $MIF377
  3113                              <2> 		CMP	AL,13				     ;;AN000;;	Is hour less than 12?
  3114                              <2> ;		$IF	GE				     ;;AN000;;	Yes,
  3115                              <2> 		JNGE $MIF378
  3116                              <2> 		  SUB	  AL,12 			     ;;AN000;;	  Set to a 12 hour value
  3117                              <2> ;		$ENDIF					     ;;AN000;;
  3118                              <2> $MIF378:
  3119                              <2> 		CMP	AL,0				     ;;AN000;;	Is hour less than 12?
  3120                              <2> ;		$IF	E				     ;;AN000;;	Yes,
  3121                              <2> 		JNE $MIF380
  3122                              <2> 		  MOV	  AL,12 			     ;;AN000;;	  Set to a 12 hour value
  3123                              <2> ;		$ENDIF					     ;;AN000;;
  3124                              <2> $MIF380:
  3125                              <2> ;	      $ENDIF					     ;;AN000;;
  3126                              <2> $MIF377:
  3127                              <2> ;	    $ENDIF					     ;;AN000;;
  3128                              <2> $MIF376:
  3129                              <2> 	    CALL    $M_CONVERT2ASC			     ;;AN000;; Convert it to ASCII
  3130                              <2> 							     ;;
  3131                              <2> 	    PUSH    BP					     ;;AN000;; Restore return address
  3132                              <2> 	    RET 					     ;;AN000;; Return
  3133                              <2> 							     ;;
  3134                              <2> $M_TIME_REPLACE ENDP					     ;;AN000;;
  3135                              <2> 							     ;;
  3136                              <2> $M_GET_TIME PROC    NEAR				     ;;AN000;;
  3137                              <2> 	    MOV     AH,DOS_GET_COUNTRY			     ;;AN000;; Call DOS for country dependant info
  3138                              <2> 	    MOV     AL,0				     ;;AN000;; Get current country info
  3139                              <2> 	    LEA     DX,[$M_RT + $M_TEMP_BUF]		     ;;AN000;; Set up addressibility to buffer
  3140                              <2> 	    INT     21H 				     ;;AN000;;
  3141                              <2> ;	    $IF     C					     ;;AN000;; No,
  3142                              <2> 	    JNC $MIF384
  3143                              <2> 	      MOV     WORD [$M_RT + $M_TIME_FORMAT],$M_DEF_TIME_FORM ;;AN000;;	 Set default time format    (BH)
  3144                              <2> 	      MOV     BYTE [$M_RT + $M_TIME_SEPARA],$M_DEF_TIME_SEP ;;AN000;;	Set default time separator (BL)
  3145                              <2> 	      MOV     BYTE [$M_RT + $M_DECI_SEPARA],$M_DEF_DECI_SEP ;;AN000;;	Set default time separator (BL)
  3146                              <2> ;	    $ENDIF					     ;;AN000;;
  3147                              <2> $MIF384:
  3148                              <2> 	    RET 					     ;;AN000;;
  3149                              <2> $M_GET_TIME ENDP					     ;;AN000;;
  3150                              <2> 							     ;;
  3151                              <2> $M_CONVERTTIME PROC NEAR				     ;;AN000;;
  3152                              <2> 	    POP     WORD [$M_RT + $M_TEMP_BUF]		     ;;AN000;; Save return address
  3153                              <2> 	    MOV     [$M_RT + $M_SIZE],CL			     ;;AN000;; Save the size before conversion
  3154                              <2> 	    CALL    $M_CONVERT2ASC			     ;;AN000;; Convert it to an ASCII string
  3155                              <2> 	    DEC     CX					     ;;AN000;; Test if size only grew by 1
  3156                              <2> 	    CMP     CL,[$M_RT + $M_SIZE]			     ;;AN000;; Did size only grow by one
  3157                              <2> ;	    $IF     E					     ;;AN000;; Yes,
  3158                              <2> 	    JNE $MIF386
  3159                              <2> 	      MOV     AX,$M_TIMEDATE_PAD		     ;;AN000;;	 Get a pad character (0)
  3160                              <2> 	      PUSH    AX				     ;;AN000;;	 Save it
  3161                              <2> 	      INC     CX				     ;;AN000;;	 Count it
  3162                              <2> ;	    $ENDIF					     ;;AN000;;
  3163                              <2> $MIF386:
  3164                              <2> 	    INC     CX					     ;;AN000;; Restore CX
  3165                              <2> 	    PUSH    WORD [$M_RT + $M_TEMP_BUF]		     ;;AN000;; Save return address
  3166                              <2> 	    RET 					     ;;AN000;;
  3167                              <2> $M_CONVERTTIME ENDP					     ;;AN000;;
  3168                              <2> 							     ;;
  3169                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3170                              <2> 	  %ENDIF 					     ;;AN000;; END of include of TIME replace
  3171                              <2> 	%ENDIF						     ;;AN000;; END of include of Replacement common code
  3172                              <2> ; 
  3173                              <2> 	%IF	INPUTmsg				     ;;AN000;; Is the request to include the code for NUM replace?
  3174                              <2> 	  INPUTmsg equ	FALSE				     ;;AN000;; Yes, THEN include it and reset the flag
  3175                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3176                              <2> ;;
  3177                              <2> ;;	PROC NAME: $M_WAIT_FOR_INPUT
  3178                              <2> ;;
  3179                              <2> ;;	FUNCTION:  To accept keyed input and return extended key value
  3180                              <2> ;;		   in AX register
  3181                              <2> ;;	INPUTS:    DL contains the DOS function requested for input
  3182                              <2> ;;	OUPUTS:    AX contains the extended key value that was read
  3183                              <2> ;;	REGS USED:
  3184                              <2> ;;
  3185                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3186                              <2> 							     ;;
  3187                              <2> $M_WAIT_FOR_INPUT PROC NEAR				     ;;AN000;;
  3188                              <2> 							     ;;
  3189                              <2> 	  PUSH	  CX					     ;;AN000;; Save CX
  3190                              <2> 	  PUSH	  DX					     ;;AN000;; Save DX
  3191                              <2> 	  PUSH	  DS					     ;;AN000;; Save Data segment
  3192                              <2> 							     ;;
  3193                              <2> 	  CMP	  DL,DOS_CLR_KEYB_BUF_MASK		     ;;AN001;; Are we to clear the keyboard buffer?
  3194                              <2> ;	  $IF	  A					     ;;AN001;; Yes,
  3195                              <2> 	  JNA $MIF388
  3196                              <2> 	    MOV     AL,DL				     ;;AN001;;	 Mov function into AL
  3197                              <2> 	    AND     AL,LOW_NIB_MASK			     ;;AN001;;	 Mask out the C in high nibble
  3198                              <2> 	    MOV     AH,DOS_CLR_KEYB_BUF 		     ;;AN001;;	 Set input function
  3199                              <2> ;	  $ELSE 					     ;;AN001;; No,
  3200                              <2> 	  JMP SHORT $MEN388
  3201                              <2> $MIF388:
  3202                              <2> 	    MOV     AH,DL				     ;;AN000;;	 Put DOS function in AH
  3203                              <2> ;	  $ENDIF					     ;;AN001;;
  3204                              <2> $MEN388:
  3205                              <2> 	  PUSH	  ES					     ;;AN000;; Get output buffer segment
  3206                              <2> 	  POP	  DS					     ;;AN000;;
  3207                              <2> 	  MOV	  DX,DI 				     ;;AN000;;	 Get output buffer offset in case needed
  3208                              <2> 	  INT	  21H					     ;;AN000;; Get keyboard input
  3209                              <2> 	  POP	  DS					     ;;AN000;;
  3210                              <2> 
  3211                              <2> 	  CMP	  DL,DOS_BUF_KEYB_INP			     ;;AN000;;
  3212                              <2> 	  CLC						     ;;AN000;;
  3213                              <2> ;	  $IF	  NE					     ;;AN000;; If character input
  3214                              <2> 	  JE $MIF391
  3215                              <2> 	    CALL    $M_IS_IT_DBCS			     ;;AN000;;	Is this character DBCS?
  3216                              <2> ;	    $IF     C					     ;;AN000;;
  3217                              <2> 	    JNC $MIF392
  3218                              <2> 	      MOV     CL,AL				     ;;AN000;; Save first character
  3219                              <2> 	      MOV     AH,DL				     ;;AN001;; Get back function
  3220                              <2> 	      INT     21H				     ;;AN000;; Get keyboard input
  3221                              <2> 	      MOV     AH,CL				     ;;AN000;; Retreive first character  AX = xxxx
  3222                              <2> 	      CLC					     ;;AN000;; Clear carry condition
  3223                              <2> ;	    $ELSE					     ;;AN000;;
  3224                              <2> 	    JMP SHORT $MEN392
  3225                              <2> $MIF392:
  3226                              <2> 	      MOV     AH,0				     ;;AN000;; AX = 00xx where xx is SBCS
  3227                              <2> ;	    $ENDIF					     ;;AN000;;
  3228                              <2> $MEN392:
  3229                              <2> ;	  $ENDIF					     ;;AN000;;
  3230                              <2> $MIF391:
  3231                              <2> 							     ;;
  3232                              <2> ;	  $IF	  NC					     ;;AN000;;
  3233                              <2> 	  JC $MIF396
  3234                              <2> 	    POP     DX					     ;;AN000;;
  3235                              <2> 	    POP     CX					     ;;AN000;;
  3236                              <2> ;	  $ELSE 					     ;;AN000;;
  3237                              <2> 	  JMP SHORT $MEN396
  3238                              <2> $MIF396:
  3239                              <2> 	    ADD     SP,4				     ;;AN000;;
  3240                              <2> 	    STC 					     ;;AN000;; Reset carry flag
  3241                              <2> ;	  $ENDIF					     ;;AN000;;
  3242                              <2> $MEN396:
  3243                              <2> 	  RET						     ;;AN000;; Return
  3244                              <2> 							     ;;
  3245                              <2> $M_WAIT_FOR_INPUT ENDP					     ;;AN000;;
  3246                              <2> 							     ;;
  3247                              <2> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3248                              <2> 	%ENDIF						     ;;AN000;; END of include of Wait for Input
  3249                              <2>       %ENDIF						     ;;AN000;; END of include of SYSDISPMSG
  3250                              <2>     %ENDIF						     ;;AN000;; END of include of MSG_DATA_ONLY
  3251                              <2> %ENDIF							     ;;AN000;; END of include of Structure only
  3252                              <2> 
  3253                              <2> ;=== Pop trace listing source
  3254                              <2> 
   331                              <1> 
    27                                  
    28                                  ShareDataVersion		   equ	1
    29                                  
    30                                  %ifndef IBM
    31                                   %iassign IBM 0
    32                                  %endif
    33                                  %ifndef Installed
    34                                   %iassign Installed 0
    35                                  %endif
    36                                  
    37                                  %iassign Installed	TRUE ; for installed version
    38                                  
    39                                  ; NASM original macros
    40                                  
    41                                  %imacro OFF 2.nolist
    42                                   %if Installed
    43                                  	mov %1, offset %2
    44                                   %else
    45                                  	mov %1, offset %2 wrt DOSGROUP
    46                                   %endif
    47                                  %endmacro
    48                                  
    49                                  %unimacro detectstripangles 4.nolist
    50                                  
    51                                  %imacro detectstripangles 4.nolist
    52                                  %defstr %%param %4
    53                                  %assign ?%2 0
    54                                  %assign ?%3 0
    55                                  %rep 16
    56                                   %substr %%opening %%param 1
    57                                   %ifidn %%opening, '<'
    58                                    %substr %%param %%param 2,-1
    59                                    %assign ?%2 ?%2 + 1
    60                                   %endif
    61                                  %endrep
    62                                  %rep 16
    63                                   %strlen %%length %%param
    64                                   %substr %%closing %%param %%length
    65                                   %ifidn %%closing, '>'
    66                                    %substr %%param %%param 1,-2
    67                                    %assign ?%3 ?%3 + 1
    68                                   %endif
    69                                  %endrep
    70                                  %deftok %%token %%param
    71                                  %define ?%1 %%token
    72                                  %endmacro
    73                                  
    74                                  %unimacro errnz 1.nolist
    75                                  
    76                                  %imacro errnz 1.nolist
    77                                  detectstripangles %%token, %%opening, %%closing, %1
    78                                  %if ? %+ %%token
    79                                      %error %1 <> 0, ERRNZ failed
    80                                  %endif
    81                                  %endmacro
    82                                  
    83                                  ; end of NASM original macros
    84                                  
    85                                  mft equ MFT	; NASM port label
    86                                  quux equ mft
    87                                  
    88                                  					   ;---------------------------------------
    89                                  					   ; if we are installed, then define the
    90                                  					   ; base code segment of the sharer first
    91                                  					   ;---------------------------------------
    92                                  ;	$SALUT	(4,9,17,36)
    93                                  
    94                                  	%IF	Installed
    95                                  
    96                                  section SHARE
    97                                  ; (no prior section) ; Share   ENDS
    98                                  
    99                                  	%ENDIF
   100                                  
   101                                  				   ;---------------------------------------
   102                                  				   ; include the rest of the segment
   103                                  				   ;  definitions for normal msdos
   104                                  
   105                                  				   ; segment ordering for MSDOS
   106                                  
   107                                  				   ;---------------------------------------
   108                                  	%include "dosseg.nas"
     1                              <1> ;	SCCSID = @(#)dosseg.asm	1.1 85/04/10
     2                              <1> ;	SCCSID = @(#)dosseg.asm	1.1 85/04/10
     3                              <1> ;
     4                              <1> ; segment ordering for MSDOS
     5                              <1> ;
     6                              <1> 
     7                              <1> %include "ddataseg.nas"
     1                              <2> 
     2                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
     1          ******************  <3>  warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi]
    14                              <4> [list -]
    14                              <3> [list -]
     3                              <2> 
     4                              <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART
     5                              <2> ; (no prior section) ; DOSSTART		ENDS
     6                              <2> 
     7                              <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START
     8                              <2> ; (no prior section) ; DOSSTARTJUMP		ENDS
     9                              <2> 
    10                              <2> addsection CONSTANTS, align=2 PUBLIC class=CONST
    11                              <2> ; (no prior section) ; CONSTANTS	ENDS
    12                              <2> 
    13                              <2> addsection DATA, align=2 PUBLIC class=DATA
    14                              <2> ; (no prior section) ; DATA		ENDS
    15                              <2> 
    16                              <2> addsection TABLE, align=2 PUBLIC class=TABLE
    17                              <2> ; (no prior section) ; TABLE		ENDS
    18                              <2> 
    19                              <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE
    20                              <2> ; (no prior section) ; DOSDATATABLE		ENDS
    21                              <2> 
    22                              <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE
    23                              <2> ; (no prior section) ; DOSDATACODE		ENDS
    24                              <2> 
    25                              <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA
    26                              <2> 
    27                              <2> addsection LAST, align=16 PUBLIC class=LAST
    28                              <2> ; (no prior section) ; LAST		ENDS
    29                              <2> 
    30                              <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST
     8                              <1> 
     9                              <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
    10                              <1> 
    11                              <1> section LAST
    12                              <1> ; (no prior section) ; LAST		ENDS
   109                                  
   110                                  section CONSTANTS
   111                                  
   112                                  	extrn	DataVersion:BYTE   ; version number of DOS data.
   113                                  	extrn	JShare:BYTE	   ; location of DOS jump table.
   114                                  	extrn	sftFCB:DWORD	   ; [SYSTEM] pointer to FCB cache table
   115                                  	extrn	KeepCount:WORD	   ; [SYSTEM] LRU count for FCB cache
   116                                  	extrn	CurrentPDB:WORD
   117                                  
   118                                  ; (no prior section) ; CONSTANTS ENDS
   119                                  
   120                                  section DATA
   121                                  
   122                                  	extrn	ThisSFT:DWORD	   ; pointer to SFT entry
   123                                  	extrn	WFP_start:WORD	   ; pointer to name string
   124                                  	extrn	User_ID:WORD
   125                                  	extrn	Proc_ID:WORD
   126                                  	extrn	SFT_addr:DWORD
   127                                  	extrn	Arena_Head:WORD
   128                                  	extrn	fshare:BYTE
   129                                  	extrn	pJFN:DWORD
   130                                  	extrn	JFN:WORD
   131                                  
   132                                  	%IF	DEBUG
   133                                  
   134                                  	    extrn   BugLev:WORD
   135                                  	    extrn   BugTyp:WORD
   136                                  	    %include "bugtyp.nas"
   137                                  
   138                                  	%ENDIF
   139                                  
   140                                  
   141                                  ; (no prior section) ; DATA	ENDS
   142                                  
   143                                  				   ;---------------------------------------
   144                                  				   ; if we are not installed, then the
   145                                  				   ; code here is just part of the normal
   146                                  				   ; MSDOS code segment otherwise,
   147                                  				   ; define our own code segment
   148                                  				   ;---------------------------------------
   149                                  
   150                                  ;	.sall
   151                                  ;	%IF	INSTALLED
   152                                  
   153                                  section SHARE
   154                                  
   155                                  	    ASSUME  SS:DOSGROUP,CS:SHARE
   156                                  
   157                                  ;	%ELSE
   158                                  ;
   159                                  ;section CODE align=1 PUBLIC class=CODE
   160                                  ;
   161                                  ;	    ASSUME  SS:DOSGROUP,CS:DOSGROUP
   162                                  ;
   163                                  ;	%ENDIF
   164                                  
   165                                  	Extrn	FreLock:WORD,Serial:WORD
   166                                  	Extrn	MFT_Enter:NEAR,MFTClose:NEAR,MFTClu:NEAR,MFTCloseP:NEAR
   167                                  	Extrn	MFTCloN:NEAR
   168                                  	Extrn	Set_Mult_Block:NEAR,Clr_Mult_Block:NEAR,Chk_Block:NEAR
   169                                  	Extrn	MFT_Get:NEAR
   170                                  
   171                                  [list -]
   174                                  
   175                                  ;  $SALUT (4,4,9,41)
   176                                  
   177                                     BREAK <FNM - Find name in MFT>
   178                                  
   179                                  ;******************* START OF SPECIFICATIONS ***********************************
   180                                  ;
   181                                  ;	FNM - Find name in MFT
   182                                  ;
   183                                  ;	FNM searches the MFT for a name record.
   184                                  ;
   185                                  ;	ENTRY	(DS:SI) = pointer to name string (.asciz)
   186                                  ;		(al) = 1 to create record if non exists
   187                                  ;		     = 0 otherwise
   188                                  ;	EXIT	'C' clear if found or created
   189                                  ;		  (DS:BX) = address of MFT name record
   190                                  ;		'C' set if error
   191                                  ;		  If not to create, item not found
   192                                  ;		    (DS:SI) unchanged
   193                                  ;		  If to create, am out of space
   194                                  ;		    (ax) = error code
   195                                  ;	USES	ALL
   196                                  ;
   197                                  ;******************* END OF SPECIFICATIONS *************************************
   198                                  
   199                                     Procedure FNM,NEAR
   199          ******************       warning: proc FNM... [-w+user]
   200                                  
   201 00000000 1E                         push ds				; save string address
   202 00000001 56                         push si
   203 00000002 86F8                       xchg bh,al				; (bh) = create flag
   204 00000004 08FF                       or	bh,bh				; if not creating
   205 00000006 7400                       jz	fnm01				; skip sft test
   206                                  
   207                                  					;---------------------------------------
   208                                  					; run down through string counting
   209                                  					;  and summing
   210                                  					;---------------------------------------
   211                                  
   212 00000008 29D2                    fnm01: sub dx,dx			; (dx) = byte count
   213 0000000A 28DB                       sub	bl,bl				; (bl) = sum
   214                                  
   215 0000000C AC                      fnm1: lodsb				; (al) = next char
   216 0000000D 00C3                       add	bl,al
   217 0000000F 80D300                     adc	bl,0
   218 00000012 42                         inc	dx
   219 00000013 20C0                       and	al,al
   220 00000015 75F5                       jnz	fnm1				; terminate after null char
   221                                  
   222                                  					;---------------------------------------
   223                                  					; Info computed.
   224                                  					;  Start searching name list
   225                                  
   226                                  					;  (bh) = create flag
   227                                  					;  (bl) = sum byte
   228                                  					;  (dx) = byte count
   229                                  					;  (TOS+2:TOS) = name string address
   230                                  					;---------------------------------------
   231                                  	; Magic code for DOSREINIT start !
   232 00000017 0E                         push cs
   233 00000018 1F                         pop	ds
   234                                  
   235 00000019 BE[2F06]                   Off	SI,mft
   236                                  
   237 0000001C 803C00                  fnm2: cmp byte [si + mft_flag],MFLG_FRE
   238                                  	; Magic code for DOSREINIT end !
   239 0000001F 7C21                       jl	fnm10				; at end - name not found
   240 00000021 7405                       jz	fnm4				; is free, just skip it
   241 00000023 3A5C03                     cmp	bl,[si + mft_sum] 		; do sums compare?
   242 00000026 7405                       jz	fnm5				; its a match - look further
   243 00000028 037401                  fnm4: add si,[si + mft_len]		; not a match... skip it
   244 0000002B EBEF                       JMP	SHORT fnm2
   245                                  					;---------------------------------------
   246                                  					; name checksums match
   247                                  					;   - compare the actual strings
   248                                  					;
   249                                  					;   (dx)	= length
   250                                  					;   (ds:si	= MFT address
   251                                  					;   (bh)	= create flag
   252                                  					;   (bl)	= sum byte
   253                                  					;   (dx)	= byte count
   254                                  					;   (TOS+2:TOS) = name string address
   255                                  					;---------------------------------------
   256                                  
   257 0000002D 89D1                    fnm5: mov cx,dx 			; (cx) = length to match
   258 0000002F 5F                         pop	di
   259 00000030 07                         pop	es				; (ES:DI) = fba given name
   260 00000031 06                         push es
   261 00000032 57                         push di
   262 00000033 56                         push si				; save MFT offset
   263 00000034 83C60C                     add	si,mft_name			; (ds:si) = fwa string in record
   264 00000037 F3A6                       repz cmpsb
   265 00000039 5E                         pop	si				; (ds:si) = fwa name record
   266 0000003A 75EC                       jnz	fnm4				; not a match
   267                                  
   268                                  					;---------------------------------------
   269                                  					; Yes, we've found it.  Return the info
   270                                  					;
   271                                  					;  (TOS+2:TOS) = name string address
   272                                  					;---------------------------------------
   273                                  
   274                                     fmt	TypShare,LevMFTSrch,<"FNM found name record at $x\n">,<si>
   275 0000003C 58                         pop	ax				; discard unneeded stack stuff
   276 0000003D 58                         pop	ax
   277 0000003E 89F3                       mov	bx,si				; (ds:bx) = fwa name record
   278 00000040 F8                         clc
   279                                  
   280 00000041 C3                         ret
   281                                  					;---------------------------------------
   282                                  					;**
   283                                  					;**  Its not in the list
   284                                  					;**  - lets find a free spot and put
   285                                  					;**    it there
   286                                  					;
   287                                  					;  (bh)        = create flag
   288                                  					;  (bl)        = sum byte
   289                                  					;  (dx)        = string length
   290                                  					;  (TOS+2:TOS) = ASCIZ string address
   291                                  					;  (ds)        = SEG CODE
   292                                  					;---------------------------------------
   293                                  fnm10:
   294 00000042 20FF                       and	bh,bh
   295 00000044 7507                       jnz	fnm10$5 			; yes, insert it
   296 00000046 5E                         pop	si
   297 00000047 1F                         pop	ds				; no insert, its a "not found"
   298 00000048 F9                         stc
   299                                  
   300                                     fmt	TypShare,LevMFTSrch,<"FNM failing\n">
   301                                  
   302 00000049 B80300                     mov	ax,error_path_not_found
   303                                  
   304 0000004C C3                         ret
   305                                  
   306                                  fnm10$5:
   307 0000004D 83C20C                     add	dx,mft_name			; (dx) = minimum space needed
   308                                  
   309 00000050 BE[2F06]                   off	SI,mft
   310                                  
   311 00000053 803C00                  fnm11: cmp byte [si + mft_flag],MFLG_FRE
   312                                  
   313                                     %IFN  DEBUG
   314 00000056 7C57                           jl   fnm20			; at END, am out of space
   315                                     %ELSE
   316                                         jl   fnm20j
   317                                     %ENDIF
   318                                  
   319 00000058 7405                       jz	fnm12				; is a free record
   320 0000005A 037401                     add	si,[si + mft_len] 		; skip name record
   321 0000005D EBF4                       JMP	SHORT fnm11
   322                                  
   323                                     %IF	DEBUG
   324                                  fnm20j: jmp fnm20
   325                                     %ENDIF
   326                                  
   327 0000005F 8B4401                  fnm12: mov ax,[si + mft_len]		; Have free record, (ax) = total length
   328 00000062 39D0                       cmp	ax,dx
   329 00000064 7304                       jnc	fnm13				; big enough
   330 00000066 01C6                       add	si,ax
   331 00000068 EBE9                       JMP	SHORT fnm11			; not large enough - move on
   332                                  
   333                                  					;---------------------------------------
   334                                  					; OK, we have a record which is big
   335                                  					;  enough.  If its large enough to hold
   336                                  					;  another name record of 6 characters
   337                                  					;  than we'll split the block, else
   338                                  					;  we'll just use the whole thing
   339                                  					;
   340                                  					; (ax)	      = size of free record
   341                                  					; (dx)	      = size needed
   342                                  					; (ds:si)     = address of free record
   343                                  					; (bl)	      = sum byte
   344                                  					; (TOS+2:TOS) = name string address
   345                                  					;---------------------------------------
   346                                  
   347 0000006A 29D0                    fnm13: sub ax,dx			; (ax) = total size of proposed fragment
   348 0000006C 83F812                     cmp	ax,mft_name+6
   349 0000006F 720C                       jc	fnm14				; not big enough to split
   350 00000071 53                         push bx				; save sum byte
   351 00000072 89D3                       mov	bx,dx				; (bx) = offset to start of new name record
   352 00000074 C60000                     mov	byte [bx + si + mft_flag],MFLG_FRE
   353 00000077 894001                     mov	[bx + si + mft_len],ax		; setup tail as free record
   354 0000007A 29C0                       sub	ax,ax				; don't extend this record
   355 0000007C 5B                         pop	bx				; restore sum byte
   356 0000007D 01C2                    fnm14: add dx,ax			; (dx) = total length of this record
   357 0000007F 895401                     mov	[si + mft_len],dx
   358 00000082 885C03                     mov	[si + mft_sum],bl
   359 00000085 C60401                     mov	byte [si + mft_flag],MFLG_NAM
   360                                  
   361                                     fmt	TypShare,LevMFTSrch,<"FNM creating record at $x\n">,<si>
   362                                  
   363 00000088 1E                         push ds
   364 00000089 07                         pop	es				; (es) = MFT segment for "stow"
   365 0000008A 29C0                       sub	ax,ax
   366 0000008C 89F7                       mov	di,si
   367 0000008E 83C704                     add	di,mft_lptr
   368 00000091 AB                         stosw				; zero LCK pointer
   369                                     ERRNZ mft_sptr-mft_lptr-2
   370                                  ;	add	di,mft_sptr-mft_lptr-2
   371 00000092 AB                         stosw				; zero SFT pointer
   372 00000093 AB                         stosw				; zero SFT pointer
   373                                  serial equ Serial	; NASM port label
   374 00000094 2EFF06[0000]               inc	word [cs:serial]				; bump serial number
   375 00000099 2EA1[0000]                 mov	ax,[cs:serial]
   376                                     ERRNZ mft_serl-mft_sptr-4
   377                                  ;	ADD	di,mft_serl-mft_sptr-4
   378 0000009D AB                         stosw
   379                                  					;---------------------------------------
   380                                  					; We're all setup except for the name.
   381                                  					;  Note that we'll block copy the whole
   382                                  					;  name field, even though the name may
   383                                  					;  be shorter than that (we may have
   384                                  					;  declined to fragment this memory block)
   385                                  					;
   386                                  					;	(dx) = total length of this record
   387                                  					;	(ds:si) = address of working record
   388                                  					;	(es) = (ds)
   389                                  					;	(TOS+2:TOS) = name string address
   390                                  					;---------------------------------------
   391 0000009E 89D1                       mov	cx,dx
   392 000000A0 83E90C                     sub	cx,mft_name			; compute total size of name area
   393                                     ERRNZ mft_name-mft_serl-2
   394                                  ;	add	di,mft_name-mft_serl-2	; (ES:DI) = target address
   395 000000A3 89F0                       mov	ax,si				; save name record offset
   396 000000A5 5E                         pop	si
   397 000000A6 1F                         pop	ds
   398 000000A7 F3A4                       rep	movsb
   399 000000A9 89C3                       mov	bx,ax				; (bx) = name record offset
   400 000000AB 06                         push es
   401 000000AC 1F                         pop	ds				; (DS:BX) = name record offset
   402 000000AD F8                         clc
   403                                  
   404 000000AE C3                         ret
   405                                  
   406                                  ;**
   407                                  ;**	OUT OF FREE SPACE
   408                                  ;**
   409                                  ;**	This is tough, folks.  Lets trigger a garbage collection and see if
   410                                  ;**	there is enough room.  If there is, we'll hop back and relook for a
   411                                  ;**	free hunk; if there isnt enough space, its error-city!
   412                                  ;
   413                                  ;	WARNING: it is important that the garbage collector be told how big a
   414                                  ;		name record hole we're looking for...  if the size given GCM
   415                                  ;		is too small we'll loop doing "no space; collect; no space;
   416                                  ;		...)
   417                                  ;
   418                                  ;	(dx) = total length of desired name record
   419                                  ;	(ds) = SEG CODE
   420                                  ;	(bl) = sum byte
   421                                  ;	(TOS+2:TOS) = name string address
   422                                  
   423                                  fnm20:
   424 000000AF 89D0                       mov	ax,dx				; (ax) = size wanted
   425 000000B1 83EA0C                     sub	dx,mft_name			; (dx) = string length for reentry at fnm10
   426 000000B4 52                         push dx
   427 000000B5 53                         push bx
   428 000000B6 E80B00                     call GCM				; garbage collect MFT
   429 000000B9 5B                         pop	bx
   430 000000BA 5A                         pop	dx
   431                                  
   432                                     %IF	DEBUG
   433                                         jnc  fnm10j
   434                                     %ELSE
   435 000000BB 7385                           jnc  fnm10			; go back and find that space
   436                                     %ENDIF
   437                                  
   438                                  					;---------------------------------------
   439                                  					; no space, return w/error
   440                                  					;---------------------------------------
   441                                  
   442 000000BD 58                      fnm50: pop ax
   443 000000BE 58                         pop	ax				; clean stack
   444 000000BF B82400                     mov	ax,error_sharing_buffer_exceeded
   445 000000C2 F9                         stc
   446                                  
   447 000000C3 C3                         ret
   448                                  
   449                                     %IF	DEBUG
   450                                  fnm10j: jmp fnm10
   451                                     %ENDIF
   452                                  
   453                                     EndProc FNM
   454                                  
   455                                     BREAK <GCM - Garbage Collect MFT>
   456                                  
   457                                  ;******************* START OF SPECIFICATIONS ***********************************
   458                                  ;
   459                                  ;	GCM - Garbage Collect MFT
   460                                  ;
   461                                  ;	GCM runs down the MFT structure squeezing out the free space and
   462                                  ;	putting it into one free block at the end.  This is a traditional heap
   463                                  ;	collection process.  We must be sure to update the pointer in the
   464                                  ;	SFTs.  This presumes no adjacent free blocks.
   465                                  ;
   466                                  ;	ENTRY	(ax) = space desired in last free block
   467                                  ;		(DS) + SEG CODE
   468                                  ;	EXIT	'C' clear if enough space in block
   469                                  ;		'C' set if not enough space
   470                                  ;
   471                                  ;******************* END OF SPECIFICATIONS *************************************
   472                                  
   473                                     Procedure GCM,NEAR
   473          ******************       warning: proc GCM... [-w+user]
   474                                  
   475 000000C4 50                         push ax				; save target
   476 000000C5 BE[2F06]                   off	si,mft				; (si) = from pointer
   477 000000C8 89F7                       mov	di,si				; (di) = to pointer
   478                                  
   479                                  					;---------------------------------------
   480                                  					; (DI) points to the beginning of
   481                                  					;	a free space block
   482                                  					; (SI) points to the next block.
   483                                  					;---------------------------------------
   484                                  
   485 000000CA 8B4C01                  gcm1: mov cx,[si + mft_len]		; (cx) = size of whatever it is
   486 000000CD 803C00                     cmp	byte [si + mft_flag],MFLG_FRE
   487 000000D0 7C3D                       jl	gcm10				; END marker
   488 000000D2 750B                       jnz	gcm2				; have a name record
   489                                  
   490                                  					;---------------------------------------
   491                                  					; (SI) points to a free block.
   492                                  					;    We coalesce it by changing the size.
   493                                  					;---------------------------------------
   494 000000D4 39FE                       cmp	si,di
   495 000000D6 7403                       jz	gcm15				; do NOT coalesce a block with itself
   496 000000D8 014D01                     add	[di + mft_len],cx 		; coalesce
   497                                  gcm15:
   498 000000DB 01CE                       add	si,cx				; skip the empty one
   499 000000DD EBEB                       JMP	SHORT gcm1
   500                                  					;---------------------------------------
   501                                  					; (SI) points to a non-free,
   502                                  					;	non-last block.
   503                                  					; (DI) points to the beginning of a
   504                                  					;	 free block.
   505                                  					;
   506                                  					; We move the non-free block down over
   507                                  					;   the free block
   508                                  					;---------------------------------------
   509 000000DF 39FE                    gcm2: cmp si,di
   510 000000E1 7506                       jnz	gcm3				; have to copy
   511                                  
   512                                  					;---------------------------------------
   513                                  					; SI = DI => we are at a boundary
   514                                  					;	     between allocated blocks.
   515                                  					;	     We do no copying.
   516                                  					;---------------------------------------
   517 000000E3 01CE                       add	si,cx
   518 000000E5 89F7                       mov	di,si				; no emptys yet... no need to copy
   519 000000E7 EBE1                       JMP	SHORT gcm1
   520                                  					;---------------------------------------
   521                                  					; CX is length of allocated block.
   522                                  					;      - Move it
   523                                  					;---------------------------------------
   524                                  
   525 000000E9 89FB                    gcm3: mov bx,di 			; (DS:BX) = new home for this record
   526 000000EB 8CD8                       mov	ax,ds
   527 000000ED 8EC0                       mov	es,ax
   528 000000EF F3A4                       rep	movsb
   529                                  					;---------------------------------------
   530                                  					; We've moved the record, now fix up
   531                                  					;  the pointers in the SFT chain
   532                                  					;
   533                                  					;  (si) = address of next record
   534                                  					;  (di) = address of next free byte
   535                                  					;  (bx) = address of record in its new home
   536                                  					;  (TOS) = needed space
   537                                  					;---------------------------------------
   538 000000F1 57                         push di
   539 000000F2 1E                         push ds
   540 000000F3 C57F06                     lds	di,[bx + mft_sptr]		; (ds:di) = chain of SFT
   541 000000F6 09FF                    gcm4: or di,di
   542 000000F8 7408                       jz	gcm5				; no more SFT
   543                                  sf_mft equ sf_MFT	; NASM port equate
   544 000000FA 895D33                     mov	[di + sf_mft],bx			; install new MFT position
   545 000000FD C57D2B                     lds	di,[di + sf_chain]		; link to next
   546 00000100 EBF4                       JMP	gcm4				; fix next SFT
   547                                  
   548 00000102 1F                      gcm5: pop ds
   549 00000103 5F                         pop	di
   550                                  					;---------------------------------------
   551                                  					; (DI) points to beginning of
   552                                  					;	new free record (moved)
   553                                  					; (SI) points to next record
   554                                  					;
   555                                  					; Make sure that the (DI) record
   556                                  					;  has correct format
   557                                  					;---------------------------------------
   558                                  
   559 00000104 C60500                     mov	byte [di + mft_flag],MFLG_FRE		; indicate free record
   560 00000107 897501                     mov	[di + mft_len],si 		; calculate correct length
   561 0000010A 297D01                     sub	[di + mft_len],di
   562                                  					;---------------------------------------
   563                                  					; MFT now has correct record structure.
   564                                  					;  Go find more free blocks
   565                                  					;---------------------------------------
   566 0000010D EBBB                       JMP	SHORT gcm1
   567                                  					;---------------------------------------
   568                                  					; We have scanned the entire table,
   569                                  					;  compacting all empty records together.
   570                                  					;
   571                                  					;   (di) = first free byte in table
   572                                  					;   (si) = address of END record
   573                                  					;   (TOS) = size needed
   574                                  					;
   575                                  					; Be extra careful!!!
   576                                  					;---------------------------------------
   577 0000010F 89F0                    gcm10: mov ax,si
   578 00000111 29F8                       sub	ax,di				; (ax) = free space
   579 00000113 5B                         pop	bx				; (bx) = space wanted
   580 00000114 29D8                       sub	ax,bx
   581                                  
   582 00000116 C3                         ret
   583                                  
   584                                     EndProc GCM
   585                                  
   586                                     BREAK <RMN - Remove MFT Name record>
   587                                  
   588                                  ;******************* START OF SPECIFICATIONS ***********************************
   589                                  ;
   590                                  ;	RMN - Remove MFT Name record
   591                                  ;
   592                                  ;	RMN removes a name record from the MFT list.  The record is marked
   593                                  ;	free and all free space is coalesced.
   594                                  ;
   595                                  ;	ENTRY	(DS:BX) = FBA MFT name record
   596                                  ;	EXIT	to INTERR if lock and SFT chains are not empty
   597                                  ;	USES	ALL
   598                                  ;
   599                                  ;******************* END OF SPECIFICATIONS *************************************
   600                                  
   601                                     Procedure RMN,NEAR
   601          ******************       warning: proc RMN... [-w+user]
   602                                  
   603 00000117 89DE                       mov	si,bx
   604 00000119 8B4406                     mov	ax,word ptr [si + mft_sptr]
   605 0000011C 0B4404                     or	ax,word ptr [si + mft_lptr]
   606 0000011F 7509                       jnz	RMNIER1 			; not clean - internal error
   607 00000121 89DE                       mov	si,bx				; (ds:si) = fwa name record
   608                                  
   609 00000123 C60400                     mov	byte [si + mft_flag],MFLG_FRE		; mark free
   610                                  
   611                                  mrg equ MRG	; NASM port label
   612 00000126 E82400                     call mrg				; coalesce all free space
   613                                  
   614 00000129 C3                         ret
   615                                  
   616 0000012A 50                      RMNIER1:push ax
   617 0000012B B8[3101]                   off	ax,rmnerr1
   618                                  
   619 0000012E E8E103                  RMNIER: call INTERR			; internal error
   620                                  
   621 00000131 524D4E3A2053465420-     rmnerr1 db "RMN: SFT LCK fields not 0", 13, 10, 0
   621 0000013A 4C434B206669656C64-
   621 00000143 73206E6F7420300D0A-
   621 0000014C 00                 
   622                                  
   623                                     EndProc RMN
   624                                  
   625                                     Break <MRG - merge all free space>
   626                                  
   627                                  ;******************* START OF SPECIFICATIONS ***********************************
   628                                  ;
   629                                  ;   MRG - merge all free space
   630                                  ;
   631                                  ;   MRG - walk through mft merging adjacent free space.
   632                                  ;
   633                                  ;   Inputs:	ds = CS
   634                                  ;   Outputs:	none (all free space coalesced)
   635                                  ;   Registers Revised: none
   636                                  ;
   637                                  ;******************* END OF SPECIFICATIONS *************************************
   638                                  
   639                                     Procedure MRG,near
   639          ******************       warning: proc MRG... [-w+user]
   640                                  
   641                                     assume ds:nothing,es:nothing
   642                                  
   643 0000014D 56                         push si
   644 0000014E 53                         push bx
   645                                  
   646 0000014F BE[2F06]                   off	si,mft				; start at beginning
   647 00000152 8B5C01                  mrg1: mov bx,[si + mft_len]		; get length
   648 00000155 803C00                     cmp	byte [si + mft_flag],MFLG_FRE		; is record free?
   649 00000158 7C13                       jl	mrg9				; done.
   650 0000015A 7404                       jz	mrg2				; yes, try to merge with next
   651 0000015C 01DE                    mrg15: add si,bx			; advance to next
   652 0000015E EBF2                       jmp	mrg1
   653                                  					;---------------------------------------
   654                                  					; (si) points to free record.
   655                                  					;  - See if next is free
   656                                  					;---------------------------------------
   657 00000160 803800                  mrg2: cmp byte [bx + si + mft_flag],MFLG_FRE
   658 00000163 75F7                       jnz	mrg15				; not free, go scan again
   659 00000165 8B5801                     mov	bx,[bx + si + mft_len]		; get length of next guy
   660 00000168 015C01                     add	[si + mft_len],bx 		; increase our length
   661 0000016B EBE5                       jmp	mrg1				; and check again
   662 0000016D 5B                      mrg9: pop bx
   663 0000016E 5E                         pop	si
   664                                  
   665 0000016F C3                         ret
   666                                  
   667                                     EndProc MRG
   668                                  
   669                                     BREAK <RSC - Remove SFT from SFT chain>
   670                                  
   671                                  ;******************* START OF SPECIFICATIONS ***********************************
   672                                  ;
   673                                  ;	RSC - Remove SFT from SFT chain
   674                                  ;
   675                                  ;	RSC removes a given SFT from its chain.  The caller must insure that
   676                                  ;	any locks have been cleared and that the SFT is indeed free.  The
   677                                  ;	sf_mft field is zeroed to indicate that this SFT is no longer chained.
   678                                  ;
   679                                  ;	NOTE - RSC does NOT remove the name record if this was the last SFT on
   680                                  ;		it.  The caller must check for this and remove it, if
   681                                  ;		necessary.
   682                                  ;
   683                                  ;	ENTRY	(ES:DI) = SFT address
   684                                  ;	EXIT	(DS:BX) = FBA name record for this SFT
   685                                  ;		'Z' set if this is the last SFT
   686                                  ;	USES	ALL
   687                                  ;
   688                                  ;******************* END OF SPECIFICATIONS *************************************
   689                                  
   690                                     Procedure RSC,NEAR
   690          ******************       warning: proc RSC... [-w+user]
   691                                  
   692 00000170 0E                         push cs
   693 00000171 1F                         pop	ds
   694                                  
   695 00000172 8CC0                       mov	ax,es				; easy spot for compare
   696 00000174 268B5D33                   mov	bx,[es:di + sf_mft]
   697 00000178 8D77DB                     lea	si,[bx + mft_sptr - sf_chain]	; [ds:si].sf_chain point to prev link
   698 0000017B 09F6                    rsc1: or si,si
   699 0000017D 742A                       jz	rscier
   700 0000017F 397C2B                     cmp	word ptr [si + sf_chain],di
   701 00000182 7505                       jnz	rsc15
   702 00000184 39442D                     cmp	word ptr [si + sf_chain + 2],ax
   703 00000187 7405                       jz	rsc2
   704 00000189 C5742B                  rsc15: lds si,[si + sf_chain]
   705 0000018C EBED                       jmp	rsc1
   706                                  					;---------------------------------------
   707                                  					; (es:di) is sft
   708                                  					; (ds:si) is prev sft link
   709                                  					;---------------------------------------
   710 0000018E 268B452B                rsc2: mov ax,word ptr [es:di + sf_chain]
   711 00000192 89442B                     mov	word ptr [si + sf_chain],ax
   712 00000195 268B452D                   mov	ax,word ptr [es:di + sf_chain + 2]
   713 00000199 89442D                     mov	word ptr [si + sf_chain + 2],ax
   714                                  
   715 0000019C 0E                         push cs
   716 0000019D 1F                         pop	ds
   717 0000019E 31DB                       xor	bx,bx
   718 000001A0 26875D33                   xchg bx,[es:di + sf_MFT]		; (DS:bx) = MFT address
   719                                  					;    and 0 MFT pointer (show free)
   720 000001A4 837F0600                   cmp	word ptr [bx + mft_sptr],0	; set z flag if no more sft
   721                                  
   722 000001A8 C3                         ret
   723                                  
   724 000001A9 50                      rscier: push ax
   725 000001AA B8[B001]                   off	ax,rscerr
   726                                  
   727                                  interr equ INTERR	; NASM port label
   728 000001AD E86203                     call interr
   729                                  
   730 000001B0 5253433A2053465420-     rscerr db "RSC: SFT not in SFT list", 13, 10, 0
   730 000001B9 6E6F7420696E205346-
   730 000001C2 54206C6973740D0A00 
   731                                  
   732                                     EndProc RSC
   733                                  
   734                                     BREAK <SLE - Scan for Lock Entry>
   735                                  
   736                                  ;******************* START OF SPECIFICATIONS ***********************************
   737                                  ;
   738                                  ;	SLE - Scan for Lock Entry
   739                                  ;
   740                                  ;	SLE scans a lock list looking for a lock range that overlaps the
   741                                  ;	caller-supplied range.	SLE indicates:
   742                                  ;
   743                                  ;		no overlap
   744                                  ;		partial overlay
   745                                  ;		1-to-1 match
   746                                  ;
   747                                  ;	ENTRY	(AX:BX) = FBA of area
   748                                  ;		(CX:DX) = LBA of area
   749                                  ;		(DS:SI) = address of name record
   750                                  ;		(DI)	= 0 to ignore locks by User_ID Proc_ID ThisSFT
   751                                  ;			= 1 to consider all locks
   752                                  ;	EXIT	'C' clear if no overlap
   753                                  ;		  AX,BX,CX,DX preserved
   754                                  ;		'C' set if overlap
   755                                  ;		  (di) = address of pointer to found record
   756                                  ;			 (i.e., DS:((di)) = address of lock record)
   757                                  ;		  'Z' set if 1-to-1 match
   758                                  ;	USES	ALL but (ds), (es) (also see EXIT)
   759                                  ;
   760                                  ;******************* END OF SPECIFICATIONS *************************************
   761                                  
   762                                     Procedure SLE,NEAR
   762          ******************       warning: proc SLE... [-w+user]
   763                                  
   764 000001CB 06                         push es
   765 000001CC 21FF                       and	di,di
   766 000001CE 9C                         pushf				; Z set to ignore own locks
   767 000001CF 8D7C04                     lea	di,[si + mft_lptr]		; (ds:di) = addr of ptr to lock record
   768 000001D2 8B35                       mov	si,[di] 			; (ds:si) = address of 1st lock record
   769                                  
   770                                  					;---------------------------------------
   771                                  					; check out next lock
   772                                  					;
   773                                  					; (ds:si) = address of next lock record
   774                                  					; (ds:di) = address of pointer to next
   775                                  					;	     lock record
   776                                  					; (TOS)   = flags (Z set to ignore
   777                                  					;	      own locks)
   778                                  					; (TOS+1) = Saved ES
   779                                  					;---------------------------------------
   780 000001D4 21F6                    sle1: and si,si
   781 000001D6 7462                       jz	sle9				; list exhaused, ergo no overlap
   782 000001D8 9D                         popf 				;
   783 000001D9 9C                         pushf
   784 000001DA 752A                       jnz	sle2				; am to check all locks
   785                                  
   786                                  					;---------------------------------------
   787                                  					; am to ignore own locks...
   788                                  					;  check the user and proc IDs on this one
   789                                  					;---------------------------------------
   790                                  
   791                                  ;dcl - this code used to compare the process id in the sft pointed to by the
   792                                  ;  lock.  now we compare the lock process id to the current process id.  this
   793                                  ;  allows a child process to lock an area and then do i/o with it.  before,
   794                                  ;  the child could lock it, but then could not access it
   795                                  
   796                                  
   797 000001DC 8B6C0E                     mov	bp,[si + rlr_pid] 		;dcl
   798                                  Proc_id equ Proc_ID	; NASM port label
   799 000001DF 363B2E[0000]               cmp	bp,[ss:Proc_id]			;dcl
   800 000001E4 751C                       jnz	sce1$5				;dcl
   801 000001E6 C4740A                     les	si,[si + rlr_sptr]		; (si) = sft address		;dcl
   802 000001E9 268B6C2F                   mov	bp,[es:si + sf_UID]		;dcl
   803 000001ED 363B2E[0000]               cmp	bp,[ss:User_ID]			;dcl
   804 000001F2 750E                       jnz	sce1$5				; doesn't belong to user        ;dcl
   805 000001F4 8CC5                       mov	bp,es				;dcl
   806 000001F6 363B2E[0200]               cmp	bp,WORD PTR [ss:ThisSFT+2]
   807 000001FB 7505                       jnz	sce1$5
   808 000001FD 363B36[0000]               cmp	si,WORD PTR [ss:ThisSFT]
   809 00000202 8B35                    sce1$5: mov si,[di]			; (ds:si) = address of next lock record
   810 00000204 7418                       jz	sle3				; owned by user - ignore
   811                                  
   812 00000206 89D5                    sle2: mov bp,dx
   813 00000208 2B6C02                     sub	bp,[si + rlr_fba] 		; compare proposed last to first of record
   814 0000020B 89CD                       mov	bp,cx
   815 0000020D 1B6C04                     sbb	bp,[si + rlr_fba + 2]
   816 00000210 720C                       jc	sle3				; proposed is above current
   817 00000212 8B6C06                     mov	bp,[si + rlr_lba]
   818 00000215 29DD                       sub	bp,bx				; compare proposed first to last of record
   819 00000217 8B6C08                     mov	bp,[si + rlr_lba + 2]
   820 0000021A 19C5                       sbb	bp,ax
   821 0000021C 7306                       jnc	sle5				; we have a hit
   822                                  
   823                                  					;---------------------------------------
   824                                  					; This entry is harmless...
   825                                  					;    chain to the next one
   826                                  					;---------------------------------------
   827                                     ERRNZ rlr_next
   828                                  
   829 0000021E 89F7                    sle3: mov di,si 			; save addr of pointer to next
   830 00000220 8B35                       mov	si,[di]
   831 00000222 EBB0                       JMP	SHORT sle1
   832                                  					;---------------------------------------
   833                                  					; We have an overlap.
   834                                  					;  - See if its an exact match
   835                                  					;
   836                                  					; (ds:di) = address of pointer
   837                                  					;	    (offset only) to the lock record
   838                                  					; (ds:si) = address of lock record
   839                                  					; (TOS) = flags ('Z' set if to ignore
   840                                  					;	  own locks)
   841                                  					; (TOS+1) = saved (es)
   842                                  					;---------------------------------------
   843                                  
   844 00000224 334404                  sle5: xor ax,[si + rlr_fba + 2]		; require a 4-word match
   845 00000227 335C02                     xor	bx,[si + rlr_fba]
   846 0000022A 334C08                     xor	cx,[si + rlr_lba + 2]
   847 0000022D 335406                     xor	dx,[si + rlr_lba]
   848 00000230 09D8                       or	ax,bx
   849 00000232 09C8                       or	ax,cx
   850 00000234 09D0                       or	ax,dx				; 'Z' set if exact match
   851 00000236 F9                         stc					; flag an overlap
   852 00000237 B82100                     mov	ax,error_lock_violation
   853 0000023A 5D                      sle9: pop bp				; discard flags (pushf)
   854 0000023B 07                         pop	es				; restore (es)
   855                                  
   856                                  					;---------------------------------------
   857                                  					; (ds:si) = address of lock record
   858                                  					;	    for Chk_Block
   859                                  					;---------------------------------------
   860 0000023C C3                         ret
   861                                  
   862                                     EndProc SLE
   863                                  
   864                                     BREAK <OFL - obtain free lock-record>
   865                                  
   866                                  ;******************* START OF SPECIFICATIONS ***********************************
   867                                  ;
   868                                  ;	OFL - obtain free lock-record
   869                                  ;
   870                                  ;	OFL returns a free lock-record, if one can be had.
   871                                  ;
   872                                  ;	ENTRY	(DS) = MFT Segment
   873                                  ;	EXIT	'C' clear if OK
   874                                  ;		  (DI) = FBA lock record
   875                                  ;		'C' set if no space
   876                                  ;		  (ax) = error code
   877                                  ;	USES	DI, FLAGS
   878                                  ;
   879                                  ;******************* END OF SPECIFICATIONS *************************************
   880                                  
   881                                     Procedure OFL,NEAR
   881          ******************       warning: proc OFL... [-w+user]
   882                                  
   883                                  Frelock equ FreLock	; NASM port label
   884 0000023D 2E8B3E[0000]               mov	di,[cs:Frelock]
   885 00000242 21FF                       and	di,di
   886                                  
   887                                  ;  $if	nz				; if something there
   888 00000244 7409                       JZ D_$IF1
   889                                  
   890 00000246 FF35                           push word [di + rlr_next]
   891 00000248 2E8F06[0000]                   pop  word [cs:Frelock]			; chain off of the list
   892                                  					; exit with 'C' clear
   893                                  
   894                                  ;  $else				; none on free list
   895 0000024D EB04                       JMP SHORT D_$EN1
   896                                  D_$IF1:
   897                                  
   898 0000024F B82400                         mov  ax,error_sharing_buffer_exceeded ; None on free list, give up until
   899 00000252 F9                             stc				;  garbage collector is ready
   900                                  
   901                                  ;  $endif
   902                                  D_$EN1:
   903                                  
   904 00000253 C3                         ret
   905                                  
   906                                     EndProc OFL
   907                                  
   908                                     Break <CPS - close process SFT>
   909                                  
   910                                  ;******************* START OF SPECIFICATIONS ***********************************
   911                                  ;
   912                                  ;   CPS - close process SFT.
   913                                  ;
   914                                  ;	During maintenance, it is necessary to close a
   915                                  ;	file given ONLY the SFT.  This necessitates walking all PDB's JFN
   916                                  ;	tables looking for the SFN.  The difficult part is in generating the
   917                                  ;	SFN from the SFT.  This is done by enumerating SFT's and comparing for
   918                                  ;	the correct SFT.  Finding all PDBs is easy:  walk arena and check
   919                                  ;	owner fields
   920                                  ;
   921                                  ;   Inputs:	ThisSFT points to SFT of interest
   922                                  ;   Outputs:	Handle is closed on user
   923                                  ;   Registers Revised: none
   924                                  ;
   925                                  ;******************* END OF SPECIFICATIONS *************************************
   926                                  
   927                                     Procedure CPS,NEAR
   927          ******************       warning: proc CPS... [-w+user]
   928                                  
   929                                     ASSUME DS:NOTHING,ES:NOTHING
   930                                  
   931 00000254 1E560657505351             SaveReg <DS,SI,ES,DI,AX,BX,CX>
   932                                  
   933 0000025B 36C536[0000]               lds	si,[ss:ThisSFT]
   934 00000260 31DB                       xor	bx,bx
   935                                  cps01:
   936                                  
   937                                  multDOS equ MultDOS	; NASM port equate
   938 00000262 53B81612CD2F5B             CallInstall SFFromSFN,multDOS,22,bx,bx
   939                                  
   940 00000269 727A                       jc	cps31				; no more SFN's.  Must be FCB.
   941                                  
   942 0000026B B81412CD2F                 CallInstall PointComp,multDOS,20
   943                                  
   944 00000270 7403                       jz	cps02				; found matching SFN, go scan.
   945 00000272 43                         inc	bx				; did not match, go back for more
   946 00000273 EBED                       jmp	cps01
   947                                  					;---------------------------------------
   948                                  					; BL is the sfn we want to find.  Walk
   949                                  					;  the memory arena enumerating all PDB's
   950                                  					;  and zap the handle tables for the
   951                                  					;  specified sfn.
   952                                  					;---------------------------------------
   953                                  cps02:
   954 00000275 88D8                       mov	al,bl
   955 00000277 31F6                       xor si, si
   956 00000279 368E1E[0000]               mov	ds,[ss:Arena_Head]			; get first arena pointer
   957                                  
   958                                  					;---------------------------------------
   959                                  					; [DS:0] is the arena header.
   960                                  					; AL is sfn to be closed
   961                                  					;---------------------------------------
   962                                  cps1:
   963 0000027E 46                         inc si				; loop detection
   964 0000027F 745C                       jz cps3				; stop if looped -->
   965 00000281 8B0E0100                   mov	cx,[arena_owner]
   966 00000285 8CDB                       mov	bx,ds
   967 00000287 43                         inc	bx				; is the owner the same as the current
   968 00000288 39D9                       cmp	cx,bx				; block?
   969 0000028A 7518                       jnz	cps2				; no, go skip some more...
   970                                  
   971                                  					;---------------------------------------
   972                                  					; CX:0 is the correct pointer to a PDB.
   973                                  					;---------------------------------------
   974 0000028C 1E                         push ds
   975 0000028D 8ED9                       mov	ds,cx
   976                                  					;---------------------------------------
   977                                  					; Given a PDB at DS:0, scan his handle
   978                                  					;  table and then loop through the next
   979                                  					;  PDB link.
   980                                  					;---------------------------------------
   981                                  cps15:
   982 0000028F 813E0000CD20               cmp word [PDB_Exit_Call], 20CDh	; harden: is this a valid PSP ?
   983 00000295 750C                       jne .skip				; no -->
   984 00000297 E85300                     call CPJ				; free for this PDB
   985 0000029A C50E3800                   lds	cx,[PDB_Next_PDB]		; advance to next
   986 0000029E 83F9FF                     cmp	cx,-1
   987 000002A1 75EC                       jnz	cps15				; there is another link to process
   988                                  .skip:
   989 000002A3 1F                         pop	ds
   990                                  					;---------------------------------------
   991                                  					; We have processed the current
   992                                  					;  allocation block pointed to by DS.
   993                                  					;  [DS:0] is the allocation block
   994                                  					;---------------------------------------
   995                                  cps2:
   996 000002A4 803E00005A                 cmp	byte [arena_signature], 'Z'
   997 000002A9 751C                       jne .not_Z
   998 000002AB 50                      	 push ax
   999 000002AC B86112                  	mov ax, 1261h
  1000 000002AF CD2F                    	int 2Fh				; get first UMCB
  1001 000002B1 83F801                  	cmp ax, 1			; none ?
  1002 000002B4 760E                    	jbe .pop
  1003 000002B6 83F8FF                  	cmp ax, -1			; none ?
  1004 000002B9 7409                    	je .pop
  1005 000002BB E81500                  	call nextmcb			; bx => next MCB
  1006 000002BE 39D8                    	cmp ax, bx			; is it the first UMCB ?
  1007 000002C0 58                      	 pop ax
  1008 000002C1 74BB                    	je cps1				; yes, so we continue -->
  1009 000002C3 A8                      	db 0A8h				; skip pop
  1010                                  .pop:
  1011 000002C4 58                      	 pop ax
  1012 000002C5 EB16                       jmp	cps3				; no more blocks to do
  1013                                  
  1014                                  .not_Z:
  1015 000002C7 803E00004D                 cmp	byte [arena_signature], 'M'
  1016 000002CC 750F                       jne cps3				; corrupted -->
  1017 000002CE E80200                  	call nextmcb
  1018 000002D1 EBAB                       jmp	cps1
  1019                                  
  1020                                  
  1021                                  nextmcb:
  1022 000002D3 8CDB                       mov	bx,ds				; get current address
  1023                                  Arena_size equ arena_size	; NASM port equate
  1024 000002D5 031E0300                   add	bx,[Arena_size]		; add on size of block
  1025 000002D9 43                         inc	bx				; remember size of header
  1026 000002DA 8EDB                       mov	ds,bx				; link to next
  1027 000002DC C3                         retn
  1028                                  					;---------------------------------------
  1029                                  					; Just for good measure, use CurrentPDB
  1030                                  					;  and clean off him
  1031                                  					;---------------------------------------
  1032                                  cps3:
  1033 000002DD 368E1E[0000]               mov	ds,[ss:CurrentPDB]
  1034                                  
  1035 000002E2 E80800                     call CPJ
  1036                                  
  1037                                  cps31:
  1038                                  
  1039 000002E5 595B585F075E1F             RestoreReg <CX,BX,AX,DI,ES,SI,DS>
  1040                                  
  1041 000002EC C3                         ret
  1042                                  
  1043                                     EndProc CPS
  1044                                  
  1045                                  ;******************* START OF SPECIFICATIONS ***********************************
  1046                                  ;
  1047                                  ; CPJ -
  1048                                  ;
  1049                                  ; Scan JFN table for SFT # and put in -1 if found
  1050                                  ;
  1051                                  ; Input: DS:0 is PDB
  1052                                  ;	 AL is SFT index # of interest
  1053                                  ;
  1054                                  ; Output: None
  1055                                  ;
  1056                                  ; Uses: Flags,CX,ES,DI
  1057                                  ;
  1058                                  ;******************* END OF SPECIFICATIONS *************************************
  1059                                  
  1060                                     Procedure CPJ,NEAR
  1060          ******************       warning: proc CPJ... [-w+user]
  1061                                  
  1062                                     assume ds:nothing,es:nothing
  1063                                  
  1064                                  PDB_JFN_length equ PDB_JFN_Length	; NASM port equate
  1065 000002ED 8B0E3200                   mov	cx,[PDB_JFN_length]
  1066                                  PDB_JFN_pointer equ PDB_JFN_Pointer	; NASM port equate
  1067 000002F1 C43E3400                   les	di,[PDB_JFN_pointer]
  1068 000002F5 FC                         cld
  1069                                  cpj1:
  1070 000002F6 E30C                       jcxz CPJret				; no more entries
  1071 000002F8 F2AE                       repne scasb
  1072                                  
  1073 000002FA 7401C3                     retnz				; none found
  1074                                  
  1075 000002FD 26C645FFFF                 mov	byte ptr [es:di-1],-1		; free this
  1076 00000302 EBF2                       jmp	cpj1				; keep looking
  1077                                  CPJret:
  1078 00000304 C3                         ret
  1079                                  
  1080                                     EndProc CPJ
  1081                                  
  1082                                     Break <SFM - convert an mft pointer into a serial number>
  1083                                  
  1084                                  ;******************* START OF SPECIFICATIONS ***********************************
  1085                                  ;
  1086                                  ;   SFM - convert a pointer to a mft entry into the serial number for that
  1087                                  ;   entry.  We keep these around to see if a FCB really points to the correct
  1088                                  ;   SFT.
  1089                                  ;
  1090                                  ;   Inputs:	BX is the mft pointer
  1091                                  ;   Outputs:	BX is the serial number
  1092                                  ;   Registers Revised: none
  1093                                  ;
  1094                                  ;******************* END OF SPECIFICATIONS *************************************
  1095                                  
  1096                                     Procedure SFM,NEAR
  1096          ******************       warning: proc SFM... [-w+user]
  1097                                  
  1098                                     ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSGROUP
  1099                                  
  1100 00000305 2E8B5F0A                   mov	bx,[cs:bx + mft_serl]
  1101                                  
  1102 00000309 C3                         ret
  1103                                  
  1104                                     EndProc SFM
  1105                                  
  1106                                     Break <ShChk - check a fcb for share related information>
  1107                                  
  1108                                  ;******************* START OF SPECIFICATIONS ***********************************
  1109                                  ;
  1110                                  ;   ShChk - check a fcb for share related information
  1111                                  ;
  1112                                  ;   ShChk - checks the reserved field contents of an FCB with a SFT to see
  1113                                  ;   if they represent the same file.  The open ref count must be > 0.
  1114                                  ;
  1115                                  ;   Inputs:	DS:SI point to FCB
  1116                                  ;		ES:DI point to SFT
  1117                                  ;   Outputs:	Carry Set if contents do not match
  1118                                  ;		Carry clear if contents match
  1119                                  ;		    BX has first cluster
  1120                                  ;   Registers Revised: none
  1121                                  ;
  1122                                  ;******************* END OF SPECIFICATIONS *************************************
  1123                                  
  1124                                     Procedure ShChk,NEAR
  1124          ******************       warning: proc ShChk... [-w+user]
  1125                                  
  1126                                     ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSGROUP
  1127                                  
  1128 0000030A 26833D00                   CMP	word [ES:DI + sf_ref_count],0
  1129 0000030E 7410                       JZ	BadSFT
  1130 00000310 268B5D33                   MOV	BX,[ES:DI + sf_mft]		; Local file or dev with sharing
  1131                                  
  1132 00000314 E8EEFF                     call SFM
  1133                                  
  1134 00000317 3B5C1C                     CMP	BX,[SI + fcb_l_mfs]
  1135 0000031A 7504                       JNZ	BadSFT
  1136 0000031C 8B5C1A                     MOV	BX,[SI + fcb_l_firclus]
  1137                                  
  1138 0000031F C3                         ret
  1139                                  
  1140 00000320 F9                      BadSFT: stc
  1141                                  
  1142 00000321 C3                         ret
  1143                                  
  1144                                     EndProc ShChk
  1145                                  
  1146                                     Break <ShSave - save information from SFT into an FCB>
  1147                                  
  1148                                  ;******************* START OF SPECIFICATIONS ***********************************
  1149                                  ;
  1150                                  ;   ShSave - save information from SFT into an FCB
  1151                                  ;
  1152                                  ;   ShSave - copy information into the reserved area of an FCB from a SFT.
  1153                                  ;   This is so that we can later match the SFT with the FCB.
  1154                                  ;
  1155                                  ;   Inputs:	ES:DI point to SFT
  1156                                  ;		DS:SI point to FCB
  1157                                  ;   Outputs:	FCB reserved field is filled in
  1158                                  ;		BL = FCBSHARE
  1159                                  ;   Registers Revised: AX,BX
  1160                                  ;
  1161                                  ;******************* END OF SPECIFICATIONS *************************************
  1162                                  
  1163                                     Procedure ShSave,NEAR
  1163          ******************       warning: proc ShSave... [-w+user]
  1164                                  
  1165                                     ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSGROUP
  1166                                  
  1167 00000322 268A4504                   MOV	AL,[ES:DI + sf_attr]		; move attribute (for reopen)
  1168 00000326 88441E                     MOV	[SI + FCB_l_attr],AL
  1169 00000329 268B450B                   MOV	AX,[ES:DI + sf_firclus]		; get first cluster
  1170 0000032D 89441A                     MOV	[SI + FCB_l_firclus],AX
  1171 00000330 268B5D33                   MOV	BX,[ES:DI + sf_mft]		; get sharing pointer
  1172                                  
  1173 00000334 E8CEFF                     call SFM
  1174                                  
  1175 00000337 895C1C                     MOV	[SI + FCB_l_mfs],BX
  1176 0000033A B3C0                       MOV	BL,FCBSHARE
  1177                                  
  1178 0000033C C3                         ret
  1179                                  
  1180                                     EndProc ShSave
  1181                                  
  1182                                     Break <ShCol - collapse identical handle SFTs in mode 70 only>
  1183                                  
  1184                                  ;******************* START OF SPECIFICATIONS ***********************************
  1185                                  ;
  1186                                  ;   ShCol - collapse identical handle SFTs in mode 70 only
  1187                                  ;
  1188                                  ;   ShCol - collapse same 70-mode handles together.  This represents network
  1189                                  ;   originated FCBs.  Since FCB's are incredibly mis-behaved, we collapse the
  1190                                  ;   SFT's for identical files, thus using a single sft for each file instead
  1191                                  ;   of a separate sft for each instance of the file.
  1192                                  ;
  1193                                  ;   Note that the redirectors will collapse multiple instances of these
  1194                                  ;   files together.  FCB's are pretty misbehaved, so the redirector will
  1195                                  ;   inform us of EACH close done on an FCB.  Therefore, we must increment
  1196                                  ;   the ref count each time we see a collapse here.
  1197                                  ;
  1198                                  ;   Inputs:	DS:SI ThisSFT has new sft to find.
  1199                                  ;   Outputs:	Carry set - no matching SFT was found
  1200                                  ;		Carry clear - matching SFT was found and all collapsing done.
  1201                                  ;		    AX has proper handle
  1202                                  ;   Registers Revised: all.
  1203                                  ;
  1204                                  ;******************* END OF SPECIFICATIONS *************************************
  1205                                  
  1206                                     Procedure ShCol,NEAR
  1206          ******************       warning: proc ShCol... [-w+user]
  1207                                  
  1208                                     ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSGROUP
  1209                                  
  1210                                  					;---------------------------------------
  1211                                  					; Collapse the files ONLY if
  1212                                  					;  the mode is for net FCB's
  1213                                  					;---------------------------------------
  1214                                  
  1215 0000033D 8A4402                     MOV	AL,BYTE PTR [SI + sf_mode]
  1216 00000340 24F0                       AND	AL,sharing_mask
  1217 00000342 3C70                       CMP	AL,sharing_net_FCB
  1218 00000344 7577                       JNZ	UseJFN
  1219                                  
  1220                                  					;---------------------------------------
  1221                                  					; In share support
  1222                                  					;---------------------------------------
  1223                                  
  1224 00000346 31DB                       XOR	BX,BX				;   for (i=0; sffromsfn(i); i++) {
  1225                                  OpenScan:
  1226                                  
  1227 00000348 53B81612CD2F5B             CallInstall SFFromSFN,multDOS,22,bx,bx
  1228                                  
  1229 0000034F 726C                       JC	UseJFN
  1230                                  
  1231 00000351 B81412CD2F                 CallInstall PointComp,multDOS,20	;	if (!pointcomp (s,d))
  1232                                  
  1233 00000356 742A                       JZ	OpenNext
  1234 00000358 26833D00                   CMP	word [ES:DI + sf_ref_count],0
  1235 0000035C 7424                       JZ	OpenNext
  1236 0000035E 268B4502                   MOV	AX,[ES:DI + sf_mode]
  1237 00000362 3B4402                     CMP	AX,[SI + sf_mode]
  1238 00000365 751B                       JNZ	OpenNext
  1239 00000367 268B4533                   MOV	AX,[ES:DI + sf_mft]
  1240 0000036B 3B4433                     CMP	AX,[SI + sf_mft]
  1241 0000036E 7512                       JNZ	OpenNext
  1242 00000370 268B452F                   MOV	AX,WORD PTR [ES:DI + sf_UID]
  1243                                  sf_uid equ sf_UID	; NASM port equate
  1244 00000374 3B442F                     CMP	AX,WORD PTR [SI + sf_uid]
  1245 00000377 7509                       JNZ	OpenNext
  1246                                  sf_pid equ sf_PID	; NASM port equate
  1247 00000379 268B4531                   MOV	AX,WORD PTR [ES:DI + sf_pid]
  1248 0000037D 3B4431                     CMP	AX,WORD PTR [SI + sf_pid]
  1249 00000380 7403                       JZ	OpenFound
  1250                                  OpenNext:
  1251 00000382 43                         INC	BX
  1252 00000383 EBC3                       JMP	OpenScan
  1253                                  					;--------------------------------------
  1254                                  					; DS:SI points to an sft which is a
  1255                                  					;	 duplicate of that found in
  1256                                  					; ES:DI is the older one.
  1257                                  					;
  1258                                  					; We call mftclose to release the
  1259                                  					;   appropriate info.
  1260                                  					;--------------------------------------
  1261                                  OpenFound:
  1262 00000385 C7040000                   MOV	word [SI + sf_ref_count],0		; free 'new' sft
  1263                                  
  1264 00000389 1E56065753                 SaveReg <DS,SI,ES,DI,BX>
  1265                                  
  1266 0000038E 161F                       Context DS
  1267                                  
  1268 00000390 C43E[0000]                 LES	DI,[ThisSFT]
  1269                                  
  1270 00000394 E8(0000)                   call MFTClose
  1271                                  
  1272 00000397 585F075E1F                 RestoreReg <AX,DI,ES,SI,DS>
  1273                                  
  1274                                     ASSUME DS:NOTHING
  1275                                  
  1276 0000039C 26FF05                     INC	word [ES:DI + sf_ref_count]		;   d->refcount++;
  1277 0000039F 31DB                       XOR	BX,BX				; find jfn with sfn as contents
  1278                                  JFNScan:
  1279                                  
  1280 000003A1 50B82012CD2F58             CallInstall pJFNFromHandle,multDOS,32,AX,AX
  1281                                  
  1282 000003A8 7213                       JC	UseJFN				; ran out of handles?
  1283 000003AA 263A05                     CMP	AL,BYTE PTR [ES:DI]		; does JFN have SFN?
  1284                                  JFNfound equ JFNFound	; NASM port label
  1285 000003AD 7403                       jz	JFNfound			; YES, go return JFN
  1286 000003AF 43                         INC	BX				; no, look at next
  1287 000003B0 EBEF                       JMP	JFNScan
  1288                                  JFNFound:
  1289 000003B2 36C536[0000]               LDS	SI,[ss:pJFN]
  1290 000003B7 C604FF                     MOV	BYTE PTR [SI],0FFh		; free JFN
  1291 000003BA 89D8                       MOV	AX,BX				; return JFN
  1292                                  
  1293 000003BC C3                         ret
  1294                                  
  1295                                  UseJFN:
  1296 000003BD 36A1[0000]                 MOV	AX,[ss:JFN]
  1297                                  
  1298 000003C1 C3                         ret
  1299                                  
  1300                                     EndProc ShCol
  1301                                  
  1302                                     Break <ShCloseFile - close a particular file for a particular UID/PID>
  1303                                  
  1304                                  ;******************* START OF SPECIFICATIONS ***********************************
  1305                                  ;
  1306                                  ;   ShCloseFile - close a particular file for a particular UID/PID
  1307                                  ;
  1308                                  ;   ShCloseFile - Compatability mode programs will often delete files that
  1309                                  ;   they had open.  This was perfectly valid in the 2.0 days, but this
  1310                                  ;   presents a reliability problem in the network based operating environment.
  1311                                  ;   As a result, both RENAME and DELETE will call us to see if the file is
  1312                                  ;   open by is only.  If it is not open or is open by us only, we close it.
  1313                                  ;   Note that we will ONLY close compatability SFTs.
  1314                                  ;   Otherwise, we signal and error.
  1315                                  ;
  1316                                  ;   Inputs:	WFT_Start has a DOSGROUP offset to the file name
  1317                                  ;		DS is DOSGroup
  1318                                  ;   Outputs:	nothing relevant.
  1319                                  ;   Registers Revised: None.
  1320                                  ;
  1321                                  ;******************* END OF SPECIFICATIONS *************************************
  1322                                  
  1323                                     Procedure ShCloseFile,NEAR
  1323          ******************       warning: proc ShCloseFile... [-w+user]
  1324                                  
  1325                                     ASSUME DS:DOSGroup,ES:NOTHING,SS:DOSGroup
  1326                                  
  1327 000003C2 505351525657551E06         SaveReg <AX,BX,CX,DX,SI,DI,BP,DS,ES>
  1328                                  
  1329 000003CB E85102                     EnterCrit critShare
  1330                                  
  1331                                  ShCl:
  1332                                  WFP_Start equ WFP_start	; NASM port label
  1333 000003CE 8B36[0000]                 MOV	SI,[WFP_Start]
  1334 000003D2 30C0                       XOR	AL,AL
  1335                                  
  1336 000003D4 E829FC                     call FNM				; attempt to find name in list
  1337                                  
  1338                                     ASSUME DS:NOTHING
  1339                                  
  1340 000003D7 7249                       JC	ShCloseDone			; can't find, signal success
  1341                                  
  1342                                  					;--------------------------------------
  1343                                  					; We have found a file in the MFT.
  1344                                  					;  Walk the open sft list to find
  1345                                  					;  the SFTs for the current UID/PID.
  1346                                  					;--------------------------------------
  1347 000003D9 8CD9                       MOV	CX,DS
  1348 000003DB C57706                     LDS	SI,[BX + mft_sptr]
  1349                                  ShClCheck:
  1350 000003DE 36A1[0000]                 MOV	AX,[ss:Proc_ID]
  1351 000003E2 394431                     CMP	[SI + sf_PID],AX
  1352 000003E5 753B                       JNZ	ShCloseDone
  1353 000003E7 36A1[0000]                 MOV	AX,[ss:User_ID]
  1354 000003EB 39442F                     CMP	[SI + sf_UID],AX
  1355 000003EE 7532                       JNZ	ShCloseDone
  1356 000003F0 8B4402                     MOV	AX,[SI + sf_mode]
  1357 000003F3 25F000                     AND	AX,sharing_mask
  1358                                  sharing_net_fcb equ sharing_net_FCB	; NASM port equate
  1359 000003F6 83F870                     CMP	AX,sharing_net_fcb
  1360 000003F9 7405                       jz	ShClNext
  1361 000003FB 83F800                     CMP	AX,sharing_compat
  1362                                  ShCloseDOne equ ShCloseDone	; NASM port label
  1363 000003FE 7522                       jnz	ShCloseDOne
  1364                                  ShClNext:
  1365 00000400 C5742B                     LDS	SI,[SI + sf_chain]
  1366 00000403 09F6                       OR	SI,SI
  1367 00000405 75D7                       JNZ	ShClCheck
  1368 00000407 8ED9                       MOV	DS,CX
  1369 00000409 C57706                     LDS	SI,[BX + mft_sptr]
  1370                                  					;--------------------------------------
  1371                                  					; Everything matches.  Set up ThisSFT
  1372                                  					;  and walk the chain from the beginning.
  1373                                  					;--------------------------------------
  1374 0000040C 368936[0000]               MOV	WORD PTR [ss:ThisSFT],SI
  1375 00000411 368C1E[0200]               MOV	WORD PTR [ss:ThisSFT+2],DS
  1376                                  					;--------------------------------------
  1377                                  					; Close all handles for this SFT
  1378                                  					;--------------------------------------
  1379 00000416 E83BFE                     call CPS
  1380                                  					;--------------------------------------
  1381                                  					; Close the sft itself.
  1382                                  					;--------------------------------------
  1383 00000419 161F                       Context DS
  1384                                  
  1385                                  multDos equ MultDOS	; NASM port equate
  1386 0000041B B80112CD2F                 CallInstall DOS_Close,multDos,1
  1387                                  					;--------------------------------------
  1388                                  					; The SFT may be free and we have no
  1389                                  					;  idea where the next is.  Go and loop
  1390                                  					;  all over.
  1391                                  					;--------------------------------------
  1392 00000420 EBAC                       JMP	ShCl
  1393                                  					;--------------------------------------
  1394                                  					; There are no more SFTs to close. Leave
  1395                                  					;---------------------------------------
  1396                                  ShCloseDone:
  1397                                  
  1398 00000422 E80202                     LeaveCrit critShare
  1399                                  
  1400 00000425 F9                         STC
  1401                                  
  1402 00000426 071F5D5F5E5A595B58         RestoreReg <ES,DS,BP,DI,SI,DX,CX,BX,AX>
  1403                                  
  1404 0000042F C3                         ret
  1405                                  
  1406                                     EndProc ShCloseFile
  1407                                  
  1408                                  ;   .xall
  1409                                     Break <ShSU - update all SFTs for a specified change>
  1410                                  ;******************* START OF SPECIFICATIONS ***********************************
  1411                                  ;
  1412                                  ;  NAME:	   ShSU - update all SFTs for a specified change>
  1413                                  ;
  1414                                  ;  FUNCTION:	   In a shared environment, we want to propogate the SFT
  1415                                  ;		   changes for a particular file to all other SFTs for that
  1416                                  ;		   file.  The types of things we propogate are:
  1417                                  ;
  1418                                  ;		   - Time of last write - we only do this on CLOSE and on
  1419                                  ;		     FILETIMES.
  1420                                  ;
  1421                                  ;		   - Size and allocation information - we do this ONLY when
  1422                                  ;		     we change sf_size.
  1423                                  ;
  1424                                  ;		   We achieve this by walking the linked list of SFTs for the
  1425                                  ;		   file. See PSEUDOCODE below
  1426                                  ;
  1427                                  ;  INPUT:	   ES.DI  has SFT that was just Revised.
  1428                                  ;		   AX = 0 for updating of time from ES:DI into old sfts
  1429                                  ;		   AX = 1 for updating of size/allocation for growth from ES:DI
  1430                                  ;		   AX = 2 for updating of size/allocation for shrink from ES:DI
  1431                                  ;		   AX = 3 for new instance copy into ES:DI
  1432                                  ;		   AX = 4 for update of codepage and high attribute
  1433                                  ;
  1434                                  ;  OUTPUT:	   All relevant SFTs are updated.
  1435                                  ;
  1436                                  ;  REGISTERS USED: All except ES:DI and DS:SI
  1437                                  ;  (NOT RESTORED)
  1438                                  ;
  1439                                  ;  LINKAGE:	   DOS Jump Table
  1440                                  ;
  1441                                  ;  EXTERNAL	   Invoke: New_Sft, Call_IFS
  1442                                  ;  REFERENCES:	   Callinstall
  1443                                  ;
  1444                                  ;  NORMAL	   -
  1445                                  ;  EXIT:
  1446                                  ;
  1447                                  ;  ERROR	   -
  1448                                  ;  EXIT:
  1449                                  ;
  1450                                  ;  CHANGE	   04/15/87 - Major overhaul and IFS support
  1451                                  ;  LOG:
  1452                                  ;
  1453                                  ;******************* END OF SPECIFICATIONS *************************************
  1454                                  ;******************+ START OF PSEUDOCODE +**************************************
  1455                                  ;
  1456                                  ;	START ShSU
  1457                                  ;
  1458                                  ;	if not a device and
  1459                                  ;	if not a network
  1460                                  ;		search
  1461                                  ;			if our SFT
  1462                                  ;				advance to next SFT
  1463                                  ;			endif
  1464                                  ;		leave if no more SFT's
  1465                                  ;		exitif cx = 3
  1466                                  ;			invoke New_Sft
  1467                                  ;		orelse
  1468                                  ;			if cx = 0
  1469                                  ;				update time
  1470                                  ;				update date
  1471                                  ;				if non - FAT file system
  1472                                  ;					call IFSFUNC
  1473                                  ;				endif
  1474                                  ;			else cx = 1 or 2
  1475                                  ;				update size
  1476                                  ;				if non - FAT file system
  1477                                  ;					call IFSFUNC
  1478                                  ;				else
  1479                                  ;					update first cluster
  1480                                  ;					if cx = 2 or
  1481                                  ;					if lstclus un-set from create
  1482                                  ;						update cluster position
  1483                                  ;						update last cluster
  1484                                  ;					endif
  1485                                  ;				endif
  1486                                  ;			endif
  1487                                  ;			advance to next SFT
  1488                                  ;		endloop
  1489                                  ;		endsearch
  1490                                  ;	endif
  1491                                  ;	return
  1492                                  ;
  1493                                  ;	END ShSU
  1494                                  ;
  1495                                  ;******************+  END  OF PSEUDOCODE +**************************************
  1496                                  
  1497                                     Procedure ShSU,near
  1497          ******************       warning: proc ShSU... [-w+user]
  1498                                  
  1499                                     ASSUME DS:NOTHING,ES:NOTHING
  1500                                  
  1501 00000430 90                         nop
  1502                                  ;  int 3
  1503 00000431 90                         nop
  1504                                  
  1505                                  ifs_flag equ 8000h			;				       ;AN000;
  1506                                  					;---------------------------------------
  1507                                  					; Do nothing for device or network
  1508                                  					;---------------------------------------
  1509 00000432 268B5D02                   mov	bx,[es:di + sf_mode]
  1510 00000436 81E38080                   and	bx,sf_isnet + devid_device
  1511                                  
  1512                                  ;  $if	z,and,long			; if not device and		       ;AC000;
  1513 0000043A 7403                       JZ D_$XL1
  1514 0000043C E98F00                     JMP D_$IF4
  1515                                  D_$XL1:
  1516                                  
  1517 0000043F 268B5D33                   mov	bx,[es:di + sf_MFT]
  1518 00000443 09DB                       or	bx,bx
  1519                                  
  1520                                  ;  $if	nz,,long			; if not network		       ;AC000;
  1521 00000445 7503                       JNZ D_$XL2
  1522 00000447 E98400                     JMP D_$IF4
  1523                                  D_$XL2:
  1524                                  
  1525 0000044A E8D201                         EnterCrit critShare
  1526                                  					;---------------------------------------
  1527                                  					; Walk the sft chain for this file and
  1528                                  					;  skip the current SFT (ES:DI)
  1529                                  					;---------------------------------------
  1530 0000044D 1E56                           SaveReg <DS,SI>
  1531                                  
  1532                                  MFT_SPTR equ mft_sptr	; NASM port equate
  1533 0000044F 2EC57706                       lds  si,[cs:bx + MFT_SPTR]
  1534 00000453 89C1                           mov  cx,ax
  1535                                  
  1536                                  ;      $search				;				       ;AC000;
  1537                                  D_$DO5:
  1538                                  
  1539 00000455 B81412CD2F              	   CallInstall PointComp,multDOS,20 ; pointers different?
  1540                                  
  1541                                  ;	   $if	z			; if ourselves			       ;AC000;
  1542 0000045A 7503                    	   JNZ D_$IF6
  1543                                  
  1544 0000045C C5742B                  	       lds  si,[si + sf_chain]	; move to next			       ;AC000;
  1545                                  
  1546                                  ;	   $endif			; endif - ourselves		       ;AC000;
  1547                                  D_$IF6:
  1548                                  
  1549 0000045F 09F6                    	   or	si,si
  1550                                  
  1551                                  ;      $leave z 			;				       ;AC000;
  1552 00000461 7466                           JZ D_$EN5
  1553                                  
  1554                                  					;---------------------------------------
  1555                                  					; CX = 0 for updating of time
  1556                                  					; CX = 1 for updating of size/allocation
  1557                                  					;	   for growth
  1558                                  					; CX = 2 for updating of size/allocation
  1559                                  					;	   for shrink
  1560                                  					; CX = 3 for new instance copy.
  1561                                  					;---------------------------------------
  1562 00000463 83F902                  	   cmp	cx,2			;				       ;AC000;
  1563                                  
  1564                                  ;      $exitif a			;				       ;AC000;
  1565 00000466 760A                           JNA D_$IF5
  1566                                  					;---------------------------------------
  1567                                  					; CX = 3 for new instance copy.
  1568                                  					; CX = 4 for codepage and high attrib update
  1569                                  					;---------------------------------------
  1570 00000468 83F903                  	   cmp	cx,3			; cx = 3 ?			       ;an000;
  1571                                  ;	   $if	e			; yes				       ;an000;
  1572 0000046B 7503                    	   JNE D_$IF10
  1573 0000046D E85F00                  	       call New_Sft		;				       ;AN000;
  1574                                  ;;	   $else			; cx = 4			       ;an000;
  1575                                  ;;	       call New_CP_Attrib	; update codepage and high attrib      ;an000;
  1576                                  ;	   $endif			;				       ;an000;
  1577                                  D_$IF10:
  1578                                  
  1579                                  ;      $orelse				;				       ;AC000;
  1580 00000470 EB57                           JMP SHORT D_$SR5
  1581                                  D_$IF5:
  1582                                  
  1583 00000472 09C9                    	   or	cx,cx
  1584                                  
  1585                                  ;	   $if	z			; if cx = 0 then		       ;AC000;
  1586 00000474 751A                    	   JNZ D_$IF13
  1587                                  					;---------------------------------------
  1588                                  					; CX = 0 for updating of time
  1589                                  					;
  1590                                  					; Copy time from ES:DI into DS:SI
  1591                                  					;---------------------------------------
  1592 00000476 268B5D0D                	       mov  bx,[es:di + sf_time]
  1593 0000047A 895C0D                  	       mov  [si + sf_time],bx
  1594 0000047D 268B5D0F                	       mov  bx,[es:di + sf_date]
  1595 00000481 895C0F                  	       mov  [si + sf_date],bx
  1596 00000484 F744050080              	       test word [si + sf_flags],ifs_flag ;				       ;AN000;
  1597                                  
  1598                                  ;	       $if  nz			; if non-FAT			       ;AC003;
  1599 00000489 7403                    	       JZ D_$IF14
  1600                                  
  1601 0000048B E87C00                  		   call Call_IFS	; tell IFS of SFT change	       ;AN000;
  1602                                  
  1603                                  ;	       $endif			; endif non- FAT		       ;AN000;
  1604                                  D_$IF14:
  1605                                  
  1606                                  ;	   $else			; else - must be >0 and <2	       ;AC000;
  1607 0000048E EB34                    	   JMP SHORT D_$EN13
  1608                                  D_$IF13:
  1609                                  					;---------------------------------------
  1610                                  					; CX = 1 for updating of size/allocation
  1611                                  					;	  for growth
  1612                                  					; CX = 2 for updating of size/allocation
  1613                                  					;	  for shrink
  1614                                  					;
  1615                                  					; We always copy size and firclus
  1616                                  					;---------------------------------------
  1617 00000490 268B5D11                	       mov  bx,word ptr [es:di + sf_size]
  1618 00000494 895C11                  	       mov  word ptr [si + sf_size],bx
  1619 00000497 268B5D13                	       mov  bx,word ptr [es:di + sf_size + 2]
  1620 0000049B 895C13                  	       mov  word ptr [si + sf_size + 2],bx
  1621 0000049E F744050080              	       test word [si + sf_flags],ifs_flag ;				       ;AN000;
  1622                                  
  1623                                  ;	       $if  nz			; if non-FAT			       ;AC003;
  1624 000004A3 7405                    	       JZ D_$IF17
  1625                                  
  1626 000004A5 E86200                  		   invoke Call_IFS	; tell IFS of SFT change	       ;AN000;
  1627                                  
  1628                                  ;	       $else			; else - its FAT		       ;AN000;
  1629 000004A8 EB1A                    	       JMP SHORT D_$EN17
  1630                                  D_$IF17:
  1631                                  
  1632 000004AA 268B5D0B                		   mov	bx,[es:di + sf_firclus]
  1633 000004AE 895C0B                  		   mov	[si + sf_firclus],bx
  1634 000004B1 83F902                  		   cmp	cx,2		;				       ;AC000;
  1635                                  
  1636                                  ;		   $if	z,or		; if SFT is shrinking or	       ;AC000;
  1637 000004B4 7406                    		   JZ D_$LL19
  1638                                  
  1639 000004B6 837C3500                		   cmp	word [si + sf_lstclus],0 ; lstclus UN-set from a create?      ;AC000;
  1640                                  
  1641                                  ;		   $if	z		; If it is, set lstclus and cluspos too;AC000;
  1642 000004BA 7508                    		   JNZ D_$IF19
  1643                                  D_$LL19:
  1644                                  					;---------------------------------------
  1645                                  					; Shrink the file, move in new cluspos
  1646                                  					;  and lstclus
  1647                                  					;---------------------------------------
  1648 000004BC C744190000              		       mov  word [si + sf_cluspos],0 ; retrace from start
  1649 000004C1 895C35                  		       mov  [si + sf_lstclus],bx ; ditto
  1650                                  
  1651                                  ;		   $endif		; endif - set lstclus and cluspos      ;AC000;
  1652                                  D_$IF19:
  1653                                  
  1654                                  ;	       $endif			; endif  FAT			       ;AN000;
  1655                                  D_$EN17:
  1656                                  
  1657                                  ;	   $endif			; enndif - > 0			       ;AC000;
  1658                                  D_$EN13:
  1659                                  					;---------------------------------------
  1660                                  					; Link to next SFT
  1661                                  					;---------------------------------------
  1662 000004C4 C5742B                  	   lds	si,[si + sf_chain]
  1663                                  
  1664                                  ;      $endloop 			;				       ;AC000;
  1665 000004C7 EB8C                           JMP SHORT D_$DO5
  1666                                  D_$EN5:
  1667                                  
  1668                                  ;      $endsrch 			;				       ;AC000;
  1669                                  D_$SR5:
  1670                                  					;---------------------------------------
  1671                                  					; All Done
  1672                                  					;---------------------------------------
  1673 000004C9 5E1F                           RestoreReg <SI,DS>
  1674                                  
  1675 000004CB E85901                         LeaveCrit critShare
  1676                                  
  1677                                  ;  $endif				; endif - device and network	       ;AC000;
  1678                                  D_$IF4:
  1679                                  
  1680 000004CE C3                         ret
  1681                                  
  1682                                     EndProc ShSU
  1683                                  
  1684                                     Break <New_Sft - update a new SFT>
  1685                                  
  1686                                  ;******************* START OF SPECIFICATIONS ***********************************
  1687                                  ;
  1688                                  ;  NAME:	   New_Sft - update a new SFT
  1689                                  ;
  1690                                  ;  FUNCTION:	   Copy all SFT information into a NEW sft of a SHARED file.
  1691                                  ;
  1692                                  ;
  1693                                  ;  INPUT:	   ES.DI  has SFT that was just Revised.
  1694                                  ;		   DS:SI  has SFT that is to be updated
  1695                                  ;
  1696                                  ;  OUTPUT:	   SFT is updated.
  1697                                  ;
  1698                                  ;  REGISTERS USED: AX, BX
  1699                                  ;  (NOT RESTORED)
  1700                                  ;
  1701                                  ;  LINKAGE:	   Invoked by: ShSU
  1702                                  ;
  1703                                  ;  EXTERNAL	   Invoke: Call_IFS
  1704                                  ;  REFERENCES:
  1705                                  ;
  1706                                  ;  CHANGE	   04/15/87 - First release
  1707                                  ;  LOG:
  1708                                  ;
  1709                                  ;******************* END OF SPECIFICATIONS *************************************
  1710                                  ;******************+ START OF PSEUDOCODE +**************************************
  1711                                  ;
  1712                                  ;	START New_Sft
  1713                                  ;
  1714                                  ;	update time
  1715                                  ;	update date
  1716                                  ;	update size
  1717                                  ;	if   non - FAT file system
  1718                                  ;		call IFSFUNC
  1719                                  ;	else
  1720                                  ;		update first cluster
  1721                                  ;		update cluster position
  1722                                  ;		update last cluster
  1723                                  ;	endif
  1724                                  ;	return
  1725                                  ;
  1726                                  ;	END New_Sft
  1727                                  ;
  1728                                  ;******************+  END  OF PSEUDOCODE +**************************************
  1729                                  
  1730                                     Procedure New_Sft,near		;				       ;AN000;
  1730          ******************       warning: proc New_Sft... [-w+user]
  1731                                  
  1732 000004CF 8B5C0D                     mov	bx,[si + sf_time] 		; update time
  1733 000004D2 26895D0D                   mov	[es:di + sf_time],bx
  1734 000004D6 8B5C0F                     mov	bx,[si + sf_date] 		; update date
  1735 000004D9 26895D0F                   mov	[es:di + sf_date],bx
  1736 000004DD 8B5C11                     mov	bx,word ptr [si + sf_size]	; update size
  1737 000004E0 26895D11                   mov	word ptr [es:di + sf_size],bx
  1738 000004E4 8B5C13                     mov	bx,word ptr [si + sf_size + 2]
  1739 000004E7 26895D13                   mov	word ptr [es:di + sf_size + 2],bx
  1740 000004EB 26F745050080               test word [es:di + sf_flags],ifs_flag	;				       ;AN000;
  1741                                  
  1742                                  ;  $if	nz				; if non-FAT			       ;AC003;
  1743 000004F1 7405                       JZ D_$IF26
  1744                                  
  1745 000004F3 E81400                         call Call_IFS			; tell IFS of SFT change	       ;AN000;
  1746                                  
  1747                                  ;  $else				; else - its FAT		       ;AN000;
  1748 000004F6 EB11                       JMP SHORT D_$EN26
  1749                                  D_$IF26:
  1750                                  
  1751 000004F8 8B5C0B                         mov  bx,[si + sf_firclus]		; update first cluster
  1752 000004FB 26895D0B                       mov  [es:di + sf_firclus],bx
  1753 000004FF 26C745190000                   mov  word [es:di + sf_cluspos],0	; retrace from start
  1754 00000505 26895D35                       mov  [es:di + sf_lstclus],bx	; ditto
  1755                                  
  1756                                  ;  $endif				; endif  FAT			       ;AN000;
  1757                                  D_$EN26:
  1758                                  
  1759 00000509 C3                         ret					; we'er done                           ;AN000;
  1760                                  
  1761                                     EndProc New_Sft			;				       ;AN000;
  1762                                  
  1763                                     Break <New_CP_Attrib - update the codepage and attrib in SFT>
  1764                                  
  1765                                  ;******************* START OF SPECIFICATIONS ***********************************
  1766                                  ;
  1767                                  ;  NAME:	   New_CP_Attrib - Update codepage and attrib in SFT
  1768                                  ;
  1769                                  ;  FUNCTION:	   Copy all codepage and attrib into SFT of a SHARED file.
  1770                                  ;
  1771                                  ;
  1772                                  ;  INPUT:	   ES.DI  has SFT that was just Revised.
  1773                                  ;		   DS:SI  has SFT that is to be updated
  1774                                  ;
  1775                                  ;  OUTPUT:	   SFT is updated.
  1776                                  ;
  1777                                  ;  REGISTERS USED: AX, BX
  1778                                  ;  (NOT RESTORED)
  1779                                  ;
  1780                                  ;  LINKAGE:	   Invoked by: ShSU
  1781                                  ;
  1782                                  ;  EXTERNAL	   Invoke: Call_IFS
  1783                                  ;  REFERENCES:
  1784                                  ;
  1785                                  ;  CHANGE	   10/06/87 - First release	- D. M. Sewell
  1786                                  ;  LOG:
  1787                                  ;
  1788                                  ;******************* END OF SPECIFICATIONS *************************************
  1789                                  ;******************+ START OF PSEUDOCODE +**************************************
  1790                                  ;
  1791                                  ;	START New_CP_Attrib
  1792                                  ;
  1793                                  ;	Update codepage
  1794                                  ;	Update high attribute
  1795                                  ;	$if ifs_flag
  1796                                  ;		call Call_IFS
  1797                                  ;	$endif
  1798                                  ;	return
  1799                                  ;
  1800                                  ;	END New_CP_Attrib
  1801                                  ;
  1802                                  ;******************+  END  OF PSEUDOCODE +**************************************
  1803                                  
  1804                                  ;; Procedure New_CP_Attrib,near 	;				       ;AN000;
  1805                                  
  1806                                  ;; mov	bx,[es:di].SF_Codepage		; update codepage		       ;an000;
  1807                                  ;; mov	[si].SF_Codepage,bx		;an000; dms;
  1808                                  ;; mov	bl,[es:di].SF_Attr_Hi		; update high attribute 	       ;an000;
  1809                                  ;; mov	[si].SF_Attr,bl 		;an000; dms;
  1810                                  ;; test [es:di].sf_flags,ifs_flag	;				       ;AN000;
  1811                                  
  1812                                  ;; $if	nz				; if non-FAT			       ;AC003;
  1813                                  
  1814                                  ;;     call Call_IFS			; tell IFS of SFT change	       ;AN000;
  1815                                  
  1816                                  ;; $endif				; endif  FAT			       ;AN000;
  1817                                  
  1818                                  ;; ret					; we'er done                           ;AN000;
  1819                                  
  1820                                  ;; EndProc New_CP_Attrib		;				       ;AN000;
  1821                                  
  1822                                  
  1823                                     Break <Call_IFS - warn IFS that SFT has changed>
  1824                                  
  1825                                  ;******************* START OF SPECIFICATIONS ***********************************
  1826                                  ;
  1827                                  ;  NAME:	   Call_IFS - warn IFS that SFT has changed
  1828                                  ;
  1829                                  ;  FUNCTION:	   Call IFS thru 2F interupt.
  1830                                  ;
  1831                                  ;  INPUT:	   DS.SI  points to SFT that was just Revised.
  1832                                  ;
  1833                                  ;  OUTPUT:	   none
  1834                                  ;
  1835                                  ;  REGISTERS USED: AX
  1836                                  ;  (NOT RESTORED)
  1837                                  ;
  1838                                  ;  LINKAGE:	   Invoked by: ShSU, New_SFT
  1839                                  ;
  1840                                  ;  EXTERNAL	   Callinstall
  1841                                  ;  REFERENCES:
  1842                                  ;
  1843                                  ;  CHANGE	   04/15/87 - First release
  1844                                  ;  LOG:
  1845                                  ;
  1846                                  ;******************* END OF SPECIFICATIONS *************************************
  1847                                  ;******************+ START OF PSEUDOCODE +**************************************
  1848                                  ;
  1849                                  ;	START Call_IFS
  1850                                  ;
  1851                                  ;	set up for INT
  1852                                  ;	INT 2F
  1853                                  ;	return
  1854                                  ;
  1855                                  ;	END Call_IFS
  1856                                  ;
  1857                                  ;******************+  END  OF PSEUDOCODE +**************************************
  1858                                  
  1859                                     Procedure Call_IFS,near		;				       ;AN000;
  1859          ******************       warning: proc Call_IFS... [-w+user]
  1860                                  
  1861 0000050A 51B82C11CD2F59             CallInstall BlockUpdate,MultIFS,44,CX,CX ;				       ;AC005;
  1862                                  
  1863 00000511 C3                         ret					;				       ;AN000;
  1864                                  
  1865                                     EndProc Call_IFS			;				       ;AN000;
  1866                                  
  1867                                     Break <Internal error routines>
  1868                                  
  1869                                  ;******************* START OF SPECIFICATIONS ***********************************
  1870                                  ;
  1871                                  ; INTERR - INTernal ERRor routines
  1872                                  ;
  1873                                  ;******************* END OF SPECIFICATIONS *************************************
  1874                                  
  1875                                     Procedure INTERR,NEAR
  1875          ******************       warning: proc INTERR... [-w+user]
  1876                                  
  1877                                     ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING
  1878                                  
  1879 00000512 53561E                     SaveReg <BX,SI,DS>			; save registers that get clobbered
  1880                                  
  1881 00000515 0E                         push cs				; gain addressability
  1882 00000516 1F                         pop	ds
  1883 00000517 89C6                       mov	si,ax				; get message to print
  1884                                  
  1885 00000519 E80B00                     call gout
  1886                                  
  1887 0000051C BE[3305]                   off	si,IntErrMsg
  1888                                  
  1889 0000051F E80500                     call gout
  1890                                  
  1891 00000522 1F5E5B                     RestoreReg <ds,si,bx>
  1892                                  
  1893 00000525 EBFE                    INTERRL:jmp INTERRL			; hang here - we're sick
  1894                                  
  1895 00000527 AC                      gout: lodsb
  1896 00000528 08C0                       or	al,al
  1897 0000052A 7501C3                     retz
  1898 0000052D B40E                       mov	ah,14
  1899 0000052F CD10                       int	10h
  1900 00000531 EBF4                       jmp	gout
  1901                                  
  1902 00000533 53686172653A20496E-     IntErrMsg DB "Share: Internal error", 13, 10, 0
  1902 0000053C 7465726E616C206572-
  1902 00000545 726F720D0A00       
  1903                                  
  1904                                     EndProc INTERR
  1905                                  
  1906                                     Break <INT 2F handler>
  1907                                  
  1908                                     %IF	installed
  1909                                  
  1910                                         public skip_check
  1911                                  
  1912 0000054B 00                      skip_check db 0 			; start with do checking
  1913                                  
  1914 0000054C 00                      state_change db 0			; SHARE change in state flag
  1915                                  					; 0 - no change in state
  1916                                  					; 1 - SHARE load state has changed
  1917                                  
  1918 0000054D CBEB10000000004B42-     iispentry i2F
  1918 00000556 00EBF400<rep 7h>   
  1919                                  
  1920                                         ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:NOTHING
  1921                                  multSHARE equ MultSHARE	; NASM port equate
  1922 00000560 80FC10                         cmp  ah,multSHARE
  1923 00000563 757D                           jnz strict short ContJ
  1924                                  
  1925                                  ; Its for SHARE!  Check to see who is calling:
  1926                                  
  1927                                  ; AL =
  1928                                  ;      81h its us, with /NC - set skip_check
  1929                                  ;			    - return 0F0h - end init
  1930                                  ;      80h its us
  1931                                  ;	if skip_check is reset
  1932                                  ;			    - return 0FFh - loaded
  1933                                  ;	if skip_check is set
  1934                                  ;			    - reset skip_check
  1935                                  ;			    - return 0F0h - end init
  1936                                  ;
  1937                                  ;      40h its IFSFUNC	    - return 0FFh - loaded
  1938                                  ;
  1939                                  ;      00h its anyone else  - clear skip_check
  1940                                  ;			    - return 0FFh - loaded
  1941                                  
  1942 00000565 A880                           test al,80h			; is it share?			       ;AN010;
  1943                                  ;      $if  nz				; if it is			       ;AN010;
  1944 00000567 7436                           JZ D_$IF29
  1945 00000569 2401                    	   and	al,1			; is /NC set			       ;AN010;
  1946 0000056B B0F0                    	   mov	al,0F0H 		; assume a quiet return 	       ;AN010;
  1947                                  ;	   $if	nz			; if it is			       ;AN010;
  1948 0000056D 7416                    	   JZ D_$IF30
  1949 0000056F 2E803E[4B05]01          	       cmp  byte [cs:skip_check],1	; is skip_check set ?		       ;AN011;
  1950                                  ;	       $if  ne			; if it is			       ;AN011;
  1951 00000575 7406                    	       JE D_$IF31
  1952 00000577 2EC606[4C05]01          		   mov	byte [cs:state_change],1	; set the change state flag	       ;AN011;
  1953                                  ;	       $endif			;				       ;AN011;
  1954                                  D_$IF31:
  1955 0000057D 2EC606[4B05]01          	       mov  byte [cs:skip_check],1	; set skip_check		       ;AN010;
  1956                                  ;	   $else			;  /NC not requested		       ;AN010;
  1957 00000583 EB18                    	   JMP SHORT D_$EN30
  1958                                  D_$IF30:
  1959 00000585 2E803E[4B05]01          	       cmp  byte [cs:skip_check],1	; is skip_check set ?		       ;AN010;
  1960                                  ;	       $if  e			; if it is			       ;AN010;
  1961 0000058B 750E                    	       JNE D_$IF34
  1962 0000058D 2EC606[4C05]01          		   mov	byte [cs:state_change],1	; set the change state flag	       ;AN011;
  1963 00000593 2EC606[4B05]00          		   mov	byte [cs:skip_check],0	; reset skip_check		       ;AN010;
  1964                                  ;	       $else			; else , its already clear	       ;AN010;
  1965 00000599 EB02                    	       JMP SHORT D_$EN34
  1966                                  D_$IF34:
  1967 0000059B B0FF                    		   mov	al,0FFH 	;    and we are loaded		       ;AN010;
  1968                                  ;	       $endif			;				       ;AN010;
  1969                                  D_$EN34:
  1970                                  ;	   $endif			;				       ;AN010;
  1971                                  D_$EN30:
  1972                                  
  1973                                  ;      $else				;				       ;AN010;
  1974 0000059D EB1E                           JMP SHORT D_$EN29
  1975                                  D_$IF29:
  1976 0000059F 3C40                    	   cmp	al,40h			; is it IFSFUNC?		       ;AN010;
  1977                                  ;	   $if	ne			; if it is not			       ;AN010;
  1978 000005A1 7418                    	   JE D_$IF39
  1979                                  
  1980 000005A3 08C0                    	       or   al,al		;    loop it any other value caus'     ;AC010;
  1981                                  Freeze:
  1982                                  freeze equ Freeze	; NASM port label
  1983 000005A5 75FE                    	       jnz  freeze		;    no one should EVER issue this     ;AC010;
  1984 000005A7 2E803E[4B05]01          	       cmp  byte [cs:skip_check],1	; is skip_check set ?		       ;AN010;
  1985                                  ;	       $if  e			; if it is			       ;AN011;
  1986 000005AD 7506                    	       JNE D_$IF40
  1987 000005AF 2EC606[4C05]01          		   mov	byte [cs:state_change],1	; set the change state flag	       ;AN011;
  1988                                  ;	       $endif			;				       ;AN011;
  1989                                  D_$IF40:
  1990 000005B5 2EC606[4B05]00          	       mov  byte [cs:skip_check],0	;    and believe it !		       ;AN011;
  1991                                  
  1992                                  ;	   $endif			;				       ;AN010;
  1993                                  D_$IF39:
  1994 000005BB B0FF                    	   mov	al,0FFH 		;  else - say we are here	       ;AN010;
  1995                                  ;      $endif				;				       ;AN010;
  1996                                  D_$EN29:
  1997 000005BD 2E803E[4C05]01                 cmp  byte [cs:state_change],1		; SHARE installed state may have change;AN011;d
  1998                                  ;      $if  e				;    - update DOS		       ;AN011;
  1999 000005C3 751C                           JNE D_$IF44
  2000 000005C5 50                      	   push ax			;				       ;AN011;
  2001 000005C6 06                      	   push es			;  this is interesting -	       ;AN011;
  2002 000005C7 B452                    	   MOV	AH,Get_In_Vars		;    if SHARE =1 and DOS =1 - no change;AN011;
  2003 000005C9 CD21                    	   INT	21h			;    if SHARE = 		       ;AN011;
  2004                                  
  2005                                  	   ASSUME ES:DOSGROUP
  2006                                  
  2007 000005CB 2EA0[4B05]              	   mov	al,[cs:skip_check]		; get the SHARE operating mode	       ;AN011;
  2008 000005CF 3C01                    	   cmp	al,1			;  is it a /nc	  -  tell DOS  " 1 "   ;AN011;
  2009                                  ;	   $if	ne			; if not			       ;AN011;
  2010 000005D1 7402                    	   JE D_$IF45
  2011 000005D3 FEC8                    	       dec  al			;   "full" SHARE  -  tell DOS  " -1 "  ;AN011;
  2012                                  ;	   $endif			;				       ;AN011;
  2013                                  D_$IF45:
  2014                                  fShare equ fshare	; NASM port label
  2015 000005D5 26A2[0000]              	   MOV	[es:fShare],al		; tell DOS we are here		       ;AN011;
  2016 000005D9 07                      	   pop	es			;				       ;AN011;
  2017 000005DA 58                      	   pop	ax			;				       ;AN011;
  2018 000005DB 2EC606[4C05]00          	   mov	byte [cs:state_change],0		; REset the change state flag	       ;AN011;
  2019                                  ;      $endif				;				       ;AN011;
  2020                                  D_$IF44:
  2021                                  
  2022                                         ASSUME ES:nothing
  2023                                  
  2024 000005E1 CF                             iret
  2025                                  ContJ:
  2026 000005E2 2EFF2E[5005]                   JMP  far [cs:i2F.next]
  2027                                  
  2028                                  
  2029                                         ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSGroup
  2030                                  
  2031                                  %macro shareentry 1-*
  2032                                   %rep %0
  2033                                  J%1 proc far
  2034                                  	call %1
  2035                                  	ret
  2036                                  J%1 endp
  2037                                    %rotate 1
  2038                                   %endrep
  2039                                  %endmacro
  2040                                  
  2041                                  shareentry MFT_Enter, MFTClose, MFTClu, MFTCloseP, MFTCloN, Set_Mult_Block, Clr_Mult_Block
  2032                              <1>  %rep %0
  2033                              <1> J%1 proc far
  2034                              <1>  call %1
  2035                              <1>  ret
  2036                              <1> J%1 endp
  2037                              <1>  %rotate 1
  2038                              <1>  %endrep
  2033                              <2> J%1 proc far
  2034 000005E7 E8(0000)            <2>  call %1
  2035 000005EA CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 000005EB E8(0000)            <2>  call %1
  2035 000005EE CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 000005EF E8(0000)            <2>  call %1
  2035 000005F2 CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 000005F3 E8(0000)            <2>  call %1
  2035 000005F6 CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 000005F7 E8(0000)            <2>  call %1
  2035 000005FA CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 000005FB E8(0000)            <2>  call %1
  2035 000005FE CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 000005FF E8(0000)            <2>  call %1
  2035 00000602 CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2042                                  shareentry Chk_Block, MFT_Get, ShSave, ShChk, ShCol, ShCloseFile, ShSU
  2032                              <1>  %rep %0
  2033                              <1> J%1 proc far
  2034                              <1>  call %1
  2035                              <1>  ret
  2036                              <1> J%1 endp
  2037                              <1>  %rotate 1
  2038                              <1>  %endrep
  2033                              <2> J%1 proc far
  2034 00000603 E8(0000)            <2>  call %1
  2035 00000606 CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 00000607 E8(0000)            <2>  call %1
  2035 0000060A CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 0000060B E814FD              <2>  call %1
  2035 0000060E CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 0000060F E8F8FC              <2>  call %1
  2035 00000612 CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 00000613 E827FD              <2>  call %1
  2035 00000616 CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 00000617 E8A8FD              <2>  call %1
  2035 0000061A CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2033                              <2> J%1 proc far
  2034 0000061B E812FE              <2>  call %1
  2035 0000061E CB                  <2>  ret
  2036                              <2> J%1 endp
  2037                              <2>  %rotate 1
  2043                                  
  2044                                         Procedure EcritShare,NEAR
  2044          ******************       warning: proc EcritShare... [-w+user]
  2045 0000061F 50                             PUSH AX
  2046 00000620 B80180                         MOV  AX,8000h+critShare
  2047                                  int_ibm equ int_IBM	; NASM port equate
  2048 00000623 CD2A                           INT  int_ibm
  2049 00000625 58                             POP  AX
  2050 00000626 C3                             ret
  2051                                         EndProc EcritShare
  2052                                  
  2053                                         Procedure LcritShare,NEAR
  2053          ******************       warning: proc LcritShare... [-w+user]
  2054 00000627 50                             PUSH AX
  2055 00000628 B80181                         MOV  AX,8100h+critShare
  2056 0000062B CD2A                           INT  int_ibm
  2057 0000062D 58                             POP  AX
  2058 0000062E C3                             ret
  2059                                         EndProc LcritShare
  2060                                  
  2061                                     %ENDIF
  2062                                  
  2063                                     BREAK <MFT and Lock Record Data Area>
  2064                                  
  2065                                  ;******************* START OF SPECIFICATIONS ***********************************
  2066                                  ;
  2067                                  ;	first MFT record
  2068                                  ;
  2069                                  ;	Note that the name field can have garbage after the trailing
  2070                                  ;	00 byte.  This is because the field might be too long, but
  2071                                  ;	not long enough (at least 16 extra bytes) to fragment.
  2072                                  ;	in this case we copy the length of the string area, not
  2073                                  ;	the length of the string and thus may copy tailing garbage.
  2074                                  ;
  2075                                  ;******************* END OF SPECIFICATIONS *************************************
  2076                                  
  2077                                  PoolSize equ 2048
  2078                                  
  2079                                     PUBLIC MFT
  2080                                  
  2081 0000062F 00                      MFT DB	0				; free
  2082 00000630 0008                       DW	PoolSize			; PoolSize bytes long
  2083                                  
  2084                                  ;   %IFn  Installed
  2085                                  ;
  2086                                  ;       DB   (PoolSize-3) DUP(0) 	; leave rest of record
  2087                                  ;MEND   DB   -1				; END record
  2088                                  ;
  2089                                  ;lck1   DW   0				; link
  2090                                  ;       DB   RLR_entry_struc_size-2 DUP(0)
  2091                                  ;lck2   DW   OFFSET lck1 wrt DOSGROUP	; link
  2092                                  ;       DB   RLR_entry_struc_size-2 DUP(0)
  2093                                  ;lck3   DW   OFFSET lck2 wrt DOSGROUP	; link
  2094                                  ;       DB   RLR_entry_struc_size-2 DUP(0)
  2095                                  ;lck4   DW   OFFSET lck3 wrt DOSGROUP	; link
  2096                                  ;       DB   RLR_entry_struc_size-2 DUP(0)
  2097                                  ;lck5   DW   OFFSET lck4 wrt DOSGROUP	; link
  2098                                  ;       DB   RLR_entry_struc_size-2 DUP(0)
  2099                                  ;lck6   DW   OFFSET lck5 wrt DOSGROUP	; link
  2100                                  ;       DB   RLR_entry_struc_size-2 DUP(0)
  2101                                  ;lck7   DW   OFFSET lck6 wrt DOSGROUP	; link
  2102                                  ;       DB   RLR_entry_struc_size-2 DUP(0)
  2103                                  ;lck8   DW   OFFSET lck7 wrt DOSGROUP	; link
  2104                                  ;       DB   RLR_entry_struc_size-2 DUP(0)
  2105                                  ;
  2106                                  ;section SHARE	; CODE ENDS
  2107                                  ;
  2108                                  ;       %warning out: Ignore this END error (blasted assembler)
  2109                                  ;
  2110                                  ;   %ENDIF
  2111                                  
  2112                                  %IF Installed
  2113                                  
  2114                                     ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:NOTHING
  2115                                  
  2116                                  shareinit equ SHAREINIT	; NASM port label
  2117                                  shareinit_minus_MFT equ shareinit - MFT
  2118                                         %IF   shareinit_minus_MFT LT PoolSize
  2119 00000632 0008                    InitSpace  DW	PoolSize
  2120                                         %ELSE
  2121                                  InitSpace  DW	shareinit_minus_MFT
  2122                                         %ENDIF
  2123 00000634 1400                    InitLocks DW 20
  2124                                  
  2125                                  
  2126                                  JTable LABEL BYTE
  2127 00000636 ????????                   DD	?
  2128 0000063A [E705][ssss]               dw	JMFT_Enter, seg JMFT_Enter			;   1	MFT_enter
  2129 0000063E [EB05][ssss]               dw	JMFTClose, seg JMFTClose			;   2	MFTClose
  2130 00000642 [EF05][ssss]               dw	JMFTClu, seg JMFTClu 			;   3	MFTClu
  2131 00000646 [F305][ssss]               dw	JMFTCloseP, seg JMFTCloseP			;   4	MFTCloseP
  2132 0000064A [F705][ssss]               dw	JMFTCloN, seg JMFTCloN			;   5	MFTCloN
  2133 0000064E [FB05][ssss]               dw	JSet_Mult_Block, seg JSet_Mult_Block 		;   6	Set_Mult_Block
  2134 00000652 [FF05][ssss]               dw	JClr_Mult_Block, seg JClr_Mult_Block 		;   7	Clr_Mult_Block
  2135 00000656 [0306][ssss]               dw	JChk_Block, seg JChk_Block			;   8	Chk_Block
  2136 0000065A [0706][ssss]               dw	JMFT_Get, seg JMFT_Get			;   9	MFT_get
  2137 0000065E [0B06][ssss]               dw	JShSave, seg JShSave 			;   10	ShSave
  2138 00000662 [0F06][ssss]               dw	JShChk, seg JShChk				;   11	ShChk
  2139 00000666 [1306][ssss]               dw	JShCol, seg JShCol				;   12	ShCol
  2140 0000066A [1706][ssss]               dw	JShCloseFile, seg JShCloseFile			;   13	ShCloseFile
  2141 0000066E [1B06][ssss]               dw	JShSU, seg JShSU				;   14	ShSU
  2142                                  JTableLen equ $ - JTable
  2143                                  
  2144                                  ;	$SALUT	(4,9,17,36)
  2145                                  				   ;---------------------------------------
  2146                                  				   ;  STRUCTURE TO DEFINE ADDITIONAL
  2147                                  				   ;  COMMAND LINE PARAMETERS
  2148                                  				   ;---------------------------------------
  2149                                  PARMS	LABEL	DWORD
  2150 00000672 [7606]                  	DW	OFFSET PARMSX	   ; POINTER TO PARMS STRUCTURE
  2151 00000674 00                      	DB	0		   ; NO DELIMITER LIST FOLLOWS
  2152 00000675 00                      	DB	0		   ; NUMBER OF ADDITIONAL DELIMITERS
  2153                                  
  2154                                  				   ;---------------------------------------
  2155                                  				   ;  STRUCTURE TO DEFINE SORT
  2156                                  				   ;  SYNTAX REQUIREMENTS
  2157                                  				   ;---------------------------------------
  2158                                  PARMSX	LABEL	BYTE
  2159 00000676 0000                    	DB	0,0		   ; THERE ARE NO POSITIONAL PARAMETERS
  2160 00000678 01                      	DB	1		   ; THERE ARE ONLY ONE TYPE OF SWITCH
  2161 00000679 [7D06]                  	DW	OFFSET SW	   ; POINTER TO THE SWITCH DEFINITION AREA
  2162 0000067B 0000                    	DW	0		   ; THERE ARE NO KEYWORDS IN SHARE SYNTAX
  2163                                  
  2164                                  				   ;---------------------------------------
  2165                                  				   ;  STRUCTURE TO DEFINE THE SWITCHES
  2166                                  				   ;---------------------------------------
  2167                                  
  2168                                  SW	LABEL	WORD
  2169 0000067D 0180                    	DW	08001H		   ; MUST BE NUMERIC
  2170 0000067F 0000                    	DW	0		   ; NO FUNCTION FLAGS
  2171 00000681 [9B06]                  	DW	OFFSET SWITCH_BUFF ; PLACE RESULT IN SWITCH BUFFER
  2172 00000683 [9006]                  	DW	OFFSET VALUES	   ; NEED VALUE LIST
  2173 00000685 03                      	DB	3		   ; TWO SWITCHES IN FOLLOWING LIST
  2174 00000686 2F4600                  F_SW	DB	"/F",0		   ; /F: INDICATES n FILESPACE REQUESTED
  2175 00000689 2F4C00                  L_SW	DB	"/L",0		   ; /L: INDICATES m LOCKS REQUESTED
  2176 0000068C 2F4E4300                N_SW	DB	"/NC",0 	   ; /NC: INDICATES no checking required
  2177                                  
  2178                                  
  2179                                  				   ;---------------------------------------
  2180                                  				   ;  VALUE LIST DEFINITION FOR n
  2181                                  				   ;---------------------------------------
  2182                                  
  2183                                  VALUES	LABEL	BYTE
  2184 00000690 01                      	DB	1		   ; ONE VALUE ALLOWED
  2185 00000691 01                      	DB	1		   ; ONLY ONE RANGE
  2186 00000692 01                      	DB	FILE_SWITCH	   ; IDENTIFY IT AS n
  2187 00000693 01000000FFFF0000        	DD	1,65535 	   ; USER CAN SPECIFY /+1 THROUGH /+65535
  2188                                  
  2189                                  				   ;---------------------------------------
  2190                                  				   ;  RETURN BUFFER FOR SWITCH INFORMATION
  2191                                  				   ;---------------------------------------
  2192                                  ;		$SALUT	  (4,17,27,36)
  2193                                  
  2194                                  SWITCH_BUFF	LABEL	  BYTE
  2195 0000069B ??                      SW_TYPE 	DB	  ?	   ; TYPE RETURNED
  2196 0000069C ??                      SW_ITEM_TAG	DB	  ?	   ; SPACE FOR ITEM TAG
  2197 0000069D ????                    SW_SYN		DW	  ?	   ; POINTER TO SWITCH LIST ENTRY
  2198 0000069F ????????                SW_VALUE	DD	  ?	   ; SPACE FOR VALUE
  2199                                  
  2200                                  ;  $SALUT (4,4,9,41)
  2201                                  
  2202                                     Break <INIT - INITalization routines>
  2203                                  
  2204                                  ;******************* START OF SPECIFICATIONS ***********************************
  2205                                  ;
  2206                                  ; INIT - INITalization routines
  2207                                  ;
  2208                                  ;******************* END OF SPECIFICATIONS *************************************
  2209                                  
  2210                                     Procedure Init,NEAR
  2210          ******************       warning: proc Init... [-w+user]
  2211                                  
  2212 000006A3 0E                         PUSH CS
  2213 000006A4 1F                         POP	DS
  2214                                  
  2215                                     ASSUME DS:SHARE
  2216                                  
  2217 000006A5 8B1E[3206]                 MOV	BX,[InitSpace]
  2218                                  
  2219 000006A9 83EB03                     SUB	BX,3
  2220 000006AC BE[2F06]                   MOV	SI,OFFSET MFT
  2221 000006AF 895C01                     MOV	WORD PTR [SI+1],BX		; length of first item
  2222 000006B2 01DE                       ADD	SI,BX				; link to end of structure
  2223 000006B4 C604FF                     MOV	BYTE PTR [SI],-1		; signal end
  2224 000006B7 46                         INC	SI				; point to next free byte
  2225                                  
  2226                                  initlocks equ InitLocks	; NASM port label
  2227 000006B8 8B0E[3406]                 MOV	CX,[initlocks]			; count for loop
  2228 000006BC B80000                     MOV	AX,0
  2229                                  
  2230                                  ;  $do					;				       ;AC000;
  2231                                  D_$DO48:
  2232                                  
  2233                                  RLR_next equ rlr_next	; NASM port equate
  2234 000006BF 8904                           MOV  [SI + RLR_next],AX		; link in previous
  2235 000006C1 89F0                           MOV  AX,SI			; this is now previous
  2236                                  RLR_Entry_struc_size equ RLR_entry_struc_size	; NASM port equate
  2237 000006C3 83C612                         ADD  SI,RLR_Entry_struc_size		; move to next object
  2238                                  
  2239                                  ;  $enddo loop				;				       ;AC000;
  2240 000006C6 E2F7                       LOOP D_$DO48
  2241                                  
  2242 000006C8 A3[0000]                   MOV	[FreLock],AX			; point to beginning of free list
  2243                                  
  2244 000006CB 8CCA                       MOV	DX,CS
  2245 000006CD 8CC3                       MOV	BX,ES
  2246 000006CF 29DA                       SUB	DX,BX
  2247 000006D1 83C60F                     ADD	SI,15
  2248 000006D4 D1DE                       RCR	SI,1
  2249 000006D6 D1EE                       SHR	SI,1
  2250 000006D8 D1EE                       SHR	SI,1
  2251 000006DA D1EE                       SHR	SI,1
  2252                                  
  2253 000006DC 01D6                       ADD	SI,DX
  2254 000006DE 56                         PUSH SI				; # of paras for share on stack
  2255                                  
  2256 000006DF B82F35                     MOV	AX,(Get_Interrupt_Vector << 8) + 2Fh
  2257 000006E2 CD21                       INT	21h
  2258 000006E4 891E[5005]                 MOV	WORD PTR [i2F.next],BX
  2259 000006E8 8C06[5205]                 MOV	WORD PTR [i2F.next + 2],ES
  2260 000006EC B82F25                     MOV	AX,(Set_Interrupt_Vector << 8) + 2Fh
  2261 000006EF BA[4E05]                   MOV	DX, i2F
  2262 000006F2 CD21                       INT	21h
  2263                                  					;---------------------------------------
  2264                                  					; Notify the DOS that we are around so that
  2265                                  					; the DOS can make expensive calls to us.
  2266                                  					;---------------------------------------
  2267 000006F4 B452                       MOV	AH,Get_In_Vars
  2268 000006F6 CD21                       INT	21h
  2269                                  
  2270                                     ASSUME ES:DOSGROUP
  2271                                  
  2272 000006F8 A0[4B05]                   mov	al,[skip_check]			; get the SHARE operating mode	       ;AN011;
  2273 000006FB 3C01                       cmp	al,1				;  is it a /nc	  -  tell DOS  " 1 "   ;AN011;
  2274                                  
  2275                                  ;  $if	ne				; if not			       ;AN011;
  2276 000006FD 7402                       JE D_$IF50
  2277 000006FF FEC8                           dec  al				;   "full" SHARE  -  tell DOS  " -1 "  ;AN011;
  2278                                  ;  $endif				;
  2279                                  D_$IF50:
  2280                                  
  2281 00000701 26A2[0000]                 MOV	[es:fShare],al			; tell DOS we are here		       ;AC011;
  2282                                  					;---------------------------------------
  2283                                  					; Cram in the new jump table
  2284                                  					;---------------------------------------
  2285 00000705 FA                         CLI
  2286 00000706 BE[3606]                   MOV	SI,OFFSET JTable
  2287 00000709 BF[0000]                   MOV	DI,OFFSET JShare
  2288 0000070C B91E00                     MOV	CX,JTableLen/2
  2289 0000070F F3A5                       REP	MOVSW
  2290                                  					;---------------------------------------
  2291                                  					; Examine the size of the FCB cache.
  2292                                  					; If it is NOT the system default of 4,0
  2293                                  					; change it (via reallocation) to 16,8.
  2294                                  					; The old table is lost.
  2295                                  					;---------------------------------------
  2296                                     ASSUME DS:NOTHING
  2297                                  
  2298 00000711 26833E[0000]00             CMP	word [es:KeepCount],0
  2299                                  
  2300                                  ;  $if	z,and				; if the ",0"  part and 	       ;AC000;
  2301 00000717 754F                       JNZ D_$IF52
  2302                                  
  2303 00000719 26C5771A                   LDS	SI,[ES:BX + SYSI_FCB]		; point to the existing cache
  2304                                  sfCount equ SFCount	; NASM port equate
  2305 0000071D 837C0404                   CMP	word [SI + sfCount],4
  2306                                  
  2307                                  ;  $if	z				; if the "4,"  part then	       ;AC000;
  2308 00000721 7545                       JNZ D_$IF52
  2309                                  
  2310                                  					;---------------------------------------
  2311                                  					; Whammo, we need to allocate 16 * size
  2312                                  					; of SF_entry + size of sfTable.
  2313                                  					; Compute this size in paragraphs
  2314                                  					;---------------------------------------
  2315 00000723 B81000                         MOV  AX,16
  2316 00000726 B93B00                         MOV  CX,sf_entry_struc_size
  2317 00000729 F7E1                           MUL  CX
  2318                                  sf_struc_size equ SF_struc_size	; NASM port equate
  2319 0000072B 83C006                         ADD  AX,(sf_struc_size) - 2
  2320                                  					;---------------------------------------
  2321                                  					; This size is in bytes...
  2322                                  					; Round up to paragraph size
  2323                                  					;---------------------------------------
  2324 0000072E 83C00F                         ADD  AX,0Fh
  2325 00000731 D1D8                           RCR  AX,1
  2326 00000733 D1E8                           SHR  AX,1
  2327 00000735 D1E8                           SHR  AX,1
  2328 00000737 D1E8                           SHR  AX,1
  2329                                  					;---------------------------------------
  2330                                  					; AX is the number of paragraphs to add.
  2331                                  					; Word on stack is current TNR size.
  2332                                  					; Make dos point to new table
  2333                                  					;---------------------------------------
  2334 00000739 26C7471A0000                   MOV  WORD PTR [ES:BX + SYSI_FCB],0
  2335 0000073F 268C571C                       MOV  WORD PTR [ES:BX + SYSI_FCB + 2],SS
  2336 00000743 5E                             POP  SI
  2337 00000744 2601771C                       ADD  WORD PTR [ES:BX + SYSI_FCB + 2],SI
  2338                                  					;---------------------------------------
  2339                                  					; Initialize table parts, next link
  2340                                  					;   and size
  2341                                  					;---------------------------------------
  2342 00000748 268E5F1C                       MOV  DS,WORD PTR [ES:BX + SYSI_FCB + 2]
  2343                                  sfLink equ SFLink	; NASM port equate
  2344 0000074C C7060000FFFF                   MOV  WORD PTR [sfLink],-1
  2345 00000752 C7060200FFFF                   MOV  WORD PTR [sfLink+2],-1
  2346                                  sfcount equ SFCount	; NASM port equate
  2347 00000758 C70604001000                   MOV  word [sfcount],16
  2348                                  					;---------------------------------------
  2349                                  					; Set up succeeding LRU size
  2350                                  					;---------------------------------------
  2351 0000075E 26C706[0000]0800               MOV  word [es:KeepCount],8
  2352                                  
  2353 00000765 01C6                           ADD  SI,AX
  2354 00000767 56                             PUSH SI
  2355                                  
  2356                                  ;  $endif				; endif - "4,0" 		       ;AC000;
  2357                                  D_$IF52:
  2358                                  
  2359                                  					;---------------------------------------
  2360                                  					; Clean out the FCB Cache
  2361                                  					;---------------------------------------
  2362 00000768 26C47F1A                   LES	DI,[ES:BX + SYSI_FCB]
  2363                                  
  2364                                     ASSUME ES:Nothing
  2365                                  
  2366 0000076C 268B4D04                   MOV	CX,[ES:DI + SFCount]
  2367 00000770 8D7D06                     LEA	DI,[DI + SFTable]
  2368                                  
  2369                                  ;  $do					;				       ;AC000;
  2370                                  D_$DO54:
  2371                                  
  2372 00000773 26C7050000                     MOV  word [ES:DI + sf_ref_count],0
  2373 00000778 26C745150000                   MOV  WORD PTR [ES:DI + sf_position],0
  2374 0000077E 26C745170000                   MOV  WORD PTR [ES:DI + sf_position + 2],0
  2375 00000784 83C73B                         ADD  DI,sf_entry_struc_size
  2376                                  
  2377                                  ;  $enddo loop				;				       ;AC000;
  2378 00000787 E2EA                       LOOP D_$DO54
  2379                                  
  2380 00000789 FB                         STI
  2381                                  
  2382                                     ASSUME ES:NOTHING
  2383                                  
  2384 0000078A 31DB                       XOR	BX,BX
  2385 0000078C B90500                     MOV	CX,5				; StdIN,StdOUT,StdERR,StdAUX,StdPRN
  2386                                  
  2387                                  ;  $do					; Close STD handles before	       ;AC000;
  2388                                  D_$DO56:
  2389                                  					; keep process
  2390                                  CLOSE equ Close	; NASM port equate
  2391 0000078F B43E                           MOV  AH,CLOSE
  2392 00000791 CD21                           INT  21H
  2393 00000793 43                             INC  BX
  2394                                  
  2395                                  ;  $enddo loop				;				       ;AC000;
  2396 00000794 E2F9                       LOOP D_$DO56
  2397                                  
  2398 00000796 5A                         POP	DX				; T+R size in DX
  2399 00000797 B80031                     MOV	AX,(Keep_Process << 8) + 0
  2400 0000079A CD21                       INT	21h
  2401                                  EXIT equ Exit	; NASM port equate
  2402 0000079C B8014C                     MOV	AX,(EXIT << 8) + 1
  2403 0000079F CD21                       INT	21h				; We'er now resident, return to DOS
  2404                                  
  2405                                     EndProc Init
  2406                                  
  2407                                     Break <SHAREINIT - Share initialization entry point>
  2408                                  
  2409                                  ;******************* START OF SPECIFICATIONS ***********************************
  2410                                  ;
  2411                                  ; SHAREINIT - Share initialization entry point
  2412                                  ;
  2413                                  ;******************* END OF SPECIFICATIONS *************************************
  2414                                  
  2415                                  ..start:
  2416                                     Procedure SHAREINIT,NEAR
  2416          ******************       warning: proc SHAREINIT... [-w+user]
  2417                                  
  2418                                     ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:STACK
  2419                                  
  2420                                  ;  int 3
  2421 000007A1 90                         nop
  2422 000007A2 90                         nop
  2423                                  
  2424                                  
  2425 000007A3 1E                         PUSH DS				; save PSP segment for later stack     ;AC001;
  2426                                  					;     relocation
  2427                                  
  2428                                  					;---------------------------------------
  2429                                  					; Load Messages
  2430                                  					;---------------------------------------
  2431 000007A4 E8AE00                     call ShLoadMsg			;				       ;AN000;
  2432                                  					;---------------------------------------
  2433                                  					; At this point, the DOS version is OK.
  2434                                  					;  (checked by SYSLOADMSG)
  2435                                  					;  Now - Check the DOS data version
  2436                                  					;---------------------------------------
  2437                                  ;  $if	c,or				; if not same as us			;AC009;
  2438 000007A7 720C                       JC D_$LL58
  2439                                  
  2440 000007A9 B452                       MOV	AH,Get_In_Vars
  2441 000007AB CD21                       INT	21h
  2442                                  
  2443                                     ASSUME ES:DOSGROUP
  2444                                  
  2445 000007AD 26803E[0000]01             CMP	byte [es:DataVersion],ShareDataVersion
  2446                                  
  2447                                     ASSUME ES:NOTHING
  2448                                  
  2449                                  ;  $if	ne				; if not same as us			;AC000;
  2450 000007B3 7406                       JE D_$IF58
  2451                                  D_$LL58:
  2452                                  Utility_Msg_CLASS equ UTILITY_MSG_CLASS	; NASM port equate
  2453 000007B5 B801FF                         mov  ax,(Utility_Msg_CLASS << 8) + Bad_DOS_Ver ;			;AN000;
  2454 000007B8 E8BB00                         call ShDispMsg			;					;AN000;
  2455                                  ;  $endif				; endif - not same as us		;AC000;
  2456                                  D_$IF58:
  2457                                  
  2458                                  					;---------------------------------------
  2459                                  					; Deallocate memory if possible
  2460                                  					;---------------------------------------
  2461                                  pdb_environ equ PDB_environ	; NASM port equate
  2462 000007BB A12C00                     mov	ax,[pdb_environ]
  2463 000007BE 09C0                       or	ax,ax
  2464                                  
  2465                                  ;  $if	nz				; if > 0 deallocate memory	       ;AC000;
  2466 000007C0 7406                       JZ D_$IF60
  2467 000007C2 8EC0                           mov  es,ax
  2468                                  dealloc equ Dealloc	; NASM port equate
  2469 000007C4 B449                           mov  ah,dealloc
  2470 000007C6 CD21                           int  21h
  2471                                  ;  $endif				; endif - > 0 deallocate memory        ;AC000;
  2472                                  D_$IF60:
  2473                                  
  2474                                  					;---------------------------------------
  2475                                  					; Parse the command line
  2476                                  					;---------------------------------------
  2477 000007C8 E81501                     call ShComndParse			;				       ;AN000;
  2478                                  					;---------------------------------------
  2479                                  					; Check to see if share already installed.
  2480                                  					;---------------------------------------
  2481 000007CB 2EA0[4B05]                 mov	al,[cs:skip_check]			;				       ;AN010;
  2482 000007CF 0C80                       or	al,80h				; signal its SHARE calling	       ;AN010;
  2483                                  multShare equ MultSHARE	; NASM port equate
  2484 000007D1 B410                       mov	ah,multShare			;				       ;AC010;
  2485 000007D3 CD2F                       INT	2Fh				;				       ;AC010;
  2486 000007D5 3CFF                       CMP	AL,0FFh 			;				       ;AC010;
  2487                                  
  2488                                  ;  $if	z				; if we'er already loaded              ;AC010;
  2489 000007D7 7506                       JNZ D_$IF62
  2490 000007D9 B802FF                         mov  ax,(UTILITY_MSG_CLASS << 8) + Sh_Already_Loaded ;		       ;AC010;
  2491 000007DC E89700                         call ShDispMsg			;				       ;AC010;
  2492                                  ;  $endif				; endif - we'er already loaded         ;AC010;
  2493                                  D_$IF62:
  2494                                  
  2495                                  					;---------------------------------------
  2496                                  					; Check to see if share installed and
  2497                                  					; a toggle was just performed
  2498                                  					;---------------------------------------
  2499 000007DF 3CF0                       CMP	AL,0F0h 			;				       ;AN010;
  2500                                  
  2501                                  ;  $if	z				; if we'er already loaded              ;AN010;
  2502 000007E1 7505                       JNZ D_$IF64
  2503                                  
  2504 000007E3 B8004C                         MOV  AX,(EXIT << 8)		;				       ;AN010;
  2505 000007E6 CD21                           INT  21h 			; Return to DOS with RC = 0	       ;AN010;
  2506                                  
  2507                                  ;  $endif				; endif - we'er already loaded         ;AN010;
  2508                                  D_$IF64:
  2509                                  
  2510                                  					;---------------------------------------
  2511                                  					; All set to initialize the world.
  2512                                  					; Make sure that we have enough memory
  2513                                  					; for everything in our little 64K here.
  2514                                  					; First get avail count of paras.
  2515                                  					;---------------------------------------
  2516 000007E8 07                         pop	es				; recover PSP segment		       ;AC002;
  2517 000007E9 06                         push es				;				       ;AC002;
  2518 000007EA 8CCB                       MOV	BX,CS
  2519                                  PDB_Block_Len equ PDB_block_len	; NASM port equate
  2520 000007EC 26A10200                   MOV	AX,[ES:PDB_Block_Len]
  2521 000007F0 29D8                       SUB	AX,BX
  2522                                  					;---------------------------------------
  2523                                  					; AX has the number of paragraphs
  2524                                  					; available to us after the beginning
  2525                                  					; of CS.  Max this out at 64K.
  2526                                  					;---------------------------------------
  2527 000007F2 3D0010                     CMP	AX,1000h
  2528                                  
  2529                                  ;  $if	a				; if more than we can handle	       ;AC000;
  2530 000007F5 7603                       JNA D_$IF66
  2531 000007F7 B80010                         MOV  AX,1000h			;  force it
  2532                                  ;  $endif				; endif - more than we can handle      ;AC000;
  2533                                  D_$IF66:
  2534                                  
  2535                                  					;---------------------------------------
  2536                                  					; Take AX paragraphs and convert them
  2537                                  					; into BX:CX bytes.
  2538                                  					;---------------------------------------
  2539 000007FA 31DB                       XOR	BX,BX
  2540 000007FC D1E0                       SHL	AX,1
  2541 000007FE D1E0                       SHL	AX,1
  2542 00000800 D1E0                       SHL	AX,1
  2543 00000802 D1E0                       SHL	AX,1
  2544 00000804 83D300                     ADC	BX,0
  2545 00000807 89C1                       MOV	CX,AX
  2546                                  					;---------------------------------------
  2547                                  					; compute in DX:AX, the size
  2548                                  					; requested by the user
  2549                                  					;---------------------------------------
  2550 00000809 2EA1[3406]                 MOV	AX,[cs:initlocks]
  2551 0000080D BE1200                     MOV	SI,RLR_Entry_struc_size
  2552 00000810 F7E6                       MUL	SI
  2553 00000812 05[2F06]                   ADD	AX,OFFSET MFT
  2554 00000815 83D200                     ADC	DX,0
  2555 00000818 2E0306[3206]               ADD	AX,[cs:InitSpace]
  2556 0000081D 83D200                     ADC	DX,0
  2557                                  					;---------------------------------------
  2558                                  					; Compare the 32 bit sizes DX:AX and BX:CX.
  2559                                  					; If BX:CX is smaller, then we
  2560                                  					; are out of memory.
  2561                                  					;---------------------------------------
  2562                                  
  2563 00000820 39DA                       CMP	DX,BX				; try upper half first
  2564                                  
  2565                                  ;  $if	a,or				; if most significant is bigger or     ;AC000;
  2566 00000822 7706                       JA D_$LL68
  2567                                  
  2568                                  ;  $if	e,and				; if equal and			       ;AC000;
  2569 00000824 750A                       JNE D_$IF68
  2570                                  
  2571 00000826 39C8                       CMP	AX,CX				;
  2572                                  
  2573                                  ;  $if	a				; if least significant is bigger       ;AC000;
  2574 00000828 7606                       JNA D_$IF68
  2575                                  D_$LL68:
  2576                                  
  2577 0000082A B80801                         mov  ax,(EXT_ERR_CLASS << 8) + No_Mem_Error ; issue error message      ;AN000;
  2578                                  
  2579 0000082D E84600                         call ShDispMsg			;				       ;AN000;
  2580                                  
  2581                                  ;  $endif				; endif - bigger		       ;AC000;
  2582                                  D_$IF68:
  2583                                  
  2584                                  					;--------------------------------------
  2585                                  					; Move stack to PSP area.  Otherwise we
  2586                                  					; will run into problems with growing
  2587                                  					; the stack into the lock records.
  2588                                  					;---------------------------------------
  2589 00000830 58                         POP	AX				; this is the entry value for DS (PSP) ;AC001;
  2590 00000831 8ED0                       MOV	SS,AX				;				       ;AC001;
  2591 00000833 BC0001                     MOV	SP,100h 			;				       ;AC001;
  2592                                  
  2593                                     ASSUME SS:NOTHING
  2594                                  					;---------------------------------------
  2595                                  					; Continue with rest of initialization
  2596                                  					;---------------------------------------
  2597                                  INIT equ Init	; NASM port label
  2598 00000836 E96AFE                     JMP	INIT
  2599                                  
  2600                                     EndProc SHAREINIT
  2601                                  
  2602                                   global amis_sign
  2603 00000839 00                      	even
  2604                                  amis_sign:
  2605 0000083A 65636D20<rep 5h>        .ven:	fill 8, 32, db "ecm"
  2606 00000842 6C444F5320<rep 4h>      .prod:	fill 8, 32, db "lDOS"
  2607                                  amis_id:			; must be directly after amis_sign
  2608 0000084A 0000                    	dw 0
  2609 0000084C 0000                    .seq:	dw 0			; sequential number
  2610 0000084E 06736861726572          .us:	counted "sharer"	; our id name
  2611                                  
  2612                                  
  2613                                     Break <ShLoadMsg  -	Share Load Message>
  2614                                  
  2615                                  ;******************* START OF SPECIFICATIONS ***********************************
  2616                                  ;
  2617                                  ;  NAME:	ShLoadMsg  -  Share Load Message
  2618                                  ;
  2619                                  ;  FUNCTION:	Load the Share messages into the message buffer.
  2620                                  ;
  2621                                  ;  INPUT:	None
  2622                                  ;
  2623                                  ;  OUTPUT:	Messages loaded into the message buffer and Message
  2624                                  ;		Sevices code initalized
  2625                                  ;
  2626                                  ;  REGISTERS USED:  DI AX CX DX
  2627                                  ;  (NOT RESTORED)
  2628                                  ;
  2629                                  ;  LINKAGE:	Call near
  2630                                  ;
  2631                                  ;  NORMAL	CF = O
  2632                                  ;  EXIT:
  2633                                  ;
  2634                                  ;  ERROR	CF = 1
  2635                                  ;  EXIT:
  2636                                  ;
  2637                                  ;  CHANGE	04/15/87 - First release
  2638                                  ;  LOG:
  2639                                  ;
  2640                                  ;******************* END OF SPECIFICATIONS *************************************
  2641                                  
  2642                                  					;---------------------------------------
  2643                                  					; Message Equates
  2644                                  					;---------------------------------------
  2645                                  
  2646                                  ;			  $SALUT (4,27,34,41)
  2647                                  
  2648                                  Bad_DOS_Ver		  equ	 1	; Incorrect DOS version 	       ;AN000;
  2649                                  Sh_Already_Loaded	  equ	 2	; SHARE already loaded message number  ;AN000;
  2650                                  No_Mem_Error		  equ	 8	; insufficient memory message number   ;AN000;
  2651                                  
  2652                                  ;  $SALUT (4,4,9,41)
  2653                                  
  2654                                     Procedure ShLoadMsg,near		;				       ;AN000;
  2654          ******************       warning: proc ShLoadMsg... [-w+user]
  2655                                  					;---------------------------------------
  2656                                  					; Load the Messages
  2657                                  					;---------------------------------------
  2658                                  EXTRN SYSLOADMSG:NEAR			;				       ;AN000;
  2659                                  
  2660 00000855 E8(0000)                   call SYSLOADMSG			;				       ;AN000;
  2661                                  
  2662                                  ;  $IF	C				; if we have a MAJOR problem	       ;AN000;
  2663 00000858 730A                       JNC D_$IF70
  2664 0000085A 88F4                           mov  ah,dh			; save the class
  2665 0000085C E81700                         call ShDispMsg			;				       ;AN000;
  2666                                  					; For pre DOS 2.0, we may come back
  2667 0000085F 31C0                           xor  ax,ax			;   here - so do it the old way
  2668 00000861 16                             push ss				;   just in case
  2669 00000862 50                             push ax				;
  2670                                  
  2671                                  xxx    proc far 			;				       ;AN000;
  2672 00000863 CB                             ret				;				       ;AN000;
  2673                                  xxx    endp				;				       ;AN000;
  2674                                  
  2675                                  ;  $ENDIF				; endif - we have a MAJOR problem      ;AN000;
  2676                                  D_$IF70:
  2677                                  
  2678                                  
  2679 00000864 C3                         ret					;				       ;AN000;
  2680                                  
  2681                                     EndProc ShLoadMsg			;
  2682                                  
  2683                                     Break <ShDispMsg  -	Share Display Message>
  2684                                  
  2685                                  ;******************* START OF SPECIFICATIONS ***********************************
  2686                                  ;
  2687                                  ;  NAME:	ShDispMsg  -  Share Display Message
  2688                                  ;
  2689                                  ;  FUNCTION:	Display the messages for share
  2690                                  ;
  2691                                  ;  INPUT:	AX = message number - AH - Class
  2692                                  ;				      AL - Number
  2693                                  ;
  2694                                  ;  OUTPUT:	- Messages output to Output Device
  2695                                  ;		- Exit to DOS
  2696                                  ;
  2697                                  ;  REGISTERS USED:  CX DX
  2698                                  ;  (NOT RESTORED)
  2699                                  ;
  2700                                  ;  LINKAGE:	Call near
  2701                                  ;
  2702                                  ;  NORMAL	CF = O
  2703                                  ;  EXIT:
  2704                                  ;
  2705                                  ;  ERROR	CF = 1
  2706                                  ;  EXIT:	CX = 0 - INCORRECT DOS VERSION
  2707                                  ;
  2708                                  ;  CHANGE	04/15/87 - First release
  2709                                  ;  LOG:
  2710                                  ;
  2711                                  ;******************* END OF SPECIFICATIONS *************************************
  2712                                  
  2713                                  ;			  $SALUT (4,27,34,41)
  2714                                  
  2715                                  					; The following structure is a
  2716                                  					;   SYSMSG SUBLIST control block.
  2717                                  					;   It is initalized for the "already
  2718                                  					;   installed " message.  The parse
  2719                                  					;   routine will set it up to work
  2720                                  					;   for parseing.
  2721                                  SUBLIST 		  LABEL  WORD
  2722                                  
  2723 00000865 0B                      			  db	 sub_size ; size of sublist
  2724 00000866 00                      			  db	 0	; reserved
  2725 00000867 [7008]                  msg_offset		  dw	 offset SHARE_Name ; insert 'SHARE'
  2726                                  
  2727                                  msg_segment		  LABEL  WORD
  2728                                  
  2729                                  %IFN	 INSTALLED
  2730                                  
  2731                                  			  dw	 CODE
  2732                                  
  2733                                  %ELSE
  2734                                  
  2735 00000869 [ssss]                  			  dw	 SHARE
  2736                                  
  2737                                  %ENDIF
  2738                                  
  2739 0000086B 01                      num_ins 		  db	 1	; only one insert
  2740 0000086C 10                      			  db	 Char_Field_ASCIIZ ; data type flag - ascii z string
  2741 0000086D 05                      max_ins 		  db	 SHARE_Name_Size ; maximum field size
  2742 0000086E 05                      min_ins 		  db	 SHARE_Name_Size ; minimum field size
  2743 0000086F 20                      			  db	 " "	; pad character
  2744                                  
  2745                                  sub_size		  equ	 $ - SUBLIST
  2746                                  
  2747                                  SHARE_Name		  LABEL  WORD
  2748                                  
  2749 00000870 5348415245              			  db	 "SHARE"
  2750                                  
  2751                                  Share_Name equ SHARE_Name	; NASM port label
  2752                                  SHARE_Name_Size 	  equ	 $ - Share_Name
  2753                                  
  2754 00000875 00                      			  db	 0	; make it a Z string
  2755                                  ;  $SALUT (4,4,9,41)
  2756                                  
  2757                                     Procedure ShDispMsg,near		;				       ;AN000;
  2757          ******************       warning: proc ShDispMsg... [-w+user]
  2758                                  					;---------------------------------------
  2759                                  					; Set up required parameters
  2760                                  					;--------------------------------------
  2761 00000876 BB0200                     MOV	BX,STDERR			;display message on STD ERROR	       ;AN000;
  2762 00000879 31C9                       XOR	CX,CX				;no substitution required	       ;AN000;
  2763 0000087B 31D2                       XOR	DX,DX				;set flags to 0 		       ;AN000;
  2764 0000087D FECE                       DEC	DH				;and class to utility		       ;AN000;
  2765 0000087F 80FC02                     cmp	ah,PARSE_ERR_CLASS		;
  2766                                  ;  $if	be,and				;				       ;AC009;
  2767 00000882 7726                       JNBE D_$IF72
  2768 00000884 88E6                       mov	dh,ah				;
  2769                                  ;  $if	e				; set up implied substitution	       ;AC009;
  2770 00000886 7522                       JNE D_$IF72
  2771                                  
  2772                                         ASSUME DS:nothing,ES:DOSGROUP
  2773                                  
  2774 00000888 2E880E[6B08]                   mov  [cs:num_ins],cl			; set number of inserts to 0	       ;AN009;
  2775 0000088D 2EC606[6D08]30                 mov  BYTE [cs:max_ins],030h	; set maximum size of insert	       ;AN009;
  2776 00000893 2EC606[6E08]01                 mov  BYTE [cs:min_ins],1		; set minimum size of insert	       ;AN009;
  2777 00000899 1E                             push ds				; set up segment		       ;AN009;
  2778 0000089A 2E8F06[6908]                   pop  word [cs:msg_segment]		;				       ;AN009;
  2779 0000089F C60400                         mov  BYTE PTR [si],0		; turn it into a ASCIIZ string	       ;AN009;
  2780 000008A2 2E3B36[6708]                   cmp  si,[cs:msg_offset]		; is there something there?	       ;AN009;
  2781                                  ;      $if  a				; if it is...			       ;AN009;
  2782 000008A7 7601                           JNA D_$IF73
  2783 000008A9 41                      	   inc	cx			;				       ;AN009;
  2784                                  ;      $endif				;				       ;AN009;
  2785                                  D_$IF73:
  2786                                  ;  $endif				;
  2787                                  D_$IF72:
  2788 000008AA 3C02                       cmp	al,Sh_Already_Loaded		; SHARE already loaded message ?       ;AN000;
  2789                                  ;  $if	e				; if it is...			       ;AN000;
  2790 000008AC 7508                       JNE D_$IF76
  2791 000008AE 41                             inc  cx				;
  2792                                  SHARE_name equ SHARE_Name	; NASM port label
  2793 000008AF 2EC706[6708][7008]             mov  word [cs:msg_offset],OFFSET SHARE_name ; ensure the pointer is right	       ;AN010;
  2794                                  ;  $endif				;
  2795                                  D_$IF76:
  2796 000008B6 0E                         push cs				; ensure that SYSMSG has proper        ;AC009;
  2797 000008B7 1F                         pop	ds				;	   addressability	       ;AC009;
  2798 000008B8 8D36[6508]                 lea	si,[SUBLIST]			; point to sublist		       ;AC009;
  2799 000008BC 30E4                       xor	ah,ah				;				       ;AN000;
  2800                                  
  2801                                  					;--------------------------------------
  2802                                  					; Output the Message
  2803                                  					;---------------------------------------
  2804                                  EXTRN SYSDISPMSG:NEAR			;				       ;AN000;
  2805                                  
  2806 000008BE E8(0000)                   CALL SYSDISPMSG			;				       ;AN000;
  2807                                  
  2808                                  ;  $IF	C				; if error occured		       ;AN000;
  2809 000008C1 7306                       JNC D_$IF78
  2810                                  
  2811 000008C3 E80900                         CALL Get_DOS_Error		; a DOS extended error occured	       ;AN000;
  2812 000008C6 E8(0000)                       CALL SYSDISPMSG			; try to issue it		       ;AN000;
  2813                                  
  2814                                  ;  $ENDIF				; endif - error occured 	       ;AN000;
  2815                                  D_$IF78:
  2816                                  
  2817 000008C9 B8FF4C                     MOV	AX,(EXIT << 8) + 0FFH		; exit to DOS			       ;AN000;
  2818 000008CC CD21                       INT	21h				;				       ;AN000;
  2819                                  
  2820 000008CE C3                         ret					; may return if pre DOS 2.0	       ;AN000;
  2821                                  
  2822                                     EndProc ShDispMsg			;				       ;AN000;
  2823                                  
  2824                                     BREAK < Get_DOS_Error >
  2825                                  
  2826                                  ;******************* START OF SPECIFICATIONS ***********************************
  2827                                  ;Routine name: Get_DOS_Error
  2828                                  ;*******************************************************************************
  2829                                  ;
  2830                                  ;Description:  Call DOS to obtain DOS extended error #
  2831                                  ;
  2832                                  ;Called Procedures: None
  2833                                  ;
  2834                                  ;Input: 	    None
  2835                                  ;
  2836                                  ;Output:	    AX = error number
  2837                                  ;		    DH = DOS extended error class
  2838                                  ;
  2839                                  ;Change History:    Created	   5/01/87	   FG
  2840                                  ;
  2841                                  ;******************* END OF SPECIFICATIONS *************************************
  2842                                  ;******************+ START OF PSEUDOCODE +**************************************
  2843                                  ;
  2844                                  ;	START  Get_DOS_Error
  2845                                  ;
  2846                                  ;	call DOS for extended error (INT21 GetExtendedError + 00 <5900>)
  2847                                  ;	set up registers for return
  2848                                  ;	ret
  2849                                  ;
  2850                                  ;	END  Get_DOS_Error
  2851                                  ;
  2852                                  ;******************-  END  OF PSEUDOCODE -**************************************
  2853                                  
  2854                                     public Get_DOS_Error
  2855                                  
  2856                                     Get_DOS_Error PROC NEAR
  2857                                  
  2858 000008CF B80059                     mov	ax,(GetExtendedError << 8)	; DOS ext. error		       ;AN000;
  2859 000008D2 31DB                       xor	bx,bx
  2860 000008D4 06                         push es				;				       ;AN000;
  2861 000008D5 CD21                       INT	21h				;    GetExtendedError + not_used <5900>;AN000;
  2862 000008D7 07                         pop	es
  2863 000008D8 BB0200                     mov	bx,STDERR			; fix up bx			       ;AN000;
  2864 000008DB 31C9                       xor	cx,cx				; fix up cx			       ;AN000;
  2865 000008DD B601                       mov	dh,EXT_ERR_CLASS		; set class to dos error
  2866                                  
  2867 000008DF C3                         ret					;				       ;AN000;
  2868                                  
  2869                                     ENDPROC Get_DOS_Error
  2870                                  
  2871                                     Break <ShComndParse	-  Share Command line Parser>
  2872                                  
  2873                                  ;******************* START OF SPECIFICATIONS ***********************************
  2874                                  ;
  2875                                  ;  NAME:	ShComndParse  -  Share Command line Parser
  2876                                  ;
  2877                                  ;  FUNCTION:	Call the DOS PARSE Service Routines to process the command
  2878                                  ;		line. Search for valid switches (/F:n and /L:m) and
  2879                                  ;		update the values for file size and number of locks accordingly
  2880                                  ;
  2881                                  ;  INPUT:	Parameter string from command line in the PSP
  2882                                  ;
  2883                                  ;  OUTPUT:	INITspace and INITlocks are updated.
  2884                                  ;
  2885                                  ;  REGISTERS USED: ES DI AX BX CX DX
  2886                                  ;  (NOT RESTORED)
  2887                                  ;
  2888                                  ;  LINKAGE:	Call
  2889                                  ;
  2890                                  ;  NORMAL	- If /F:n specified, then INITspace is updated.
  2891                                  ;  EXIT:	- If /L:m specified, then INITlocks is updated.
  2892                                  ;
  2893                                  ;  ERROR	If user enters:
  2894                                  ;  EXIT:	- any parameter or switch other than /F:n or /L:m
  2895                                  ;		- an invalid value for "n" or "m"
  2896                                  ;		then this routine will display the "Invalid Parameter"
  2897                                  ;		error message and terminate.
  2898                                  ;
  2899                                  ;  EXTERNAL	- System parse service routines
  2900                                  ;  REFERENCES:	- INT21 - GET PSP Function Call 062h
  2901                                  ;
  2902                                  ;  CHANGE	04/15/87 - First release
  2903                                  ;  LOG:
  2904                                  ;
  2905                                  ;******************* END OF SPECIFICATIONS *************************************
  2906                                  ;******************+ START OF PSEUDOCODE +**************************************
  2907                                  ;
  2908                                  ;	START
  2909                                  ;
  2910                                  ;	return
  2911                                  ;
  2912                                  ;	END
  2913                                  ;
  2914                                  ;******************-  END  OF PSEUDOCODE -*************************************
  2915                                  
  2916                                  ;			  $SALUT (4,27,34,41)
  2917                                  
  2918                                  					;--------------------------------------
  2919                                  					; Parse Equates
  2920                                  					;--------------------------------------
  2921                                  
  2922                                  EOL			  equ	 -1	; Indicator for End-Of-Line	       ;AN000;
  2923                                  NOERROR 		  equ	 0	; Return Indicator for No Errors       ;AN000;
  2924                                  FILE_SWITCH		  equ	 1	; this is a file switch 	       ;AN000;
  2925                                  LOCK_SWITCH		  equ	 2	; this is a lock switch 	       ;AN000;
  2926                                  Syntax_Error		  equ	 9	; maximum PARSE error # 	       ;AN000;
  2927                                  
  2928                                  ;  $SALUT (4,4,9,41)
  2929                                  
  2930                                     Procedure ShComndParse,near		;				       ;AN000;
  2930          ******************       warning: proc ShComndParse... [-w+user]
  2931                                  					;--------------------------------------
  2932                                  					;  Get address of command line
  2933                                  					;--------------------------------------
  2934                                  EXTRN SYSPARSE:NEAR			;				       ;AN000;
  2935                                  
  2936 000008E0 BE8100                     MOV	SI,0081H			; OFFSET OF COMMAND LINE IN PSP        ;AN000;
  2937 000008E3 B462                       MOV	AH,62H				; AH=GET PSP ADDRESS FUNCTION CALL     ;AN000;
  2938 000008E5 CD21                       INT	21H				; PSP SEGMENT RETURNED IN BX	       ;AN000;
  2939 000008E7 8EDB                       MOV	DS,BX				; PUT PSP SEG IN DS		       ;AN000;
  2940 000008E9 B90000                     MOV	CX,0				; NUMBER OF PARMS PROCESSED SO FAR     ;AN000;
  2941 000008EC 0E                         PUSH CS				;				       ;AN000;
  2942 000008ED 07                         POP	ES				;				       ;AN000;
  2943                                  
  2944                                     ASSUME ES:SHARE			;				       ;AN000;
  2945                                  
  2946                                  					;--------------------------------------
  2947                                  					;  Loop for each operand at DS:SI
  2948                                  					;--------------------------------------
  2949                                  ;  $do					;				       ;AN000;
  2950                                  D_$DO80:
  2951                                  
  2952 000008EE 8D3E[7206]                     LEA  DI,[PARMS]			; ADDRESS OF PARSE CONTROLS	       ;AN000;
  2953 000008F2 BA0000                         MOV  DX,0			; RESERVED			       ;AN000;
  2954 000008F5 268936[6708]                   mov  [es:msg_offset],si		; save the start scan point	       ;AC009;
  2955 000008FA E8(0000)                       CALL SYSPARSE			; PARSE IT!			       ;AN000;
  2956 000008FD 83F8FF                         CMP  AX,EOL			; ARE WE AT END OF COMMAND LINE ?      ;AN000;
  2957                                  
  2958                                  ;  $leave e				;				       ;AN000;
  2959 00000900 7456                       JE D_$EN80
  2960                                  
  2961 00000902 83F800                         CMP  AX,NOERROR			; ANY ERRORS?			       ;AN000;
  2962                                  
  2963                                  ;      $if  ne,or			; if parse says error or	       ;AN000;
  2964 00000905 750B                           JNE D_$LL82
  2965                                  
  2966 00000907 B80900                         MOV  AX,Syntax_Error		; Parse syntax error - just in case    ;AN000;
  2967 0000090A 89D3                           MOV  BX,DX			; PLACE RESULT ADDRESS IN BX	       ;AN000;
  2968 0000090C 81FB[9B06]                     CMP  BX,OFFSET SWITCH_BUFF	;				       ;AN000;
  2969                                  
  2970                                  ;      $if  ne				; if no pointer 		       ;AN000;
  2971 00000910 7403                           JE D_$IF82
  2972                                  D_$LL82:
  2973                                  
  2974 00000912 E84400                  	   call PARSE_ERROR		;   call error routine		       ;AN000;
  2975                                  
  2976                                  ;      $endif				; endif - error 		       ;AN000;
  2977                                  D_$IF82:
  2978                                  
  2979 00000915 26A1[9F06]                     MOV  AX,WORD PTR [es:SW_VALUE]	; load the value		       ;AN000;
  2980 00000919 268B1E[9D06]                   MOV  BX,[es:SW_SYN]			; load pointer to synonym	       ;AN000;
  2981                                  
  2982                                  					;--------------------------------------
  2983                                  					;  If user said  /F:n, then
  2984                                  					;--------------------------------------
  2985                                  
  2986 0000091E 81FB[8606]                     CMP  BX,OFFSET F_SW		; IF USER SPECIFIED /F		       ;AN000;
  2987                                  
  2988                                  ;      $if  e				;				       ;AN000;
  2989 00000922 750D                           JNE D_$IF84
  2990                                  
  2991                                  INITspace equ InitSpace	; NASM port label
  2992 00000924 263906[3206]            	   CMP	[es:INITspace],AX		; is default < requested ?	       ;AN000;
  2993                                  
  2994                                  ;	   $if	b			; if default is <		       ;AN000;
  2995 00000929 7304                    	   JNB D_$IF85
  2996 0000092B 26A3[3206]              	       MOV  [es:INITspace],AX	; save the new value		       ;AN000;
  2997                                  ;	   $endif			; endif   (else leave it alone)        ;AN000;
  2998                                  D_$IF85:
  2999                                  
  3000                                  ;      $else				; else - CHECK FOR LOCKS	       ;AN000;
  3001 0000092F EB25                           JMP SHORT D_$EN84
  3002                                  D_$IF84:
  3003                                  
  3004                                  					;---------------------------------------
  3005                                  					;  If user said /L:m, then update INITlocks
  3006                                  					;---------------------------------------
  3007 00000931 81FB[8906]              	   CMP	BX,OFFSET L_SW		; IF USER SPECIFIED /L		       ;AN000;
  3008                                  
  3009                                  ;	   $if	e			; if it is				;AN000;
  3010 00000935 750D                    	   JNE D_$IF88
  3011                                  
  3012                                  INITlocks equ InitLocks	; NASM port label
  3013 00000937 263906[3406]            	       CMP  [es:INITlocks],AX	; is default < requested ?	       ;AN000;
  3014                                  
  3015                                  ;	       $if  b			; if default is <		       ;AN000;
  3016 0000093C 7304                    	       JNB D_$IF89
  3017 0000093E 26A3[3406]              		   MOV	[es:INITlocks],AX	;   save the value		       ;AN000;
  3018                                  ;	       $endif			; endif      (else leave it alone)     ;AN000;
  3019                                  D_$IF89:
  3020                                  
  3021                                  ;	   $else			; else - CHECK FOR TOGGLE	       ;AN010;
  3022 00000942 EB12                    	   JMP SHORT D_$EN88
  3023                                  D_$IF88:
  3024                                  
  3025                                  					;---------------------------------------
  3026                                  					;  If user said /NC, then update check_flag
  3027                                  					;---------------------------------------
  3028 00000944 81FB[8C06]              	       CMP  BX,OFFSET N_SW	; IF USER SPECIFIED /NC 	       ;AN010;
  3029                                  ;	       $if  ne			; if error			       ;AC010;
  3030 00000948 7406                    	       JE D_$IF92
  3031 0000094A B80900                  		   MOV	AX,Syntax_Error ; Parse syntax error		       ;AN000;
  3032 0000094D E80900                  		   call PARSE_ERROR	;   call error routine		       ;AN000;
  3033                                  ;	       $endif			; endif - error 		       ;AC010;
  3034                                  D_$IF92:
  3035                                  
  3036 00000950 26C606[4B05]01          	       mov  byte [es:skip_check],1	; set the skip check flag	       ;AN010;
  3037                                  
  3038                                  ;	   $endif			; endif - CHECK FOR TOGGLE	       ;AN010;
  3039                                  D_$EN88:
  3040                                  
  3041                                  ;      $endif				; endif - CHECK FOR LOCKS	       ;AN000;
  3042                                  D_$EN84:
  3043                                  
  3044                                  ;  $enddo				; CHECK FOR NEXT PARM		       ;AN000;
  3045 00000956 EB96                       JMP SHORT D_$DO80
  3046                                  D_$EN80:
  3047                                  
  3048 00000958 C3                         ret					; NORMAL RETURN TO CALLER	       ;AN000;
  3049                                  
  3050                                  					;---------------------------------------
  3051                                  					;  If any other parameter specified,
  3052                                  					;  display message and quit
  3053                                  					;---------------------------------------
  3054                                  PARSE_ERROR:				;				       ;AN000;
  3055                                  
  3056 00000959 3C09                       cmp	al,Syntax_Error 		; error 1 to 9 ?		       ;AN000;
  3057                                  
  3058                                  ;  $if	a				; if parse error		       ;AN000;
  3059 0000095B 7602                       JNA D_$IF97
  3060                                  
  3061 0000095D B009                           mov  al,Syntax_Error		; Parse syntax error
  3062                                  
  3063                                  ;  $endif				; endif errors			       ;AN000;
  3064                                  D_$IF97:
  3065                                  
  3066 0000095F 8D1E[6B09]                 lea	bx,[Parse_Ret_Code]
  3067 00000963 2ED7                       cs xlatb
  3068 00000965 B402                       mov	ah,PARSE_ERR_CLASS		; set class to parse error	       ;AN000;
  3069                                  
  3070 00000967 E80CFF                     CALL ShDispMsg			; display the parse error	       ;AN000;
  3071                                  
  3072 0000096A C3                         ret					; this should never be used
  3073                                  
  3074                                  Parse_Ret_Code label byte
  3075                                  
  3076 0000096B 00                         db	0				; Ret Code 0 -
  3077 0000096C 09                         db	9				; Ret Code 1 - Too many parameters
  3078 0000096D 09                         db	9				; Ret Code 2 - Required parameter missing
  3079 0000096E 03                         db	3				; Ret Code 3 - Invalid switch
  3080 0000096F 09                         db	9				; Ret Code 4 - Invalid keyword
  3081 00000970 09                         db	9				; Ret Code 5 - (reserved)
  3082 00000971 06                         db	6				; Ret Code 6 - Parm val out of range
  3083 00000972 09                         db	9				; Ret Code 7 - Parameter val not allowed
  3084 00000973 09                         db	9				; Ret Code 8 - Parameter val not allowed
  3085 00000974 09                         db	9				; Ret Code 9 - Parm format not correct
  3086                                  
  3087                                     EndProc ShComndParse 		;				       ;AN000;
  3088                                  
  3089                                     %include "msgdcl.mac"
     1                              <1> ; This Macro was removed from sysmsg.inc. We had to remove this
     2                              <1> ; macro and put it into it's own include file in order to clear up
     3                              <1> ; some assembly errors. MS MASM will not allow a public declaration
     4                              <1> ; during the second pass of the assembler. IBM MASM will allow this.
     5                              <1> ;
     6                              <1> ;
     7                              <1> ;
     8                              <1> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     9                              <1> ;;	$M_DECLARE	     Macro
    10                              <1> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    11                              <1> 
    12                              <1> ; NASM original macros
    13                              <1> 
    14                              <1> %imacro $M_DECLARE 1
    15                              <1>    %iassign $M_DCOUNT 0
    16                              <1>    %rep %1
    17                              <1>      %iassign $M_DCOUNT $M_DCOUNT + 1
    18                              <1>      $M_DECLARE2 $M_DCOUNT
    19                              <1>    %endrep
    20                              <1> 
    21                              <1>   %IF COMR
    22                              <1> 	EXTRN	$M_RT2:BYTE
    23                              <1>   %ELSE
    24                              <1> 	EXTRN	$M_RT:BYTE
    25                              <1>   %ENDIF
    26                              <1> 
    27                              <1>   $M_CHECK $M_MSGSERV_1		      ;  If this subroutine is not in this assembly,
    28                              <1>   $M_CHECK $M_MSGSERV_2		      ;  If this subroutine is not in this assembly,
    29                              <1> %endmacro
    30                              <1> 
    31                              <1> %imacro $M_DECLARE2 1
    32                              <1>   %IFN COMR				 ; IF Not resident COMMAND.COM
    33                              <1>     %IFN COMT				 ; IF Not transient COMMAND.COM
    34                              <1> 	%IF	FARmsg
    35                              <1> 	  EXTRN   $M_CLS_%1:FAR
    36                              <1> 	%ELSE
    37                              <1> 	  EXTRN   $M_CLS_%1:NEAR
    38                              <1> 	%ENDIF
    39                              <1>     %ELSE				 ; ELSE
    40                              <1>       %ifnidni  $M_CLS_%1, $M_CLS_1	 ; IF NOT $M_CLS_1 or
    41                              <1> 	%ifnidni $M_CLS_%1, $M_CLS_2	 ;   IF NOT $M_CLS_2 then
    42                              <1> 	    %IF	    FARmsg		 ;
    43                              <1> 	      EXTRN   $M_CLS_%1:FAR
    44                              <1> 	    %ELSE			 ;
    45                              <1> 	      EXTRN   $M_CLS_%1:NEAR
    46                              <1> 	    %ENDIF			 ;
    47                              <1> 	%ENDIF				 ;
    48                              <1>       %ENDIF				 ;
    49                              <1>     %ENDIF				 ;
    50                              <1>   %ELSE					 ; ELSE
    51                              <1>     %ifnidni  $M_CLS_%1, $M_CLS_1	 ; IF NOT $M_CLS_1 or
    52                              <1>       %ifnidni $M_CLS_%1, $M_CLS_2	 ;   IF NOT $M_CLS_2 then
    53                              <1> 	    %IF	    FARmsg		 ;
    54                              <1> 	      EXTRN   $M_CLS_%1:FAR
    55                              <1> 	    %ELSE			 ;
    56                              <1> 	      EXTRN   $M_CLS_%1:NEAR
    57                              <1> 	    %ENDIF			 ;
    58                              <1>       %ENDIF				 ;
    59                              <1>     %ENDIF				 ;
    60                              <1>   %ENDIF			       ;
    61                              <1> %ENDMacro			       ;
    62                              <1> 				       ;
    63                              <1> %imacro $M_CHECK 1
    64                              <1>     %IF	    FARmsg		       ;
    65                              <1>       EXTRN   %1:FAR		       ;    Must be external
    66                              <1>     %ELSE			       ;
    67                              <1>       EXTRN   %1:NEAR		       ;    Must be external
    68                              <1>     %ENDIF			       ;
    69                              <1> %ENDMacro			       ;
    70                              <1> 
    71                              <1>   $M_DECLARE $M_NUM_CLS		       ;  Declare any class not in this assembly
    15                              <2>  %iassign $M_DCOUNT 0
    16                              <2>  %rep %1
    17                              <2>  %iassign $M_DCOUNT $M_DCOUNT + 1
    18                              <2>  $M_DECLARE2 $M_DCOUNT
    19                              <2>  %endrep
    17                              <3>  %iassign $M_DCOUNT $M_DCOUNT + 1
    18                              <3>  $M_DECLARE2 $M_DCOUNT
    32                              <4>  %IFN COMR
    33                              <4>  %IFN COMT
    34                              <4>  %IF FARmsg
    35                              <4>  EXTRN $M_CLS_%1:FAR
    36                              <4>  %ELSE
    37                              <4>  EXTRN $M_CLS_%1:NEAR
    38                              <4>  %ENDIF
    39                              <4>  %ELSE
    40                              <4>  %ifnidni $M_CLS_%1, $M_CLS_1
    41                              <4>  %ifnidni $M_CLS_%1, $M_CLS_2
    42                              <4>  %IF FARmsg
    43                              <4>  EXTRN $M_CLS_%1:FAR
    44                              <4>  %ELSE
    45                              <4>  EXTRN $M_CLS_%1:NEAR
    46                              <4>  %ENDIF
    47                              <4>  %ENDIF
    48                              <4>  %ENDIF
    49                              <4>  %ENDIF
    50                              <4>  %ELSE
    51                              <4>  %ifnidni $M_CLS_%1, $M_CLS_1
    52                              <4>  %ifnidni $M_CLS_%1, $M_CLS_2
    53                              <4>  %IF FARmsg
    54                              <4>  EXTRN $M_CLS_%1:FAR
    55                              <4>  %ELSE
    56                              <4>  EXTRN $M_CLS_%1:NEAR
    57                              <4>  %ENDIF
    58                              <4>  %ENDIF
    59                              <4>  %ENDIF
    60                              <4>  %ENDIF
    20                              <2> 
    21                              <2>  %IF COMR
    22                              <2>  EXTRN $M_RT2:BYTE
    23                              <2>  %ELSE
    24                              <2>  EXTRN $M_RT:BYTE
    25                              <2>  %ENDIF
    26                              <2> 
    27                              <2>  $M_CHECK $M_MSGSERV_1
    64                              <3>  %IF FARmsg
    65                              <3>  EXTRN %1:FAR
    66                              <3>  %ELSE
    67                              <3>  EXTRN %1:NEAR
    68                              <3>  %ENDIF
    28                              <2>  $M_CHECK $M_MSGSERV_2
    64                              <3>  %IF FARmsg
    65                              <3>  EXTRN %1:FAR
    66                              <3>  %ELSE
    67                              <3>  EXTRN %1:NEAR
    68                              <3>  %ENDIF
  3090                                  
  3091                                  ; (no prior section) ; SHARE ENDS
  3092                                  
  3093                                  section STACK stack class=STACK
  3094 00000000 <res 196h>                 DB	278  + 128 DUP (?)		; 278 == IBM's ROM requirements
  3095                                  ; (no prior section) ; STACK ENDS
  3096                                  
  3097                                  %ENDIF
  3098                                  
  3099                                     END	shareinit
  3100                                  
  3101                                  
  3102                                  
