     1                                  ;	SCCSID = @(#)ibmdata.asm	1.1 85/04/10
     2                                  ;
     3                                  ; DATA Segment for DOS.
     4                                  ;
     5                                  
     6                                  ;page 255,132
     7                                  
     8                                  [list -]
     8          ******************       warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi]
    14                              <3> [list -]
    14                              <2> [list -]
     6                              <1> %include "entrysw.mac"
     1                              <2> 
     2                              <2> %ifndef __ENTRYSW_MAC__
     3                              <2>  %assign __ENTRYSW_MAC__ 1
     4                              <2> 
     5                              <2> %assign _DOSCODEHMA		1
     6                              <2> %assign _RELOCATEDOSCODE	1
     7                              <2> 
     8                              <2> 		; Write a label "%1" (only if DOSCODE isn't relocated) and
     9                              <2> 		; "relocated%1" (always).
    10                              <2> 	%imacro relocated 1-2.nolist
    11                              <2> %ifnidni %2, device
    12                              <2>  %ifnidni %2, amis
    13                              <2>   %ifn _RELOCATEDOSCODE
    14                              <2> %1:
    15                              <2> 	global %1
    16                              <2>   %endif
    17                              <2>  %endif
    18                              <2> %endif
    19                              <2> relocated%1:				; always used for local labels
    20                              <2> 	global relocated%1
    21                              <2> 	%endmacro
    22                              <2> 
    23                              <2> %if _RELOCATEDOSCODE
    24                              <2> DOSENTRYADJUSTSEGMENT equ 60h - 26h
    25                              <2> %else
    26                              <2> DOSENTRYADJUSTSEGMENT equ 0
    27                              <2> %endif
    28                              <2> DOSENTRYADJUSTOFFSET equ DOSENTRYADJUSTSEGMENT * 16
    29                              <2> 
    30                              <2> DOSENTRYDEVICEBASE equ 10h
    31                              <2> 
    32                              <2> %endif
     7                              <1> [list -]
    39                              <1> usesection DOSENTRY
    40                              <1> 
    41                              <1> %endif
    11                                  ;=== Push trace listing source: mssw.nas
    12                                  %include "mssw.nas" ; NASM included file
     1                              <1> ;	SCCSID = @(#)ibmsw.asm	1.1 85/04/10
     2                              <1> 
     3                              <1> %include "version.mac"
     1                              <2> ; Some modules really want TRUE to be 0FFH.  Best to let them have their way.
     2                              <2> 	TRUE	   EQU	   0FFFFh
     3                              <2> 	TRUEBYTE   EQU     0FFh
     4                              <2> 	FALSE	   EQU	   0
     5                              <2> 
     6                              <2> ;
     7                              <2> ; Use the following switches to control cmacros.inc
     8                              <2> ;
     9                              <2> ?PLM       equ       0
    10                              <2> ?WIN       equ       0
    11                              <2> 
    12                              <2> memS       EQU     1			; Small model
    13                              <2> ;
    14                              <2> ; Use the switches below to produce the standard Microsoft version or the IBM
    15                              <2> ; version of the operating system
    16                              <2> ;
    17                              <2> ; The below chart will indicate how to set the switches to build the various
    18                              <2> ; versions
    19                              <2> ;
    20                              <2> ;                     IBMVER          IBMCOPYRIGHT
    21                              <2> ; --------------------------------------------------------
    22                              <2> ;  IBM Version   |     TRUE              TRUE
    23                              <2> ; --------------------------------------------------------
    24                              <2> ;  MS Version    |     FALSE             FALSE
    25                              <2> ; --------------------------------------------------------
    26                              <2> ;  Clone Version |     TRUE              FALSE
    27                              <2> ;
    28                              <2> IBMVER     EQU     TRUE
    29                              <2> IBMCOPYRIGHT EQU   FALSE
    30                              <2> 
    31                              <2> BUFFERFLAG	EQU	~ IBMCOPYRIGHT
    32                              <2> 
    33                              <2> %ifndef	MSVER	
    34                              <2> MSVER      EQU     ~ IBMVER
    35                              <2> %endif
    36                              <2> IBM	   EQU	   IBMVER
    37                              <2> ;
    38                              <2> ;
    39                              <2> 	%IF IBMVER
    40                              <2> 	    %IF IBMCOPYRIGHT
    41                              <2>               %warning out: ... IBM version build switch on ...
    42                              <2> 	    %ELSE
    43                              <2> 	      %warning out: ... CLONE version build switch on ...
    43          ******************  <2>  warning: out: ... CLONE version build switch on ... [-w+user]
    44                              <2> 	    %ENDIF
    45                              <2> 	%ELSE
    46                              <2> 	    %IFN IBMCOPYRIGHT
    47                              <2> 	      %warning out: ... MS version build switch on ...
    48                              <2> 	    %ELSE
    49                              <2> 	      %warning out: !!!!!!!!!  VERSION SWITCHES SET INCORECTLY  !!!!!!!!!
    50                              <2> 	      %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!!
    51                              <2> 	    %ENDIF
    52                              <2> 	%ENDIF   
    53                              <2> ;
    54                              <2> ;
    55                              <2> ;***************************************************************************
    56                              <2> ;*          The following switches are for DBCS or SBCS support            *
    57                              <2> ;*                                                                         *
    58                              <2> ;*                     Set INTERNAT EQU TRUE FOR DBCS                      *
    59                              <2> ;*                     Set INTERNAT EQU FALSE FOR SBCS                     *
    60                              <2> ;*                                                                         *
    61                              <2> ;***************************************************************************
    62                              <2> ;
    63                              <2> IBMJAPVER  EQU	   FALSE		;If TRUE set KANJI true also
    64                              <2> 
    65                              <2> ;
    66                              <2> ; Switch INTERNAT for DBCS support
    67                              <2> ;
    68                              <2> INTERNAT   EQU	   FALSE
    69                              <2> ;
    70                              <2> 	%IF INTERNAT
    71                              <2> %ifndef KANJI
    72                              <2> KANJI	   EQU	   TRUE
    73                              <2> %endif
    74                              <2> IBMJAPAN   EQU	   TRUE
    75                              <2> 	%ELSE
    76                              <2> %ifndef KANJI
    77                              <2> KANJI	   EQU	   FALSE
    78                              <2> %endif
    79                              <2> IBMJAPAN   EQU	   FALSE
    80                              <2> 	%ENDIF
    81                              <2> 
    82                              <2> %ifndef altvect				; avoid jerking off vector.inc
    83                              <2> ALTVECT    EQU	   FALSE		;Switch to build ALTVECT version
    84                              <2> %endif
    85                              <2> 
    86                              <2> ;
    87                              <2> ; Country code switches
    88                              <2> ; The default contry code is assumed as USA.
    89                              <2> ;
    90                              <2> 	%IF INTERNAT
    91                              <2>  KOREA	   EQU	   TRUE
    92                              <2>  JAPAN	   EQU	   FALSE
    93                              <2> 	%ELSE
    94                              <2>  KOREA	   EQU	   FALSE
    95                              <2>  JAPAN	   EQU	   FALSE
    96                              <2> 	%ENDIF
    97                              <2> ;
    98                              <2> 		%IF INTERNAT
    99                              <2> %warning out: Internat(ECS) version build switch on
   100                              <2> 		%ENDIF
     4                              <1> 
     5                              <1> ibmver equ IBMVER	; NASM port equate
     6                              <1> IBM		EQU	ibmver
     7                              <1> WANG		EQU	FALSE
     8                              <1> 
     9                              <1> ; Set this switch to cause DOS to move itself to the end of memory
    10                              <1> HIGHMEM EQU	FALSE
    11                              <1> 
    12                              <1> ; Turn on switch below to allow testing disk code with DEBUG. It sets
    13                              <1> ; up a different stack for disk I/O (functions > 11) than that used for
    14                              <1> ; character I/O which effectively makes the DOS re-entrant.
    15                              <1> 
    16                              <1> 	%IF	IBM
    17                              <1> ESCCH	EQU	0			; character to begin escape seq.
    18                              <1> CANCEL	EQU	27			;Cancel with escape
    19                              <1> TOGLPRN EQU	TRUE			;One key toggles printer echo
    20                              <1> ZEROEXT EQU	TRUE
    21                              <1> 	%ELSE
    22                              <1> ESCCH	EQU	1BH
    23                              <1> CANCEL	EQU	"X"-"@" 		;Cancel with Ctrl-X
    24                              <1> TOGLPRN EQU	FALSE			;Separate keys for printer echo on
    25                              <1> 					;and off
    26                              <1> ZEROEXT EQU	TRUE
    27                              <1> 	%ENDIF
    28                              <1> 
    13                                  ;=== Pop trace listing source
    14                                  %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 -]
     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
    15                                  debug equ FALSE                           ; No dossym (too big)
    16                                  %include "dosmac.mac"
     1                              <1> ;	SCCSID = @(#)dosmac.asm	1.1 85/04/10
     2                              <1> ;	SCCSID = @(#)dosmac.asm	1.1 85/04/10
     3                              <1> ;
     4                              <1> ; Macro file for MSDOS.
     5                              <1> ;
     6                              <1> 
     7                              <1> %ifndef __DOSMAC_MAC__
     8                              <1>  %assign __DOSMAC_MAC__ 1
     9                              <1> 
    10                              <1> TRUE    EQU 0FFFFh
    11                              <1> FALSE   EQU 0
    12                              <1> 
    13                              <1> 
    14                              <1> ; NASM original macros (comment for fixmem.pl)
    15                              <1> 
    16                              <1> ;SUBTTL BREAK a listing into pages and give new subtitles
    17                              <1> ;PAGE
    18                              <1> %imacro BREAK 0-1+.nolist
    19                              <1> 	;SUBTTL  subtitle
    20                              <1> 	;PAGE
    21                              <1> %endmacro
    22                              <1> ;.xcref  break
    23                              <1> 
    24                              <1> BREAK   <ASMVAR - handle assembly variables once and for all>
    25                              <1> 
    26                              <1> %if 0
    27                              <1> AsmVars Macro   varlist
    28                              <1> IRP     var,<varlist>
    29                              <1> AsmVar  var
    30                              <1> ENDM
    31                              <1> ENDM
    32                              <1> 
    33                              <1> AsmVar  Macro   var
    34                              <1> IFNDEF  var
    35                              <1> var = FALSE
    36                              <1> ENDIF
    37                              <1> ENDM
    38                              <1> %endif
    39                              <1> 
    40                              <1> BREAK <I_NEED: declare a variable external, if necessary, and allocate a size>
    41                              <1> 
    42                              <1> ;
    43                              <1> ; declare a variable external and allocate a size
    44                              <1> ;
    45                              <1> ;AsmVar  InstalledData
    46                              <1> %ifndef InstalledData
    47                              <1>  %define InstalledData 0
    48                              <1> %endif
    49                              <1> 
    50                              <1> %imacro I_NEED 1-2.nolist
    51                              <1> %ifn InstalledData
    52                              <1> 	[section DATA]
    53                              <1>     %IFIDNi   %2, WORD
    54                              <1> 	EXTRN   %1:WORD
    55                              <1>     %ELSE
    56                              <1> 	%IFIDNi   %2, DWORD
    57                              <1> 	EXTRN   %1:DWORD
    58                              <1> 	%ELSE
    59                              <1> 	EXTRN   %1:BYTE
    60                              <1> 	%ENDIF
    61                              <1>     %ENDIF
    62                              <1> 	__SECT__
    63                              <1> %ENDIF
    64                              <1> %endmacro
    65                              <1> 	;.xcref I_need
    66                              <1> 
    67                              <1> ;
    68                              <1> ; call a procedure that may be external.  The call will be short.
    69                              <1> ;
    70                              <1> %imacro invoke 1.nolist
    71                              <1> ;.xcref
    72                              <1> 	EXTRN   %1:NEAR
    73                              <1> ;.cref
    74                              <1> 	CALL    %1
    75                              <1> %endmacro
    76                              <1> ;.xcref  invoke
    77                              <1> 
    78                              <1> ;PAGE
    79                              <1> ;
    80                              <1> ; jump to a label that may be external.  The jump will be near.
    81                              <1> ;
    82                              <1> %imacro transfer 1.nolist
    83                              <1> ;.xcref
    84                              <1> 	EXTRN   %1:NEAR
    85                              <1> ;.cref
    86                              <1> 	JUMP    %1
    87                              <1> %endmacro
    88                              <1> ;.xcref  transfer
    89                              <1> 
    90                              <1> ;
    91                              <1> ; get a short address in a word
    92                              <1> ;
    93                              <1> %imacro short_addr 1.nolist
    94                              <1>     %ifnidn %1, ?
    95                              <1> 	EXTRN   %1:NEAR
    96                              <1> 	DW  OFFSET %1
    97                              <1>     %ELSE
    98                              <1> 	DW  ?
    99                              <1>     %ENDIF
   100                              <1> %endmacro
   101                              <1> ;.xcref  short_addr
   102                              <1> 
   103                              <1> ;
   104                              <1> ; get a long address in a dword
   105                              <1> ;
   106                              <1> %imacro long_addr 1.nolist
   107                              <1> 	EXTRN   %1:NEAR
   108                              <1> 	DD  %1
   109                              <1> %endmacro
   110                              <1> ;.xcref  long_addr
   111                              <1> 
   112                              <1> ;
   113                              <1> ; declare a PROC near or far but PUBLIC nonetheless
   114                              <1> ;
   115                              <1> ;.xcref ?frame
   116                              <1> ;.xcref ?aframe
   117                              <1> ;.xcref ?stackdepth
   118                              <1> ;.xcref ?initstack
   119                              <1> %assign ?frame           0                     ; initial
   120                              <1> %assign ?aframe          0                     ; initial
   121                              <1> %assign ?stackdepth      0                     ; initial stack size
   122                              <1> %assign ?initstack       0                     ; initial stack size
   123                              <1> 
   124                              <1> %imacro procedure 1-2.nolist
   125                              <1> 	%assign ?frame     0
   126                              <1> 	%assign ?aframe    2                   ;; remember the pushed BP
   127                              <1> 	%warning proc %1...
   128                              <1> %1    PROC    %2
   129                              <1> 	PUBLIC  %1
   130                              <1> 	%assign ?initstack     ?stackdepth     ;; beginning of procedure
   131                              <1> %endmacro
   132                              <1> ;.xcref  procedure
   133                              <1> 
   134                              <1> ;
   135                              <1> ; end a procedure and check that stack depth is preserved
   136                              <1> ;
   137                              <1> %imacro EndProc 1-2.nolist
   138                              <1> 	%ifnidni   %2, NoCheck        ;; check the stack size
   139                              <1> 	%if ?initstack != ?stackdepth    ;; is it different?
   140                              <1> 	%warning    ***** Possible stack size error in %1 *****
   141                              <1> 	%endif
   142                              <1> 	%endif
   143                              <1> %1    ENDP
   144                              <1> %endmacro
   145                              <1> ;.xcref  endproc
   146                              <1> ;PAGE
   147                              <1> ;
   148                              <1> ; define a data item to be public and of an appropriate size/type
   149                              <1> ;
   150                              <1> 
   151                              <1> %imacro stripangles 2.nolist
   152                              <1> %defstr %%param %2
   153                              <1> %rep 16
   154                              <1>  %substr %%opening %%param 1
   155                              <1>  %ifidn %%opening, '<'
   156                              <1>   %substr %%param %%param 2,-1
   157                              <1>  %endif
   158                              <1> %endrep
   159                              <1> %rep 16
   160                              <1>  %strlen %%length %%param
   161                              <1>  %substr %%closing %%param %%length
   162                              <1>  %ifidn %%closing, '>'
   163                              <1>   %substr %%param %%param 1,-2
   164                              <1>  %endif
   165                              <1> %endrep
   166                              <1> %deftok %%token %%param
   167                              <1> %1 %%token
   168                              <1> %endmacro
   169                              <1> 
   170                              <1> %imacro I_AM 2-*.nolist
   171                              <1> ;I_AM    MACRO   name,size,init
   172                              <1> %xdefine %%name %1
   173                              <1> ;; declare the type of the object
   174                              <1>     %IFIDNi %2, WORD
   175                              <1> %1    LABEL WORD
   176                              <1> 	%assign I_AM_SIZE      1
   177                              <1> 	%assign I_AM_LEN       2
   178                              <1>     %ELSE
   179                              <1> 	%IFIDNi %2, DWORD
   180                              <1> %1    LABEL DWORD
   181                              <1> 	%assign I_AM_SIZE      2
   182                              <1> 	%assign I_AM_LEN       2
   183                              <1> 	%ELSE
   184                              <1> 	    %IFIDNi %2, BYTE
   185                              <1> %1    LABEL BYTE
   186                              <1> 	%assign I_AM_SIZE      1
   187                              <1> 	%assign I_AM_LEN       1
   188                              <1> 	    %ELSE
   189                              <1> %1    LABEL BYTE
   190                              <1> %undef I_AM_SIZE
   191                              <1> 	stripangles %assign I_AM_SIZE, %2
   192                              <1> 	%assign I_AM_LEN       1
   193                              <1> 	    %ENDIF
   194                              <1> 	%ENDIF
   195                              <1>     %ENDIF
   196                              <1> ;; declare the object public
   197                              <1> 	PUBLIC  %%name
   198                              <1> ;; if no initialize then allocate blank storage
   199                              <1>     %IF %0 == 2
   200                              <1> 	DB  I_AM_SIZE*I_AM_LEN DUP (?)
   201                              <1>     %ELSE
   202                              <1> %ifn InstalledData
   203                              <1>  %rotate 2
   204                              <1>  %rep %0 - 2
   205                              <1> 	    %IF I_AM_LEN == 1
   206                              <1> 		stripangles db, %1
   207                              <1> 	    %ELSE
   208                              <1> 		stripangles dw, %1
   209                              <1> 	    %ENDIF
   210                              <1> 	    %assign I_AM_SIZE I_AM_SIZE - 1
   211                              <1> 	    %rotate 1
   212                              <1>  %endrep
   213                              <1> 	%IF I_AM_SIZE != 0
   214                              <1> 	    %error    ***** initialization of %%name not complete *****
   215                              <1> 	%ENDIF
   216                              <1> %ELSE
   217                              <1> 	DB  I_AM_SIZE*I_AM_LEN DUP (?)
   218                              <1> %ENDIF
   219                              <1>     %ENDIF
   220                              <1> %endmacro
   221                              <1> 
   222                              <1> %imacro I_AM_NOBITS 2-*.nolist
   223                              <1> ;I_AM    MACRO   name,size,init
   224                              <1> %xdefine %%name %1
   225                              <1> ;; declare the type of the object
   226                              <1>     %IFIDNi %2, WORD
   227                              <1> %1    LABEL WORD
   228                              <1> 	%assign I_AM_SIZE      1
   229                              <1> 	%assign I_AM_LEN       2
   230                              <1>     %ELSE
   231                              <1> 	%IFIDNi %2, DWORD
   232                              <1> %1    LABEL DWORD
   233                              <1> 	%assign I_AM_SIZE      2
   234                              <1> 	%assign I_AM_LEN       2
   235                              <1> 	%ELSE
   236                              <1> 	    %IFIDNi %2, BYTE
   237                              <1> %1    LABEL BYTE
   238                              <1> 	%assign I_AM_SIZE      1
   239                              <1> 	%assign I_AM_LEN       1
   240                              <1> 	    %ELSE
   241                              <1> %1    LABEL BYTE
   242                              <1> %undef I_AM_SIZE
   243                              <1> 	stripangles %assign I_AM_SIZE, %2
   244                              <1> 	%assign I_AM_LEN       1
   245                              <1> 	    %ENDIF
   246                              <1> 	%ENDIF
   247                              <1>     %ENDIF
   248                              <1> ;; declare the object public
   249                              <1> 	PUBLIC  %%name
   250                              <1> ;; if no initialize then allocate blank storage
   251                              <1>     %IF %0 == 2
   252                              <1> 	resb  I_AM_SIZE*I_AM_LEN
   253                              <1>     %ELSE
   254                              <1> %ifn InstalledData
   255                              <1>  %rotate 2
   256                              <1>  %rep %0 - 2
   257                              <1> 	    %IF I_AM_LEN == 1
   258                              <1> 		resb 1
   259                              <1> 	    %ELSE
   260                              <1> 		resw 1
   261                              <1> 	    %ENDIF
   262                              <1> 	    %assign I_AM_SIZE I_AM_SIZE - 1
   263                              <1> 	    %rotate 1
   264                              <1>  %endrep
   265                              <1> 	%IF I_AM_SIZE != 0
   266                              <1> 	    %error    ***** initialization of %%name not complete *****
   267                              <1> 	%ENDIF
   268                              <1> %ELSE
   269                              <1> 	resb  I_AM_SIZE*I_AM_LEN
   270                              <1> %ENDIF
   271                              <1>     %ENDIF
   272                              <1> %endmacro
   273                              <1> 
   274                              <1> ;.xcref  I_AM
   275                              <1> ;.xcref  I_AM_SIZE
   276                              <1> ;.xcref  I_AM_LEN
   277                              <1> %assign I_AM_SIZE 0
   278                              <1> %assign I_AM_LEN  0
   279                              <1> 
   280                              <1> ;PAGE
   281                              <1> 
   282                              <1> ;
   283                              <1> ; define an entry in a procedure
   284                              <1> ;
   285                              <1> %imacro entry 1-2.nolist
   286                              <1> %1:
   287                              <1> 	PUBLIC  %1
   288                              <1> %endmacro
   289                              <1> ;.xcref  entry
   290                              <1> 
   291                              <1> BREAK <ERROR - store an error code then jump to a label>
   292                              <1> 
   293                              <1> %imacro error 1.nolist
   294                              <1> ;.xcref
   295                              <1> 	MOV AL, %1
   296                              <1> 	transfer    SYS_RET_ERR
   297                              <1> ;.cref
   298                              <1> %endmacro
   299                              <1> ;.xcref  error
   300                              <1> 
   301                              <1> BREAK <JUMP - real jump that links up shortwise>
   302                              <1> ;
   303                              <1> ; given a label <lbl> either 2 byte jump to another label <lbl>_J
   304                              <1> ; if it is near enough or 3 byte jump to <lbl>
   305                              <1> ;
   306                              <1> 
   307                              <1> %imacro jump 1.nolist
   308                              <1> ;.xcref
   309                              <1> 
   310                              <1>     %ifndef %1_J                       ;; is this the first invocation
   311                              <1> %%a:      JMP %1
   312                              <1>     %ELSE
   313                              <1> 	%IF (%1_J >= $) || ($-%1_J > 126)
   314                              <1> %%a:      JMP %1                         ;; is the jump too far away?
   315                              <1> 	%ELSE
   316                              <1> %%a:      JMP %1_J                      ;; do the short one...
   317                              <1> 	%ENDIF
   318                              <1>     %ENDIF
   319                              <1>     %ixdefine %1_j %%a
   320                              <1> ;.cref
   321                              <1> %endmacro
   322                              <1> ;.xcref  jump
   323                              <1> 
   324                              <1> BREAK <RETURN - return from a function>
   325                              <1> 
   326                              <1> %imacro return 0.nolist
   327                              <1> %%a:
   328                              <1> 	RET
   329                              <1> %xdefine ret_l %%a
   330                              <1> %endmacro
   331                              <1> ;.xcref  return
   332                              <1> 
   333                              <1> BREAK <CONDRET - conditional return>
   334                              <1> 
   335                              <1> %imacro condret 2.nolist
   336                              <1> %assign %%exit 0
   337                              <1>     %ifdef   ret_l                       ;; if ret_l is defined
   338                              <1> 	%if (($ - ret_l) <= 126) && ($ > ret_l)
   339                              <1> 					;;     if ret_l is near enough then
   340                              <1> 	    %%a:  j%1    ret_l           ;;         a: j<CC> to ret_l
   341                              <1> 	    %xdefine ret_%1 %%a                 ;;         define ret_<CC> to be a:
   342                              <1> 	    %assign %%exit 1
   343                              <1> 	%endif
   344                              <1>     %endif
   345                              <1>     %ifn %%exit
   346                              <1>     %ifdef   ret_%1                     ;; if ret_<CC> defined
   347                              <1> 	%if (($ - ret_%1) <= 126) && ($ > ret_%1)
   348                              <1> 					;;     if ret_<CC> is near enough
   349                              <1> 	    %%a:  j%1    ret_%1         ;;         a: j<CC> to ret_<CC>
   350                              <1> 	    %xdefine ret_%1 %%a                 ;;         define ret_<CC> to be a:
   351                              <1> 	    %assign %%exit 1
   352                              <1> 	%endif
   353                              <1>     %endif
   354                              <1>     %endif
   355                              <1>     %ifn %%exit
   356                              <1>     j%2   %%a                           ;; j<NCC> a:
   357                              <1>     return                              ;; return
   358                              <1>     %%a:                                  ;; a:
   359                              <1>     %xdefine ret_%1 ret_l                     ;; define ret_<CC> to be ret_l
   360                              <1>     %endif
   361                              <1> %endmacro
   362                              <1> ;.xcref  condret
   363                              <1> 
   364                              <1> BREAK <RETZ - return if zero, links up shortwise if necessary>
   365                              <1> 
   366                              <1> %imacro retz 0.nolist
   367                              <1>     condret z,nz
   368                              <1> %endmacro
   369                              <1> ;.xcref  retz
   370                              <1> 
   371                              <1> BREAK <RETNZ - return if not zero, links up shortwise if necessary>
   372                              <1> 
   373                              <1> %imacro retnz 0.nolist
   374                              <1>     condret nz,z
   375                              <1> %endmacro
   376                              <1> ;.xcref  retnz
   377                              <1> 
   378                              <1> BREAK <RETC - return if carry set, links up shortwise if necessary>
   379                              <1> 
   380                              <1> %imacro retc 0.nolist
   381                              <1>     condret c,nc
   382                              <1> %endmacro
   383                              <1> ;.xcref  retc
   384                              <1> 
   385                              <1> BREAK <RETNC - return if not carry, links up shortwise if necessary>
   386                              <1> 
   387                              <1> %imacro retnc 0.nolist
   388                              <1>     condret nc,c
   389                              <1> %endmacro
   390                              <1> ;.xcref  retnc
   391                              <1> 
   392                              <1> BREAK <CONTEXT - set the DOS context to a particular register>
   393                              <1> 
   394                              <1> %imacro context 1.nolist
   395                              <1> 	PUSH    SS
   396                              <1> 	stripangles POP, %1
   397                              <1> 	; ASSUME  %1:DOSGROUP
   398                              <1> %endmacro
   399                              <1> ;.xcref  context
   400                              <1> 
   401                              <1> BREAK <SaveReg - save a set of registers>
   402                              <1> 
   403                              <1> %imacro SaveReg 0-*.nolist                 ;; push those registers
   404                              <1>  %rep %0
   405                              <1> 	%assign ?stackdepth ?stackdepth + 1
   406                              <1> 	stripangles push, %1
   407                              <1> 	%rotate 1
   408                              <1>  %endrep
   409                              <1> %endmacro
   410                              <1> ;.xcref  SaveReg
   411                              <1> 
   412                              <1> BREAK <RestoreReg - unsave some registers>
   413                              <1> 
   414                              <1> %imacro RestoreReg 0-*.nolist             ;; pop those registers
   415                              <1>  %rep %0
   416                              <1> 	%assign ?stackdepth ?stackdepth - 1
   417                              <1> 	stripangles pop, %1
   418                              <1> 	%rotate 1
   419                              <1>  %endrep
   420                              <1> %endmacro
   421                              <1> ;.xcref  RestoreReg
   422                              <1> 
   423                              <1> BREAK <Critical section macros>
   424                              <1> 
   425                              <1> %imacro EnterCrit 1.nolist
   426                              <1> 	Invoke  E%1
   427                              <1> %endmacro
   428                              <1> 
   429                              <1> %imacro LeaveCrit 1.nolist
   430                              <1> 	Invoke  L%1
   431                              <1> %endmacro
   432                              <1> 
   433                              <1> Break   <message - display a message>
   434                              <1> 
   435                              <1> ;AsmVars <ShareF,Cargs,Redirector>
   436                              <1> %ifndef ShareF
   437                              <1>  %idefine ShareF 0
   438                              <1> %endif
   439                              <1> %ifndef Cargs
   440                              <1>  %idefine Cargs 0
   441                              <1> %endif
   442                              <1> %ifndef Redirector
   443                              <1>  %idefine Redirector 0
   444                              <1> %endif
   445                              <1> %ifndef debug
   446                              <1>  %idefine debug 0
   447                              <1> %endif
   448                              <1> 
   449                              <1> %if debug
   450                              <1> %imacro fmt 3-*.nolist
   451                              <1> ;fmt     MACRO   typ,lev,fmts,args
   452                              <1> ;local   a,b,c
   453                              <1> 	PUSHF
   454                              <1> %IFNempty %1
   455                              <1> 	TEST    word [BugTyp],%1
   456                              <1> 	JZ      %%c
   457                              <1> 	CMP     word [BugLev],%2
   458                              <1> 	JB      %%c
   459                              <1> %ENDIF
   460                              <1> 	PUSH    AX
   461                              <1> 	PUSH    BP
   462                              <1> 	MOV     BP,SP
   463                              <1> %If (! sharef) && (! redirector)
   464                              <1> 	[section Table]
   465                              <1> %%a:       db      %3,0
   466                              <1> 	__SECT__
   467                              <1> 	MOV     AX,OFFSET %%a wrt DOSGROUP
   468                              <1> %else
   469                              <1> 	jmp     short %%b
   470                              <1> %%a:       db      %3,0
   471                              <1> %if sharef
   472                              <1> %%b:      mov     ax,offset %%a wrt share
   473                              <1> %else
   474                              <1> %%b:      mov     ax,offset %%a wrt netwrk
   475                              <1> %endif
   476                              <1> %endif
   477                              <1> 	PUSH    AX
   478                              <1> %iassign cargs 2
   479                              <1> %rotate 3
   480                              <1> %rep %0 - 3
   481                              <1>  %ifidni ax, %1
   482                              <1> 	MOV     AX,[BP+2]
   483                              <1>  %ELSE
   484                              <1> 	MOV     AX, %1
   485                              <1>  %ENDIF
   486                              <1> 	PUSH    AX
   487                              <1>  %iassign cargs cargs + 2
   488                              <1>  %rotate 1
   489                              <1> %endrep
   490                              <1> 	invoke  PFMT
   491                              <1> 	ADD     SP, Cargs
   492                              <1> 	POP     BP
   493                              <1> 	POP     AX
   494                              <1> %%c:
   495                              <1> 	POPF
   496                              <1> %endmacro
   497                              <1> %else
   498                              <1> %imacro fmt 3-*.nolist
   499                              <1> %endmacro
   500                              <1> %endif
   501                              <1> 
   502                              <1> Break   <DOSAssume - validate assumes>
   503                              <1> 
   504                              <1> ;AsmVar  Debug,$temp
   505                              <1> 
   506                              <1> %imacro detectstripangles 4.nolist
   507                              <1> %defstr %%param %4
   508                              <1> %assign ?%2 0
   509                              <1> %assign ?%3 0
   510                              <1> %rep 16
   511                              <1>  %substr %%opening %%param 1
   512                              <1>  %ifidn %%opening, '<'
   513                              <1>   %substr %%param %%param 2,-1
   514                              <1>   %assign ?%2 ?%2 + 1
   515                              <1>  %endif
   516                              <1> %endrep
   517                              <1> %rep 16
   518                              <1>  %strlen %%length %%param
   519                              <1>  %substr %%closing %%param %%length
   520                              <1>  %ifidn %%closing, '>'
   521                              <1>   %substr %%param %%param 1,-2
   522                              <1>   %assign ?%3 ?%3 + 1
   523                              <1>  %endif
   524                              <1> %endrep
   525                              <1> %deftok %%token %%param
   526                              <1> %define ?%1 %%token
   527                              <1> %endmacro
   528                              <1> 
   529                              <1> 
   530                              <1> %IF debug
   531                              <1> %imacro DOSAssume 3-*.nolist
   532                              <1> ;DOSAssume   Macro   reg,reglist,message
   533                              <1>  %ifidni %1, CS
   534                              <1>   %assign %%temp 1
   535                              <1>  %else
   536                              <1>   %ifidni %1, SS
   537                              <1>    %assign %%temp 0
   538                              <1>   %else
   539                              <1>    %error ***** Invalid DOS register %1 in DOSAssume *****
   540                              <1>   %endif
   541                              <1>  %endif
   542                              <1>  %rotate 1
   543                              <1>  %assign %%level 0
   544                              <1>  %assign %%amount %0 - 1
   545                              <1>  %rep 16
   546                              <1>   detectstripangles %%token, %%opening, %%closing, %1
   547                              <1>   %assign %%level %%level + ? %+ %%opening
   548                              <1>   %assign %%level %%level - ? %+ %%closing
   549                              <1>   %ifidni ? %+ %%token, DS
   550                              <1>    %assign %%temp %%temp | 2
   551                              <1>   %else
   552                              <1>    %ifidni ? %+ %%token, ES
   553                              <1>     %assign %%temp %%temp | 4
   554                              <1>    %else
   555                              <1>     %error ***** Invalid register reg in DOSAssume *****
   556                              <1>    %endif
   557                              <1>   %endif
   558                              <1>   %assign %%amount %%amount - 1
   559                              <1>   %rotate 1
   560                              <1>   %if %%level <= 0
   561                              <1>    %exitrep
   562                              <1>   %endif
   563                              <1>  %endrep
   564                              <1> 
   565                              <1> 	PUSH    AX
   566                              <1> 	MOV     AX, %%temp
   567                              <1> 	PUSH    AX
   568                              <1> %IF SHAREF
   569                              <1> 	MOV     AX,OFFSET %%a
   570                              <1> %ELSE
   571                              <1> 	MOV     AX,OFFSET %%a wrt DOSGroup
   572                              <1> %ENDIF
   573                              <1> 	PUSH    AX
   574                              <1> 	Invoke  SegCheck
   575                              <1> 	POP     AX
   576                              <1> %IFN SHAREF
   577                              <1> 	[section Table]
   578                              <1> %ELSE
   579                              <1> 	JMP     SHORT %%b
   580                              <1> %ENDIF
   581                              <1> %%a:
   582                              <1>  %rep %%amount
   583                              <1>         DB      %1
   584                              <1>   %rotate 1
   585                              <1>  %endrep
   586                              <1> 	db 0
   587                              <1> %IFN SHAREF
   588                              <1> 	__SECT__
   589                              <1> %ELSE
   590                              <1> %%b:
   591                              <1> %ENDIF
   592                              <1> ;IRP r,<reglist>
   593                              <1> ;    ASSUME  r:DOSGroup
   594                              <1> ;ENDM
   595                              <1> %endmacro
   596                              <1> %ELSE
   597                              <1> %imacro DOSAssume 3-*.nolist
   598                              <1> ;DOSAssume   Macro   reg,reglist,message
   599                              <1> ;IRP r,<reglist>
   600                              <1> ;    ASSUME  r:DOSGroup
   601                              <1> ;ENDM
   602                              <1> %endmacro
   603                              <1> %ENDIF
   604                              <1> 
   605                              <1> BREAK   <ASSERT - make assertions about registers>
   606                              <1> 
   607                              <1> %if 0
   608                              <1> ;IF DEBUG
   609                              <1> Assert  MACRO   kind, objs, message
   610                              <1> 	LOCAL   a,b
   611                              <1>     IFIDN   <kind>,<Z>
   612                              <1> 	CMP     objs,0
   613                              <1> 	JZ      a
   614                              <1> 	fmt <>,<>,<message>
   615                              <1> a:
   616                              <1>     ELSE
   617                              <1> 	IFIDN   <kind>,<NZ>
   618                              <1> 	CMP     objs,0
   619                              <1> 	JNZ     a
   620                              <1> 	fmt <>,<>,<message>
   621                              <1> a:
   622                              <1> 	ELSE
   623                              <1>     PUSH    AX
   624                              <1> 	    IRP obj,<objs>
   625                              <1> 	PUSH    obj
   626                              <1> 	    ENDM
   627                              <1> 	    IF SHAREF
   628                              <1>     MOV     AX,OFFSET b
   629                              <1> 	    ELSE
   630                              <1>     MOV     AX,OFFSET DOSGroup:b
   631                              <1> 	    ENDIF
   632                              <1>     PUSH    AX
   633                              <1> 	    IFIDN   <kind>,<ISBUF>
   634                              <1> 	Invoke  BUFCheck
   635                              <1> 	    ENDIF
   636                              <1> 	    IFIDN   <kind>,<ISSFT>
   637                              <1> 	Invoke  SFTCheck
   638                              <1> 	    ENDIF
   639                              <1> 	    IFIDN   <kind>,<ISDPB>
   640                              <1> 	Invoke  DPBCheck
   641                              <1> 	    ENDIF
   642                              <1>     POP     AX
   643                              <1> 	    IF SHAREF
   644                              <1>     JMP SHORT a
   645                              <1> b   DB  Message,0
   646                              <1> a:
   647                              <1> 	    ELSE
   648                              <1> Table   segment
   649                              <1> b   db  Message,0
   650                              <1> Table   ends
   651                              <1> 	    ENDIF
   652                              <1> 	ENDIF
   653                              <1>     ENDIF
   654                              <1> ENDM
   655                              <1> %ELSE
   656                              <1> %imacro Assert 0-*.nolist
   657                              <1> %endmacro
   658                              <1> %ENDIF
   659                              <1> 
   660                              <1> %ifndef Installed
   661                              <1>  %idefine Installed 1
   662                              <1> %endif
   663                              <1> 
   664                              <1> Break   <CallInstall - hook to installable pieces>
   665                              <1> 
   666                              <1> %imacro CallInstall 3-*.nolist
   667                              <1> ;CallInstall MACRO   name,mpx,fn,save,restore
   668                              <1> %define %%name %1
   669                              <1> %assign %%mpx %2
   670                              <1> %assign %%fn %3
   671                              <1> %IF Installed
   672                              <1>  %rotate 3
   673                              <1>  %assign %%level 0
   674                              <1>  %assign %%amountsaved 0
   675                              <1>  %rep %0 - 3
   676                              <1>   %ifnempty %1
   677                              <1>    detectstripangles %%token, %%opening, %%closing, %1
   678                              <1>    %assign %%level %%level + ? %+ %%opening
   679                              <1>    %assign %%level %%level - ? %+ %%closing
   680                              <1>    SaveReg ? %+ %%token
   681                              <1>   %endif
   682                              <1>   %assign %%amountsaved %%amountsaved + 1
   683                              <1>   %rotate 1
   684                              <1>   %if %%level <= 0
   685                              <1>    %exitrep
   686                              <1>   %endif
   687                              <1>  %endrep
   688                              <1> 	MOV     AX,(%%mpx << 8) + %%fn
   689                              <1> 	INT     2Fh
   690                              <1>  %assign %%level 0
   691                              <1>  %assign %%amountrestored 0
   692                              <1>  %rep %0 - 3 - %%amountsaved
   693                              <1>   %ifnempty %1
   694                              <1>    detectstripangles %%token, %%opening, %%closing, %1
   695                              <1>    %assign %%level %%level + ? %+ %%opening
   696                              <1>    %assign %%level %%level - ? %+ %%closing
   697                              <1>    RestoreReg ? %+ %%token
   698                              <1>   %endif
   699                              <1>   %assign %%amountrestored %%amountrestored + 1
   700                              <1>   %rotate 1
   701                              <1>   %if %%level <= 0
   702                              <1>    %exitrep
   703                              <1>   %endif
   704                              <1>  %endrep
   705                              <1>  %if %%level > 0 || %0 != 3 + %%amountsaved + %%amountrestored
   706                              <1>   %error Wrong amount saved or restored
   707                              <1>  %endif
   708                              <1> %ELSE
   709                              <1> 	Invoke  %%name
   710                              <1> %ENDIF
   711                              <1> %endmacro
   712                              <1> 
   713                              <1> Break   <Stack frame manipulators>
   714                              <1> 
   715                              <1> %imacro localvar 2.nolist
   716                              <1> %ifidni %2, BYTE
   717                              <1>  %assign ?frame ?frame + 1
   718                              <1>  %assign %%a ?frame
   719                              <1>  labelsize %1, byte, bp - %%a
   720                              <1> %else
   721                              <1>  %ifidni %2, WORD
   722                              <1>   %assign ?frame ?frame + 2
   723                              <1>   %assign %%a ?frame
   724                              <1>   labelsize %1, word, bp - %%a
   725                              <1>  %else
   726                              <1>   %ifidni %2, DWORD
   727                              <1>    %assign ?frame ?frame + 4
   728                              <1>    %assign %%a ?frame
   729                              <1>    labelsize %1 %+ l, word, bp - %%a
   730                              <1>    labelsize %1 %+ h, word, bp - %%a + 2
   731                              <1>    labelsize %1, dword, bp - %%a
   732                              <1>   %else
   733                              <1>    %assign ?frame ?frame + %2
   734                              <1>    %assign %%a ?frame
   735                              <1>    labelsize %1, byte, bp - %%a
   736                              <1>   %endif
   737                              <1>  %endif
   738                              <1> %endif
   739                              <1> %endmacro
   740                              <1> 
   741                              <1> %imacro enter 0.nolist
   742                              <1> 	push    bp
   743                              <1> 	mov     bp,sp
   744                              <1> 	sub     sp,?frame
   745                              <1> %endmacro
   746                              <1> 
   747                              <1> %imacro leave 0.nolist
   748                              <1> 	mov     sp,bp
   749                              <1> 	pop     bp
   750                              <1> %endmacro
   751                              <1> 
   752                              <1> 
   753                              <1> %imacro argvar 2.nolist
   754                              <1> %ifidni %2, BYTE
   755                              <1>  %assign %%a ?aframe
   756                              <1>  %assign ?aframe ?aframe + 1
   757                              <1>  labelsize %1, byte, bp + %%a
   758                              <1> %else
   759                              <1>  %ifidni %2, WORD
   760                              <1>   %assign %%a ?aframe
   761                              <1>   %assign ?aframe ?aframe + 2
   762                              <1>   labelsize %1, word, bp + %%a
   763                              <1>  %else
   764                              <1>   %ifidni %2, DWORD
   765                              <1>    %assign %%a ?aframe
   766                              <1>    %assign ?aframe ?aframe + 4
   767                              <1>    labelsize %1 %+ l, word, bp + %%a
   768                              <1>    labelsize %1 %+ h, word, bp + %%a + 2
   769                              <1>    labelsize %1, dword, bp + %%a
   770                              <1>   %else
   771                              <1>    %assign %%a ?aframe
   772                              <1>    %assign ?aframe ?aframe + %2
   773                              <1>    labelsize %1, byte, bp + %%a
   774                              <1>   %endif
   775                              <1>  %endif
   776                              <1> %endif
   777                              <1> %endmacro
   778                              <1> 
   779                              <1> BREAK   <errnz - generate compilation errors>
   780                              <1> 
   781                              <1> %imacro errnz 1.nolist
   782                              <1> detectstripangles %%token, %%opening, %%closing, %1
   783                              <1> %if ? %+ %%token
   784                              <1>     %error %1 <> 0
   785                              <1> %endif
   786                              <1> %endmacro
   787                              <1> 
   788                              <1> %endif
    17                                  %include "sf.mac"
     1                              <1> ;	SCCSID = @(#)sf.asm	1.1 85/04/10
     2                              <1> BREAK <Internal system file table format>
     3                              <1> ;
     4                              <1> ;   AN000   version 4.00   Jan. 1988
     5                              <1> ;   AN003   PTM 3680 --  make NAME offset the same as before (<=3.30)
     6                              <1> ;   AN009   PTM 3839	 reorder SFT for MS WINDOWS
     7                              <1> 
     8                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     9                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    10                              <1> ;									   ;
    11                              <1> ;
    12                              <1> ; system file table
    13                              <1> ;
    14                              <1> 
    15                              <1> SF		STRUC
    16 00000000 ????????            <1> SFLink		DD	?
    17 00000004 ????                <1> SFCount 	DW	?		; number of entries
    18 00000006 ????                <1> SFTable 	DW	?		; beginning of array of the following
    19                              <1> SF		ENDS
    20                              <1> 
    21                              <1> ;
    22                              <1> ; system file table entry
    23                              <1> ;
    24                              <1> 
    25                              <1> sf_entry	STRUC
    26 00000000 ????                <1> sf_ref_count	DW	?		; number of processes sharing entry
    27                              <1> 					;   if FCB then ref count
    28 00000002 ????                <1> sf_mode 	DW	?		; mode of access or high bit on if FCB
    29 00000004 ??                  <1> sf_attr 	DB	?		; attribute of file
    30 00000005 ????                <1> sf_flags	DW	?		;Bits 8-15
    31                              <1> 					; Bit 15 = 1 if remote file
    32                              <1> 					;	 = 0 if local file or device
    33                              <1> 					; Bit 14 = 1 if date/time is not to be
    34                              <1> 					;   set from clock at CLOSE.  Set by
    35                              <1> 					;   FILETIMES and FCB_CLOSE.  Reset by
    36                              <1> 					;   other reseters of the dirty bit
    37                              <1> 					;   (WRITE)
    38                              <1> 					; Bit 13 = Pipe bit (reserved)
    39                              <1> 					;
    40                              <1> 					; Bits 0-7 (old FCB_devid bits)
    41                              <1> 					; If remote file or local file, bit
    42                              <1> 					; 6=0 if dirty Device ID number, bits
    43                              <1> 					; 0-5 if local file.
    44                              <1> 					; bit 7=0 for local file, bit 7
    45                              <1> 					;      =1 for local I/O device
    46                              <1> 					; If local I/O device, bit 6=0 if EOF (input)
    47                              <1> 					;		Bit 5=1 if Raw mode
    48                              <1> 					;		Bit 0=1 if console input device
    49                              <1> 					;		Bit 1=1 if console output device
    50                              <1> 					;		Bit 2=1 if null device
    51                              <1> 					;		Bit 3=1 if clock device
    52 00000007 ????????            <1> sf_devptr	DD	?		; Points to DPB if local file, points
    53                              <1> 					; to device header if local device,
    54                              <1> 					; points to net device header if
    55                              <1> 					; remote
    56 0000000B ????                <1> sf_firclus	DW	?		; First cluster of file (bit 15 = 0)
    57 0000000D ????                <1> sf_time 	DW	?		; Time associated with file
    58 0000000F ????                <1> sf_date 	DW	?		; Date associated with file
    59 00000011 ????????            <1> sf_size 	DD	?		; Size associated with file
    60 00000015 ????????            <1> sf_position	DD	?		; Read/Write pointer or LRU count for FCBs
    61                              <1> ;
    62                              <1> ; Starting here, the next 7 bytes may be used by the file system to store an
    63                              <1> ; ID
    64                              <1> ;
    65 00000019 ????                <1> sf_cluspos	DW	?		; Position of last cluster accessed
    66 0000001B ????????            <1> sf_dirsec	DD	?		; Sector number of directory sector for
    67                              <1> 					; for this file
    68 0000001F ??                  <1> sf_dirpos	DB	?		; Offset of this entry in the above
    69                              <1> ;
    70                              <1> ; End of 7 bytes of file-system specific info.
    71                              <1> ;
    72 00000020 <res Bh>            <1> sf_name 	DB	11 DUP (?)	; 11 character name that is in the
    73                              <1> 					; directory entry.  This is used by
    74                              <1> 					; close to detect file deleted and
    75                              <1> 					; disk changed errors.
    76                              <1> 
    77                              <1> ; SHARING INFO
    78 0000002B ????????            <1> sf_chain	DD	?		; link to next SF
    79 0000002F ????                <1> sf_UID		DW	?
    80 00000031 ????                <1> sf_PID		DW	?
    81 00000033 ????                <1> sf_MFT		DW	?
    82 00000035 ????                <1> sf_lstclus	DW	?		;AN009; Last cluster accessed
    83 00000037 ????????            <1> sf_IFS_HDR	DD	?
    84                              <1> sf_entry	ENDS
    85                              <1> 
    86                              <1> labelsize sf_fsda, byte, sf_cluspos	     ;DOS 4.00
    87                              <1> labelsize sf_serial_ID, word, sf_firclus	     ;DOS 4.00
    88                              <1> labelsize sf_netid, byte, sf_cluspos
    89                              <1> labelsize sf_OpenAge, word, sf_position+2
    90                              <1> labelsize sf_LRU, word, sf_position
    91                              <1> 
    92                              <1> sf_default_number   EQU     5h
    93                              <1> 
    94                              <1> ;
    95                              <1> ; Note that we need to mark an SFT as being busy for OPEN/CREATE.  This is
    96                              <1> ; because an INT 24 may prevent us from 'freeing' it.  We mark this as such
    97                              <1> ; by placing a -1 in the ref_count field.
    98                              <1> ;
    99                              <1> 
   100                              <1> sf_busy EQU -1
   101                              <1> 
   102                              <1> 
   103                              <1> ; mode mask for FCB detection
   104                              <1> sf_isfcb		EQU	1000000000000000B
   105                              <1> 
   106                              <1> ; Flag word masks
   107                              <1> sf_isnet		EQU	1000000000000000B
   108                              <1> sf_close_nodate 	EQU	0100000000000000B
   109                              <1> sf_pipe 		EQU	0010000000000000B
   110                              <1> sf_no_inherit		EQU	0001000000000000B
   111                              <1> sf_net_spool		EQU	0000100000000000B
   112                              <1> Handle_Fail_I24 	EQU	0000000100000000B  ;BIT 8 - DISK FULL I24 ERROR
   113                              <1> 
   114                              <1> ; Local file/device flag masks
   115                              <1> devid_file_clean	EQU	40h	; true if file and not written
   116                              <1> devid_file_mask_drive	EQU	3Fh	; mask for drive number
   117                              <1> 
   118                              <1> devid_device		EQU	80h	; true if a device
   119                              <1> devid_device_EOF	EQU	40h	; true if end of file reached
   120                              <1> devid_device_raw	EQU	20h	; true if in raw mode
   121                              <1> devid_device_special	EQU	10h	; true if special device
   122                              <1> devid_device_clock	EQU	08h	; true if clock device
   123                              <1> devid_device_null	EQU	04h	; true if null device
   124                              <1> devid_device_con_out	EQU	02h	; true if console output
   125                              <1> devid_device_con_in	EQU	01h	; true if consle input
   126                              <1> ;									   ;
   127                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   128                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   129                              <1> 
   130                              <1> ;
   131                              <1> ; structure of devid field as returned by IOCTL is:
   132                              <1> ;
   133                              <1> ;	BIT	7   6	5   4	3   2	1   0
   134                              <1> ;	      |---|---|---|---|---|---|---|---|
   135                              <1> ;	      | I | E | R | S | I | I | I | I |
   136                              <1> ;	      | S | O | A | P | S | S | S | S |
   137                              <1> ;	      | D | F | W | E | C | N | C | C |
   138                              <1> ;	      | E |   |   | C | L | U | O | I |
   139                              <1> ;	      | V |   |   | L | K | L | T | N |
   140                              <1> ;	      |---|---|---|---|---|---|---|---|
   141                              <1> ;	ISDEV = 1 if this channel is a device
   142                              <1> ;	      = 0 if this channel is a disk file
   143                              <1> ;
   144                              <1> ;	If ISDEV = 1
   145                              <1> ;
   146                              <1> ;	      EOF = 0 if End Of File on input
   147                              <1> ;	      RAW = 1 if this device is in Raw mode
   148                              <1> ;		  = 0 if this device is cooked
   149                              <1> ;	      ISCLK = 1 if this device is the clock device
   150                              <1> ;	      ISNUL = 1 if this device is the null device
   151                              <1> ;	      ISCOT = 1 if this device is the console output
   152                              <1> ;	      ISCIN = 1 if this device is the console input
   153                              <1> ;
   154                              <1> ;	If ISDEV = 0
   155                              <1> ;	      EOF = 0 if channel has been written
   156                              <1> ;	      Bits 0-5	are  the  block  device  number  for
   157                              <1> ;		  the channel (0 = A, 1 = B, ...)
   158                              <1> ;
   159                              <1> devid_ISDEV	EQU	80h
   160                              <1> devid_EOF	EQU	40h
   161                              <1> devid_RAW	EQU	20h
   162                              <1> devid_SPECIAL	EQU	10H
   163                              <1> devid_ISCLK	EQU	08h
   164                              <1> devid_ISNUL	EQU	04h
   165                              <1> devid_ISCOT	EQU	02h
   166                              <1> devid_ISCIN	EQU	01h
   167                              <1> 
   168                              <1> devid_block_dev EQU	1Fh		; mask for block device number
    18                                  %include "dirent.mac"
     1                              <1> ;	SCCSID = @(#)dirent.asm 1.1 85/04/10
     2                              <1> ;	SCCSID = @(#)dirent.asm 1.1 85/04/10
     3                              <1> Break <Directory entry>
     4                              <1> 
     5                              <1> ;
     6                              <1> ;	+---------------------------+
     7                              <1> ;	|  (12 BYTE) filename/ext   |	    0	    0
     8                              <1> ;	+---------------------------+
     9                              <1> ;	|     (BYTE) attributes     |	    11	    B
    10                              <1> ;	+---------------------------+
    11                              <1> ;	|    (10 BYTE) reserved     |	    12	    C
    12                              <1> ;	+---------------------------+
    13                              <1> ;	| (WORD) time of last write |	    22	    16
    14                              <1> ;	+---------------------------+
    15                              <1> ;	| (WORD) date of last write |	    24	    18
    16                              <1> ;	+---------------------------+
    17                              <1> ;	|   (WORD) First cluster    |	    26	    1A
    18                              <1> ;	+---------------------------+
    19                              <1> ;	|     (DWORD) file size     |	    28	    1C
    20                              <1> ;	+---------------------------+
    21                              <1> ;
    22                              <1> ;   First byte of filename  = E5 -> free directory entry
    23                              <1> ;			    = 00 -> end of allocated directory
    24                              <1> ;   Time:   Bits 0-4=seconds/2, bits 5-10=minute, 11-15=hour
    25                              <1> ;   Date:   Bits 0-4=day, bits 5-8=month, bits 9-15=year-1980
    26                              <1> ;
    27                              <1> 
    28                              <1> dir_entry   STRUC
    29 00000000 <res Bh>            <1> dir_name    DB	    11 DUP (?)		; file name
    30 0000000B ??                  <1> dir_attr    DB	    ?			; attribute bits
    31 0000000C ????                <1> dir_codepg  dw	    ?			; code page DOS 4.00
    32 0000000E ????                <1> dir_extcluster dw   ?			; extended attribute starting cluster
    33 00000010 ??                  <1> dir_attr2   db	    ?			; reserved
    34 00000011 ??????????          <1> dir_pad     DB	    5  DUP (?)		; reserved for expansion
    35 00000016 ????                <1> dir_time    DW	    ?			; time of last write
    36 00000018 ????                <1> dir_date    DW	    ?			; date of last write
    37 0000001A ????                <1> dir_first   DW	    ?			; first allocation unit of file
    38 0000001C ????                <1> dir_size_l  DW	    ?			; low 16 bits of file size
    39 0000001E ????                <1> dir_size_h  DW	    ?			; high 16 bits of file size
    40                              <1> dir_entry   ENDS
    41                              <1> 
    42                              <1> attr_read_only	    EQU      1h
    43                              <1> attr_hidden	    EQU      2h
    44                              <1> attr_system	    EQU      4h
    45                              <1> attr_volume_id	    EQU      8h
    46                              <1> attr_directory	    EQU     10h
    47                              <1> attr_archive	    EQU     20h
    48                              <1> attr_device	    EQU     40h 	; This is a VERY special bit.
    49                              <1> 					;   NO directory entry on a disk EVER
    50                              <1> 					;   has this bit set. It is set non-zero
    51                              <1> 					;   when a device is found by GETPATH
    52                              <1> 
    53                              <1> attr_all	    EQU     attr_hidden+attr_system+attr_directory
    54                              <1> 					; OR of hard attributes for FINDENTRY
    55                              <1> 
    56                              <1> attr_ignore	    EQU     attr_read_only+attr_archive+attr_device
    57                              <1> 					; ignore this(ese) attribute(s) during
    58                              <1> 					; search first/next
    59                              <1> 
    60                              <1> attr_changeable     EQU     attr_read_only+attr_hidden+attr_system+attr_archive
    61                              <1> 					; changeable via CHMOD
    19                                  %include "curdir.mac"
     1                              <1> ;	SCCSID = @(#)curdir.asm 1.1 85/04/10
     2                              <1> ;	SCCSID = @(#)curdir.asm 1.1 85/04/10
     3                              <1> BREAK <Current directory list structure>
     4                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     5                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     6                              <1> ;									   ;
     7                              <1> ; CDS items are used bu the internal routines to store cluster numbers and ;
     8                              <1> ; network identifiers for each logical name.  The ID field is used dually, ;
     9                              <1> ; both as net ID and for a cluster number for local devices.  In the case  ;
    10                              <1> ; of local devices, the cluster number will be -1 if there is a potential  ;
    11                              <1> ; of the disk being changed or if the path must be recracked.  The END	   ;
    12                              <1> ; field is the location of the end of the definition.  No .. is allowed    ;
    13                              <1> ; past this point							   ;
    14                              <1> 
    15                              <1> DIRSTRLEN	EQU	64+3		; Max length in bytes of directory strings
    16                              <1> TEMPLEN 	EQU	DIRSTRLEN*2
    17                              <1> 
    18                              <1> curdir_list	STRUC
    19 00000000 <res 43h>           <1> curdir_text	DB	DIRSTRLEN DUP (?)   ; text of assignment and curdir
    20 00000043 ????                <1> curdir_flags	DW	?		; various flags
    21 00000045 ????????            <1> curdir_devptr	DD	?		; local pointer to DPB or net device
    22 00000049 ????                <1> curdir_ID	DW	?		; cluster of current dir (net ID)
    23 0000004B ????                <1> 		DW	?
    24 0000004D ????                <1> curdir_user_word DW	?
    25 0000004F ????                <1> curdir_end	DW	?		; end of assignment
    26 00000051 ??                  <1> curdir_type	DB	?		; IFS drive (2=ifs, 4=netuse)
    27 00000052 ????????            <1> curdir_ifs_hdr	DD	?		; Ptr to File System Header
    28 00000056 ????                <1> curdir_fsda	DB	2 DUP (?)	; File System Dependent Data Area
    29                              <1> curdir_list	ENDS
    30                              <1> 
    31                              <1> curdirLen	EQU	curdir_list_struc_size	; Needed for screwed up
    32                              <1> 						; ASM87 which doesn't allow
    33                              <1> 						; Size directive as a macro
    34                              <1> 						; argument
    35                              <1> labelsize curdir_netID, dword, curdir_ID
    36                              <1> 
    37                              <1> ;Flag word masks
    38                              <1> curdir_isnet	EQU	1000000000000000B
    39                              <1> curdir_isifs	EQU	1000000000000000B	; DOS 4.00
    40                              <1> curdir_inuse	EQU	0100000000000000B
    41                              <1> curdir_splice	EQU	0010000000000000B
    42                              <1> curdir_local	EQU	0001000000000000B
    43                              <1> ;									   ;
    44                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    45                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    20                                  %include "dpb.mac"
     1                              <1> ;	SCCSID = @(#)dpb.asm	1.1 85/04/10
     2                              <1> ;	SCCSID = @(#)dpb.asm	1.1 85/04/10
     3                              <1> BREAK <DPB structure>
     4                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     5                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     6                              <1> ;									   ;
     7                              <1> dpb	STRUC
     8 00000000 ??                  <1> dpb_drive	    DB	    ?		; Logical drive # assoc with DPB (A=0,B=1,...)
     9 00000001 ??                  <1> dpb_UNIT	    DB	    ?		; Driver unit number of DPB
    10 00000002 ????                <1> dpb_sector_size     DW	    ?		; Size of physical sector in bytes
    11 00000004 ??                  <1> dpb_cluster_mask    DB	    ?		; Sectors/cluster - 1
    12 00000005 ??                  <1> dpb_cluster_shift   DB	    ?		; Log2 of sectors/cluster
    13 00000006 ????                <1> dpb_first_FAT	    DW	    ?		; Starting record of FATs
    14 00000008 ??                  <1> dpb_FAT_count	    DB	    ?		; Number of FATs for this drive
    15 00000009 ????                <1> dpb_root_entries    DW	    ?		; Number of directory entries
    16 0000000B ????                <1> dpb_first_sector    DW	    ?		; First sector of first cluster
    17 0000000D ????                <1> dpb_max_cluster     DW	    ?		; Number of clusters on drive + 1
    18 0000000F ????                <1> dpb_FAT_size	    DW	    ?		;;Number of records occupied by FAT
    19 00000011 ????                <1> dpb_dir_sector	    DW	    ?		; Starting record of directory
    20 00000013 ????????            <1> dpb_driver_addr     DD	    ?		; Pointer to driver
    21 00000017 ??                  <1> dpb_media	    DB	    ?		; Media byte
    22 00000018 ??                  <1> dpb_first_access    DB	    ?		; This is initialized to -1 to force a media
    23                              <1> 					; check the first time this DPB is used
    24 00000019 ????????            <1> dpb_next_dpb	    DD	    ?		; Pointer to next Drive parameter block
    25 0000001D ????                <1> dpb_next_free	    DW	    ?		; Cluster # of last allocated cluster
    26 0000001F ????                <1> dpb_free_cnt	    DW	    ?		; Count of free clusters, -1 if unknown
    27                              <1> dpb	ENDS
    28                              <1> 
    29                              <1> DPBSIZ	EQU	dpb_struc_size		; Size of the structure in bytes
    30                              <1> 
    31                              <1> DSKSIZ	equ	dpb_max_cluster 	; Size of disk (temp used during init only)
    32                              <1> ;									   ;
    33                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    34                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    21                                  %include "buffer.mac"
     1                              <1> %include "buf2sw.mac"
     1                              <2> %define BUF2 1
     2                              <1> 
     3                              <1> ;	SCCSID = @(#)buffer.asm 1.1 85/04/09
     4                              <1> BREAK <Disk I/O Buffer Header>
     5                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     6                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     7                              <1> ;									   ;
     8                              <1> 
     9                              <1> %ifdef BUF2
    10                              <1> 
    11                              <1> ; Field definition for I/O buffer information
    12                              <1> 
    13                              <1> BUFFINFO        STRUC
    14 00000000 ????????            <1> NEXTBUF         DD      ?       ; Pointer to next buffer in list
    15                              <1> ; The next two items are often refed as a word
    16                              <1> buf_ID:
    17 00000004 ??                  <1> BUFDRV          DB      ?       ; Logical drive # assoc with buffer FF = free
    18                              <1> buf_flags:
    19 00000005 ??                  <1> BUFDATAFLAG	db	?
    20 00000006 ??                  <1> BUFPRI          DB      ?       ; Buffer selection priority (see EQUs below)
    21 00000007 ??                  <1> 	alignb 2
    22                              <1> buf_sector:
    23 00000008 ????????            <1> BUFSECNO        dd      ?       ; Sector number of buffer
    24                              <1> 	alignb 2
    25 0000000C ????????            <1> BUFDRVDP        DD      ?       ; Pointer to drive parameters
    26                              <1> BUFFINFO        ENDS
    27                              <1> 
    28                              <1> BUFINSIZ        EQU     BUFFINFO_struc_size
    29                              <1>                                 ; Size of structure in bytes
    30                              <1> BUFINSIZE equ BUFINSIZ
    31                              <1> 
    32                              <1> FREEPRI EQU     0
    33                              <1> LBRPRI  EQU     2               ; Last byte of buffer read
    34                              <1> LBWPRI  EQU     4               ; Last byte written
    35                              <1> RPRI    EQU     6               ; Read but not last byte
    36                              <1> WPRI    EQU     8               ; Written but not last byte
    37                              <1> DIRPRI  EQU     15              ; Directory Sector
    38                              <1> FATPRI  EQU     30              ; FAT sector
    39                              <1> 
    40                              <1> buf_dirty	EQU	01000000B
    41                              <1> buf_isDATA	EQU	00001000B
    42                              <1> buf_isDIR	EQU	00000100B
    43                              <1> buf_isFAT	EQU	00000010B
    44                              <1> buf_type_0	EQU	11110001B	; AND sets type to "none"
    45                              <1> 
    46                              <1> %else
    47                              <1> 
    48                              <1> ; Field definition for I/O buffer information
    49                              <1> 
    50                              <1> BUFFINFO	STRUC
    51                              <1> buf_next	DW	?		; Pointer to next buffer in list
    52                              <1> buf_prev	DW	?		; Pointer to prev buffer in list
    53                              <1> buf_ID		DB	?		; Drive of buffer (bit 7 = 0)
    54                              <1> 					; SFT table index (bit 7 = 1)
    55                              <1> 					; = FFH if buffer free
    56                              <1> buf_flags	DB	?		; Bit 7 = 1 if Remote file buffer
    57                              <1> 					;	= 0 if Local device buffer
    58                              <1> 					; Bit 6 = 1 if buffer dirty
    59                              <1> 					; Bit 5 = Reserved
    60                              <1> 					; Bit 4 = Search bit (bit 7 = 1)
    61                              <1> 					; Bit 3 = 1 if buffer is DATA
    62                              <1> 					; Bit 2 = 1 if buffer is DIR
    63                              <1> 					; Bit 1 = 1 if buffer is FAT
    64                              <1> 					; Bit 0 = Reserved
    65                              <1> buf_sector	DD	?		; Sector number of buffer (bit 7 = 0)
    66                              <1> ; The next two items are often refed as a word (bit 7 = 0)
    67                              <1> buf_wrtcnt	DB	?		; For FAT sectors, # times sector written out
    68                              <1> buf_wrtcntinc	DW	?		; "   "     "   , # sectors between each write
    69                              <1> buf_DPB 	DD	?		; Pointer to drive parameters
    70                              <1> buf_fill	DW	?		; How full buffer is (bit 7 = 1)
    71                              <1> buf_reserved	DB	?		; make DWORD boundary for 386
    72                              <1> BUFFINFO	ENDS
    73                              <1> 
    74                              <1> labelsize buf_offset, dword, buf_sector
    75                              <1> 					;For bit 7 = 1, this is the byte
    76                              <1> 					;offset of the start of the buffer in
    77                              <1> 					;the file pointed to by buf_ID.  Thus
    78                              <1> 					;the buffer starts at location
    79                              <1> 					;buf_offset in the file and contains
    80                              <1> 					;buf_fill bytes.
    81                              <1> 
    82                              <1> BUFINSIZ	EQU	BUFFINFO_struc_size
    83                              <1> 					; Size of structure in bytes
    84                              <1> 
    85                              <1> buf_Free	EQU	0FFh		; buf_id of free buffer
    86                              <1> 
    87                              <1> ;Flag byte masks
    88                              <1> buf_isnet	EQU	10000000B
    89                              <1> buf_dirty	EQU	01000000B
    90                              <1> 
    91                              <1> buf_isDATA	EQU	00001000B
    92                              <1> buf_isDIR	EQU	00000100B
    93                              <1> buf_isFAT	EQU	00000010B
    94                              <1> buf_type_0	EQU	11110001B	; AND sets type to "none"
    95                              <1> 
    96                              <1> buf_NetID	EQU	BUFINSIZ
    97                              <1> 
    98                              <1> ;
    99                              <1> ; Buffer Hash Entry Structure
   100                              <1> 
   101                              <1> BUFFER_HASH_ENTRY	STRUC		; DOS 4.00
   102                              <1> EMS_PAGE_NUM	DW	?		; logical page number for EMS handle
   103                              <1> BUFFER_BUCKET	DD	 ?		; pointer to buffers
   104                              <1> DIRTY_COUNT	DB	 ?		; number of dirty buffers
   105                              <1> BUFFER_RESERVED DB	 ?		; reserved
   106                              <1> BUFFER_HASH_ENTRY	ENDS
   107                              <1> 
   108                              <1> MaxBuffinBucket EQU	15		; Max number of buffers per bucket
   109                              <1> MaxBucketinPage EQU	 2		; Max number of buckets per 16kb page
   110                              <1> 
   111                              <1> %endif
   112                              <1> 
   113                              <1> ;									   ;
   114                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   115                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    22                                  %include "arena.mac"
     1                              <1> ;	SCCSID = @(#)arena.asm	1.1 85/04/09
     2                              <1> ;BREAK <Memory arena structure>
     3                              <1> 
     4                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     5                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     6                              <1> ;									   ;
     7                              <1> ;
     8                              <1> ; arena item
     9                              <1> ;
    10                              <1> arena	STRUC
    11 00000000 ??                  <1> arena_signature     DB	?		; 4D for valid item, 5A for last item
    12 00000001 ????                <1> arena_owner	    DW	?		; owner of arena item
    13 00000003 ????                <1> arena_size	    DW	?		; size in paragraphs of item
    14 00000005 ??????              <1> arena_reserved	    DB	3 DUP(?)	; reserved
    15 00000008 ????????????????    <1> arena_name	    DB	8 DUP(?)	; owner file name
    16                              <1> arena	ENDS
    17                              <1> 
    18                              <1> ;
    19                              <1> ; CAUTION: The routines in ALLOC.ASM rely on the fact that arena_signature
    20                              <1> ; and arena_owner_system are all equal to zero and are contained in DI.  Change
    21                              <1> ; them and change ALLOC.ASM.
    22                              <1> 
    23                              <1> arena_owner_system  EQU 0		; free block indication
    24                              <1> 
    25                              <1> arena_signature_normal	EQU 4Dh 	; valid signature, not end of arena
    26                              <1> arena_signature_end	EQU 5Ah 	; valid signature, last block in arena
    27                              <1> ;									   ;
    28                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    29                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    30                              <1> 
    23                                  %include "vector.mac"
     1                              <1> ;	SCCSID = @(#)vector.asm	1.1 85/04/10
     2                              <1> BREAK <interrupt definitions>
     3                              <1> 
     4                              <1> ;Asmvar	AltVect
     5                              <1> %ifndef AltVect
     6                              <1>  %iassign AltVect 0
     7                              <1> %endif
     8                              <1> 
     9                              <1> INTTAB		EQU	20H
    10                              <1> inttab equ INTTAB	; NASM port equate
    11                              <1> INTBASE 	EQU	4 * inttab
    12                              <1> ENTRYPOINT	EQU	INTBASE+40H
    13                              <1> 
    14                              <1> 	%IF	ALTVECT
    15                              <1> ALTTAB	EQU	0F0H
    16                              <1> ALTBASE EQU	4 * ALTTAB
    17                              <1> 	%ENDIF
    18                              <1> 
    19                              <1> ;
    20                              <1> ; interrupt assignments
    21                              <1> ;
    22                              <1> 	%IFN ALTVECT
    23                              <1> int_abort	    EQU     INTTAB	; abort process
    24                              <1> int_command	    EQU     int_abort+1 ; call MSDOS
    25                              <1> int_terminate	    EQU     int_abort+2 ; int to terminate address
    26                              <1> int_ctrl_c	    EQU     int_abort+3 ; ^c trapper
    27                              <1> int_fatal_abort     EQU     int_abort+4 ; hard disk error
    28                              <1> int_disk_read	    EQU     int_abort+5 ; logical sector disk read
    29                              <1> int_disk_write	    EQU     int_abort+6 ; logical sector disk write
    30                              <1> int_keep_process    EQU     int_abort+7 ; terminate program and stay
    31                              <1> 					; resident
    32                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    33                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    34                              <1> ;									   ;
    35                              <1> int_spooler	    EQU     int_abort+8 ; spooler call
    36                              <1> int_fastcon	    EQU     int_abort+9 ; fast CON interrupt
    37                              <1> int_IBM 	    EQU     int_abort+10; critical section maintenance
    38                              <1> ;									   ;
    39                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    40                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    41                              <1> 	%ELSE
    42                              <1> int_abort	    EQU     INTTAB	; abort process
    43                              <1> int_command	    EQU     int_abort+1 ; call MSDOS
    44                              <1> int_terminate	    EQU     ALTTAB	; int to terminate address
    45                              <1> int_ctrl_c	    EQU     int_terminate+1 ; ^c trapper
    46                              <1> int_fatal_abort     EQU     int_terminate+2 ; hard disk error
    47                              <1> int_disk_read	    EQU     int_abort+5 ; logical sector disk read
    48                              <1> int_disk_write	    EQU     int_abort+6 ; logical sector disk write
    49                              <1> int_keep_process    EQU     int_abort+7 ; terminate program and stay resident
    50                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    51                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    52                              <1> ;									   ;
    53                              <1> int_spooler	    EQU     int_terminate+3 ; spooler call
    54                              <1> int_fastcon	    EQU     int_abort+9 ; fast CON interrupt
    55                              <1> ;									   ;
    56                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    57                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    58                              <1> 	%ENDIF
    59                              <1> 
    60                              <1> addr_int_abort		EQU    4 * int_abort
    61                              <1> addr_int_command	EQU    4 * int_command
    62                              <1> addr_int_terminate	EQU    4 * int_terminate
    63                              <1> addr_int_ctrl_c 	EQU    4 * int_ctrl_c
    64                              <1> addr_int_fatal_abort	EQU    4 * int_fatal_abort
    65                              <1> addr_int_disk_read	EQU    4 * int_disk_read
    66                              <1> addr_int_disk_write	EQU    4 * int_disk_write
    67                              <1> addr_int_keep_process	EQU    4 * int_keep_process
    68                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    69                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    70                              <1> ;									   ;
    71                              <1> addr_int_spooler	EQU    4 * int_spooler
    72                              <1> addr_int_fastcon	EQU    4 * int_fastcon
    73                              <1> addr_int_IBM		EQU    4 * int_IBM
    74                              <1> ;									   ;
    75                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    76                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    24                                  %include "devsym.mac"
     1                              <1> 	%warning out: DEVSYM.INC...
     1          ******************  <1>  warning: out: DEVSYM.INC... [-w+user]
     2                              <1> ;	SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04
     3                              <1> ;	SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04
     4                              <1> 
     5                              <1> ; THE DEVICE TABLE LIST HAS THE FORM:
     6                              <1> SYSDEV	       STRUC
     7 00000000 ????????            <1> SDEVNEXT       DD    ?		    ;POINTER TO NEXT DEVICE HEADER
     8 00000004 ????                <1> SDEVATT        DW    ?		    ;ATTRIBUTES OF THE DEVICE
     9 00000006 ????                <1> SDEVSTRAT      DW    ?		    ;STRATEGY ENTRY POINT
    10 00000008 ????                <1> SDEVINT        DW    ?		    ;INTERRUPT ENTRY POINT
    11 0000000A ????????????????    <1> SDEVNAME       DB    8 DUP (?)	    ;NAME OF DEVICE (ONLY FIRST BYTE USED FOR BLOCK)
    12                              <1> SYSDEV	       ENDS
    13                              <1> 
    14                              <1> ;
    15                              <1> ; ATTRIBUTE BIT MASKS
    16                              <1> ;
    17                              <1> ; CHARACTER DEVICES:
    18                              <1> ;
    19                              <1> ; BIT 15 -> MUST BE 1
    20                              <1> ;     14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS
    21                              <1> ;     13 -> 1 IF THE DEVICE SUPPORTS OUTPUT-UNTIL-BUSY
    22                              <1> ;     12 -> UNUSED
    23                              <1> ;     11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE
    24                              <1> ;     10 -> MUST BE 0
    25                              <1> ;      9 -> MUST BE 0
    26                              <1> ;      8 -> UNUSED
    27                              <1> ;      7 -> UNUSED
    28                              <1> ;      6 -> UNUSED
    29                              <1> ;      5 -> UNUSED
    30                              <1> ;      4 -> 1 IF DEVICE IS RECIPIENT OF INT 29H
    31                              <1> ;      3 -> 1 IF DEVICE IS CLOCK DEVICE
    32                              <1> ;      2 -> 1 IF DEVICE IS NULL DEVICE
    33                              <1> ;      1 -> 1 IF DEVICE IS CONSOLE OUTPUT
    34                              <1> ;      0 -> 1 IF DEVICE IS CONSOLE INPUT
    35                              <1> ;
    36                              <1> ; BLOCK DEVICES:
    37                              <1> ;
    38                              <1> ; BIT 15 -> MUST BE 0
    39                              <1> ;     14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS
    40                              <1> ;     13 -> 1 IF THE DEVICE DETERMINES MEDIA BY EXAMINING THE FAT ID BYTE.
    41                              <1> ;	    THIS REQUIRES THE FIRST SECTOR OF THE FAT TO *ALWAYS* RESIDE IN
    42                              <1> ;	    THE SAME PLACE.
    43                              <1> ;     12 -> UNUSED
    44                              <1> ;     11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE/REMOVABLE MEDIA
    45                              <1> ;     10 -> MUST BE 0
    46                              <1> ;      9 -> MUST BE 0
    47                              <1> ;      8 -> UNUSED
    48                              <1> ;      7 -> UNUSED
    49                              <1> ;      6 -> IF DEVICE HAS SUPPORT FOR GETMAP/SETMAP OF LOGICAL DRIVES.
    50                              <1> ;	    IF THE DEVICE UNDERSTANDS GENERIC IOCTL FUNCTION CALLS.
    51                              <1> ;      5 -> UNUSED
    52                              <1> ;      4 -> UNUSED
    53                              <1> ;      3 -> UNUSED
    54                              <1> ;      2 -> UNUSED
    55                              <1> ;      1 -> UNUSED
    56                              <1> ;      0 -> UNUSED
    57                              <1> ;
    58                              <1> 
    59                              <1> DEVTYP	       EQU   8000H	    ; BIT 15 - 1  IF CHAR, 0 IF BLOCK
    60                              <1> CHARDEV        EQU   8000H
    61                              <1> DEVIOCTL       EQU   4000H	    ; BIT 14 - CONTROL MODE BIT
    62                              <1> ISFATBYDEV     EQU   2000H	    ; BIT 13 - DEVICE USES FAT ID BYTES,
    63                              <1> 				    ;  COMP MEDIA.
    64                              <1> OUTTILBUSY     EQU   2000H	    ; OUTPUT UNTIL BUSY IS ENABLED
    65                              <1> ISNET	       EQU   1000H	    ; BIT 12 - 1 IF A NET DEVICE, 0 IF
    66                              <1> 				    ;  NOT.  CURRENTLY BLOCK ONLY.
    67                              <1> DEVOPCL        EQU   0800H	    ; BIT 11 - 1 IF THIS DEVICE HAS
    68                              <1> 				    ;  OPEN,CLOSE AND REMOVABLE MEDIA
    69                              <1> 				    ;  ENTRY POINTS, 0 IF NOT
    70                              <1> 
    71                              <1> EXTENTBIT      EQU   0400H	    ; BIT 10 - CURRENTLY 0 ON ALL DEVS
    72                              <1> 				    ;  THIS BIT IS RESERVED FOR FUTURE USE
    73                              <1> 				    ;  TO EXTEND THE DEVICE HEADER BEYOND
    74                              <1> 				    ;  ITS CURRENT FORM.
    75                              <1> 
    76                              <1> ; NOTE BIT 9 IS CURRENTLY USED ON IBM SYSTEMS TO INDICATE "DRIVE IS SHARED".
    77                              <1> ;    SEE IOCTL FUNCTION 9. THIS USE IS NOT DOCUMENTED, IT IS USED BY SOME
    78                              <1> ;    OF THE UTILITIES WHICH ARE SUPPOSED TO FAIL ON SHARED DRIVES ON SERVER
    79                              <1> ;    MACHINES (FORMAT,CHKDSK,RECOVER,..).
    80                              <1> 
    81                              <1> DEV320	       EQU   0040H	    ;BIT 6 - FOR BLOCK DEVICES, THIS
    82                              <1> 				    ;DEVICE SUPPORTS SET/GET MAP OF
    83                              <1> 				    ;LOGICAL DRIVES, AND SUPPORTS
    84                              <1> 				    ;GENERIC IOCTL CALLS.
    85                              <1> 				    ;FOR CHARACTER DEVICES, THIS
    86                              <1> 				    ;DEVICE SUPPORTS GENERIC IOCTL.
    87                              <1> 				    ;THIS IS A DOS 3.2 DEVICE DRIVER.
    88                              <1> ISSPEC	       EQU   0010H	    ;BIT 4 - THIS DEVICE IS SPECIAL
    89                              <1> ISCLOCK        EQU   0008H	    ;BIT 3 - THIS DEVICE IS THE CLOCK DEVICE.
    90                              <1> ISNULL	       EQU   0004H	    ;BIT 2 - THIS DEVICE IS THE NULL DEVICE.
    91                              <1> ISCOUT	       EQU   0002H	    ;BIT 1 - THIS DEVICE IS THE CONSOLE OUTPUT.
    92                              <1> ISCIN	       EQU   0001H	    ;BIT 0 - THIS DEVICE IS THE CONSOLE INPUT.
    93                              <1> EXTDRVR        EQU   0002H	    ;BIT 1 - BLOCK DEVICE EXTNDED DRIVER
    94                              <1> 
    95                              <1> ;STATIC REQUEST HEADER
    96                              <1> SRHEAD	       STRUC
    97 00000000 ??                  <1> REQLEN	       DB    ?		    ;LENGTH IN BYTES OF REQUEST BLOCK
    98 00000001 ??                  <1> REQUNIT        DB    ?		    ;DEVICE UNIT NUMBER
    99 00000002 ??                  <1> REQFUNC        DB    ?		    ;TYPE OF REQUEST
   100 00000003 ????                <1> REQSTAT        DW    ?		    ;STATUS WORD
   101 00000005 ????????????????    <1> 	       DB    8 DUP(?)	    ;RESERVED FOR QUEUE LINKS
   102                              <1> SRHEAD	       ENDS
   103                              <1> 
   104                              <1> ;STATUS WORD MASKS
   105                              <1> STERR	       EQU   8000H	    ;BIT 15 - ERROR
   106                              <1> STBUI	       EQU   0200H	    ;BIT 9 - BUISY
   107                              <1> STDON	       EQU   0100H	    ;BIT 8 - DONE
   108                              <1> STECODE        EQU   00FFH	    ;ERROR CODE
   109                              <1> ;						  2/12/KK
   110                              <1> ; Interim  character identifier 		  2/12/KK
   111                              <1> Ddkey		EQU	0000010000000000B	; 2/12/KK
   112                              <1> 
   113                              <1> ;FUNCTION CODES
   114                              <1> DEVINIT        EQU   0		    ;INITIALIZATION
   115                              <1> DINITHL        EQU   26 	    ;SIZE OF INIT HEADER
   116                              <1> DEVMDCH        EQU   1		    ;MEDIA CHECK
   117                              <1> DMEDHL	       EQU   15 	    ;SIZE OF MEDIA CHECK HEADER
   118                              <1> DEVBPB	       EQU   2		    ;GET BPB
   119                              <1> DEVRDIOCTL     EQU   3		    ;IOCTL READ
   120                              <1> DBPBHL	       EQU   22 	    ;SIZE OF GET BPB HEADER
   121                              <1> DEVRD	       EQU   4		    ;READ
   122                              <1> DRDWRHL        EQU   22 	    ;SIZE OF RD/WR HEADER
   123                              <1> DEVRDND        EQU   5		    ;NON DESTRUCTIVE READ NO WAIT (CHARACTER DEVS)
   124                              <1> DRDNDHL        EQU   14 	    ;SIZE OF NON DESTRUCTIVE READ HEADER
   125                              <1> DEVIST	       EQU   6		    ;INPUT STATUS
   126                              <1> DSTATHL        EQU   13 	    ;SIZE OF STATUS HEADER
   127                              <1> DEVIFL	       EQU   7		    ;INPUT FLUSH
   128                              <1> DFLSHL	       EQU   15 	    ;SIZE OF FLUSH HEADER
   129                              <1> DEVWRT	       EQU   8		    ;WRITE
   130                              <1> DEVWRTV        EQU   9		    ;WRITE WITH VERIFY
   131                              <1> DEVOST	       EQU   10 	    ;OUTPUT STATUS
   132                              <1> DEVOFL	       EQU   11 	    ;OUTPUT FLUSH
   133                              <1> DEVWRIOCTL     EQU   12 	    ;IOCTL WRITE
   134                              <1> DEVOPN	       EQU   13 	    ;DEVICE OPEN
   135                              <1> DEVCLS	       EQU   14 	    ;DEVICE CLOSE
   136                              <1> DOPCLHL        EQU   13 	    ;SIZE OF OPEN/CLOSE HEADER
   137                              <1> DEVRMD	       EQU   15 	    ;REMOVABLE MEDIA
   138                              <1> REMHL	       EQU   13 	    ;SIZE OF REMOVABLE MEDIA HEADER
   139                              <1> GENIOCTL       EQU   19
   140                              <1> ; THE NEXT THREE ARE USED IN DOS 4.0
   141                              <1> ;		     20
   142                              <1> ;		     21
   143                              <1> ;		     22
   144                              <1> DEVGETOWN      EQU   23 	    ;GET DEVICE OWNER
   145                              <1> DEVSETOWN      EQU   24 	    ;SET DEVICE OWNER
   146                              <1> QUERYGENIOCTL equ 25		; query generic IOCTL support (MS-DOS v5+)
   147                              <1> OWNHL	       EQU   13 	    ;SIZE OF DEVICE OWNER HEADER
   148                              <1> 
   149                              <1> DEVOUT	       EQU   16 	    ; OUTPUT UNTIL BUSY.
   150                              <1> DEVOUTL        EQU   DEVWRT	    ; LENGTH OF OUTPUT UNTIL BUSY
   151                              <1> 
   152                              <1> ; GENERIC IOCTL REQUEST STRUCTURE
   153                              <1> ;	SEE THE DOS 4.0 DEVICE DRIVER SPEC FOR FURTHER ELABORATION.
   154                              <1> ;
   155                              <1> IOCTL_REQ      STRUC
   156 00000000 <res Dh>            <1> 	       DB    (SRHEAD_struc_size) DUP(?)
   157                              <1> 				    ; GENERIC IOCTL ADDITION.
   158 0000000D ??                  <1> MAJORFUNCTION  DB    ?		    ;FUNCTION CODE
   159 0000000E ??                  <1> MINORFUNCTION  DB    ?		    ;FUNCTION CATEGORY
   160 0000000F ????                <1> REG_SI	       DW    ?
   161 00000011 ????                <1> REG_DI	       DW    ?
   162 00000013 ????????            <1> GENERICIOCTL_PACKET DD ?	    ; POINTER TO DATA BUFFER
   163                              <1> IOCTL_REQ      ENDS
   164                              <1> 
   165                              <1> ;	DEFINITIONS FOR IOCTL_REQ.MINORFUNCTION
   166                              <1> GEN_IOCTL_WRT_TRK   EQU   40H
   167                              <1> GEN_IOCTL_RD_TRK    EQU   60H
   168                              <1> GEN_IOCTL_FN_TST    EQU   20H	    ; USED TO DIFF. BET READS AND WRTS
   169                              <1> 
   170                              <1> ;; 32-bit absolute read/write input list structure
   171                              <1> 
   172                              <1> ABS_32RW	 STRUC
   173 00000000 ????????            <1> SECTOR_RBA	 DD	 ?	    ; relative block address
   174 00000004 ????                <1> ABS_RW_COUNT	 DW	 ?	    ; number of sectors to be transferred
   175 00000006 ????????            <1> BUFFER_ADDR	 DD	 ?	    ; data addrress
   176                              <1> ABS_32RW	 ENDS
   177                              <1> 
   178                              <1> ;; media ID info
   179                              <1> 
   180                              <1> MEDIA_ID_INFO	 STRUC
   181 00000000 ????                <1> MEDIA_level	 DW	 ?	    ; info level
   182 00000002 ????????            <1> MEDIA_Serial	 DD	 ?	    ; serial #
   183 00000006 <res Bh>            <1> MEDIA_Label	 DB	 11 dup (?) ;volume label
   184 00000011 ????????????????    <1> MEDIA_System	 DB	 8  dup (?) ;system type
   185                              <1> MEDIA_ID_INFO	 ENDS
   186                              <1> 
   187                              <1> ;; equates for DOS34_FLAG
   188                              <1> 
   189                              <1> IFS_ABSRW	      EQU   00001H	   ;IFS absolute read/write
   190                              <1> NO_IFS_ABSRW	      EQU   0FFFEH	   ;no IFS absolute read/write
   191                              <1> IFS_DRIVE_RESET       EQU   00002H	   ;IFS drvive reset
   192                              <1> NO_IFS_DRIVE_RESET    EQU   0FFFDH	   ;no IFS drive reset
   193                              <1> FROM_DISK_RESET       EQU   00004H	   ;from disk reset
   194                              <1> NO_FROM_DISK_RESET    EQU   0FFFBH	   ;not from disk reset
   195                              <1> From_String_Output    EQU   00008H	   ;from con string output
   196                              <1> NO_From_String_Output EQU   0FFF7H	   ;not from con string output
   197                              <1> From_DOS_WRITE	      EQU   00010H	   ;from dos_write
   198                              <1> NO_From_DOS_WRITE     EQU   0FFEFH	   ;not from dos_write
   199                              <1> Force_I24_Fail	      EQU   00020H	   ;form IFS CALL BACK
   200                              <1> NO_Force_I24_Fail     EQU   0FFDFH	   ;not form IFS CALL BACK
   201                              <1> Disable_EOF_I24       EQU   00040H	   ;disable EOF int24 for input status
   202                              <1> NO_Disable_EOF_I24    EQU   0FFBFH	   ;disable EOF int24 for input status
   203                              <1> DBCS_VOLID	      EQU   00080H	   ;indicate from volume id
   204                              <1> DBCS_VOLID2	      EQU   00100H	   ;indicate 8th char is DBCS
   205                              <1> CTRL_BREAK_FLAG       EQU   00200H	   ;indicate control break is input
   206                              <1> NO_CTRL_BREAK_FLAG    EQU   0FDFFH	   ;reset control break
   207                              <1> SEARCH_FASTOPEN       EQU   00400H	   ;set fastopen flag for search
   208                              <1> X25_special	      EQU   00800H	   ;flag for X25 driver
    25                                  %include "pdb.mac"
     1                              <1> ;	SCCSID = @(#)pdb.asm	1.1 85/04/10
     2                              <1> BREAK <Process data block>
     3                              <1> 
     4                              <1> ;
     5                              <1> ; Process data block (otherwise known as program header)
     6                              <1> ;
     7                              <1> 
     8                              <1> FilPerProc	    EQU     20
     9                              <1> 
    10                              <1> Process_data_block  STRUC
    11 00000000 ????                <1> PDB_Exit_Call	    DW	    ?		; INT int_abort system terminate
    12 00000002 ????                <1> PDB_block_len	    DW	    ?		; size of execution block
    13 00000004 ??                  <1> 		    DB	    ?
    14 00000005 ??????????          <1> PDB_CPM_Call	    DB	5 DUP (?)	; ancient call to system
    15 0000000A ????????            <1> PDB_Exit	    DD	    ?		; pointer to exit routine
    16 0000000E ????????            <1> PDB_Ctrl_C	    DD	    ?		; pointer to ^C routine
    17 00000012 ????????            <1> PDB_Fatal_abort     DD	    ?		; pointer to fatal error
    18                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    19                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    20                              <1> ;									   ;
    21 00000016 ????                <1> PDB_Parent_PID	    DW	    ?		; PID of parent (terminate PID)
    22 00000018 <res 14h>           <1> PDB_JFN_Table	    DB	FilPerProc DUP (?)
    23                              <1> 					; indices into system table
    24                              <1> ;									   ;
    25                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    26                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    27 0000002C ????                <1> PDB_environ	    DW	    ?		; seg addr of environment
    28                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    29                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    30                              <1> ;									   ;
    31 0000002E ????????            <1> PDB_User_stack	    DD	    ?		; stack of self during system calls
    32 00000032 ????                <1> PDB_JFN_Length	    DW	    ?		; number of handles allowed
    33 00000034 ????????            <1> PDB_JFN_Pointer     DD	    ?		; pointer to JFN table
    34 00000038 ????????            <1> PDB_Next_PDB	    DD	    ?		; pointer to nested PDB's
    35 0000003C <res 14h>           <1> PDB_PAD1	    DB	    14h DUP (?)
    36                              <1> ;									   ;
    37                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    38                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    39 00000050 ??????????          <1> PDB_Call_system     DB	    5 DUP (?)	; portable method of system call
    40                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    41                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    42                              <1> ;									   ;
    43 00000055 ??????????????      <1> PDB_PAD2	    DB	    7h DUP (?)
    44                              <1> ;									   ;
    45                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    46                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    47                              <1> Process_data_block  ENDS
    48                              <1> 
    49                              <1> labelsize PDB_InterCon, byte, PDB_PAD1	; 2/12/KK
    50                              <1> labelsize PDB_Append, byte, PDB_PAD1+1	; 2/12/KK
    26                                  %include "find.mac"
     1                              <1> ;	SCCSID = @(#)find.asm	1.1 85/04/10
     2                              <1> ;	SCCSID = @(#)find.asm	1.1 85/04/10
     3                              <1> Break	<find first/next buffer>
     4                              <1> 
     5                              <1> find_buf    STRUC
     6                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     7                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     8                              <1> ;									   ;
     9 00000000 ??                  <1> find_buf_drive	    DB	?		; drive of search
    10 00000001 <res Bh>            <1> find_buf_name	    DB	11 DUP (?)	; formatted name
    11 0000000C ??                  <1> find_buf_sattr	    DB	?		; attribute of search
    12 0000000D ????                <1> find_buf_LastEnt    DW	?		; LastEnt
    13 0000000F ????                <1> find_buf_DirStart   DW	?		; DirStart
    14 00000011 ????????            <1> find_buf_NetID	    DB	4 DUP (?)	; Reserved for NET
    15                              <1> ;									   ;
    16                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    17                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    18                              <1> 
    19 00000015 ??                  <1> find_buf_attr	    DB	?		; attribute found
    20 00000016 ????                <1> find_buf_time	    DW	?		; time
    21 00000018 ????                <1> find_buf_date	    DW	?		; date
    22 0000001A ????                <1> find_buf_size_l     DW	?		; low(size)
    23 0000001C ????                <1> find_buf_size_h     DW	?		; high(size)
    24 0000001E <res Dh>            <1> find_buf_pname	    DB	13 DUP (?)	; packed name
    25                              <1> find_buf    ENDS
    27                                  %include "mi.mac"
     1                              <1> ;	SCCSID = @(#)mi.asm	1.1 85/04/10
     2                              <1> BREAK <Machine instruction, flag definitions and character types>
     3                              <1> 
     4                              <1> mi_INT		EQU	0CDh
     5                              <1> mi_Long_JMP	EQU	0EAh
     6                              <1> mi_Long_CALL	EQU	09Ah
     7                              <1> mi_Long_RET	EQU	0CBh
     8                              <1> mi_Near_RET	EQU	0C3h
     9                              <1> 
    10                              <1> ;			xxxxoditszxaxpxc
    11                              <1> f_Overflow	EQU	0000100000000000B
    12                              <1> f_Direction	EQU	0000010000000000B
    13                              <1> f_Interrupt	EQU	0000001000000000B
    14                              <1> f_Trace 	EQU	0000000100000000B
    15                              <1> f_Sign		EQU	0000000010000000B
    16                              <1> f_Zero		EQU	0000000001000000B
    17                              <1> f_Aux		EQU	0000000000010000B
    18                              <1> f_Parity	EQU	0000000000000100B
    19                              <1> f_Carry 	EQU	0000000000000001B
    28                                  ;.cref
    29                                  [list +]
    30                                  
    31                                  ;TITLE   IBMDATA - DATA segment for DOS
    32                                  ;NAME    IBMDATA
    33                                  
    34                                  %iassign installed TRUE
    35                                  
    36                                  ;=== Push trace listing source: ms_data.nas
    37                                  %include "ms_data.nas" ; NASM included file
     1                              <1> %include "nasmorg.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> NASM macros to replace JWasm org directive
     5                              <2>  2024 by E. C. Masloch, Public Domain
     6                              <2> 
     7                              <2> %endif
     8                              <2> 
     9                              <2> 	%imacro org 1-2.nolist db 0
    10                              <2> times (%1) - ($ - $$) %2
    11                              <2> 	%endmacro
     2                              <1> 
     3                              <1> ;       SCCSID = @(#)msdata.asm 1.8 85/09/12
     4                              <1> %ifndef Kanji
     5                              <1>  %iassign Kanji 0
     6                              <1> %endif
     7                              <1> %ifndef Debug
     8                              <1>  %iassign Debug 0
     9                              <1> %endif
    10                              <1> %ifndef Redirector
    11                              <1>  %iassign Redirector 0
    12                              <1> %endif
    13                              <1> %ifndef ShareF
    14                              <1>  %iassign ShareF 0
    15                              <1> %endif
    16                              <1>  
    17                              <1> Break <Uninitialized data overlayed by initialization code>
    18                              <1> 
    19                              <1> %define RECORDED none, none
    20                              <1> %macro record 2.nolist
    21                              <1> %%before:
    22                              <1> 	%1
    23                              <1> %%after:
    24                              <1> %assign %%i 0
    25                              <1> %rep %%after - %%before
    26                              <1>  %assign %%offset %%before + %%i - MSDAT001S
    27                              <1>  %xdefine RECORDED RECORDED, %%offset, %2
    28                              <1>  %assign %%i %%i + 1
    29                              <1> %endrep
    30                              <1> %endmacro
    31                              <1>  
    32                              <1> section DATA
    33                              <1> ; Init code overlaps with data area below
    34                              <1> 
    35                              <1> absolute $
    36                              <1> 
    37                              <1>         ORG     0, resb 1
    38                              <1> MSDAT001E equ MSDAT001e	; NASM port label
    39                              <1> PUBLIC MSDAT001S,MSDAT001E
    40                              <1> MSDAT001S       label byte
    41                              <1>  
    42 00000000 ????????????        <1>         I_am_nobits    TIMEBUF,6               ; Time read from clock device
    43 00000006 ????                <1>         I_am_nobits    DEVIOBUF,2              ; Buffer for I/O under file assignment
    44                              <1> ;
    45                              <1> ; The following areas are used as temp buffer in EXEC system call
    46                              <1> ;
    47 00000008 <res 80h>           <1>         I_am_nobits    OPENBUF,128             ; buffer for name operations
    48 00000088 <res 80h>           <1>         I_am_nobits    RenBuf,128              ; buffer for rename destination
    49                              <1> ; Buffer for search calls
    50 00000108 <res 35h>           <1>         I_am_nobits    SEARCHBUF,53            ; internal search buffer
    51 0000013D <res 58h>           <1>         I_am_nobits    DummyCDS,curdirLen
    52                              <1> ;
    53                              <1> ; End of contiguous buffer
    54                              <1> ;
    55                              <1>  
    56                              <1> ;
    57                              <1> ; Temporary directory entry for use by many routines.  Device directory
    58                              <1> ; entries (bogus) are built here.
    59                              <1> ;
    60                              <1> DevFCB equ DEVFCB	; NASM port label
    61                              <1>         PUBLIC  DevFCB
    62                              <1> DEVFCB  LABEL   BYTE                    ; Uses NAME1, NAME2, combined
    63                              <1> ; WARNING..  do not alter position of NAME1 relative to DEVFCB
    64                              <1> ; without first examining BUILD_DEVICE_ENT. Look carefully at DOS_RENAME
    65                              <1> ; as well as it is the only guy who uses NAME2 and DESTSTART.
    66 00000195 <res Ch>            <1>         I_am_nobits    NAME1,12                ; File name buffer
    67 000001A1 <res Dh>            <1>         I_am_nobits    NAME2,13                ;
    68 000001AE ????                <1>         I_am_nobits    DESTSTART,WORD          ;
    69                              <1> DIR_ENTRY_struc_size equ dir_entry_struc_size	; NASM port equate
    70 000001B0 ??????????          <1>         DB      ((DIR_ENTRY_struc_size) - ($ - DEVFCB)) DUP (?)
    71                              <1> ;
    72                              <1> ; End Temporary directory entry.
    73                              <1> ;
    74 000001B5 ??                  <1>         I_am_nobits    ATTRIB,BYTE             ; storage for file attributes
    75 000001B6 ??                  <1>         I_am_nobits    EXTFCB,BYTE             ; TRUE => extended FCB in use
    76 000001B7 ??                  <1>         I_am_nobits    SATTRIB,BYTE            ; Storage for search attributes
    77                              <1> %if EXTFCB + 1 != SATTRIB	; used in macro2.nas
    78                              <1>  %error Unexpected layout
    79                              <1> %endif
    80 000001B8 ??                  <1>         I_am_nobits    open_access,BYTE        ; access of open system call
    81 000001B9 ??                  <1>         I_am_nobits    FoundDel,BYTE           ; true => file was deleted
    82 000001BA ??                  <1>         I_am_nobits    Found_dev,BYTE          ; true => search found a device
    83 000001BB ??                  <1>         I_am_nobits    fSplice,BYTE            ; true => do a splice in transpath
    84 000001BC ??                  <1>         I_am_nobits    fSharing,BYTE           ; TRUE => no redirection
    85 000001BD ??                  <1>         I_am_nobits    SECCLUSPOS,BYTE         ; Position of first sector within cluster
    86 000001BE ??                  <1>         I_am_nobits    TRANS,BYTE              ;
    87 000001BF ??                  <1>         I_am_nobits    READOP,BYTE             ;
    88 000001C0 ??                  <1>         I_am_nobits    THISDRV,BYTE            ;
    89 000001C1 ??                  <1>         I_am_nobits    CLUSFAC,BYTE            ;
    90 000001C2 ??                  <1>         I_am_nobits    CLUSSPLIT,BYTE          ;
    91 000001C3 ??                  <1>         I_am_nobits    INSMODE,BYTE            ; true => insert mode in buffered read
    92 000001C4 ??                  <1>         I_am_nobits    cMeta,BYTE              ; count of meta'ed components found
    93 000001C5 ??                  <1>         I_am_nobits    VOLID,BYTE              ;
    94 000001C6 ??                  <1>         I_am_nobits    exit_type,BYTE          ; type of exit...
    95                              <1>  
    96 000001C7 ??                  <1>         record alignb 2, 90h
    97                              <1>  
    98                              <1> ; WARNING - the following two items are accessed as a word
    99 000001C8 ??                  <1>         I_am_nobits    CREATING,BYTE           ; true => creating a file
   100 000001C9 ??                  <1>         I_am_nobits    DELALL,BYTE             ; true => deleting everything
   101                              <1>  
   102 000001CA ????????            <1>         I_am_nobits    EXITHOLD,DWORD          ; Temp location for proc terminate
   103 000001CE ????                <1>         I_am_nobits    user_SP,WORD            ; User SP for system call
   104 000001D0 ????                <1>         I_am_nobits    user_SS,WORD            ; User SS for system call
   105 000001D2 ????                <1>         I_am_nobits    CONTSTK,WORD            ;
   106 000001D4 ????????            <1>         I_am_nobits    THISDPB,DWORD           ;
   107 000001D8 ????                <1>         I_am_nobits    CLUSSAVE,WORD           ;
   108 000001DA ????????            <1>         I_am_nobits    CLUSSEC,DWORD           ;>32mb                                  AC0000
   109 000001DE ????                <1>         I_am_nobits    PREREAD,WORD            ; 0 means preread; 1 means optional
   110 000001E0 ????                <1>         I_am_nobits    FATBYT,WORD             ; Used by ALLOCATE
   111 000001E2 ????                <1>         I_am_nobits    FATBYTE,WORD            ; Used by $SLEAZEFUNC
   112 000001E4 ????????            <1>         I_am_nobits    DEVPT,DWORD             ;
   113 000001E8 ????????            <1>         I_am_nobits    THISSFT,DWORD           ; Address of user SFT
   114 000001EC ????????            <1>         I_am_nobits    THISCDS,DWORD           ; Address of current CDS
   115 000001F0 ????????            <1>         I_am_nobits    THISFCB,DWORD           ; Address of user FCB
   116 000001F4 ????                <1>         record {I_am_nobits    SFN,WORD,<-1>}, 255           ; SystemFileNumber found for accessfile
   117 000001F6 ????                <1>         I_am_nobits    JFN,WORD                ; JobFileNumber found for accessfile
   118 000001F8 ????????            <1>         I_am_nobits    PJFN,DWORD              ; PointerJobFileNumber found for accessfile
   119 000001FC ????                <1>         I_am_nobits    WFP_START,WORD          ;
   120 000001FE ????                <1>         I_am_nobits    REN_WFP,WORD            ;
   121 00000200 ????                <1>         I_am_nobits    CURR_DIR_END,WORD       ;
   122 00000202 ????                <1>         I_am_nobits    NEXTADD,WORD            ;
   123 00000204 ????                <1>         I_am_nobits    LASTPOS,WORD            ;
   124 00000206 ????                <1>         I_am_nobits    CLUSNUM,WORD            ;
   125 00000208 ????????            <1>         I_am_nobits    DIRSEC,DWORD            ;>32mb                                  AC0000
   126 0000020C ????                <1>         I_am_nobits    DIRSTART,WORD           ;
   127 0000020E ????????            <1>         I_am_nobits    SECPOS,DWORD       ;>32mb Position of first sector accessed
   128 00000212 ????????            <1>         I_am_nobits    VALSEC,DWORD       ;>32mb Number of valid (previously written)
   129                              <1>                                         ; sectors
   130 00000216 ????                <1>         I_am_nobits    BYTSECPOS,WORD          ; Position of first byte within sector
   131 00000218 ????????            <1>         I_am_nobits    BYTPOS,4                ; Byte position in file of access
   132 0000021C ????                <1>         I_am_nobits    BYTCNT1,WORD            ; No. of bytes in first sector
   133 0000021E ????                <1>         I_am_nobits    BYTCNT2,WORD            ; No. of bytes in last sector
   134 00000220 ????                <1>         I_am_nobits    SECCNT_DOS,WORD             ; No. of whole sectors
   135 00000222 ????                <1>         I_am_nobits    ENTFREE,WORD            ;
   136 00000224 ????                <1>         I_am_nobits    ENTLAST,WORD            ;
   137 00000226 ????                <1>         I_am_nobits    NXTCLUSNUM,WORD         ;
   138 00000228 ????????            <1>         I_am_nobits    GROWCNT,DWORD           ;
   139 0000022C ????????            <1>         I_am_nobits    CURBUF,DWORD            ;
   140 00000230 ????????            <1>         I_am_nobits    CONSft,DWORD            ; SFT of console swapped guy.
   141 00000234 ????                <1>         I_am_nobits    SaveBX,WORD             ;
   142 00000236 ????                <1>         I_am_nobits    SaveDS,WORD             ;
   143 00000238 ????                <1>         I_am_nobits    restore_tmp,WORD        ; return address for restore world
   144 0000023A ????                <1>         I_am_nobits    NSS,WORD
   145 0000023C ????                <1>         I_am_nobits    NSP,WORD
   146 0000023E ????                <1>         I_am_nobits    EXTOPEN_FLAG,WORD,<0>   ;FT. extended open input flag           ;AN000;
   147 00000240 ??                  <1>         I_am_nobits    EXTOPEN_ON,BYTE,<0>     ;FT. extended open conditional flag     ;AN000;
   148 00000241 ????                <1>         I_am_nobits    EXTOPEN_IO_MODE,WORD,<0>;FT. extende open io mode               ;AN000;
   149 00000243 ????                <1>         I_am_nobits    SAVE_DI,WORD            ;FT. extende open saved DI              ;AN000;
   150 00000245 ????                <1>         I_am_nobits    SAVE_ES,WORD            ;FT. extende open saved ES              ;AN000;
   151 00000247 ????                <1>         I_am_nobits    SAVE_DX,WORD            ;FT. extende open saved DX              ;AN000;
   152 00000249 ????                <1>         I_am_nobits    SAVE_CX,WORD            ;FT. extende open saved CX              ;AN000;
   153 0000024B ????                <1>         I_am_nobits    SAVE_BX,WORD            ;FT. extende open saved BX              ;AN000;
   154 0000024D ????                <1>         I_am_nobits    SAVE_SI,WORD            ;FT. extende open saved SI              ;AN000;
   155 0000024F ????                <1>         I_am_nobits    SAVE_DS,WORD            ;FT. extende open saved DS              ;AN000;
   156 00000251 ????                <1>         I_am_nobits    HIGH_SECTOR,WORD,<0>    ;>32mb higher sector #                  ;AN000;
   157 00000253 ????                <1>         I_am_nobits    HIGH_SECTOR_TEMP,WORD,<0>;>32mb high sector #                   ;AN000;
   158 00000255 ??                  <1>         I_am_nobits    DISK_FULL,BYTE          ;>32mb indicating disk full when 1      ;AN000;
   159 00000256 ????                <1>         I_am_nobits    TEMP_VAR,WORD           ; temporary variable for everyone       ;AN000;
   160 00000258 ????                <1>         I_am_nobits    TEMP_VAR2,WORD          ; temporary variable 2 for everyone     ;AN000;
   161 0000025A ??                  <1>         I_am_nobits    DrvErr,BYTE             ; used to save drive error              ;AN000;
   162 0000025B ????                <1>         I_am_nobits    DOS34_FLAG,WORD,<0>     ; common flag for DOS 3.4               ;AN000;
   163 0000025D ????????            <1>         I_am_nobits    NO_FILTER_PATH,DWORD    ; pointer to orignal path               ;AN000;
   164 00000261 ????????            <1>         I_am_nobits    NO_FILTER_DPATH,DWORD   ; pointer to orignal path of destination;AN000;
   165 00000265 ????                <1>         I_am_nobits   Callback_SS,WORD         ;AN000; call back SS for system call
   166 00000267 ????                <1>         I_am_nobits   Callback_SP,WORD         ;AN000; call back SP for system call
   167 00000269 ??                  <1>         I_am_nobits   Callback_flag,BYTE,<0>   ;AN000; call back flag
   168                              <1>  
   169                              <1>  
   170                              <1> ; make those pushes fast!!!
   171                              <1> record alignb 2, 90h
   172                              <1> StackSize   equ   180h                    ; gross but effective
   173                              <1> ;;;StackSize   =   300h                    ; This is a "trial" change IBM hasn't
   174                              <1> ;;;                                        ; made up their minds about
   175                              <1>  
   176                              <1> ;
   177                              <1> ; WARNING!!!! DskStack may grow into AUXSTACK due to interrupt service.
   178                              <1> ; This is NO problem as long as AUXSTACK comes immediately before DSKSTACK
   179                              <1> ;
   180                              <1>  
   181                              <1>         PUBLIC  RENAMEDMA,AuxStack,DskStack,IOStack
   182                              <1> RENAMEDMA   LABEL   BYTE                ; See DOS_RENAME
   183                              <1>  
   184 0000026A <res 180h>          <1>         DB      StackSize DUP (?)       ;
   185                              <1> AuxStack    LABEL   BYTE
   186                              <1>  
   187 000003EA <res 180h>          <1>         DB      StackSize DUP (?)       ;
   188                              <1> DskStack    LABEL   BYTE
   189                              <1>  
   190 0000056A <res 180h>          <1>         DB      StackSize DUP (?)       ;
   191                              <1> IOStack LABEL   BYTE
   192                              <1>  
   193                              <1>  
   194                              <1> ; patch space for Boca folks.
   195                              <1> ; Say What????!!! This does NOT go into the swappable area!
   196                              <1> ; NOTE: We include the decl of ibmpatch in ms-dos even though it is not needed.
   197                              <1> ;       This allows the REDIRector to work on either IBM or MS-DOS.
   198                              <1>  
   199                              <1> PUBLIC  IBMPATCH
   200                              <1> IBMPATCH    label byte
   201 000006EA ??                  <1>         I_am_nobits    PRINTER_FLAG,BYTE,<0>   ; [SYSTEM] status of PRINT utility
   202 000006EB ??                  <1>         I_am_nobits    VOLCHNG_FLAG,BYTE,<0>   ; [SYSTEM] true if volume label created
   203 000006EC ??                  <1>         I_am_nobits    VIRTUAL_OPEN,BYTE,<0>   ; [SYSTEM] non-zero if we opened a virtual file
   204                              <1>  
   205                              <1> ; Following 4 variables moved to MSDATA.asm from MSTABLE.asm (P4986)
   206 000006ED ??                  <1>       I_am_nobits     FSeek_drive,BYTE         ;AN000; fastseek drive #
   207 000006EE ????                <1>       I_am_nobits     FSeek_firclus,WORD       ;AN000; fastseek first cluster #
   208 000006F0 ????                <1>       I_am_nobits     FSeek_logclus,WORD       ;AN000; fastseek logical cluster #
   209 000006F2 ????                <1>       I_am_nobits     FSeek_logsave,WORD       ;AN000; fastseek returned log clus #
   210                              <1> %ifndef BUF2
   211                              <1>       record {I_am_nobits     ACT_PAGE,WORD,<-1>}, 255       ;;;;;;; ;BL ; active EMS page                       ;AN000;
   212                              <1> %endif
   213                              <1> 
   214                              <1> ; lDOS extensions
   215                              <1> record alignb 2, 90h
   216 000006F4 ????                <1> 	I_am_nobits	CLUSTER_FACTOR_EDR,WORD
   217 000006F6 ????                <1> 	I_am_nobits	CLUSTER_NEXT_EDR,WORD
   218 000006F8 ????                <1> 	I_am_nobits	dosdata_to_doscode,WORD
   219                              <1> dosdata_to_doscode_segment equ dosdata_to_doscode
   220                              <1> 	global dosdata_to_doscode_segment
   221 000006FA ????                <1> 	record {I_am_nobits	first_umcb, word, <-1>}, 255
   222 000006FC ??                  <1> 	I_am_nobits	enable_uma, byte
   223 000006FD ??                  <1> 	I_am_nobits	alloc_strategy_ext, byte
   224 000006FE ????                <1> 	I_am_nobits	first_hmcb, word
   225 00000700 ??                  <1> 	I_am_nobits	doslocation3306, byte
   226 00000701 ??                  <1> 	I_am_nobits	doslocation3001, byte
   227 00000702 ????                <1> 	I_am_nobits	nextmcbinput, word
   228 00000704 ????                <1> 	I_am_nobits	haltflags, word
   229 00000706 ????                <1> 	I_am_nobits	backdoor_free_mcb_exec, word
   230 00000708 ????????            <1> 	record {I_am_nobits	backdoor_indicator, dword, <-1, -1>}, 255
   231                              <1> 
   232 0000070C ????????            <1> 	I_am_nobits	shell_return_address, dword
   233 00000710 ??                  <1> 	record {I_am_nobits	shell_return_has_been_freed, byte, <-1>}, 255
   234 00000711 ??                  <1> 	I_am_nobits	create_redirector_called, byte
   235                              <1> 
   236                              <1> SWAP_END    LABEL   BYTE
   237                              <1> PUBLIC  SWAP_END
   238                              <1>  
   239                              <1> ; THE FOLLOWING BYTE MUST BE HERE, IMMEDIATELY FOLLOWING SWAP_END. IT CANNOT
   240                              <1> ;   BE USED. If the size of the swap data area is ODD, it will be rounded up
   241                              <1> ;   to include this byte.
   242 00000712 ??                  <1>         DB      ?
   243                              <1>  
   244                              <1> ibmpatch equ IBMPATCH	; NASM port label
   245 00000713 <res 248h>          <1>             DB      (512+80+32-(SWAP_END-ibmpatch)) DUP (?)
   246                              <1>  
   247                              <1> MSDAT001e       label byte
   248                              <1>  
   249                              <1> ;.xall
   250                              <1>  
   251                              <1> ; (no prior section) ; DATA    ENDS
   252                              <1> 
    38                                  ;=== Pop trace listing source
    39                                  ;=== Push trace listing source: dosinit.nas
    40                                  %include "dosinit.nas" ; NASM included file
     1                              <1> ;	SCCSID = @(#)msinit.asm 1.2 85/07/23
     2                              <1> ; TITLE MSINIT.ASM -- MS-DOS INITIALIZATION CODE
     3                              <1> ; AN000 version 4.0 Jan. 1988
     4                              <1> ; AN007 PTM 3957 - fake version for IBMCACHE.COM
     5                              <1> ; AN008 PTM 4070 - fake version for MS WINDOWS
     6                              <1> [list -]
     6          ******************  <1>  warning: out: ... CLONE version build switch on ... [-w+user]
    11                              <1> %include "entrysw.mac"
     1                              <2> 
     2                              <2> %ifndef __ENTRYSW_MAC__
     3                              <2>  %assign __ENTRYSW_MAC__ 1
     4                              <2> 
     5                              <2> %assign _DOSCODEHMA		1
     6                              <2> %assign _RELOCATEDOSCODE	1
     7                              <2> 
     8                              <2> 		; Write a label "%1" (only if DOSCODE isn't relocated) and
     9                              <2> 		; "relocated%1" (always).
    10                              <2> 	%imacro relocated 1-2.nolist
    11                              <2> %ifnidni %2, device
    12                              <2>  %ifnidni %2, amis
    13                              <2>   %ifn _RELOCATEDOSCODE
    14                              <2> %1:
    15                              <2> 	global %1
    16                              <2>   %endif
    17                              <2>  %endif
    18                              <2> %endif
    19                              <2> relocated%1:				; always used for local labels
    20                              <2> 	global relocated%1
    21                              <2> 	%endmacro
    22                              <2> 
    23                              <2> %if _RELOCATEDOSCODE
    24                              <2> DOSENTRYADJUSTSEGMENT equ 60h - 26h
    25                              <2> %else
    26                              <2> DOSENTRYADJUSTSEGMENT equ 0
    27                              <2> %endif
    28                              <2> DOSENTRYADJUSTOFFSET equ DOSENTRYADJUSTSEGMENT * 16
    29                              <2> 
    30                              <2> DOSENTRYDEVICEBASE equ 10h
    31                              <2> 
    32                              <2> %endif
    12                              <1> %include "lstruct.mac"
     1                              <2> [list -]
    13                              <2> [list -]
    13                              <1> %include "entryseg.nas"
     1                              <2> 
     2                              <2> %ifndef ENTRYSEGNAS
     3                              <2> %define ENTRYSEGNAS 1
     4                              <2> 
     5                              <2> %include "lmacros3.mac"
     6                              <2> %include "entrysw.mac"
     7                              <2> [list -]
     8                              <2> 
     9                              <2> %define HARDALIGN 2
    10                              <2> %ifdef MSHARD
    11                              <2>  %define HARDALIGN 16
    12                              <2> %endif
    13                              <2> 
    14                              <2> %if _RELOCATEDOSCODE
    15                              <2>  %define DOSENTRYCLASS DOSENTRY
    16                              <2> %else
    17                              <2>  %define DOSENTRYCLASS DOSCODE
    18                              <2> %endif
    19                              <2> 
    20                              <2> addsection DOSENTRY, class=%[DOSENTRYCLASS]
    21                              <2> %ifn _RELOCATEDOSCODE
    22                              <2>  [list +]
    23                              <2>  %define DOSENTRYGROUP DOSCODEGROUP
    24                              <2>  [list -]
    25                              <2>  %include "dcodeseg.nas"
    26                              <2> %endif
    27                              <2> addsection DOSENTRYHARD, class=%[DOSENTRYCLASS] align=HARDALIGN
    28                              <2> addsection DOSENTRYINIT, class=%[DOSENTRYCLASS] align=2
    29                              <2> 
    30                              <2> %if _RELOCATEDOSCODE
    31                              <2> group DOSENTRYGROUP DOSENTRY DOSENTRYHARD DOSENTRYINIT
    32                              <2> %else
    33                              <2>  group DOSCODEGROUP DOSENTRY 	DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 	DOSENTRYHARD DOSENTRYINIT
    36                              <2> %endif
    37                              <2> 
    38                              <2> [list +]
    39                              <2> usesection DOSENTRY
    40                              <2> 
    41                              <2> %endif
    14                              <1> [list +]
    15                              <1> 
    16                              <1> extern i20, i21, i25, i26, i27, i2F, i2D, call5, i23, i24, entry_iret, i31
    17                              <1> 
    18                              <1> 	I_need	DMAAdd,DWORD		; current dma address
    19                              <1> 	I_need	DPBHead,DWORD		; long pointer to DPB chain
    20                              <1> 	I_need	SFT_Addr,DWORD		; pointer to open file list
    21                              <1> 	I_need	NumIO,BYTE		; number of physical drives
    22                              <1> 	I_need	BuffHead,DWORD		; pointer to buffer chain
    23                              <1> 	I_need	EndMem,WORD		; first unavailable address in memory
    24                              <1> 	I_need	CurrentPDB,WORD 	; current process ID
    25                              <1> 	I_need	CreatePDB,BYTE		; TRUE => create a new PDB
    26                              <1> 	I_need	Arena_Head,WORD 	; paragraph address of head of arena
    27                              <1> 	I_need	sfTabl,BYTE		; internal file table
    28                              <1> 	I_need	SysInitVar,BYTE 	; label for internal structures
    29                              <1> 	I_need	NulDev,DWORD		; long pointer to device chain
    30                              <1> 	I_need	BCon,DWORD		; pointer to console device
    31                              <1> 	I_need	BClock,DWORD		; pointer to clock device
    32                              <1> 	I_need	CallUnit,BYTE		; unit field in dd packet
    33                              <1> 	I_need	CallBPB,DWORD		; returned BPB from DD
    34                              <1> 	I_need	Maxsec,WORD
    35                              <1> 	I_need	Dskchret,BYTE
    36                              <1> 	I_need	Devcall,BYTE
    37                              <1> 	i_need	Header,BYTE
    38                              <1> 	I_need	JShare,DWORD
    39                              <1> 	I_need	COUNTRY_CDPG,BYTE	 ; country info table, DOS 3.3
    40                              <1> 	I_need	SysInitTable,BYTE	 ; sys init table for SYSINIT
    41                              <1> 	I_need	FastOpenTable,BYTE	 ; table for FASTOPEN
    42                              <1> 	I_need	FETCHI_TAG,WORD 	 ; TAG CHECK
    43                              <1> 	I_need	Special_Entries,WORD	 ; address of special entries ;AN007;
    44                              <1> 	I_need	IFS_DOS_CALL,DWORD	 ; IFS IBMDOS CALL entry      ;AN000;
    45                              <1> 	I_need	HASHINITVAR,WORD	 ; hash table variables       ;AN000;
    46                              <1> 	I_need	Packet_Temp,WORD	 ; used for initial Hash table;AN000;
    47                              <1> 	I_need	BUF_HASH_PTR,DWORD	 ; used for initial Hash table;AN000;
    48                              <1> 	I_need	SWAP_ALWAYS_AREA,DWORD	 ; swap always area addr    ;AN000;
    49                              <1> 	I_need	SWAP_ALWAYS_AREA_LEN,WORD; swap always area length  ;AN000;
    50                              <1> 	I_need	SWAP_IN_DOS,DWORD	 ; swap in dos area	    ;AN000;
    51                              <1> 	I_need	SWAP_IN_DOS_LEN,WORD	 ; swap in dos area length  ;AN000;
    52                              <1> 	I_need	SWAP_AREA_LEN,WORD	 ; swap area length	    ;AN000;
    53                              <1> 	I_need	SWAP_START,BYTE 	 ; swap start addr	    ;AN000;
    54                              <1> 	I_need	SWAP_ALWAYS,BYTE	 ; swap always addr	    ;AN000;
    55                              <1> 	I_need	Hash_Temp,WORD		 ; temporary Hash table     ;AN000;
    56                              <1> 
    57                              <1> 	i_need	CallDevAd,DWORD
    58                              <1> 
    59                              <1> section DATA
    60                              <1> 	; ORG	0			; reset to beginning of data segment
    61                              <1> 
    62                              <1> %ifdef DONOBITS
    63                              <1>  [list -]
    64                              <1> %endif
    65                              <1> 
    66                              <1> %ifndef DONOBITS
    67                              <1> 
    68                              <1> Public MSINI001S,MSINI001E
    69                              <1> MSINI001S label byte
    70                              <1> MSINI001E label byte
    71                              <1> 
    72                              <1> 
    73                              <1> section SYSINITSEG PUBLIC class=INIT
    74                              <1> section SYSINITTRAIL PUBLIC class=INIT
    75                              <1> 
    76                              <1> group SYSINITGROUP SYSINITSEG SYSINITTRAIL
    77                              <1> 
    78                              <1> extern doscode_retf
    79                              <1> extern dosdata_to_doscode
    80                              <1> 
    81                              <1> %imacro neartransfer 1.nolist
    82                              <1> 	extern %1
    83                              <1> 	call transfer_sysinitseg_to_doscode
    84                              <1> 	jmp strict short %%skip
    85                              <1> 	dw %1
    86                              <1> %%skip:
    87                              <1> %endmacro
    88                              <1> 
    89                              <1>  global transfer_sysinitseg_to_doscode
    90                              <1> transfer_sysinitseg_to_doscode:		; near call ip: in_ip_out_cs
    91                              <1>  assume ds:nothing, es:nothing, ss:nothing
    92 00000000 50                  <1> 	push ax				; in_ax_out_ip
    93 00000001 B8[0000]            <1> 	mov ax, doscode_retf
    94 00000004 50                  <1> 	push ax				; out_retf
    95 00000005 50                  <1> 	push ax				; out_destination + 2
    96 00000006 50                  <1> 	push ax				; out_destination + 0
    97                              <1> 	lframe 0
    98                              <1> 	lpar word, in_ip_out_cs
    99                              <1> 	lpar word, in_ax_out_ip
   100                              <1> 	lpar word, out_retf
   101                              <1> 	lpar dword, out_destination
   102 00000007 5589E5              <1> 	lenter
   103 0000000A 1E                  <1> 	push ds
   104 0000000B 56                  <1> 	push si
   105 0000000C 8CCE                <1> 	mov si, cs			; si = cs
   106 0000000E 87760A              <1> 	xchg si, word [bp + ?in_ip_out_cs]
   107                              <1> 					; set cs, get ip
   108 00000011 56                  <1> 	push si				; preserve ip for later
   109 00000012 AD                  <1> 	lodsw				; skip jmp short
   110 00000013 2EAD                <1> 	cs lodsw			; get destination
   111 00000015 894602              <1> 	mov word [bp + ?out_destination + 0], ax
   112                              <1> 					; set destination
   113 00000018 E81000              <1> 	call getdosdata
   114 0000001B 8ED8                <1> 	mov ds, ax
   115                              <1>  assume ds:DOSGROUP
   116 0000001D A1[F806]            <1> 	mov ax, word [dosdata_to_doscode]
   117                              <1> 					; ax => DOSCODE
   118 00000020 894604              <1> 	mov word [bp + ?out_destination + 2], ax
   119                              <1> 					; => DOSCODE
   120 00000023 58                  <1> 	pop ax
   121 00000024 874608              <1> 	xchg ax, word [bp + ?in_ax_out_ip]
   122                              <1> 					; ax = original ax, set out ip
   123 00000027 5E                  <1> 	pop si
   124 00000028 1F                  <1> 	pop ds
   125                              <1>  assume ds:nothing
   126 00000029 5D                  <1> 	lleave
   127 0000002A CB                  <1> 	retf
   128                              <1> 
   129                              <1> 
   130                              <1> 	global sysinit_getdosdata
   131                              <1> sysinit_getdosdata:
   132                              <1> getdosdata:
   133                              <1>  assume ds:nothing
   134 0000002B 1E                  <1> 	push ds
   135 0000002C B80000              <1> 	mov ax, 0
   136 0000002F 8ED8                <1> 	mov ds, ax			; ds => IVT
   137                              <1>  assume ds:IVT
   138 00000031 A1C600              <1> 	mov ax, [31h * 4 + 2]		; ds => DOSDATA
   139 00000034 1F                  <1> 	pop ds
   140                              <1>  assume ds:nothing
   141 00000035 C3                  <1> 	retn
   142                              <1> 
   143                              <1> 
   144                              <1> section DATA
   145                              <1> 
   146                              <1> %macro replayrecorded 2-*.nolist
   147                              <1>  %rep (%0 - 2) / 2
   148                              <1>   %rotate 2
   149                              <1>   %assign %%offset %1
   150                              <1>   %assign %%value %2
   151                              <1>   %if ($ - MSINI001S) < %%offset
   152                              <1> 	org %%offset
   153                              <1>   %endif
   154                              <1>   %if ($ - MSINI001S) == %%offset
   155                              <1> 	db %%value
   156                              <1>   %endif
   157                              <1>  %endrep
   158                              <1> %endmacro
   159                              <1> 
   160 00000000 00<rep 1C7h>9000-   <1> 	replayrecorded RECORDED
   160 00000000 <rep 2Ch>FFFF00-    <1>
   160 00000000 <rep 504h>FFFF00-   <1>
   160 00000000 <rep Ch>FFFFFFFF00- <1>
   160 00000000 <rep 4h>FF          <1>
   161                              <1> 
   162 00000711 00<rep 24Ah>        <1> 	org (MSDAT001e - MSDAT001S)
   163                              <1> %else	; DONOBITS
   164                              <1> 	org (MSDAT001e - MSDAT001S), db ?
   165                              <1> %endif	; DONOBITS
   166                              <1> 
   167                              <1> [list +]
   168                              <1> 
   169                              <1> ; (no prior section) ; DATA	ENDS
   170                              <1> 
   171                              <1> ; the next segment defines a new class that MUST appear last in the link map.
   172                              <1> ; This defines several important locations for the initialization process that
   173                              <1> ; must be the first available locations of free memory.
   174                              <1> 
   175                              <1> section LAST
   176                              <1> 
   177                              <1> %ifdef DONOBITS
   178                              <1>  [list -]
   179                              <1> %endif
   180                              <1> 
   181                              <1> %ifndef DONOBITS
   182                              <1> 
   183                              <1> entry DOSINIT
   184                              <1>  assume ds:nothing, es:nothing, ss:nothing
   185                              <1> %ifndef DOPLACEHOLDER
   186 00000000 EA[A003][ssss]      <1> 	jmp DOSENTRY - DOSENTRYADJUSTSEGMENT:i31 + DOSENTRYADJUSTOFFSET
   187                              <1> %else
   188                              <1> 	jmp 0:0
   189                              <1> %endif
   190                              <1> 
   191 00000005 90                  <1> 	align 2, nop
   192                              <1> 
   193                              <1> 	PUBLIC	SYSBUF
   194                              <1> 	PUBLIC	MEMSTRT
   195                              <1> 
   196                              <1> SYSBUF	LABEL	WORD
   197                              <1> 
   198                              <1> section SYSINITTRAIL
   199                              <1> 
   200                              <1> %ifndef DOPLACEHOLDER
   201                              <1> 
   202                              <1> 		; INP:	dx => DOSDATA segment source (0 if initial)
   203                              <1> 		;	ax => DOSDATA segment destination
   204                              <1> 		;	cs:si -> table, 0FFFFh terminated
   205                              <1> 		;	ds:di -> base for table entries
   206                              <1> init_table_plus_di:
   207                              <1>  assume ds:nothing
   208                              <1> .loop:
   209 00000036 93                  <1> 	xchg bx, ax
   210 00000037 2EAD                <1> 	cs lodsw
   211 00000039 83F8FF              <1> 	cmp ax, -1
   212 0000003C 93                  <1> 	xchg bx, ax
   213 0000003D 7408                <1> 	je .ret
   214 0000003F 3911                <1> 	cmp word [di + bx], dx
   215 00000041 7502                <1> 	jne .next
   216 00000043 8901                <1> 	mov word [di + bx], ax
   217                              <1> .next:
   218 00000045 EBEF                <1> 	jmp .loop
   219                              <1> 
   220                              <1> .ret:
   221 00000047 C3                  <1> 	retn
   222                              <1> 
   223                              <1> 
   224                              <1> 	align 2, db 0
   225                              <1> table_country:
   226 00000048 4F00                <1> 	dw ccUcase_ptr + 2
   227 0000004A 5400                <1> 	dw ccFileUcase_ptr + 2
   228 0000004C 5900                <1> 	dw ccFileChar_ptr + 2
   229 0000004E 5E00                <1> 	dw ccCollate_ptr + 2
   230 00000050 6300                <1> 	dw ccDBCS_ptr + 2
   231 00000052 FFFF                <1> 	dw -1
   232                              <1> 
   233                              <1> table_sysinit:
   234 00000054 0600                <1> 	dw SYSI_Country_Tab + 2
   235 00000056 0200                <1> 	dw SYSI_InitVars + 2
   236 00000058 FFFF                <1> 	dw -1
   237                              <1> 
   238                              <1> %ifdef BUF2
   239                              <1> %else
   240                              <1> table_buffers:
   241                              <1> BUFFHEAD equ BuffHead	; NASM port label
   242                              <1> 	dw BUFFHEAD + 2
   243                              <1> 	dw BUF_HASH_PTR + 2
   244                              <1> 	dw -1
   245                              <1> %endif
   246                              <1> 
   247                              <1> 		; INP:	dx => DOSDATA segment source (0 if initial)
   248                              <1> 		;	ax => DOSDATA segment destination
   249                              <1> 		;	cannot overlap
   250                              <1> 		;	data copied already
   251                              <1> 		; OUT:	es = ds = ax
   252                              <1> 		; CHG:	bx, si, di, cx
   253                              <1> entry DOSREINIT
   254 0000005A 31DB                <1> 	xor bx, bx
   255 0000005C 8EDB                <1> 	mov ds, bx
   256                              <1>  assume ds:IVT
   257 0000005E 8EC0                <1> 	mov es, ax
   258                              <1>  assume es:nothing
   259 00000060 8C06C600            <1> 	mov word [31h * 4 + 2], es	; RI31S => DOSDATA
   260 00000064 8ED8                <1> 	mov ds, ax
   261                              <1>  assume ds:DOSGROUP, es:DOSGROUP
   262                              <1> DSKCHRET equ Dskchret	; NASM port label
   263 00000066 A3[0300]            <1> 	MOV	WORD PTR [DSKCHRET+3], ax
   264 00000069 A3[0200]            <1> 	MOV	WORD PTR [sft_addr+2], ax
   265                              <1> 		; Must be set to print messages
   266 0000006C A3[0200]            <1> 	MOV	WORD PTR [SWAP_ALWAYS_AREA+2], ax
   267 0000006F A3[0200]            <1> 	MOV	WORD PTR [SWAP_IN_DOS+2], ax
   268                              <1>  extern dosinfo
   269 00000072 2EA3[0200]          <1> 	mov word [cs:dosinfo + 2], ax
   270                              <1>  extern SYSI_Country
   271 00000076 2E3916[0200]        <1> 	cmp word [cs:SYSI_Country + 2], dx
   272 0000007B 7504                <1> 	jne @F
   273 0000007D 2EA3[0200]          <1> 	mov word [cs:SYSI_Country + 2], ax
   274                              <1> @@:
   275                              <1> 
   276                              <1> ;F.C Modification start  DOS 3.3
   277 00000081 BF[0000]            <1> 	mov di, COUNTRY_CDPG wrt DOSGROUP	; country info table address
   278 00000084 BE[4800]            <1> 	mov si, table_country
   279 00000087 E8ACFF              <1> 	call init_table_plus_di
   280                              <1> 
   281 0000008A BF[0000]            <1> 	mov di, SysInitTable wrt DOSGROUP
   282 0000008D BE[5400]            <1> 	mov si, table_sysinit
   283 00000090 E8A3FF              <1> 	call init_table_plus_di
   284                              <1> 
   285                              <1> %ifdef BUF2
   286                              <1> %else
   287                              <1> 	xor di, di
   288                              <1> 	mov si, table_buffers
   289                              <1> 	call init_table_plus_di
   290                              <1> %endif
   291                              <1> 
   292 00000093 85D2                <1> 	test dx, dx			; re-init after relocation ?
   293 00000095 7416                <1> 	jz .retn				; no, just return -->
   294                              <1> 	; Now the fun starts. Poke into sharer table to find the sharer.
   295                              <1>  extern JShare, okcallentry
   296 00000097 06                  <1> 	push es
   297 00000098 52                  <1> 	push dx
   298 00000099 C43E[0400]          <1> 	les di, [JShare + 4]		; entry for MFT_enter
   299                              <1>  assume es:nothing
   300 0000009D 8CC2                <1> 	mov dx, es
   301 0000009F 81FA[ssss]          <1> 	cmp dx, DOSENTRY
   302 000000A3 7509                <1> 	jne @F
   303 000000A5 81FF[0000]          <1> 	cmp di, okcallentry
   304 000000A9 7503                <1> 	jne @F
   305 000000AB 5A                  <1> 	pop dx
   306 000000AC 07                  <1> 	pop es
   307                              <1>  assume es:DOSGROUP
   308                              <1> .retn:
   309 000000AD C3                  <1> 	retn
   310                              <1> 
   311                              <1>  extern init2_disp_dxax_times_cx_width_bx_size
   312                              <1>  extern init2_disp_msg_asciz_cs_dx
   313                              <1>  extern init2_disp_al
   314                              <1>  extern init2_disp_dxax_hex
   315                              <1>  extern init2_disp_ax_hex
   316                              <1>  extern init2_disp_al_hex
   317                              <1>  extern init2_disp_ax_dec
   318                              <1> 
   319                              <1> %include "mft.mac"
     1                              <2> BREAK   <MFT Definitions>
     2                              <2> 
     3                              <2> ;**     MSDOS MFT definitions
     4                              <2> ;
     5                              <2> ;   The Master File Table (MFT) associates the cannonicalized pathnames, lock
     6                              <2> ;   records and SFTs for all files open on this machine.
     7                              <2> ;
     8                              <2> ;   The MFT implementation employs a single memory buffer which is used from
     9                              <2> ;   both ends.  This gives the effect (at least until they run into each
    10                              <2> ;   other) of two independent buffers.
    11                              <2> ;
    12                              <2> ;       MFT buffer
    13                              <2> ;       ==========
    14                              <2> ;   The MFT buffer contains MFT name records and free space.  It uses a
    15                              <2> ;   classic heap architecture:  freed name records are marked free and
    16                              <2> ;   conglomerated with any adjacent free space.  When one is to create a name
    17                              <2> ;   entry the free list is searched first-fit.  The list of name and free
    18                              <2> ;   records is always terminated by a single END record.
    19                              <2> ;
    20                              <2> ;       LOCK buffer
    21                              <2> ;       ===========
    22                              <2> ;   The lock buffer contains fixed format records containing record locking
    23                              <2> ;   information.  Since they are fixed format the space is handled as a series
    24                              <2> ;   of chains:  one for each MFT name record and one for the free list.  No
    25                              <2> ;   garbage collection is necessary.
    26                              <2> ;
    27                              <2> ;       Space allocation
    28                              <2> ;       ================
    29                              <2> ;   The MFT is managed as a heap.  Empty blocks are allocated on a first-fit
    30                              <2> ;   basis.  If there is no single large enough empty block the list is garbage
    31                              <2> ;   collected.
    32                              <2> ;
    33                              <2> ;       MFT name records:
    34                              <2> ;
    35                              <2> ;              8     16     8     16     32     16        n
    36                              <2> ;           |------|-----|-----|------|------|------|---------~~~~~~---------|
    37                              <2> ;           | FLAG | LEN | SUM | LPTR | SPTR | SERL |     <.asciz string>    |
    38                              <2> ;           --------------------------------------------------~~~~~~----------
    39                              <2> ;
    40                              <2> ;                       FLAG = record type flag
    41                              <2> ;                       LEN =  total byte length of record.
    42                              <2> ;                       SUM =  sum of bytes in asciz string.  Used to speed
    43                              <2> ;                              searches
    44                              <2> ;                       LPTR=  pointer to first record in lock chain segment
    45                              <2> ;                              is MFT segment
    46                              <2> ;                       SPTR= pointer to first sft in sft chain
    47                              <2> ;                       SERL= serial number
    48                              <2> ;                       <string> = name string, zero-byte terminated.  There
    49                              <2> ;                              may be garbage bytes following the 00 byte;
    50                              <2> ;                              these are counted in the LEN field.
    51                              <2> ;
    52                              <2> ;
    53                              <2> ;       MFT free records
    54                              <2> ;
    55                              <2> ;              8      16
    56                              <2> ;           |------|-----|----~~~~~~~~~~~~~~~~~~~~~~~~~~~---------|
    57                              <2> ;           | FLAG | LEN |         free                           |
    58                              <2> ;           ------------------~~~~~~~~~~~~~~~~~~~~~~~~~~~----------
    59                              <2> ;
    60                              <2> ;                       FLAG = record type flag
    61                              <2> ;                       LEN  = total byte length of record.
    62                              <2> ;
    63                              <2> ;
    64                              <2> ;       MFT END records
    65                              <2> ;
    66                              <2> ;                  8
    67                              <2> ;               |------|
    68                              <2> ;               | FLAG |
    69                              <2> ;               --------
    70                              <2> ;
    71                              <2> ;                       FLAG = record type flag
    72                              <2> 
    73                              <2> ;**     MFT definitions
    74                              <2> ;*
    75                              <2> ;*      NOTE:  the flag and length fields are identical for all record types
    76                              <2> ;*              (except the END type has no length) This must remain so as
    77                              <2> ;*              some code depends upon it.
    78                              <2> ;*
    79                              <2> ;*      NOTE:  Many routines check for "n-1" of the N flag values and if no
    80                              <2> ;*              match is found assume the flag value must be the remaining
    81                              <2> ;*              possibility.  If you add or remove flag values you must check
    82                              <2> ;*              all references to mft_flag.
    83                              <2> 
    84                              <2> MFT_entry       STRUC
    85                              <2> 
    86 00000000 ??                  <2> mft_flag        DB      ?               ; flag/len field
    87 00000001 ????                <2> mft_len         DW      ?
    88 00000003 ??                  <2> mft_sum         DB      ?               ; string sum word
    89 00000004 ????                <2> mft_lptr        DW      ?               ; LCK pointer
    90 00000006 ????????            <2> mft_sptr        DD      ?               ; sft pointer
    91 0000000A ????                <2> mft_serl        DW      ?               ; serial number
    92 0000000C ??                  <2> mft_name        DB      ?               ; offset to start of name
    93                              <2> 
    94                              <2> MFT_entry       ENDS
    95                              <2> 
    96                              <2> MFLG_NAM        EQU     1               ; min value for name record
    97                              <2> MFLG_FRE        EQU     0               ; free record
    98                              <2> MFLG_END        EQU     -1              ; end record
    99                              <2> 
   100                              <2> ;*      Record Lock Record (RLR):
   101                              <2> ;
   102                              <2> ;                  16       32       32       32
   103                              <2> ;               |-------|--------|--------|--------|
   104                              <2> ;               | NEXT  |  FBA   |  LBA   |  SPTR  |
   105                              <2> ;               |       | lo hi  | lo hi  |        |
   106                              <2> ;               ------------|--------|--------------
   107                              <2> ;
   108                              <2> ;                       CHAIN  = pointer to next RLR.  0 if end
   109                              <2> ;                       FBA    = offset of 1st  byte of locked region
   110                              <2> ;                       LBA    = offset of last byte of locked region
   111                              <2> ;                       SPTR   = pointer to SFT lock was issued on
   112                              <2> 
   113                              <2> RLR_entry       STRUC
   114                              <2> 
   115 00000000 ????                <2> rlr_next        DW      ?               ; chain to next RLR, 0 if end
   116 00000002 ????                <2> rlr_fba         DW      ?               ; first byte addr (offset) of reigion
   117 00000004 ????                <2>                 DW      ?
   118 00000006 ????                <2> rlr_lba         DW      ?               ; last byte addr of region
   119 00000008 ????                <2>                 DW      ?
   120 0000000A ????????            <2> rlr_sptr        DD      ?               ; SFT pointer
   121 0000000E ????                <2> rlr_pid         dw      ?               ; process id of issuer
   122 00000010 ????                <2> rlr_type        dw      ?               ; lock type
   123                              <2> RLR_entry       ENDS
   124                              <2> 
   125                              <2> rlr_lall        equ     00h            ; lock all ops
   126                              <2> rlr_lwr         equ     01h            ; lock write ops
   127                              <2> 
   128                              <2> ;
   129                              <2> ;   A pictorial diagram for the linkages is as follows:
   130                              <2> ;
   131                              <2> ;          +---sptr------+
   132                              <2> ;          V             |
   133                              <2> ;        +---+<----------|---sptr------+------------+
   134                              <2> ;        |SFT+----+      |             |            |
   135                              <2> ;        +-+-+    |    +-+-+        +--+-+       +--+-+
   136                              <2> ;          V      +--->|MFT+-lptr->-|LOCK+-next->|LOCK+->0
   137                              <2> ;        +---+    |    +---+        +----+       +----+
   138                              <2> ;        |SFT+----+      ^
   139                              <2> ;        +-+-+           |
   140                              <2> ;          |             |
   141                              <2> ;          +-------------+
   142                              <2> ;
   143                              <2> ;
   144                              <2> 
   145                              <2> ;**
   146                              <2> ;
   147                              <2> ;   Interesting behavior should be noted:
   148                              <2> ;
   149                              <2> ;       The sharer must maintain information on files in three forms:
   150                              <2> ;
   151                              <2> ;       local/remote handles.  These are normal handles and behave in no
   152                              <2> ;           strange manner.  They are identified by SF_mode not having the
   153                              <2> ;           sfIsFCB flag nor by having the sf_mode = 70.  No problems with
   154                              <2> ;           locking.  No problems with open.  No problems with close.
   155                              <2> ;           CloseByName will iterate closes until the mft disappears.
   156                              <2> ;           CloseUser will iterate closes until no SFT for the particular user
   157                              <2> ;           appears.  CloseProcess will iterate closes until no SFT for the
   158                              <2> ;           particular user/process appears.
   159                              <2> ;
   160                              <2> ;       local FCBs.  There are no corresponding SFT's for these as the SFTs
   161                              <2> ;           are cached but will be valid for the particular file.  There is
   162                              <2> ;           one SFT for each open on a file by a specific process.  These are
   163                              <2> ;           identified the sfIsFCB flag in the sf_mode field.  When multiple
   164                              <2> ;           opens occur, we merely find the sf pertinent to the file and
   165                              <2> ;           process.  Close decrements the ref count.  CloseByName, CloseUser,
   166                              <2> ;           CloseProcess will iterate closes until no more SFTs exist.
   167                              <2> ;
   168                              <2> ;       handles with mode 70.  These represent FCB's open across the network.
   169                              <2> ;           As such, identical sfts may have been collapsed by the $open code.
   170                              <2> ;           This results in a reuse of the same SFT.  The $Open code must
   171                              <2> ;           correctly set the ref-count for the sft to reflect the number of
   172                              <2> ;           collapses that have occurred.  These are identified by a 70 in the
   173                              <2> ;           SF_mode field.  There can be no locking on these SFTs.  Open must
   174                              <2> ;           scan the list of SFTs for the file and increment its ref count
   175                              <2> ;           appropriately.
   320                              <1> 
   321                              <1> @@:
   322                              <1> dosreinit_scan_sharer:
   323 000000AE 50                  <1> 	push ax
   324                              <1> 	lframe 0
   325                              <1> 	lpar word, orig_es
   326                              <1> 	lpar word, orig_dx
   327                              <1> 	lpar word, orig_ax
   328 000000AF 5589E5              <1> 	lenter
   329 000000B2 31D2                <1> 	xor dx, dx
   330                              <1> 	lvar word, seensftcount
   331 000000B4 52                  <1> 	 push dx
   332                              <1> 	lvar word, editsftcount
   333 000000B5 52                  <1> 	 push dx
   334                              <1> 	lvar word, seenlockcount
   335 000000B6 52                  <1> 	 push dx
   336                              <1> 	lvar word, editlockcount
   337 000000B7 52                  <1> 	 push dx
   338                              <1> 	lvar word, seenmftcount
   339 000000B8 52                  <1> 	 push dx
   340                              <1> 	lvar word, editmftcount
   341 000000B9 52                  <1> 	 push dx
   342                              <1> 	lvar word, sftloopdetection
   343 000000BA 52                  <1> 	 push dx
   344                              <1> 	lvar word, lockloopdetection
   345 000000BB 52                  <1> 	 push dx
   346 000000BC BA[2C02]            <1> 	mov dx, initmsg.share.detected.1
   347 000000BF E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   348 000000C2 8CC0                <1> 	mov ax, es
   349 000000C4 E8(0000)            <1> 	call init2_disp_ax_hex
   350 000000C7 BA[4E02]            <1> 	mov dx, initmsg.share.detected.2
   351 000000CA E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   352                              <1> 
   353 000000CD 1E                  <1> 	push ds
   354 000000CE 0E                  <1> 	 push cs
   355 000000CF 1F                  <1> 	 pop ds
   356                              <1>  assume ds:SYSINITGROUP
   357 000000D0 31FF                <1> 	xor di, di
   358 000000D2 B90040              <1> 	mov cx, 16 * 1024
   359                              <1> .loop_scan:			; if branching here with cx = 0, must be NZ
   360 000000D5 BE[2402]            <1> 	mov si, sharer_magic_code	; access with ds
   361 000000D8 8A04                <1> 	mov al, [si]
   362 000000DA F2AE                <1> 	repne scasb
   363 000000DC 7403E93501          <1> 	jne .none		; no luck -->
   364 000000E1 51                  <1> 	 push cx
   365 000000E2 57                  <1> 	 push di
   366 000000E3 4F                  <1> 	dec di
   367 000000E4 B90800              <1> 	mov cx, sharer_magic_code.size
   368 000000E7 268B4503            <1> 	mov ax, [es:di + sharer_magic_code.mft_offset]
   369                              <1> 		; This code must take care not to access the word
   370                              <1> 		;  at offset FFFFh. The counter in cx insures that
   371                              <1> 		;  di isn't too high.
   372 000000EB 894403              <1> 	mov [si + sharer_magic_code.mft_offset], ax
   373 000000EE F3A6                <1> 	repe cmpsb
   374 000000F0 5F                  <1> 	 pop di
   375 000000F1 59                  <1> 	 pop cx
   376 000000F2 75E1                <1> 	jne .loop_scan		; not yet found --> (NZ)
   377 000000F4 1F                  <1> 	pop ds
   378                              <1>  assume ds:DOSGROUP
   379                              <1> 
   380 000000F5 BA[5302]            <1> 	mov dx, initmsg.share.magic.1
   381 000000F8 E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   382 000000FB 97                  <1> 	xchg ax, di
   383 000000FC E8(0000)            <1> 	call init2_disp_ax_hex
   384 000000FF 97                  <1> 	xchg ax, di
   385 00000100 BA[7F02]            <1> 	mov dx, initmsg.share.magic.2
   386 00000103 E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   387 00000106 E8(0000)            <1> 	call init2_disp_ax_hex
   388 00000109 BA[4E02]            <1> 	mov dx, initmsg.share.magic.3
   389 0000010C E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   390                              <1> 
   391 0000010F 97                  <1> 	xchg ax, di
   392                              <1> .loop_mft:
   393                              <1>  assume ds:DOSGROUP, es:nothing
   394                              <1> 		; es:di -> next MFT entry
   395                              <1> 		; ds => new DOSDATA segment
   396 00000110 268A05              <1> 	mov al, byte [es:di + mft_flag]
   397 00000113 3CFF                <1> 	cmp al, MFLG_END
   398 00000115 7503E9AC00          <1> 	je .done
   399 0000011A 3C00                <1> 	cmp al, MFLG_FRE
   400 0000011C 7503E98D00          <1> 	je .next_mft
   401 00000121 3C01                <1> 	cmp al, MFLG_NAM
   402 00000123 7403E99600          <1> 	jne .error
   403 00000128 FF46F6              <1> 	inc word [bp + ?seenmftcount]
   404 0000012B 06                  <1> 	push es
   405 0000012C 57                  <1> 	push di
   406 0000012D 89FB                <1> 	mov bx, di
   407 0000012F 268B4508            <1> 	mov ax, word [es:di + mft_sptr + 2]
   408 00000133 3B4604              <1> 	cmp ax, word [bp + ?orig_dx]
   409 00000136 7507                <1> 	jne @F
   410 00000138 FF46F4              <1> 	inc word [bp + ?editmftcount]
   411 0000013B 268C5D08            <1> 	mov word [es:di + mft_sptr + 2], ds
   412                              <1> @@:
   413 0000013F 26C47D06            <1> 	les di, [es:di + mft_sptr]
   414                              <1>  assume es:nothing
   415 00000143 85FF                <1> 	test di, di			; must have at least one SFT
   416 00000145 7475                <1> 	jz .error_pop_pop		; if invalid -->
   417 00000147 8366F200            <1> 	and word [bp + ?sftloopdetection], 0
   418                              <1> .loop_sft:
   419                              <1> 		; dword [ss:sp] -> current MFT entry
   420                              <1> 		; bx = current MFT entry offset
   421                              <1> 		; es:di -> next SFT entry, except if di == 0
   422 0000014B 85FF                <1> 	test di, di
   423 0000014D 7424                <1> 	jz .done_sft
   424 0000014F FF46FE              <1> 	inc word [bp + ?seensftcount]
   425 00000152 FF46F2              <1> 	inc word [bp + ?sftloopdetection]
   426 00000155 7465                <1> 	jz .error_pop_pop
   427 00000157 26395D33            <1> 	cmp word [es:di + sf_MFT], bx
   428 0000015B 755F                <1> 	jne .error_pop_pop
   429 0000015D 268B452D            <1> 	mov ax, word [es:di + sf_chain + 2]
   430 00000161 3B4604              <1> 	cmp ax, word [bp + ?orig_dx]
   431 00000164 7507                <1> 	jne @F
   432 00000166 FF46FC              <1> 	inc word [bp + ?editsftcount]
   433 00000169 268C5D2D            <1> 	mov word [es:di + sf_chain + 2], ds
   434                              <1> @@:
   435 0000016D 26C47D2B            <1> 	les di, [es:di + sf_chain]
   436                              <1>  assume es:nothing
   437 00000171 EBD8                <1> 	jmp .loop_sft
   438                              <1> 
   439                              <1> .done_sft:
   440 00000173 5F                  <1> 	pop di
   441 00000174 07                  <1> 	pop es				; restore es:di -> MFT
   442                              <1>  assume es:nothing
   443 00000175 57                  <1> 	push di
   444 00000176 8366F000            <1> 	and word [bp + ?lockloopdetection], 0
   445 0000017A 268B7D04            <1> 	mov di, [es:di + mft_lptr]
   446                              <1> .loop_lock:
   447                              <1> 		; word [ss:sp] -> current MFT entry
   448                              <1> 		; es:di -> next lock record, except if di == 0
   449                              <1> 		; es => sharer segment
   450 0000017E 85FF                <1> 	test di, di
   451 00000180 742B                <1> 	jz .done_lock
   452 00000182 FF46FA              <1> 	inc word [bp + ?seenlockcount]
   453 00000185 FF46F0              <1> 	inc word [bp + ?lockloopdetection]
   454 00000188 7433                <1> 	jz .error_pop
   455 0000018A 268B450C            <1> 	mov ax, word [es:di + rlr_sptr + 2]
   456 0000018E 3B4604              <1> 	cmp ax, word [bp + ?orig_dx]
   457 00000191 7507                <1> 	jne @F
   458 00000193 FF46F8              <1> 	inc word [bp + ?editlockcount]
   459 00000196 268C5D0C            <1> 	mov word [es:di + rlr_sptr + 2], ds
   460                              <1> @@:
   461 0000019A 06                  <1> 	push es
   462 0000019B 57                  <1> 	push di
   463 0000019C 26C47D0A            <1> 	les di, [es:di + rlr_sptr]
   464                              <1>  assume es:nothing
   465 000001A0 26395D33            <1> 	cmp word [es:di + sf_MFT], bx
   466 000001A4 5F                  <1> 	pop di
   467 000001A5 07                  <1> 	pop es
   468                              <1>  assume es:nothing
   469 000001A6 7515                <1> 	jne .error_pop
   470 000001A8 268B3D              <1> 	mov di, [es:di + rlr_next]
   471 000001AB EBD1                <1> 	jmp .loop_lock
   472                              <1> 
   473                              <1> .done_lock:
   474 000001AD 5F                  <1> 	pop di
   475                              <1> .next_mft:
   476                              <1> 		; MFT loop doesn't need loop detection
   477                              <1> 		;  because we detect empty lengths or
   478                              <1> 		;  offset additions that carry here.
   479 000001AE 268B4D01            <1> 	mov cx, word [es:di + mft_len]
   480 000001B2 E30A                <1> 	jcxz .error
   481 000001B4 01CF                <1> 	add di, cx
   482 000001B6 7203E955FF          <1> 	jnc .loop_mft
   483 000001BB A9                  <1> 	db __TEST_IMM16
   484                              <1> .error_pop_pop:
   485 000001BC 58                  <1> 	pop ax
   486                              <1> .error_pop:
   487 000001BD 58                  <1> 	pop ax
   488                              <1> .error:
   489 000001BE BA[0003]            <1> 	mov dx, initmsg.share.error
   490 000001C1 E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   491 000001C4 EB57                <1> 	jmp .ret
   492                              <1> 
   493                              <1> .done:
   494 000001C6 BA[C402]            <1> 	mov dx, initmsg.share.done.1
   495 000001C9 E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   496 000001CC 8B46F4              <1> 	mov ax, word [bp + ?editmftcount]
   497 000001CF E8(0000)            <1> 	call init2_disp_ax_dec
   498 000001D2 BA[E402]            <1> 	mov dx, initmsg.share.done.2
   499 000001D5 E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   500 000001D8 8B46F6              <1> 	mov ax, word [bp + ?seenmftcount]
   501 000001DB E8(0000)            <1> 	call init2_disp_ax_dec
   502 000001DE BA[E602]            <1> 	mov dx, initmsg.share.done.3
   503 000001E1 E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   504 000001E4 8B46FC              <1> 	mov ax, word [bp + ?editsftcount]
   505 000001E7 E8(0000)            <1> 	call init2_disp_ax_dec
   506 000001EA BA[E402]            <1> 	mov dx, initmsg.share.done.4
   507 000001ED E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   508 000001F0 8B46FE              <1> 	mov ax, word [bp + ?seensftcount]
   509 000001F3 E8(0000)            <1> 	call init2_disp_ax_dec
   510 000001F6 BA[F302]            <1> 	mov dx, initmsg.share.done.5
   511 000001F9 E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   512 000001FC 8B46F8              <1> 	mov ax, word [bp + ?editlockcount]
   513 000001FF E8(0000)            <1> 	call init2_disp_ax_dec
   514 00000202 BA[E402]            <1> 	mov dx, initmsg.share.done.6
   515 00000205 E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   516 00000208 8B46FA              <1> 	mov ax, word [bp + ?seenlockcount]
   517 0000020B E8(0000)            <1> 	call init2_disp_ax_dec
   518 0000020E BA[FC02]            <1> 	mov dx, initmsg.share.done.7
   519 00000211 E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   520 00000214 EB07                <1> 	jmp .ret
   521                              <1> 
   522                              <1> .none:
   523 00000216 BA[9302]            <1> 	mov dx, initmsg.share.nomagic
   524 00000219 E8(0000)            <1> 	call init2_disp_msg_asciz_cs_dx
   525 0000021C 1F                  <1> 	pop ds
   526                              <1>  assume ds:DOSGROUP
   527                              <1> .ret:
   528 0000021D 89EC5D              <1> 	lleave
   529 00000220 58                  <1> 	pop ax
   530 00000221 5A                  <1> 	pop dx
   531 00000222 07                  <1> 	pop es
   532                              <1>  assume es:DOSGROUP
   533 00000223 C3                  <1> 	retn
   534                              <1> 
   535                              <1> 
   536                              <1> sharer_magic_code:
   537                              <1>  assume nocheck, cs:nothing, ds:nothing, es:nothing, ss:nothing
   538                              <1> 		; need cs assumption so the following push/pop pair
   539                              <1> 		;  isn't misdetected by listvars.pl
   540                              <1> .:
   541 00000224 0E                  <1> 	push cs
   542 00000225 1F                  <1> 	pop  ds
   543                              <1>  assume nocheck, ds:nothing
   544 00000226 BE0000              <1> 	mov si, 0
   545                              <1> .mft_offset equ ($ - 2) - .
   546 00000229 803C00              <1> 	cmp byte [si + mft_flag],MFLG_FRE
   547                              <1> .end:
   548                              <1> .size equ .end - .
   549                              <1>  assume nocheck, cs:SYSINITGROUP
   550                              <1> 		; reset cs assumption
   551                              <1> 
   552                              <1> 
   553                              <1> initmsg:
   554 0000022C 696E69743A20536861- <1> .share.detected.1:	asciz "init: Sharer detected at segment="
   554 00000235 726572206465746563- <1>
   554 0000023E 746564206174207365- <1>
   554 00000247 676D656E743D00      <1>
   555                              <1> .share.magic.3:		; asciz "h.",13,10
   556 0000024E 682E0D0A00          <1> .share.detected.2:	asciz "h.",13,10
   557 00000253 696E69743A20536861- <1> .share.magic.1:		asciz "init: Sharer magic code detected at offset "
   557 0000025C 726572206D61676963- <1>
   557 00000265 20636F646520646574- <1>
   557 0000026E 656374656420617420- <1>
   557 00000277 6F66667365742000    <1>
   558 0000027F 682C204D4654207374- <1> .share.magic.2:		asciz "h, MFT start is at "
   558 00000288 617274206973206174- <1>
   558 00000291 2000                <1>
   559 00000293 696E69743A20576172- <1> .share.nomagic:		asciz "init: Warning: Sharer magic code not detected!",13,10
   559 0000029C 6E696E673A20536861- <1>
   559 000002A5 726572206D61676963- <1>
   559 000002AE 20636F6465206E6F74- <1>
   559 000002B7 206465746563746564- <1>
   559 000002C0 210D0A00            <1>
   560 000002C4 696E69743A20456469- <1> .share.done.1:		asciz "init: Edited/total sharer MFTs "
   560 000002CD 7465642F746F74616C- <1>
   560 000002D6 20736861726572204D- <1>
   560 000002DF 4654732000          <1>
   561                              <1> .share.done.6:		; asciz "/"
   562                              <1> .share.done.4:		; asciz "/"
   563 000002E4 2F00                <1> .share.done.2:		asciz "/"
   564 000002E6 2C206E657874205346- <1> .share.done.3:		asciz ", next SFTs "
   564 000002EF 54732000            <1>
   565 000002F3 2C206C6F636B732000  <1> .share.done.5:		asciz ", locks "
   566 000002FC 2E0D0A00            <1> .share.done.7:		asciz ".",13,10
   567 00000300 696E69743A20457272- <1> .share.error:		asciz "init: Error: Sharer tables invalid.",13,10
   567 00000309 6F723A205368617265- <1>
   567 00000312 72207461626C657320- <1>
   567 0000031B 696E76616C69642E0D- <1>
   567 00000324 0A00                <1>
   568                              <1> 
   569                              <1> 
   570                              <1> 		; INP:	es => DOS data segment
   571                              <1> 		;	bx => where to create PSP
   572                              <1> 		;	dx => behind usable memory (at EBDA or UMA)
   573                              <1> 		;	ss:sp -> init stack
   574                              <1> 		;	ds:si -> CON device
   575                              <1> 		;		(and subsequent device chain in msbio)
   576                              <1> 		;	cx => S MCB to link to (chain at top of LMA)
   577                              <1> 		;	di => space for free MCB (behind DOSENTRY S MCB)
   578                              <1> 	entry	NEARDOSINIT
   579                              <1>  assume ds:nothing, es:DOSGROUP, ss:SYSINITGROUP
   580 00000326 FA                  <1> 	CLI
   581 00000327 FC                  <1> 	CLD
   582 00000328 26891E[0000]        <1> 	MOV	[es:CurrentPDB], bx
   583 0000032D 268916[0000]        <1> 	MOV	[es:ENDMEM],DX
   584                              <1> NULDEV equ NulDev	; NASM port label
   585 00000332 268C1E[0200]        <1> 	MOV	WORD PTR [es:NULDEV+2],DS
   586 00000337 268936[0000]        <1> 	MOV	WORD PTR [es:NULDEV],SI   ; DS:SI Points to CONSOLE Device
   587                              <1> 
   588 0000033C 57                  <1> 	push di
   589 0000033D 51                  <1> 	push cx
   590 0000033E 1E                  <1> 	push ds
   591 0000033F 56                  <1> 	push si
   592                              <1> 			; Need Crit vector inited to use DEVIOCALL
   593 00000340 31C0                <1> 	XOR	AX,AX
   594 00000342 8ED8                <1> 	MOV	DS,AX
   595                              <1>  assume ds:IVT
   596 00000344 8C06C600            <1> 	mov word [31h * 4 + 2], es	; RI31S => DOSDATA
   597 00000348 C706A800[A003]      <1> 	MOV	word [addr_int_IBM], entry_iret + DOSENTRYADJUSTOFFSET
   598 0000034E C706AA00[ssss]      <1> 	MOV	word [addr_int_IBM+2], DOSENTRY - DOSENTRYADJUSTSEGMENT
   599                              <1> 
   600 00000354 4A                  <1> 	dec dx			; => first UMCB
   601 00000355 268916[FA06]        <1> 	mov word [es:first_umcb], dx
   602 0000035A 06                  <1> 	 push es
   603 0000035B 8EC2                <1> 	mov es, dx
   604                              <1>  assume es:nothing
   605 0000035D 31FF                <1> 	xor di, di		; -> first UMCB
   606 0000035F 0E                  <1> 	 push cs
   607 00000360 1F                  <1> 	 pop ds
   608                              <1>  assume ds:SYSINITGROUP
   609 00000361 BE[6006]            <1> 	mov si, first_umcb_smcb	; -> template ; access with ds
   610 00000364 B90800              <1> 	mov cx, words(MCB_size)
   611 00000367 F3A5                <1> 	rep movsw		; copy the template
   612 00000369 07                  <1> 	 pop es
   613                              <1>  assume es:DOSGROUP
   614 0000036A 8CC0                <1> 	mov ax, es
   615 0000036C 31D2                <1> 	xor dx, dx
   616 0000036E E8E9FC              <1> 	call DOSREINIT
   617                              <1>  assume ds:DOSGROUP, es:DOSGROUP
   618                              <1> 
   619 00000371 BD[0600]            <1> 	MOV	BP,OFFSET SYSBUF wrt DOSGROUP
   620 00000374 892E[0000]          <1> 	MOV	[Special_Entries],BP ;MS.;AN007 save starting address of Special entries
   621 00000378 BE[1C00]            <1> 	MOV	SI,OFFSET Version_Fake_Table wrt DOSGROUP	;MS.;AN007
   622 0000037B 89F2                <1> 	MOV	DX,SI		     ;MS.;AN007
   623 0000037D 30E4                <1> 	XOR	AH,AH		     ;MS.;AN007
   624                              <1> .NextEntry:			     ;MS.;AN007
   625 0000037F AC                  <1> 	LODSB			     ;MS.;AN007  get name length
   626 00000380 84C0                <1> 	test	AL,AL		     ;MS.;AN007  end of list
   627 00000382 7407                <1> 	JZ	endlist 	     ;MS.;AN007  yes
   628 00000384 01C6                <1> 	ADD	SI,AX		     ;MS.;AN007  position to
   629 00000386 83C603              <1> 	ADD	SI,3		     ;MS.;AN007  next entry
   630 00000389 EBF4                <1> 	JMP	.NextEntry	     ;MS.;AN007
   631                              <1> endlist:			     ;MS.;AN007
   632 0000038B 29D6                <1> 	SUB	SI,DX		     ;MS.;AN007
   633 0000038D 01F5                <1> 	ADD	BP,SI		     ;MS.;AN007
   634                              <1> 
   635 0000038F 89F1                <1> 	mov cx, si
   636 00000391 89D6                <1> 	mov si, dx
   637 00000393 BF[0600]            <1> 	mov di, SYSBUF wrt DOSGROUP
   638 00000396 F3A4                <1> 	rep movsb
   639                              <1> 
   640 00000398 83C50F              <1> 	ADD	BP,15		; True start of free space (round up to segment)
   641 0000039B D1DD                <1> 	RCR	BP,1
   642 0000039D B103                <1> 	MOV	CL,3
   643 0000039F D3ED                <1> 	SHR	BP,CL		; Number of segments for DOS resources
   644 000003A1 89EA                <1> 	MOV	DX,bp		; = size of DOSDATA segment in paragraphs
   645 000003A3 BB0F00              <1> 	MOV	BX,0FH
   646 000003A6 8B0E[0000]          <1> 	MOV	CX,[ENDMEM]
   647                              <1> 
   648 000003AA 8CC5                <1> 	MOV	BP, es
   649                              <1> 
   650                              <1> ; BP has segment of DOS (whether to load high or run in place)
   651                              <1> ; DX has program segment (whether after DOS or overlaying DOS)
   652                              <1> ; CX has size of memory in paragraphs (reduced by DOS size if HIGHMEM)
   653 000003AC 890E[0000]          <1> 	MOV	[ENDMEM],CX
   654 000003B0 8EC5                <1> 	MOV	ES,BP
   655                              <1> ASSUME	ES:DOSGROUP
   656                              <1> 
   657 000003B2 5E                  <1> 	pop si
   658 000003B3 1F                  <1> 	pop ds
   659                              <1>  assume ds:nothing
   660                              <1> 
   661 000003B4 52                  <1> 	push dx
   662 000003B5 55                  <1> 	push bp
   663                              <1> 
   664 000003B6 E8F602              <1> 	CALL	CHARINIT
   665 000003B9 56                  <1> 	PUSH	SI			; Save pointer to header
   666                              <1> 		; es => DOSDATA
   667                              <1>  ASSUME ES:DOSGROUP
   668 000003BA BF[0600]            <1> 	MOV	DI,OFFSET sftabl + SFTable wrt DOSGROUP   ; Point to sft 0
   669 000003BD B80300              <1> 	MOV	AX,3
   670 000003C0 AB                  <1> 	STOSW		; Refcount
   671 000003C1 48                  <1> 	DEC	ax
   672                              <1> 	errnz	sf_mode-(sf_ref_count+2)
   673 000003C2 AB                  <1> 	STOSW		; Access rd/wr, compatibility
   674 000003C3 30C0                <1> 	XOR	AL,AL
   675                              <1> 	errnz	sf_attr-(sf_mode+2)
   676 000003C5 AA                  <1> 	STOSB		; attribute
   677 000003C6 B0C3                <1> 	MOV	AL,devid_device_EOF | devid_device | ISCIN | ISCOUT
   678                              <1> 	errnz	sf_flags-(sf_attr+1)
   679 000003C8 AB                  <1> 	STOSW		; Flags
   680 000003C9 89F0                <1> 	MOV	AX,SI
   681                              <1> 	errnz	sf_devptr-(sf_flags+2)
   682 000003CB AB                  <1> 	STOSW			; Device pointer in devptr
   683 000003CC 8CD8                <1> 	MOV	AX,DS
   684 000003CE AB                  <1> 	STOSW
   685 000003CF 31C0                <1> 	XOR	AX,AX
   686                              <1> 	errnz	sf_firclus-(sf_devptr+4)
   687 000003D1 AB                  <1> 	STOSW			; firclus
   688                              <1> 	errnz	sf_time-(sf_firclus+2)
   689 000003D2 AB                  <1> 	STOSW			; time
   690                              <1> 	errnz	sf_date-(sf_time+2)
   691 000003D3 AB                  <1> 	STOSW			; date
   692 000003D4 48                  <1> 	DEC	AX
   693                              <1> 	errnz	sf_size-(sf_date+2)
   694 000003D5 AB                  <1> 	STOSW			; size
   695 000003D6 AB                  <1> 	STOSW
   696 000003D7 40                  <1> 	INC	AX
   697                              <1> 	errnz	sf_position-(sf_size+4)
   698 000003D8 AB                  <1> 	STOSW			; position
   699 000003D9 AB                  <1> 	STOSW
   700 000003DA 83C707              <1> 	ADD	DI,sf_name - sf_cluspos ;Point at name
   701 000003DD 83C60A              <1> 	ADD	SI,SDEVNAME		; Point to name
   702 000003E0 B90400              <1> 	MOV	CX,4
   703 000003E3 F3A5                <1> 	REP	MOVSW	; Name
   704 000003E5 B103                <1> 	MOV	CL,3
   705 000003E7 B020                <1> 	MOV	AL," "
   706 000003E9 F3AA                <1> 	REP	STOSB	; Extension
   707 000003EB 5E                  <1> 	POP	SI	; Get back pointer to header
   708 000003EC 804C0403            <1> 	OR	BYTE PTR [SI + SDEVATT],ISCIN | ISCOUT
   709                              <1> BCON equ BCon	; NASM port label
   710 000003F0 268936[0000]        <1> 	MOV	WORD PTR [es:BCON],SI
   711 000003F5 268C1E[0200]        <1> 	MOV	WORD PTR [es:BCON+2],DS
   712                              <1> 
   713 000003FA 5D                  <1> 	pop bp
   714 000003FB 5A                  <1> 	pop dx
   715                              <1> 
   716 000003FC 31C0                <1> 	XOR	AX,AX
   717 000003FE 8ED8                <1> 	MOV	DS,AX
   718 00000400 8EC0                <1> 	MOV	ES,AX
   719                              <1>  assume ds:IVT, es:IVT
   720 00000402 BF8200              <1> 	MOV	DI,INTBASE+2
   721 00000405 89E8                <1> 	MOV	AX,BP		; Final DOS segment to AX
   722                              <1> 
   723 00000407 50                  <1> 	push ax
   724                              <1> 
   725 00000408 B8[ssss]            <1> 	mov ax, DOSENTRY - DOSENTRYADJUSTSEGMENT
   726                              <1> 
   727                              <1> 	extern i00
   728 0000040B C7060000[A003]      <1> 	mov word [0], i00 + DOSENTRYADJUSTOFFSET
   729 00000411 A30200              <1> 	mov word [2], ax	; Set default divide trap address
   730                              <1> 
   731                              <1> ; Set vectors 20-28 and 2A-3F to point to IRET.
   732 00000414 B91100              <1> 	MOV	CX,17
   733 00000417 F3AB                <1> 	REP	STOSW		; Set 9 segments
   734                              <1> 				;   Sets segs for INTs 20H-28H
   735 00000419 83C706              <1> 	ADD	DI,6		; Skip INT 29H vector (FAST CON) as it may
   736                              <1> 				;   already be set.
   737 0000041C B12B                <1> 	MOV	cl, 43
   738 0000041E F3AB                <1> 	REP	STOSW		; Set 22 segments
   739                              <1> 				;   Sets segs for vectors 2AH-3FH
   740 00000420 8F06C600            <1> 	pop word [31h * 4 + 2]	; RI31S => DOSDATA
   741                              <1> 
   742 00000424 BF8000              <1> 	MOV	DI,INTBASE
   743 00000427 B8[A003]            <1> 	MOV	AX, entry_iret + DOSENTRYADJUSTOFFSET
   744 0000042A B109                <1> 	MOV	cl, 9		; Set 9 offsets (skip 2 between each)
   745                              <1> 				;   Sets offsets for INTs 20H-28H
   746                              <1> 
   747                              <1> ISET1:
   748 0000042C AB                  <1> 	STOSW			; offset
   749 0000042D AF                  <1> 	scasw			; di += 2
   750 0000042E E2FC                <1> 	LOOP	ISET1
   751                              <1> 
   752 00000430 AF                  <1> 	scasw			; di += 2
   753 00000431 AF                  <1> 	scasw			; di += 2
   754                              <1> 				; Skip vector 29H
   755                              <1> 
   756 00000432 B116                <1> 	MOV	cl, 22		; Set 22 offsets (skip 2 between each)
   757                              <1> 				;   Sets offsets for INTs 2AH-3FH
   758                              <1> 
   759                              <1> ISET2:
   760 00000434 AB                  <1> 	STOSW
   761 00000435 AF                  <1> 	scasw			; di += 2
   762 00000436 E2FC                <1> 	LOOP	ISET2
   763                              <1> 
   764 00000438 89E8                <1> 	MOV	AX,BP		; Final DOS segment to AX
   765                              <1> 
   766 0000043A C706BC00[A003]      <1> 	mov word [2Fh * 4], i2F + DOSENTRYADJUSTOFFSET
   767 00000440 C706B400[A003]      <1> 	mov word [2Dh * 4], i2D + DOSENTRYADJUSTOFFSET
   768                              <1> 
   769                              <1> ; Set up entry point call at vectors 30-31H
   770 00000446 C606C000EA          <1> 	MOV	BYTE PTR [ENTRYPOINT],mi_Long_JMP
   771 0000044B C706C100[A003]      <1> 	MOV	WORD PTR [ENTRYPOINT+1], call5 + DOSENTRYADJUSTOFFSET
   772 00000451 C706C300[ssss]      <1> 	MOV	WORD PTR [ENTRYPOINT+3], DOSENTRY - DOSENTRYADJUSTSEGMENT
   773 00000457 C606C50000          <1> 	mov byte [ENTRYPOINT+5], 0
   774                              <1> 		; this also happens to init int 31h to DOSDATA:0,
   775                              <1> 		;  which is equal to our legacy DOSINIT entrypoint.
   776                              <1> 		;  this is now re-used as i31, far-jumping to DOSENTRY
   777                              <1> 		;  and relocating to DOSCODE. currently this just sets
   778                              <1> 		;  ax = 1 and CY and returns (using an iret).
   779                              <1> 
   780                              <1> 	%IF	ALTVECT
   781                              <1> 	MOV	DI,ALTBASE+2
   782                              <1> 	MOV	CX,15
   783                              <1> 	REP	STOSW		; Set 8 segments (skip 2 between each)
   784                              <1> 	%ENDIF
   785                              <1> 
   786                              <1> 		; all interrupt handler entrypoints
   787                              <1> 		;  => DOSENTRY - DOSENTRYADJUSTSEGMENT
   788 0000045C C7068000[A003]      <1> 	MOV	WORD PTR [addr_int_abort], i20 + DOSENTRYADJUSTOFFSET
   789 00000462 C7068400[A003]      <1> 	MOV	WORD PTR [addr_int_command], i21 + DOSENTRYADJUSTOFFSET
   790 00000468 C70688000001        <1> 	MOV	WORD PTR [addr_int_terminate],100H
   791 0000046E 89168A00            <1> 	MOV	WORD PTR [addr_int_terminate+2],DX
   792 00000472 C7068C00[A003]      <1> 	MOV	WORD PTR [23h * 4], i23 + DOSENTRYADJUSTOFFSET
   793 00000478 C7069000[A003]      <1> 	MOV	WORD PTR [24h * 4], i24 + DOSENTRYADJUSTOFFSET
   794 0000047E C7069400[A003]      <1> 	MOV	WORD PTR [addr_int_disk_read], i25 + DOSENTRYADJUSTOFFSET
   795 00000484 C7069800[A003]      <1> 	MOV	WORD PTR [addr_int_disk_write], i26 + DOSENTRYADJUSTOFFSET
   796 0000048A C7069C00[A003]      <1> 	MOV	WORD PTR [addr_int_keep_process], i27 + DOSENTRYADJUSTOFFSET
   797                              <1> 
   798 00000490 E898FB              <1> 	call getdosdata
   799 00000493 8ED8                <1> 	mov ds, ax
   800 00000495 8EC0                <1> 	mov es, ax
   801                              <1> ASSUME	DS:DOSGROUP,ES:DOSGROUP
   802                              <1> 
   803 00000497 89D5                <1> 	mov bp, dx		; = size for DOSDATA
   804                              <1> 
   805 00000499 BA6000              <1> 	mov dx, 60h		; new first MCB (init PSP)
   806                              <1> arena_head equ Arena_Head	; NASM port label
   807 0000049C 268916[0000]        <1> 	MOV	[ES:arena_head], dx
   808                              <1> 
   809 000004A1 5B                  <1> 	 pop bx			; bx => S MCB to link to
   810 000004A2 58                  <1> 	 pop ax			; ax => free MCB
   811 000004A3 1E                  <1> 	push ds
   812 000004A4 06                  <1> 	push es
   813 000004A5 8EC2                <1> 	mov es, dx		; => DOSENTRY MCB destination
   814                              <1>  assume es:nothing
   815 000004A7 0E                  <1> 	push cs
   816 000004A8 1F                  <1> 	pop ds
   817                              <1>  assume ds:SYSINITGROUP
   818 000004A9 BE[7006]            <1> 	mov si, dosentry_mcb	; -> template ; access with ds
   819 000004AC 31FF                <1> 	xor di, di
   820 000004AE B90800              <1> 	mov cx, words(16)
   821 000004B1 F3A5                <1> 	rep movsw
   822 000004B3 F7DA                <1> 	neg dx
   823 000004B5 01C2                <1> 	add dx, ax		; dx = ax - dx
   824 000004B7 4A                  <1> 	dec dx
   825 000004B8 2689160300          <1> 	mov word [es:arena_size], dx
   826                              <1> 				; set size
   827 000004BD 07                  <1> 	pop es
   828                              <1>  assume es:DOSGROUP
   829                              <1> 
   830 000004BE 8ED8                <1> 	MOV	DS,AX
   831                              <1>  assume ds:nothing
   832 000004C0 C60600004D          <1> 	MOV	byte [arena_signature], 'M'
   833                              <1> 		; The free MCB does link to the LMA top chain of S MCBs.
   834                              <1> 		;  The last LMCB does not initially link to the first
   835                              <1> 		;  UMCB, but the free MCB is not the last LMCB.
   836                              <1> ENDMEM equ EndMem	; NASM port label
   837 000004C5 29D8                <1> 	SUB	AX, bx
   838 000004C7 F7D0                <1> 	not ax			; like neg ax, dec ax
   839 000004C9 A30300              <1> 	MOV	[arena_size],AX
   840 000004CC 31C0                <1> 	xor ax, ax		; = 0
   841 000004CE A30100              <1> 	mov word [arena_owner], ax
   842 000004D1 A30500              <1> 	mov word [mcbReserved], ax
   843 000004D4 A30700              <1> 	mov word [mcbReserved + 2], ax
   844 000004D7 A30800              <1> 	mov word [mcbName], ax
   845 000004DA A30A00              <1> 	mov word [mcbName + 2], ax
   846 000004DD A30C00              <1> 	mov word [mcbName + 4], ax
   847 000004E0 A30E00              <1> 	mov word [mcbName + 6], ax
   848 000004E3 1F                  <1> 	pop ds
   849                              <1>  assume ds:DOSGROUP
   850                              <1> 
   851 000004E4 8B16[0000]          <1> 	mov dx, [CurrentPDB]
   852 000004E8 8EC2                <1> 	mov es, dx
   853                              <1>  assume es:nothing
   854 000004EA 31FF                <1> 	xor di, di		; -> PSP to create
   855 000004EC B93000              <1> 	mov cx, words(60h)	; clear PSP needed part
   856 000004EF F3AB                <1> 	rep stosw		; clear memory
   857 000004F1 A1[0000]            <1> 	mov ax, [ENDMEM]
   858                              <1> 
   859 000004F4 E809FBEB02[0000]    <1> 	neartransfer	SETMEM	; Basic Header
   860                              <1> 				; SETMEM works with ss != DOSDATA
   861 000004FB 268C061600          <1> 	mov word [ES:PDB_Parent_PID], es
   862                              <1> 				; set parent to itself (better than uninit)
   863                              <1> ASSUME	DS:NOTHING,ES:NOTHING
   864 00000500 E828FB              <1> 	call getdosdata
   865 00000503 8ED8                <1> 	mov ds, ax
   866                              <1> ASSUME	DS:DOSGROUP
   867 00000505 BF1800              <1> 	MOV	DI,PDB_JFN_Table
   868 00000508 31C0                <1> 	XOR	AX,AX
   869 0000050A AB                  <1> 	STOSW
   870 0000050B AA                  <1> 	STOSB			; 0,1 and 2 are CON device
   871 0000050C B0FF                <1> 	MOV	AL,0FFH
   872 0000050E B91100              <1> 	MOV	CX,FilPerProc - 3
   873 00000511 F3AA                <1> 	REP	STOSB		; Rest are unused
   874 00000513 1E                  <1> 	PUSH	ds
   875 00000514 07                  <1> 	POP	ES
   876                              <1> ASSUME	ES:DOSGROUP
   877                              <1> 
   878                              <1> ; After this points the char device functions for CON will work for
   879                              <1> ; printing messages
   880                              <1> 
   881                              <1> 	%IF	(! IBM) | (DEBUG)
   882                              <1> 	%IFN ALTVECT
   883                              <1> HEADER equ Header	; NASM port label
   884                              <1> 	MOV	SI,OFFSET HEADER wrt DOSGROUP
   885                              <1> .OUTMES:
   886                              <1> 	call getdosdata
   887                              <1> 	mov ds, ax
   888                              <1> 	lodsb
   889                              <1> 	CMP	AL,"$"
   890                              <1> 	JZ	.OUTDONE
   891                              <1> 	invalid function call
   892                              <1> 	invoke	OUT
   893                              <1> 	JMP	SHORT .OUTMES
   894                              <1> .OUTDONE:
   895                              <1> 	PUSH	ds			; OUT stomps on segments
   896                              <1> 	POP	es
   897                              <1> 	%ENDIF
   898                              <1> 	%ENDIF
   899                              <1> 
   900                              <1> %ifdef BUF2
   901                              <1> %else
   902                              <1> 	MOV	SI,OFFSET HASHINITVAR wrt DOSGROUP	  ;LB. points to Hashinitvar	   ;AN000;
   903                              <1> 	MOV	WORD PTR [ES:BUFFHEAD],SI	  ;LB.				   ;AN000;
   904                              <1> 	MOV	SI,OFFSET Hash_Temp wrt DOSGROUP	  ;LB.				   ;AN000;
   905                              <1> 	MOV	WORD PTR [ES:BUF_HASH_PTR],SI	  ;LB.				   ;AN000;
   906                              <1> %endif
   907 00000515 26C706[0000]7258    <1> 	MOV	word [ES:FETCHI_TAG],22642	  ; TAG for IBM,
   908                              <1> 					  ; Fetchi's serial # = 822642
   909                              <1> 
   910 0000051C 89EB                <1> 	mov bx, bp			; = size for DOSDATA S MCB
   911 0000051E B44A                <1> 	mov ah, 4Ah
   912 00000520 CD21                <1> 	int 21h				; shrink it
   913 00000522 8CC0                <1> 	mov ax, es
   914 00000524 48                  <1> 	dec ax				; => D0SDATA S MCB
   915 00000525 8ED8                <1> 	mov ds, ax
   916                              <1>  assume ds:MCB
   917 00000527 C70601000800        <1> 	mov word [mcbOwner], 8		; reset owner
   918                              <1> 
   919 0000052D BF[0000]            <1> 	MOV	DI,OFFSET SWAP_START wrt DOSGROUP	  ;IFS. 			;AN000;
   920 00000530 B9[1207]            <1> 	MOV	CX,OFFSET SWAP_END wrt DOSGROUP	  ;IFS. 			;AN000;
   921                              <1> Swap_Always equ SWAP_ALWAYS	; NASM port label
   922 00000533 BA[0000]            <1> 	MOV	DX,OFFSET Swap_Always wrt DOSGroup	  ;IFS. 			;AN000;
   923 00000536 89CD                <1> 	MOV	BP,CX			;IFS.					;AN000;
   924 00000538 29FD                <1> 	SUB	BP,DI			;IFS.					;AN000;
   925 0000053A D1ED                <1> 	SHR	BP,1			;IFS. div by 2, remainder in carry	;AN000;
   926 0000053C 83D500              <1> 	ADC	BP,0			;IFS. div by 2 + round up		;AN000;
   927 0000053F D1E5                <1> 	SHL	BP,1			;IFS. round up to 2 boundary.		;AN000;
   928 00000541 26892E[0000]        <1> 	MOV	[ES:SWAP_AREA_LEN],BP	;IFS.					;AN000;
   929                              <1> 
   930 00000546 29D1                <1> 	SUB	CX,DX			;IFS.					;AN000;
   931 00000548 29FA                <1> 	SUB	DX,DI			;IFS.					;AN000;
   932 0000054A D1E9                <1> 	SHR	CX,1			;IFS. div by 2, remainder in carry	;AN000;
   933 0000054C 83D100              <1> 	ADC	CX,0			;IFS. div by 2 + round up		;AN000;
   934 0000054F D1E1                <1> 	SHL	CX,1			;IFS. round up to 2 boundary.		;AN000;
   935 00000551 26890E[0000]        <1> 	MOV	[ES:SWAP_IN_DOS_LEN],CX 	    ;IFS.			;AN000;
   936 00000556 26893E[0000]        <1> 	MOV	WORD PTR [ES:SWAP_ALWAYS_AREA],DI   ;IFS.			;AN000;
   937 0000055B 81CA0080            <1> 	OR	DX,8000H			    ;IFS.			;AN000;
   938 0000055F 268916[0000]        <1> 	MOV	[ES:SWAP_ALWAYS_AREA_LEN],DX	    ;IFS.			;AN000;
   939 00000564 BF[0000]            <1> 	MOV	DI,OFFSET Swap_Always wrt DOSGroup	    ;IFS.			;AN000;
   940 00000567 26893E[0000]        <1> 	MOV	WORD PTR [ES:SWAP_IN_DOS],DI	    ;IFS.			;AN000;
   941                              <1> 
   942                              <1> SySInitTable equ SysInitTable	; NASM port label
   943 0000056C BF[0000]            <1> 	MOV	DI,OFFSET SySInitTable wrt DOSGROUP
   944                              <1> 
   945                              <1> 	%IFN Installed
   946                              <1> 	invoke	NETWINIT
   947                              <1> ;	ELSE
   948                              <1> ;	invoke	NETWINIT
   949                              <1> ;	%OUT Random NETWINIT done at install
   950                              <1> 	%ENDIF
   951                              <1> 
   952 0000056F 268E1E[0000]        <1> 	mov ds, word [es:CurrentPDB]	; ds => created PSP
   953                              <1>  assume ds:nothing
   954                              <1> DMAADD equ DMAAdd	; NASM port label
   955 00000574 268C1E[0200]        <1> 	MOV	WORD PTR [es:DMAADD+2], ds
   956 00000579 C3                  <1> 	retn
   957                              <1> 
   958                              <1> 
   959                              <1> entry INITDPB
   960                              <1>  assume ds:nothing, es:nothing, ss:SYSINITGROUP
   961 0000057A E8AEFA              <1> 	call getdosdata
   962 0000057D 8EC0                <1> 	mov es, ax
   963                              <1>  assume es:DOSGROUP
   964                              <1> 
   965 0000057F 26C536[0000]        <1> 	lds si, [es:NULDEV]
   966                              <1>  assume ds:nothing
   967                              <1> CHAR_INIT_LOOP:
   968 00000584 C534                <1> 	LDS	SI,[SI]		; AUX device
   969                              <1>  assume ds:nothing
   970 00000586 E82601              <1> 	CALL	CHARINIT
   971 00000589 F6440408            <1> 	TEST	BYTE PTR [SI + SDEVATT],ISCLOCK
   972 0000058D 74F5                <1> 	JZ	CHAR_INIT_LOOP
   973                              <1> BCLOCK equ BClock	; NASM port label
   974 0000058F 268936[0000]        <1> 	MOV	WORD PTR [es:BCLOCK],SI
   975 00000594 268C1E[0200]        <1> 	MOV	WORD PTR [es:BCLOCK+2],DS
   976                              <1> 
   977 00000599 B448                <1> 	mov ah, 48h
   978 0000059B BB0500              <1> 	mov bx, paras(DPBSIZ * 2)
   979 0000059E CD21                <1> 	int 21h
   980 000005A0 7303                <1> 	jnc @F
   981                              <1> mem_err_j:
   982                              <1> 	extern MEM_ERR
   983 000005A2 E9(0000)            <1> 	jmp MEM_ERR
   984                              <1> @@:
   985                              <1> 	lframe
   986 000005A5 5589E5              <1> 	lenter
   987                              <1> 	lvar word, dosdataseg
   988 000005A8 06                  <1> 	 push es		; => DOS data segment
   989                              <1> 	lvar dword, nextdpb
   990 000005A9 50                  <1> 	 push ax		; => DPB allocation
   991 000005AA 31C0                <1> 	xor ax, ax
   992 000005AC 50                  <1> 	 push ax		; -> next DPB
   993                              <1> PERDRIVER:
   994 000005AD 8E46FE              <1> 	mov es, word [bp + ?dosdataseg]
   995                              <1>  assume es:DOSGROUP
   996 000005B0 C534                <1> 	LDS	SI,[SI]		; Next device
   997                              <1>  assume ds:nothing
   998 000005B2 83FEFF              <1> 	CMP	SI,-1
   999 000005B5 7503E9D100          <1> 	JZ	CONTINIT
  1000 000005BA E8F200              <1> 	CALL	CHARINIT
  1001 000005BD F744040080          <1> 	TEST	word [SI + SDEVATT],DEVTYP
  1002 000005C2 75E9                <1> 	JNZ	PERDRIVER		; Skip any other character devs
  1003                              <1> CALLUNIT equ CallUnit	; NASM port label
  1004 000005C4 31C9                <1> 	xor cx, cx
  1005 000005C6 268A0E[0000]        <1> 	MOV	CL,[es:CALLUNIT]
  1006 000005CB 884C0A              <1> 	MOV	[SI + SDEVNAME],CL	; Number of units in name field
  1007 000005CE E3DD                <1> 	jcxz PERDRIVER
  1008 000005D0 1E                  <1> 	PUSH	DS
  1009 000005D1 56                  <1> 	PUSH	SI
  1010 000005D2 268A16[0000]        <1> 	MOV	DL,[es:NUMIO]
  1011 000005D7 30F6                <1> 	XOR	DH,DH
  1012 000005D9 26000E[0000]        <1> 	ADD	[es:NUMIO],CL
  1013                              <1> CALLBPB equ CallBPB	; NASM port label
  1014 000005DE 26C51E[0000]        <1> 	LDS	BX,[es:CALLBPB]
  1015                              <1>  assume ds:nothing
  1016                              <1> PERUNIT:
  1017 000005E3 8B37                <1> 	MOV	SI,[BX] 		; DS:SI Points to BPB
  1018 000005E5 43                  <1> 	INC	BX
  1019 000005E6 43                  <1> 	INC	BX			; On to next BPB
  1020                              <1> 
  1021 000005E7 55                  <1> 	push bp
  1022 000005E8 C46EFA              <1> 	les bp, [bp + ?nextdpb]
  1023                              <1>  assume es:nothing
  1024                              <1> 
  1025 000005EB 85ED                <1> 	test bp, bp
  1026 000005ED 7408                <1> 	jz @F
  1027 000005EF 26896EF8            <1> 	mov word [es:bp - DPBSIZ + dpb_next_dpb], bp
  1028 000005F3 268C46FA            <1> 	mov word [es:bp - DPBSIZ + dpb_next_dpb + 2], es
  1029                              <1> @@:
  1030                              <1> 
  1031 000005F7 53                  <1> 	PUSH	BX
  1032 000005F8 51                  <1> 	PUSH	CX
  1033 000005F9 52                  <1> 	PUSH	DX
  1034                              <1> 
  1035                              <1> 					; es => DPB allocation
  1036 000005FA B104                <1> 	mov cl, 4
  1037 000005FC 8D5E30              <1> 	lea bx, [bp + DPBSIZ + 15]	; -> behind this DPB, round up
  1038 000005FF 39EB                <1> 	cmp bx, bp
  1039 00000601 729F                <1> 	jb mem_err_j
  1040 00000603 D3EB                <1> 	shr bx, cl			; to paragraphs
  1041 00000605 B44A                <1> 	mov ah, 4Ah
  1042 00000607 CD21                <1> 	int 21h				; resize
  1043 00000609 7297                <1> 	jc mem_err_j
  1044                              <1> 
  1045                              <1> 		; ! only write the next DPB after it is allocated
  1046 0000060B 5A                  <1> 	pop dx				; = unit/drive numbers
  1047                              <1> %if dpb_drive + 1 != dpb_UNIT
  1048                              <1>  %error Unexpected layout
  1049                              <1> %endif
  1050 0000060C 26895600            <1> 	MOV	[ES:BP + dpb_drive], dx
  1051                              <1> 
  1052 00000610 B8FFFF              <1> 	mov ax, -1
  1053 00000613 26894619            <1> 	mov word [es:bp + dpb_next_dpb], ax
  1054 00000617 2689461B            <1> 	mov word [es:bp + dpb_next_dpb + 2], ax
  1055 0000061B 52                  <1> 	push dx				; push unit/drive numbers again
  1056                              <1> 
  1057                              <1> 		; es:bp -> DPB, ds:si -> BPB
  1058                              <1> %if 0
  1059                              <1> 	neartransfer	D_SETDPB
  1060                              <1> 				; D_SETDPB works with ss != DOSDATA
  1061                              <1> %else
  1062 0000061C B453                <1> 	mov ah, 53h
  1063 0000061E CD21                <1> 	int 21h
  1064                              <1> %endif
  1065 00000620 26C64618FF          <1> 	mov byte [es:bp + dpb_first_access], -1	 ; Never accessed before
  1066 00000625 268B4602            <1> 	MOV	AX,[ES:BP + dpb_sector_size]
  1067 00000629 5A                  <1> 	POP	DX
  1068 0000062A 59                  <1> 	POP	CX
  1069 0000062B 5B                  <1> 	POP	BX
  1070                              <1> 
  1071 0000062C 5D                  <1> 	pop bp
  1072 0000062D 8E46FE              <1> 	mov es, word [bp + ?dosdataseg]
  1073                              <1>  assume es:DOSGROUP
  1074                              <1> 
  1075                              <1> MAXSEC equ Maxsec	; NASM port label
  1076 00000630 263B06[0000]        <1> 	CMP	AX,[es:MAXSEC]
  1077 00000635 7604                <1> 	JBE	.NOTMAX
  1078 00000637 26A3[0000]          <1> 	MOV	[es:MAXSEC],AX
  1079                              <1> .NOTMAX:
  1080                              <1> 
  1081                              <1> 
  1082 0000063B 8CD8                <1> 	MOV	AX,DS			; Save DS
  1083 0000063D 5E                  <1> 	POP	SI
  1084 0000063E 1F                  <1> 	POP	DS
  1085                              <1>  assume ds:nothing
  1086                              <1> 
  1087 0000063F 55                  <1> 	push bp
  1088 00000640 C46EFA              <1> 	les bp, [bp + ?nextdpb]
  1089                              <1>  assume es:nothing
  1090                              <1>  
  1091 00000643 26897613            <1> 	MOV	WORD PTR [ES:BP + dpb_driver_addr],SI
  1092 00000647 268C5E15            <1> 	MOV	WORD PTR [ES:BP + dpb_driver_addr+2],DS
  1093                              <1> 
  1094 0000064B 5D                  <1> 	pop bp
  1095                              <1> 
  1096 0000064C 1E                  <1> 	PUSH	DS
  1097 0000064D 56                  <1> 	PUSH	SI
  1098 0000064E FEC6                <1> 	INC	DH
  1099 00000650 FEC2                <1> 	INC	DL
  1100 00000652 8ED8                <1> 	MOV	DS,AX
  1101                              <1>  assume ds:nothing
  1102 00000654 8346FA21            <1> 	ADD	word [bp + ?nextdpb],DPBSIZ
  1103 00000658 E289                <1> 	LOOP	PERUNIT
  1104 0000065A 5E                  <1> 	POP	SI
  1105 0000065B 1F                  <1> 	POP	DS
  1106                              <1>  assume ds:nothing
  1107 0000065C E94EFF              <1> 	JMP	PERDRIVER
  1108                              <1> 
  1109 0000065F 90                  <1> 	align 2
  1110                              <1> first_umcb_smcb:
  1111                              <1> 	istruc MCB
  1112 00000660 5A                  <1> at mcbSignature,	db 'Z'
  1113 00000661 0800                <1> at mcbOwner,		dw 8
  1114 00000663 0000                <1> at mcbSize,		dw 0
  1115 00000665 00<rep 3h>5300      <1> at smcbName,		db "S", 0
  1116 0000066A 30                  <1> at smcbType,		db S_EXCLDUMA
  1117 0000066B 00<rep 5h>          <1> 	iend
  1118                              <1> 
  1119                              <1> dosentry_mcb:
  1120                              <1> 	istruc MCB
  1121 00000670 4D                  <1> at mcbSignature,	db 'M'
  1122 00000671 0800                <1> at mcbOwner,		dw 8
  1123 00000673 0000                <1> at mcbSize,		dw 0
  1124 00000675 00<rep 3h>5300      <1> at smcbName,		db "S", 0
  1125 0000067A 01                  <1> at smcbType,		db S_DOSENTRY
  1126 0000067B 00<rep 5h>          <1> 	iend
  1127                              <1> 
  1128                              <1> dpb_smcb:
  1129 00000680 000000              <1> 	db 0,0,0
  1130 00000683 5300                <1> 	db "S",0		; name "S"
  1131 00000685 08                  <1> 	db 8			; type S_DPB
  1132 00000686 00<rep 5h>          <1> 	times 5 db 0
  1133                              <1> 
  1134                              <1> CONTINIT:		; es => DOSDATA
  1135                              <1>  assume ds:nothing, es:DOSGROUP
  1136 0000068B 58                  <1> 	pop ax			; offset last DPB
  1137 0000068C 58                  <1> 	pop ax			; => DPB allocation
  1138 0000068D 26A3[0200]          <1> 	mov word [es:DPBHEAD + 2], ax
  1139 00000691 48                  <1> 	dec ax
  1140 00000692 8EC0                <1> 	mov es, ax
  1141                              <1>  assume es:MCB
  1142 00000694 26C70601000800      <1> 	mov word [es:arena_owner], 8
  1143                              <1> 				; init owner
  1144 0000069B BF0500              <1> 	mov di, arena_reserved
  1145 0000069E 0E                  <1> 	 push cs
  1146 0000069F 1F                  <1> 	 pop ds
  1147                              <1>  assume ds:SYSINITGROUP
  1148 000006A0 BE[8006]            <1> 	mov si, dpb_smcb	; access with ds
  1149 000006A3 B90B00              <1> 	mov cx, 3 + 8
  1150 000006A6 F3A4                <1> 	rep movsb		; init name and type
  1151                              <1> 
  1152 000006A8 1F                  <1> 	pop ds			; => DOS data
  1153                              <1>  assume ds:DOSGROUP
  1154 000006A9 1E                  <1> 	PUSH	ds
  1155 000006AA 07                  <1> 	POP	es
  1156                              <1>  assume es:DOSGROUP
  1157                              <1> 
  1158 000006AB 89EC5D              <1> 	lleave
  1159                              <1> 
  1160                              <1> sft_addr equ SFT_Addr	; NASM port label
  1161                              <1> NUMIO equ NumIO	; NASM port label
  1162                              <1> DPBHEAD equ DPBHead	; NASM port label
  1163                              <1> DOSGroup equ DOSGROUP	; NASM port equate
  1164                              <1> sftabl equ sfTabl	; NASM port label
  1165                              <1> 
  1166 000006AE C3                  <1> 	retn
  1167                              <1> 
  1168                              <1> 
  1169                              <1> CHARINIT:
  1170                              <1> ASSUME	DS:NOTHING,ES:NOTHING
  1171                              <1> ; DS:SI Points to device header
  1172                              <1> DEVCALL equ Devcall	; NASM port label
  1173 000006AF 06                  <1> 	PUSH	ES
  1174 000006B0 53                  <1> 	PUSH	BX
  1175 000006B1 50                  <1> 	PUSH	AX
  1176 000006B2 E876F9              <1> 	call getdosdata
  1177 000006B5 8EC0                <1> 	mov es, ax		; => DOSDATA
  1178                              <1>  assume es:DOSGROUP
  1179 000006B7 58                  <1> 	pop ax
  1180 000006B8 50                  <1> 	push ax
  1181 000006B9 BB[0000]            <1> 	MOV	BX,OFFSET DEVCALL wrt DOSGROUP
  1182 000006BC 26C6071A            <1> 	MOV	byte [es:bx + REQLEN],DINITHL
  1183 000006C0 26C6470100          <1> 	MOV	byte [es:bx + REQUNIT],0
  1184 000006C5 26C6470200          <1> 	MOV	byte [es:bx + REQFUNC],DEVINIT
  1185 000006CA 2683670300          <1> 	and	word [es:bx + REQSTAT],0
  1186                              <1> %if 0
  1187                              <1> 	neartransfer	DEVIOCALL2
  1188                              <1> %else
  1189                              <1> 		; device critical section is not yet enabled
  1190 000006CF 8B4406              <1> 	MOV	AX, [SI + SDEVSTRAT]
  1191                              <1> CALLDEVAD equ CallDevAd	; NASM port label
  1192 000006D2 26A3[0000]          <1> 	MOV	WORD PTR [es:CALLDEVAD],AX
  1193 000006D6 268C1E[0200]        <1> 	MOV	WORD PTR [es:CALLDEVAD+2],DS
  1194 000006DB 26FF1E[0000]        <1> 	CALL	far [es:CALLDEVAD]
  1195 000006E0 8B4408              <1> 	MOV	AX,[SI + SDEVINT]
  1196 000006E3 26A3[0000]          <1> 	MOV	WORD PTR [es:CALLDEVAD],AX
  1197 000006E7 26FF1E[0000]        <1> 	CALL	far [es:CALLDEVAD]
  1198                              <1> %endif
  1199 000006EC 58                  <1> 	POP	AX
  1200 000006ED 5B                  <1> 	POP	BX
  1201 000006EE 07                  <1> 	POP	ES
  1202                              <1>  assume es:nothing
  1203 000006EF C3                  <1> 	RET
  1204                              <1> 
  1205                              <1> %endif	; DOPLACEHOLDER
  1206                              <1> 
  1207                              <1> 
  1208                              <1> section LAST
  1209                              <1> 
  1210                              <1> Public MSINI002S,MSINI002E
  1211                              <1> MSINI002S label byte
  1212                              <1> 
  1213                              <1> 	align 2, db ?
  1214 00000006 ????                <1> 	DW	?
  1215 00000008 414444205350454349- <1> 	DB	"ADD SPECIAL ENTRIES",0     ;AN007  tiltle
  1215 00000011 414C20454E54524945- <1>
  1215 0000001A 5300                <1>
  1216                              <1> ;The following entries don't expect version 4.0
  1217                              <1> ;The entry format: name_length, name, expected version, fake count
  1218                              <1> ;fake_count: ff means the version will be reset when Abort or Exec is encountered
  1219                              <1> ;	     n means the version will be reset after n DOS version calls are issued
  1220                              <1> ;
  1221                              <1> Version_Fake_Table:			    ;AN007  starting address for special
  1222 0000001C 0C49424D4341434845- <1> 	DB	12,"IBMCACHE.COM",3,40,255  ;AN007  ibmcache     1
  1222 00000025 2E434F4D0328FF      <1>
  1223 0000002C 0C49424D4341434845- <1> 	DB	12,"IBMCACHE.SYS",3,40,255  ;AN007  ibmcache     2
  1223 00000035 2E5359530328FF      <1>
  1224 0000003C 0C44584D41304D4F44- <1> 	DB	12,"DXMA0MOD.SYS",3,40,255  ;AN007  lan support  3
  1224 00000045 2E5359530328FF      <1>
  1225 0000004C 0A57494E3230302E42- <1> 	DB	10,"WIN200.BIN"  ,3,40,4    ;AN008  windows      4
  1225 00000055 494E032804          <1>
  1226 0000005A 0950534350472E434F- <1> 	DB	 9,"PSCPG.COM"   ,3,40,255  ;AN008  vittoria     5
  1226 00000063 4D0328FF            <1>
  1227 00000067 0B44434A535330322E- <1> 	DB	11,"DCJSS02.EXE" ,3,40,255  ;AN008  netview      6
  1227 00000070 4558450328FF        <1>
  1228 00000076 084953414D2E455845- <1> 	DB	 8,"ISAM.EXE"    ,3,40,255  ;AN008  basic        7
  1228 0000007F 0328FF              <1>
  1229 00000082 094953414D322E4558- <1> 	DB	 9,"ISAM2.EXE"   ,3,40,255  ;AN008  basic        8
  1229 0000008B 450328FF            <1>
  1230 0000008F 0C44464941304D4F44- <1> 	DB	12,"DFIA0MOD.SYS",3,40,255  ;AN008  lan support  9
  1230 00000098 2E5359530328FF      <1>
  1231 0000009F 000000000000000000- <1> 	DB	20  dup(0)		    ;AN007
  1231 000000A8 000000000000000000- <1>
  1231 000000B1 0000                <1>
  1232                              <1> 
  1233 000000B3 00<rep Dh>          <1> 	align 16, db 0
  1234                              <1> 
  1235                              <1> MEMSTRT LABEL	WORD
  1236                              <1> MSINI002E label byte
  1237                              <1> ADJFAC	EQU	MEMSTRT-SYSBUF
  1238                              <1> 
  1239                              <1> %endif	; DONOBITS
  1240                              <1> 
  1241                              <1> [list +]
  1242                              <1> 
  1243                              <1> ; (no prior section) ; LAST	ENDS
    41                                  ;=== Pop trace listing source
    42                                  	END
