     1                                  ;	PAGE	,132			;
     2                                  ;	SCCSID = @(#)sysinit2.asm	1.13 85/10/15
     3                                  ;TITLE	BIOS SYSTEM INITIALIZATION
     4                                  %warning out: ...SYSINIT2
     4          ******************       warning: out: ...SYSINIT2 [-w+user]
     5                                  
     6                                  ;==============================================================================
     7                                  ;REVISION HISTORY:
     8                                  ;AN000 - New for DOS Version 4.00 - J.K.
     9                                  ;AC000 - Changed for DOS Version 4.00 - J.K.
    10                                  ;AN00x - PTM number for DOS Version 4.00 - J.K.
    11                                  ;==============================================================================
    12                                  ;AN001; p132 Multiple character device installation problem.	    6/27/87 J.K.
    13                                  ;AN002; d24  MultiTrack= command added. 			    6/29/87 J.K.
    14                                  ;AN003; p29  Extra space character in parameters passed.
    15                                  ;	     (Modification on ORGANIZE routine for COMMENT= fixed this
    16                                  ;	      problem too)					    6/29/87 J.K.
    17                                  ;AN004; d41  REM command in CONFIG.SYS				    7/7/87  J.K.
    18                                  ;AN005; d184 Set DEVMARK for MEM command			    8/25/87 J.K.
    19                                  ;AN006; p1820 New Message SKL file				   10/20/87 J.K.
    20                                  ;AN007; p1821 Include the COPYRIGH.INC file			   10/22/87 J.K.
    21                                  ;AN008; p2210 IBMDOS returns incorrect DBCS vector table length    11/02/87 J.K.
    22                                  ;AN009; p2667 ccMono_Ptr problem				   11/30/87 J.K.
    23                                  ;AN010; p2792 Device?driver.sys /d:2 command should not work	   12/09/87 J.K.
    24                                  ;AN011; p3120 REM followed by CR, LF causes problem		   01/13/88 J.K.
    25                                  ;AN012; p3111 Take out the order dependency of the INSTALL=	   01/25/88 J.K.
    26                                  ;AN013; d479  New option to disable extended INT 16h function call 02/12/88 J.K.
    27                                  ;AN014; D486 SHARE installation for big media			   02/23/88 J.K.
    28                                  ;AN015; D526 Add /NC parameter when installing SHARE.EXE	   04/28/88 J.K.
    29                                  ;==============================================================================
    30                                  
    31                                  TRUE	    EQU 0FFFFh
    32                                  FALSE	    EQU 0
    33                                  LF	equ	10
    34                                  CR	equ	13
    35                                  TAB	equ	 9
    36                                  
    37                                  IBMVER	   EQU	   TRUE
    38                                  IBM	   EQU	   IBMVER
    39                                  STACKSW    EQU	   TRUE 		;Include Switchable Hardware Stacks
    40                                  IBMJAPVER  EQU	   FALSE		;If TRUE set KANJI true also
    41                                  %iassign MSVER FALSE
    42                                  ALTVECT    EQU	   FALSE		;Switch to build ALTVECT version
    43                                  KANJI	   EQU	   FALSE
    44                                  
    45                                  	%IF	IBMJAPVER
    46                                  NOEXEC	EQU	TRUE
    47                                  	%ELSE
    48                                  NOEXEC	EQU	FALSE
    49                                  	%ENDIF
    50                                  
    51                                  ;DOSSIZE EQU	0A000H
    52                                  
    53                                  
    54                                  [list -]
    54          ******************       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	0
     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 -]
    23                              <1>  %define DOSENTRYGROUP DOSCODEGROUP
    24                              <1>  [list -]
    39                              <1> usesection DOSENTRY
    40                              <1> 
    41                              <1> %endif
    56                                  	%include "msgroup.mac"
     1                              <1> EVBOUND equ 1  ;THIS VALUE BEING 0 DOES NO BOUNDARY ALLIGNMENT, VALUE 1	  ;3.30
     2                              <1> 	     ; ALIGNS TO EVEN						  ;3.30
     3                              <1> 
     4                              <1> ; NASM original macros
     5                              <1> 
     6                              <1> %include "dcodeseg.nas"
     1                              <2> 
     2                              <2> %ifndef DCODESEGNAS
     3                              <2> %assign DCODESEGNAS 1
     4                              <2> 
     5                              <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE
     6                              <2> ; (no prior section) ; DOSCODETABLE		ENDS
     7                              <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE
     8                              <2> ; (no prior section) ; DOSCODECODE		ENDS
     9                              <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE
    10                              <2> section BIOCODE	align=2 PUBLIC class=DOSCODE
    11                              <2> 
    12                              <2> %ifnidni DOSENTRYGROUP, DOSCODEGROUP
    13                              <2>  group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE
    14                              <2> %endif
    15                              <2> 
    16                              <2> %endif
     7                              <1> 
     8                              <1> 	%if EVBOUND	;;IF EVEN (WORD) ALLIGNMENT IS REQUESTED,	  ;3.30
     9                              <1> 
    10                              <1> %imacro EVENB 0.nolist
    11                              <1> 	EVEN	;;ADJUST TO EVEN BOUNDARY
    12                              <1> %endmacro
    13                              <1> 
    14                              <1> %imacro ODD 0.nolist
    15                              <1> %if (($ - $$) % 2) == 0
    16                              <1> 	db ?
    17                              <1> %endif
    18                              <1> %endmacro
    19                              <1> 
    20                              <1> 	%else	;;SINCE EVEN ALLIGNMENT IS NOT DESIRED, JUST USE BYTE ALLI;3.30 GNMENT
    21                              <1> 
    22                              <1> %imacro EVENB 0.nolist
    23                              <1> ;;REQUEST FOR WORD ALLIGNMENT DOES NOTHING				  ;3.30
    24                              <1> %endmacro
    25                              <1> 
    26                              <1> %imacro ODD 0.nolist
    27                              <1> ;;REQUEST FOR ODD ALLIGNMENT DOES NOTHING				  ;3.30
    28                              <1> %endmacro
    29                              <1> 
    30                              <1> 	%endif								  ;3.30
    31                              <1> 
    32                              <1> %imacro CODE_SEGMENT 0.nolist
    33                              <1> 	section BIOCODE
    34                              <1> %endmacro
    35                              <1> 
    36                              <1> ; end of NASM original macros
    37                              <1> 
    38                              <1> 	CODE_SEGMENT							  ;3.30
    39                              <1> 	ASSUME	CS:BIOCODE 						  ;3.30
    40                              <1> 									  ;3.30
    57                                  ;	INCLUDE dossym.INC
    58                                  	%include "smdossym.mac"	;J.K. Reduced version of DOSSYM.INC
     1                              <1> ;	SCCSID = @(#)dossym.asm 1.1 85/04/10
     2                              <1> ;	SCCSID = @(#)dossym.asm 1.1 85/04/10
     3                              <1> ;	PAGE 80,132
     4                              <1> TRUE	    EQU 0FFFFh
     5                              <1> FALSE	    EQU 0
     6                              <1> 
     7                              <1> Installed   equ TRUE
     8                              <1> %IFNDEF	DEBUG
     9                              <1>     DEBUG	equ FALSE
    10                              <1> %ENDIF
    11                              <1> %IFNDEF	debug
    12                              <1>     debug	equ DEBUG
    13                              <1> %ENDIF
    14                              <1> 
    15                              <1> %include "dosmac.mac"
     1                              <2> ;	SCCSID = @(#)dosmac.asm	1.1 85/04/10
     2                              <2> ;	SCCSID = @(#)dosmac.asm	1.1 85/04/10
     3                              <2> ;
     4                              <2> ; Macro file for MSDOS.
     5                              <2> ;
     6                              <2> 
     7                              <2> %ifndef __DOSMAC_MAC__
     8                              <2>  %assign __DOSMAC_MAC__ 1
     9                              <2> 
    10                              <2> TRUE    EQU 0FFFFh
    11                              <2> FALSE   EQU 0
    12                              <2> 
    13                              <2> 
    14                              <2> ; NASM original macros (comment for fixmem.pl)
    15                              <2> 
    16                              <2> ;SUBTTL BREAK a listing into pages and give new subtitles
    17                              <2> ;PAGE
    18                              <2> %imacro BREAK 0-1+.nolist
    19                              <2> 	;SUBTTL  subtitle
    20                              <2> 	;PAGE
    21                              <2> %endmacro
    22                              <2> ;.xcref  break
    23                              <2> 
    24                              <2> BREAK   <ASMVAR - handle assembly variables once and for all>
    25                              <2> 
    26                              <2> %if 0
    27                              <2> AsmVars Macro   varlist
    28                              <2> IRP     var,<varlist>
    29                              <2> AsmVar  var
    30                              <2> ENDM
    31                              <2> ENDM
    32                              <2> 
    33                              <2> AsmVar  Macro   var
    34                              <2> IFNDEF  var
    35                              <2> var = FALSE
    36                              <2> ENDIF
    37                              <2> ENDM
    38                              <2> %endif
    39                              <2> 
    40                              <2> BREAK <I_NEED: declare a variable external, if necessary, and allocate a size>
    41                              <2> 
    42                              <2> ;
    43                              <2> ; declare a variable external and allocate a size
    44                              <2> ;
    45                              <2> ;AsmVar  InstalledData
    46                              <2> %ifndef InstalledData
    47                              <2>  %define InstalledData 0
    48                              <2> %endif
    49                              <2> 
    50                              <2> %imacro I_NEED 1-2.nolist
    51                              <2> %ifn InstalledData
    52                              <2> 	[section DATA]
    53                              <2>     %IFIDNi   %2, WORD
    54                              <2> 	EXTRN   %1:WORD
    55                              <2>     %ELSE
    56                              <2> 	%IFIDNi   %2, DWORD
    57                              <2> 	EXTRN   %1:DWORD
    58                              <2> 	%ELSE
    59                              <2> 	EXTRN   %1:BYTE
    60                              <2> 	%ENDIF
    61                              <2>     %ENDIF
    62                              <2> 	__SECT__
    63                              <2> %ENDIF
    64                              <2> %endmacro
    65                              <2> 	;.xcref I_need
    66                              <2> 
    67                              <2> ;
    68                              <2> ; call a procedure that may be external.  The call will be short.
    69                              <2> ;
    70                              <2> %imacro invoke 1.nolist
    71                              <2> ;.xcref
    72                              <2> 	EXTRN   %1:NEAR
    73                              <2> ;.cref
    74                              <2> 	CALL    %1
    75                              <2> %endmacro
    76                              <2> ;.xcref  invoke
    77                              <2> 
    78                              <2> ;PAGE
    79                              <2> ;
    80                              <2> ; jump to a label that may be external.  The jump will be near.
    81                              <2> ;
    82                              <2> %imacro transfer 1.nolist
    83                              <2> ;.xcref
    84                              <2> 	EXTRN   %1:NEAR
    85                              <2> ;.cref
    86                              <2> 	JUMP    %1
    87                              <2> %endmacro
    88                              <2> ;.xcref  transfer
    89                              <2> 
    90                              <2> ;
    91                              <2> ; get a short address in a word
    92                              <2> ;
    93                              <2> %imacro short_addr 1.nolist
    94                              <2>     %ifnidn %1, ?
    95                              <2> 	EXTRN   %1:NEAR
    96                              <2> 	DW  OFFSET %1
    97                              <2>     %ELSE
    98                              <2> 	DW  ?
    99                              <2>     %ENDIF
   100                              <2> %endmacro
   101                              <2> ;.xcref  short_addr
   102                              <2> 
   103                              <2> ;
   104                              <2> ; get a long address in a dword
   105                              <2> ;
   106                              <2> %imacro long_addr 1.nolist
   107                              <2> 	EXTRN   %1:NEAR
   108                              <2> 	DD  %1
   109                              <2> %endmacro
   110                              <2> ;.xcref  long_addr
   111                              <2> 
   112                              <2> ;
   113                              <2> ; declare a PROC near or far but PUBLIC nonetheless
   114                              <2> ;
   115                              <2> ;.xcref ?frame
   116                              <2> ;.xcref ?aframe
   117                              <2> ;.xcref ?stackdepth
   118                              <2> ;.xcref ?initstack
   119                              <2> %assign ?frame           0                     ; initial
   120                              <2> %assign ?aframe          0                     ; initial
   121                              <2> %assign ?stackdepth      0                     ; initial stack size
   122                              <2> %assign ?initstack       0                     ; initial stack size
   123                              <2> 
   124                              <2> %imacro procedure 1-2.nolist
   125                              <2> 	%assign ?frame     0
   126                              <2> 	%assign ?aframe    2                   ;; remember the pushed BP
   127                              <2> 	%warning proc %1...
   128                              <2> %1    PROC    %2
   129                              <2> 	PUBLIC  %1
   130                              <2> 	%assign ?initstack     ?stackdepth     ;; beginning of procedure
   131                              <2> %endmacro
   132                              <2> ;.xcref  procedure
   133                              <2> 
   134                              <2> ;
   135                              <2> ; end a procedure and check that stack depth is preserved
   136                              <2> ;
   137                              <2> %imacro EndProc 1-2.nolist
   138                              <2> 	%ifnidni   %2, NoCheck        ;; check the stack size
   139                              <2> 	%if ?initstack != ?stackdepth    ;; is it different?
   140                              <2> 	%warning    ***** Possible stack size error in %1 *****
   141                              <2> 	%endif
   142                              <2> 	%endif
   143                              <2> %1    ENDP
   144                              <2> %endmacro
   145                              <2> ;.xcref  endproc
   146                              <2> ;PAGE
   147                              <2> ;
   148                              <2> ; define a data item to be public and of an appropriate size/type
   149                              <2> ;
   150                              <2> 
   151                              <2> %imacro stripangles 2.nolist
   152                              <2> %defstr %%param %2
   153                              <2> %rep 16
   154                              <2>  %substr %%opening %%param 1
   155                              <2>  %ifidn %%opening, '<'
   156                              <2>   %substr %%param %%param 2,-1
   157                              <2>  %endif
   158                              <2> %endrep
   159                              <2> %rep 16
   160                              <2>  %strlen %%length %%param
   161                              <2>  %substr %%closing %%param %%length
   162                              <2>  %ifidn %%closing, '>'
   163                              <2>   %substr %%param %%param 1,-2
   164                              <2>  %endif
   165                              <2> %endrep
   166                              <2> %deftok %%token %%param
   167                              <2> %1 %%token
   168                              <2> %endmacro
   169                              <2> 
   170                              <2> %imacro I_AM 2-*.nolist
   171                              <2> ;I_AM    MACRO   name,size,init
   172                              <2> %xdefine %%name %1
   173                              <2> ;; declare the type of the object
   174                              <2>     %IFIDNi %2, WORD
   175                              <2> %1    LABEL WORD
   176                              <2> 	%assign I_AM_SIZE      1
   177                              <2> 	%assign I_AM_LEN       2
   178                              <2>     %ELSE
   179                              <2> 	%IFIDNi %2, DWORD
   180                              <2> %1    LABEL DWORD
   181                              <2> 	%assign I_AM_SIZE      2
   182                              <2> 	%assign I_AM_LEN       2
   183                              <2> 	%ELSE
   184                              <2> 	    %IFIDNi %2, BYTE
   185                              <2> %1    LABEL BYTE
   186                              <2> 	%assign I_AM_SIZE      1
   187                              <2> 	%assign I_AM_LEN       1
   188                              <2> 	    %ELSE
   189                              <2> %1    LABEL BYTE
   190                              <2> %undef I_AM_SIZE
   191                              <2> 	stripangles %assign I_AM_SIZE, %2
   192                              <2> 	%assign I_AM_LEN       1
   193                              <2> 	    %ENDIF
   194                              <2> 	%ENDIF
   195                              <2>     %ENDIF
   196                              <2> ;; declare the object public
   197                              <2> 	PUBLIC  %%name
   198                              <2> ;; if no initialize then allocate blank storage
   199                              <2>     %IF %0 == 2
   200                              <2> 	DB  I_AM_SIZE*I_AM_LEN DUP (?)
   201                              <2>     %ELSE
   202                              <2> %ifn InstalledData
   203                              <2>  %rotate 2
   204                              <2>  %rep %0 - 2
   205                              <2> 	    %IF I_AM_LEN == 1
   206                              <2> 		stripangles db, %1
   207                              <2> 	    %ELSE
   208                              <2> 		stripangles dw, %1
   209                              <2> 	    %ENDIF
   210                              <2> 	    %assign I_AM_SIZE I_AM_SIZE - 1
   211                              <2> 	    %rotate 1
   212                              <2>  %endrep
   213                              <2> 	%IF I_AM_SIZE != 0
   214                              <2> 	    %error    ***** initialization of %%name not complete *****
   215                              <2> 	%ENDIF
   216                              <2> %ELSE
   217                              <2> 	DB  I_AM_SIZE*I_AM_LEN DUP (?)
   218                              <2> %ENDIF
   219                              <2>     %ENDIF
   220                              <2> %endmacro
   221                              <2> 
   222                              <2> %imacro I_AM_NOBITS 2-*.nolist
   223                              <2> ;I_AM    MACRO   name,size,init
   224                              <2> %xdefine %%name %1
   225                              <2> ;; declare the type of the object
   226                              <2>     %IFIDNi %2, WORD
   227                              <2> %1    LABEL WORD
   228                              <2> 	%assign I_AM_SIZE      1
   229                              <2> 	%assign I_AM_LEN       2
   230                              <2>     %ELSE
   231                              <2> 	%IFIDNi %2, DWORD
   232                              <2> %1    LABEL DWORD
   233                              <2> 	%assign I_AM_SIZE      2
   234                              <2> 	%assign I_AM_LEN       2
   235                              <2> 	%ELSE
   236                              <2> 	    %IFIDNi %2, BYTE
   237                              <2> %1    LABEL BYTE
   238                              <2> 	%assign I_AM_SIZE      1
   239                              <2> 	%assign I_AM_LEN       1
   240                              <2> 	    %ELSE
   241                              <2> %1    LABEL BYTE
   242                              <2> %undef I_AM_SIZE
   243                              <2> 	stripangles %assign I_AM_SIZE, %2
   244                              <2> 	%assign I_AM_LEN       1
   245                              <2> 	    %ENDIF
   246                              <2> 	%ENDIF
   247                              <2>     %ENDIF
   248                              <2> ;; declare the object public
   249                              <2> 	PUBLIC  %%name
   250                              <2> ;; if no initialize then allocate blank storage
   251                              <2>     %IF %0 == 2
   252                              <2> 	resb  I_AM_SIZE*I_AM_LEN
   253                              <2>     %ELSE
   254                              <2> %ifn InstalledData
   255                              <2>  %rotate 2
   256                              <2>  %rep %0 - 2
   257                              <2> 	    %IF I_AM_LEN == 1
   258                              <2> 		resb 1
   259                              <2> 	    %ELSE
   260                              <2> 		resw 1
   261                              <2> 	    %ENDIF
   262                              <2> 	    %assign I_AM_SIZE I_AM_SIZE - 1
   263                              <2> 	    %rotate 1
   264                              <2>  %endrep
   265                              <2> 	%IF I_AM_SIZE != 0
   266                              <2> 	    %error    ***** initialization of %%name not complete *****
   267                              <2> 	%ENDIF
   268                              <2> %ELSE
   269                              <2> 	resb  I_AM_SIZE*I_AM_LEN
   270                              <2> %ENDIF
   271                              <2>     %ENDIF
   272                              <2> %endmacro
   273                              <2> 
   274                              <2> ;.xcref  I_AM
   275                              <2> ;.xcref  I_AM_SIZE
   276                              <2> ;.xcref  I_AM_LEN
   277                              <2> %assign I_AM_SIZE 0
   278                              <2> %assign I_AM_LEN  0
   279                              <2> 
   280                              <2> ;PAGE
   281                              <2> 
   282                              <2> ;
   283                              <2> ; define an entry in a procedure
   284                              <2> ;
   285                              <2> %imacro entry 1-2.nolist
   286                              <2> %1:
   287                              <2> 	PUBLIC  %1
   288                              <2> %endmacro
   289                              <2> ;.xcref  entry
   290                              <2> 
   291                              <2> BREAK <ERROR - store an error code then jump to a label>
   292                              <2> 
   293                              <2> %imacro error 1.nolist
   294                              <2> ;.xcref
   295                              <2> 	MOV AL, %1
   296                              <2> 	transfer    SYS_RET_ERR
   297                              <2> ;.cref
   298                              <2> %endmacro
   299                              <2> ;.xcref  error
   300                              <2> 
   301                              <2> BREAK <JUMP - real jump that links up shortwise>
   302                              <2> ;
   303                              <2> ; given a label <lbl> either 2 byte jump to another label <lbl>_J
   304                              <2> ; if it is near enough or 3 byte jump to <lbl>
   305                              <2> ;
   306                              <2> 
   307                              <2> %imacro jump 1.nolist
   308                              <2> ;.xcref
   309                              <2> 
   310                              <2>     %ifndef %1_J                       ;; is this the first invocation
   311                              <2> %%a:      JMP %1
   312                              <2>     %ELSE
   313                              <2> 	%IF (%1_J >= $) || ($-%1_J > 126)
   314                              <2> %%a:      JMP %1                         ;; is the jump too far away?
   315                              <2> 	%ELSE
   316                              <2> %%a:      JMP %1_J                      ;; do the short one...
   317                              <2> 	%ENDIF
   318                              <2>     %ENDIF
   319                              <2>     %ixdefine %1_j %%a
   320                              <2> ;.cref
   321                              <2> %endmacro
   322                              <2> ;.xcref  jump
   323                              <2> 
   324                              <2> BREAK <RETURN - return from a function>
   325                              <2> 
   326                              <2> %imacro return 0.nolist
   327                              <2> %%a:
   328                              <2> 	RET
   329                              <2> %xdefine ret_l %%a
   330                              <2> %endmacro
   331                              <2> ;.xcref  return
   332                              <2> 
   333                              <2> BREAK <CONDRET - conditional return>
   334                              <2> 
   335                              <2> %imacro condret 2.nolist
   336                              <2> %assign %%exit 0
   337                              <2>     %ifdef   ret_l                       ;; if ret_l is defined
   338                              <2> 	%if (($ - ret_l) <= 126) && ($ > ret_l)
   339                              <2> 					;;     if ret_l is near enough then
   340                              <2> 	    %%a:  j%1    ret_l           ;;         a: j<CC> to ret_l
   341                              <2> 	    %xdefine ret_%1 %%a                 ;;         define ret_<CC> to be a:
   342                              <2> 	    %assign %%exit 1
   343                              <2> 	%endif
   344                              <2>     %endif
   345                              <2>     %ifn %%exit
   346                              <2>     %ifdef   ret_%1                     ;; if ret_<CC> defined
   347                              <2> 	%if (($ - ret_%1) <= 126) && ($ > ret_%1)
   348                              <2> 					;;     if ret_<CC> is near enough
   349                              <2> 	    %%a:  j%1    ret_%1         ;;         a: j<CC> to ret_<CC>
   350                              <2> 	    %xdefine ret_%1 %%a                 ;;         define ret_<CC> to be a:
   351                              <2> 	    %assign %%exit 1
   352                              <2> 	%endif
   353                              <2>     %endif
   354                              <2>     %endif
   355                              <2>     %ifn %%exit
   356                              <2>     j%2   %%a                           ;; j<NCC> a:
   357                              <2>     return                              ;; return
   358                              <2>     %%a:                                  ;; a:
   359                              <2>     %xdefine ret_%1 ret_l                     ;; define ret_<CC> to be ret_l
   360                              <2>     %endif
   361                              <2> %endmacro
   362                              <2> ;.xcref  condret
   363                              <2> 
   364                              <2> BREAK <RETZ - return if zero, links up shortwise if necessary>
   365                              <2> 
   366                              <2> %imacro retz 0.nolist
   367                              <2>     condret z,nz
   368                              <2> %endmacro
   369                              <2> ;.xcref  retz
   370                              <2> 
   371                              <2> BREAK <RETNZ - return if not zero, links up shortwise if necessary>
   372                              <2> 
   373                              <2> %imacro retnz 0.nolist
   374                              <2>     condret nz,z
   375                              <2> %endmacro
   376                              <2> ;.xcref  retnz
   377                              <2> 
   378                              <2> BREAK <RETC - return if carry set, links up shortwise if necessary>
   379                              <2> 
   380                              <2> %imacro retc 0.nolist
   381                              <2>     condret c,nc
   382                              <2> %endmacro
   383                              <2> ;.xcref  retc
   384                              <2> 
   385                              <2> BREAK <RETNC - return if not carry, links up shortwise if necessary>
   386                              <2> 
   387                              <2> %imacro retnc 0.nolist
   388                              <2>     condret nc,c
   389                              <2> %endmacro
   390                              <2> ;.xcref  retnc
   391                              <2> 
   392                              <2> BREAK <CONTEXT - set the DOS context to a particular register>
   393                              <2> 
   394                              <2> %imacro context 1.nolist
   395                              <2> 	PUSH    SS
   396                              <2> 	stripangles POP, %1
   397                              <2> 	; ASSUME  %1:DOSGROUP
   398                              <2> %endmacro
   399                              <2> ;.xcref  context
   400                              <2> 
   401                              <2> BREAK <SaveReg - save a set of registers>
   402                              <2> 
   403                              <2> %imacro SaveReg 0-*.nolist                 ;; push those registers
   404                              <2>  %rep %0
   405                              <2> 	%assign ?stackdepth ?stackdepth + 1
   406                              <2> 	stripangles push, %1
   407                              <2> 	%rotate 1
   408                              <2>  %endrep
   409                              <2> %endmacro
   410                              <2> ;.xcref  SaveReg
   411                              <2> 
   412                              <2> BREAK <RestoreReg - unsave some registers>
   413                              <2> 
   414                              <2> %imacro RestoreReg 0-*.nolist             ;; pop those registers
   415                              <2>  %rep %0
   416                              <2> 	%assign ?stackdepth ?stackdepth - 1
   417                              <2> 	stripangles pop, %1
   418                              <2> 	%rotate 1
   419                              <2>  %endrep
   420                              <2> %endmacro
   421                              <2> ;.xcref  RestoreReg
   422                              <2> 
   423                              <2> BREAK <Critical section macros>
   424                              <2> 
   425                              <2> %imacro EnterCrit 1.nolist
   426                              <2> 	Invoke  E%1
   427                              <2> %endmacro
   428                              <2> 
   429                              <2> %imacro LeaveCrit 1.nolist
   430                              <2> 	Invoke  L%1
   431                              <2> %endmacro
   432                              <2> 
   433                              <2> Break   <message - display a message>
   434                              <2> 
   435                              <2> ;AsmVars <ShareF,Cargs,Redirector>
   436                              <2> %ifndef ShareF
   437                              <2>  %idefine ShareF 0
   438                              <2> %endif
   439                              <2> %ifndef Cargs
   440                              <2>  %idefine Cargs 0
   441                              <2> %endif
   442                              <2> %ifndef Redirector
   443                              <2>  %idefine Redirector 0
   444                              <2> %endif
   445                              <2> %ifndef debug
   446                              <2>  %idefine debug 0
   447                              <2> %endif
   448                              <2> 
   449                              <2> %if debug
   450                              <2> %imacro fmt 3-*.nolist
   451                              <2> ;fmt     MACRO   typ,lev,fmts,args
   452                              <2> ;local   a,b,c
   453                              <2> 	PUSHF
   454                              <2> %IFNempty %1
   455                              <2> 	TEST    word [BugTyp],%1
   456                              <2> 	JZ      %%c
   457                              <2> 	CMP     word [BugLev],%2
   458                              <2> 	JB      %%c
   459                              <2> %ENDIF
   460                              <2> 	PUSH    AX
   461                              <2> 	PUSH    BP
   462                              <2> 	MOV     BP,SP
   463                              <2> %If (! sharef) && (! redirector)
   464                              <2> 	[section Table]
   465                              <2> %%a:       db      %3,0
   466                              <2> 	__SECT__
   467                              <2> 	MOV     AX,OFFSET %%a wrt DOSGROUP
   468                              <2> %else
   469                              <2> 	jmp     short %%b
   470                              <2> %%a:       db      %3,0
   471                              <2> %if sharef
   472                              <2> %%b:      mov     ax,offset %%a wrt share
   473                              <2> %else
   474                              <2> %%b:      mov     ax,offset %%a wrt netwrk
   475                              <2> %endif
   476                              <2> %endif
   477                              <2> 	PUSH    AX
   478                              <2> %iassign cargs 2
   479                              <2> %rotate 3
   480                              <2> %rep %0 - 3
   481                              <2>  %ifidni ax, %1
   482                              <2> 	MOV     AX,[BP+2]
   483                              <2>  %ELSE
   484                              <2> 	MOV     AX, %1
   485                              <2>  %ENDIF
   486                              <2> 	PUSH    AX
   487                              <2>  %iassign cargs cargs + 2
   488                              <2>  %rotate 1
   489                              <2> %endrep
   490                              <2> 	invoke  PFMT
   491                              <2> 	ADD     SP, Cargs
   492                              <2> 	POP     BP
   493                              <2> 	POP     AX
   494                              <2> %%c:
   495                              <2> 	POPF
   496                              <2> %endmacro
   497                              <2> %else
   498                              <2> %imacro fmt 3-*.nolist
   499                              <2> %endmacro
   500                              <2> %endif
   501                              <2> 
   502                              <2> Break   <DOSAssume - validate assumes>
   503                              <2> 
   504                              <2> ;AsmVar  Debug,$temp
   505                              <2> 
   506                              <2> %imacro detectstripangles 4.nolist
   507                              <2> %defstr %%param %4
   508                              <2> %assign ?%2 0
   509                              <2> %assign ?%3 0
   510                              <2> %rep 16
   511                              <2>  %substr %%opening %%param 1
   512                              <2>  %ifidn %%opening, '<'
   513                              <2>   %substr %%param %%param 2,-1
   514                              <2>   %assign ?%2 ?%2 + 1
   515                              <2>  %endif
   516                              <2> %endrep
   517                              <2> %rep 16
   518                              <2>  %strlen %%length %%param
   519                              <2>  %substr %%closing %%param %%length
   520                              <2>  %ifidn %%closing, '>'
   521                              <2>   %substr %%param %%param 1,-2
   522                              <2>   %assign ?%3 ?%3 + 1
   523                              <2>  %endif
   524                              <2> %endrep
   525                              <2> %deftok %%token %%param
   526                              <2> %define ?%1 %%token
   527                              <2> %endmacro
   528                              <2> 
   529                              <2> 
   530                              <2> %IF debug
   531                              <2> %imacro DOSAssume 3-*.nolist
   532                              <2> ;DOSAssume   Macro   reg,reglist,message
   533                              <2>  %ifidni %1, CS
   534                              <2>   %assign %%temp 1
   535                              <2>  %else
   536                              <2>   %ifidni %1, SS
   537                              <2>    %assign %%temp 0
   538                              <2>   %else
   539                              <2>    %error ***** Invalid DOS register %1 in DOSAssume *****
   540                              <2>   %endif
   541                              <2>  %endif
   542                              <2>  %rotate 1
   543                              <2>  %assign %%level 0
   544                              <2>  %assign %%amount %0 - 1
   545                              <2>  %rep 16
   546                              <2>   detectstripangles %%token, %%opening, %%closing, %1
   547                              <2>   %assign %%level %%level + ? %+ %%opening
   548                              <2>   %assign %%level %%level - ? %+ %%closing
   549                              <2>   %ifidni ? %+ %%token, DS
   550                              <2>    %assign %%temp %%temp | 2
   551                              <2>   %else
   552                              <2>    %ifidni ? %+ %%token, ES
   553                              <2>     %assign %%temp %%temp | 4
   554                              <2>    %else
   555                              <2>     %error ***** Invalid register reg in DOSAssume *****
   556                              <2>    %endif
   557                              <2>   %endif
   558                              <2>   %assign %%amount %%amount - 1
   559                              <2>   %rotate 1
   560                              <2>   %if %%level <= 0
   561                              <2>    %exitrep
   562                              <2>   %endif
   563                              <2>  %endrep
   564                              <2> 
   565                              <2> 	PUSH    AX
   566                              <2> 	MOV     AX, %%temp
   567                              <2> 	PUSH    AX
   568                              <2> %IF SHAREF
   569                              <2> 	MOV     AX,OFFSET %%a
   570                              <2> %ELSE
   571                              <2> 	MOV     AX,OFFSET %%a wrt DOSGroup
   572                              <2> %ENDIF
   573                              <2> 	PUSH    AX
   574                              <2> 	Invoke  SegCheck
   575                              <2> 	POP     AX
   576                              <2> %IFN SHAREF
   577                              <2> 	[section Table]
   578                              <2> %ELSE
   579                              <2> 	JMP     SHORT %%b
   580                              <2> %ENDIF
   581                              <2> %%a:
   582                              <2>  %rep %%amount
   583                              <2>         DB      %1
   584                              <2>   %rotate 1
   585                              <2>  %endrep
   586                              <2> 	db 0
   587                              <2> %IFN SHAREF
   588                              <2> 	__SECT__
   589                              <2> %ELSE
   590                              <2> %%b:
   591                              <2> %ENDIF
   592                              <2> ;IRP r,<reglist>
   593                              <2> ;    ASSUME  r:DOSGroup
   594                              <2> ;ENDM
   595                              <2> %endmacro
   596                              <2> %ELSE
   597                              <2> %imacro DOSAssume 3-*.nolist
   598                              <2> ;DOSAssume   Macro   reg,reglist,message
   599                              <2> ;IRP r,<reglist>
   600                              <2> ;    ASSUME  r:DOSGroup
   601                              <2> ;ENDM
   602                              <2> %endmacro
   603                              <2> %ENDIF
   604                              <2> 
   605                              <2> BREAK   <ASSERT - make assertions about registers>
   606                              <2> 
   607                              <2> %if 0
   608                              <2> ;IF DEBUG
   609                              <2> Assert  MACRO   kind, objs, message
   610                              <2> 	LOCAL   a,b
   611                              <2>     IFIDN   <kind>,<Z>
   612                              <2> 	CMP     objs,0
   613                              <2> 	JZ      a
   614                              <2> 	fmt <>,<>,<message>
   615                              <2> a:
   616                              <2>     ELSE
   617                              <2> 	IFIDN   <kind>,<NZ>
   618                              <2> 	CMP     objs,0
   619                              <2> 	JNZ     a
   620                              <2> 	fmt <>,<>,<message>
   621                              <2> a:
   622                              <2> 	ELSE
   623                              <2>     PUSH    AX
   624                              <2> 	    IRP obj,<objs>
   625                              <2> 	PUSH    obj
   626                              <2> 	    ENDM
   627                              <2> 	    IF SHAREF
   628                              <2>     MOV     AX,OFFSET b
   629                              <2> 	    ELSE
   630                              <2>     MOV     AX,OFFSET DOSGroup:b
   631                              <2> 	    ENDIF
   632                              <2>     PUSH    AX
   633                              <2> 	    IFIDN   <kind>,<ISBUF>
   634                              <2> 	Invoke  BUFCheck
   635                              <2> 	    ENDIF
   636                              <2> 	    IFIDN   <kind>,<ISSFT>
   637                              <2> 	Invoke  SFTCheck
   638                              <2> 	    ENDIF
   639                              <2> 	    IFIDN   <kind>,<ISDPB>
   640                              <2> 	Invoke  DPBCheck
   641                              <2> 	    ENDIF
   642                              <2>     POP     AX
   643                              <2> 	    IF SHAREF
   644                              <2>     JMP SHORT a
   645                              <2> b   DB  Message,0
   646                              <2> a:
   647                              <2> 	    ELSE
   648                              <2> Table   segment
   649                              <2> b   db  Message,0
   650                              <2> Table   ends
   651                              <2> 	    ENDIF
   652                              <2> 	ENDIF
   653                              <2>     ENDIF
   654                              <2> ENDM
   655                              <2> %ELSE
   656                              <2> %imacro Assert 0-*.nolist
   657                              <2> %endmacro
   658                              <2> %ENDIF
   659                              <2> 
   660                              <2> %ifndef Installed
   661                              <2>  %idefine Installed 1
   662                              <2> %endif
   663                              <2> 
   664                              <2> Break   <CallInstall - hook to installable pieces>
   665                              <2> 
   666                              <2> %imacro CallInstall 3-*.nolist
   667                              <2> ;CallInstall MACRO   name,mpx,fn,save,restore
   668                              <2> %define %%name %1
   669                              <2> %assign %%mpx %2
   670                              <2> %assign %%fn %3
   671                              <2> %IF Installed
   672                              <2>  %rotate 3
   673                              <2>  %assign %%level 0
   674                              <2>  %assign %%amountsaved 0
   675                              <2>  %rep %0 - 3
   676                              <2>   %ifnempty %1
   677                              <2>    detectstripangles %%token, %%opening, %%closing, %1
   678                              <2>    %assign %%level %%level + ? %+ %%opening
   679                              <2>    %assign %%level %%level - ? %+ %%closing
   680                              <2>    SaveReg ? %+ %%token
   681                              <2>   %endif
   682                              <2>   %assign %%amountsaved %%amountsaved + 1
   683                              <2>   %rotate 1
   684                              <2>   %if %%level <= 0
   685                              <2>    %exitrep
   686                              <2>   %endif
   687                              <2>  %endrep
   688                              <2> 	MOV     AX,(%%mpx << 8) + %%fn
   689                              <2> 	INT     2Fh
   690                              <2>  %assign %%level 0
   691                              <2>  %assign %%amountrestored 0
   692                              <2>  %rep %0 - 3 - %%amountsaved
   693                              <2>   %ifnempty %1
   694                              <2>    detectstripangles %%token, %%opening, %%closing, %1
   695                              <2>    %assign %%level %%level + ? %+ %%opening
   696                              <2>    %assign %%level %%level - ? %+ %%closing
   697                              <2>    RestoreReg ? %+ %%token
   698                              <2>   %endif
   699                              <2>   %assign %%amountrestored %%amountrestored + 1
   700                              <2>   %rotate 1
   701                              <2>   %if %%level <= 0
   702                              <2>    %exitrep
   703                              <2>   %endif
   704                              <2>  %endrep
   705                              <2>  %if %%level > 0 || %0 != 3 + %%amountsaved + %%amountrestored
   706                              <2>   %error Wrong amount saved or restored
   707                              <2>  %endif
   708                              <2> %ELSE
   709                              <2> 	Invoke  %%name
   710                              <2> %ENDIF
   711                              <2> %endmacro
   712                              <2> 
   713                              <2> Break   <Stack frame manipulators>
   714                              <2> 
   715                              <2> %imacro localvar 2.nolist
   716                              <2> %ifidni %2, BYTE
   717                              <2>  %assign ?frame ?frame + 1
   718                              <2>  %assign %%a ?frame
   719                              <2>  labelsize %1, byte, bp - %%a
   720                              <2> %else
   721                              <2>  %ifidni %2, WORD
   722                              <2>   %assign ?frame ?frame + 2
   723                              <2>   %assign %%a ?frame
   724                              <2>   labelsize %1, word, bp - %%a
   725                              <2>  %else
   726                              <2>   %ifidni %2, DWORD
   727                              <2>    %assign ?frame ?frame + 4
   728                              <2>    %assign %%a ?frame
   729                              <2>    labelsize %1 %+ l, word, bp - %%a
   730                              <2>    labelsize %1 %+ h, word, bp - %%a + 2
   731                              <2>    labelsize %1, dword, bp - %%a
   732                              <2>   %else
   733                              <2>    %assign ?frame ?frame + %2
   734                              <2>    %assign %%a ?frame
   735                              <2>    labelsize %1, byte, bp - %%a
   736                              <2>   %endif
   737                              <2>  %endif
   738                              <2> %endif
   739                              <2> %endmacro
   740                              <2> 
   741                              <2> %imacro enter 0.nolist
   742                              <2> 	push    bp
   743                              <2> 	mov     bp,sp
   744                              <2> 	sub     sp,?frame
   745                              <2> %endmacro
   746                              <2> 
   747                              <2> %imacro leave 0.nolist
   748                              <2> 	mov     sp,bp
   749                              <2> 	pop     bp
   750                              <2> %endmacro
   751                              <2> 
   752                              <2> 
   753                              <2> %imacro argvar 2.nolist
   754                              <2> %ifidni %2, BYTE
   755                              <2>  %assign %%a ?aframe
   756                              <2>  %assign ?aframe ?aframe + 1
   757                              <2>  labelsize %1, byte, bp + %%a
   758                              <2> %else
   759                              <2>  %ifidni %2, WORD
   760                              <2>   %assign %%a ?aframe
   761                              <2>   %assign ?aframe ?aframe + 2
   762                              <2>   labelsize %1, word, bp + %%a
   763                              <2>  %else
   764                              <2>   %ifidni %2, DWORD
   765                              <2>    %assign %%a ?aframe
   766                              <2>    %assign ?aframe ?aframe + 4
   767                              <2>    labelsize %1 %+ l, word, bp + %%a
   768                              <2>    labelsize %1 %+ h, word, bp + %%a + 2
   769                              <2>    labelsize %1, dword, bp + %%a
   770                              <2>   %else
   771                              <2>    %assign %%a ?aframe
   772                              <2>    %assign ?aframe ?aframe + %2
   773                              <2>    labelsize %1, byte, bp + %%a
   774                              <2>   %endif
   775                              <2>  %endif
   776                              <2> %endif
   777                              <2> %endmacro
   778                              <2> 
   779                              <2> BREAK   <errnz - generate compilation errors>
   780                              <2> 
   781                              <2> %imacro errnz 1.nolist
   782                              <2> detectstripangles %%token, %%opening, %%closing, %1
   783                              <2> %if ? %+ %%token
   784                              <2>     %error %1 <> 0
   785                              <2> %endif
   786                              <2> %endmacro
   787                              <2> 
   788                              <2> %endif
    16                              <1> %include "versiona.mac"		;DEFINE THE MAJOR AND MINOR VERSION NUMBERS
     1                              <2> 
     2                              <2> major_version	    equ     4	    ;Major DOS version
     3                              <2> minor_version	    equ     00	    ;Minor DOS Version
     4                              <2> 
     5                              <2> MINOR_VERSION equ minor_version	; NASM port equate
     6                              <2> MAJOR_VERSION equ major_version	; NASM port equate
     7                              <2> expected_version    equ     (MINOR_VERSION << 8)+MAJOR_VERSION
     8                              <2> 
     9                              <2> alt_major_version    equ     5	    ;Major DOS version
    10                              <2> alt_minor_version    equ     26	    ;Minor DOS Version
    11                              <2> 
    12                              <2> alt_expected_version    equ     (alt_minor_version << 8) + alt_major_version
    13                              <2> 
    14                              <2> new_major_version    equ     5	    ;Major DOS version
    15                              <2> new_minor_version    equ     38	    ;Minor DOS Version
    16                              <2> new_expected_version    equ     (new_minor_version << 8) + new_major_version
    17                              <2> 
    18                              <2>        %warning out: ... for DOS Version 4.00 ...
    18          ******************  <2>  warning: out: ... for DOS Version 4.00 ... [-w+user]
    19                              <2> 
    20                              <2>        ;******************************
    21                              <2>        ;Each assembler program should:
    22                              <2>        ;  mov ah,030h			;DOS Get Version function
    23                              <2>        ;  int 021h			;Version ret. in AX,minor version first
    24                              <2>        ;  cmp ax,expected_version	;ALL utilities should check for an
    25                              <2>        ;  jne error_handler		; EXACT version match.
    26                              <2>        ;******************************
    27                              <2> 
    17                              <1> 
    18                              <1> BREAK <Control character definitions>
    19                              <1> 
    20                              <1> c_DEL	    EQU     7Fh 		;    ASCII rubout or delete previous char
    21                              <1> c_BS	    EQU     08h 		; ^H ASCII backspace
    22                              <1> c_CR	    EQU     0Dh 		; ^M ASCII carriage return
    23                              <1> c_LF	    EQU     0Ah 		; ^J ASCII linefeed
    24                              <1> c_ETB	    EQU     17h 		; ^W ASCII end of transmission
    25                              <1> c_NAK	    EQU     15h 		; ^U ASCII negative acknowledge
    26                              <1> c_ETX	    EQU     03h 		; ^C ASCII end of text
    27                              <1> c_HT	    EQU     09h 		; ^I ASCII tab
    28                              <1> 
    29                              <1> BREAK <Read This and Weep>
    30                              <1> 
    31                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    32                              <1> ;									   ;
    33                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    34                              <1> ;									   ;
    35                              <1> ; Certain structures, constants and system  calls  below  are  private	to ;
    36                              <1> ; the DOS  and	are  extremely	version-dependent.  They may change at any ;
    37                              <1> ; time at  the	implementors'  whim.   As  a  result,  they  must  not  be ;
    38                              <1> ; documented to  the  general  public.	 If  an  extreme case arises, they ;
    39                              <1> ; must be documented with this warning. 				   ;
    40                              <1> ;									   ;
    41                              <1> ; Those structures and constants that are subject to  the  above  will	be ;
    42                              <1> ; marked and bracketed with the flag:					   ;
    43                              <1> ;									   ;
    44                              <1> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    45                              <1> ;									   ;
    46                              <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    47                              <1> 
    48                              <1> %include "bpb.mac"
     1                              <2> 	%warning out: BPB.INC...
     1          ******************  <2>  warning: out: BPB.INC... [-w+user]
     2                              <2> ;	SCCSID = @(#)BPB.ASM	1.1 85/04/29
     3                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     4                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     5                              <2> ;									   ;
     6                              <2> 
     7                              <2> ; BIOS PARAMETER BLOCK DEFINITION
     8                              <2> ; THIS STRUCTURE IS USED TO BUILD A FULL DPB
     9                              <2> 
    10                              <2> BPBLOCK STRUC
    11 00000000 ????                <2> BPSECSZ DW	?			; SIZE IN BYTES OF PHYSICAL SECTOR
    12 00000002 ??                  <2> BPCLUS	DB	?			; SECTORS/ALLOC UNIT
    13 00000003 ????                <2> BPRES	DW	?			; NUMBER OF RESERVED SECTORS
    14 00000005 ??                  <2> BPFTCNT DB	?			; NUMBER OF FATS
    15 00000006 ????                <2> BPDRCNT DW	?			; NUMBER OF DIRECTORY ENTRIES
    16 00000008 ????                <2> BPSCCNT DW	?			; TOTAL NUMBER OF SECTORS
    17 0000000A ??                  <2> BPMEDIA DB	?			; MEDIA DESCRIPTOR BYTE
    18 0000000B ????                <2> BPFTSEC DW	?			; NUMBER OF SECTORS TAKEN UP BY ONE FAT
    19                              <2> BPBLOCK ENDS
    20                              <2> 
    21                              <2> A_BPB			STRUC
    22 00000000 ????                <2> BPB_BYTESPERSECTOR	DW	?
    23 00000002 ??                  <2> BPB_SECTORSPERCLUSTER	DB	?
    24 00000003 ????                <2> BPB_RESERVEDSECTORS	DW	?
    25 00000005 ??                  <2> BPB_NUMBEROFFATS	DB	?
    26 00000006 ????                <2> BPB_ROOTENTRIES 	DW	?
    27 00000008 ????                <2> BPB_TOTALSECTORS	DW	?
    28 0000000A ??                  <2> BPB_MEDIADESCRIPTOR	DB	?
    29 0000000B ????                <2> BPB_SECTORSPERFAT	DW	?
    30 0000000D ????                <2> BPB_SECTORSPERTRACK	DW	?
    31 0000000F ????                <2> BPB_HEADS		DW	?
    32 00000011 ????                <2> BPB_HIDDENSECTORS	DW	?
    33 00000013 ????                <2> 			DW	?
    34 00000015 ????                <2> BPB_BIGTOTALSECTORS	DW	?
    35 00000017 ????                <2> 			DW	?
    36 00000019 ????????????        <2> 			DB	6 DUP(?)
    37                              <2> A_BPB			ENDS
    38                              <2> ;									   ;
    39                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    40                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    49                              <1> 
    50                              <1> %include "buffer.mac"
     1                              <2> %include "buf2sw.mac"
     1                              <3> %define BUF2 1
     2                              <2> 
     3                              <2> ;	SCCSID = @(#)buffer.asm 1.1 85/04/09
     4                              <2> BREAK <Disk I/O Buffer Header>
     5                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     6                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     7                              <2> ;									   ;
     8                              <2> 
     9                              <2> %ifdef BUF2
    10                              <2> 
    11                              <2> ; Field definition for I/O buffer information
    12                              <2> 
    13                              <2> BUFFINFO        STRUC
    14 00000000 ????????            <2> NEXTBUF         DD      ?       ; Pointer to next buffer in list
    15                              <2> ; The next two items are often refed as a word
    16                              <2> buf_ID:
    17 00000004 ??                  <2> BUFDRV          DB      ?       ; Logical drive # assoc with buffer FF = free
    18                              <2> buf_flags:
    19 00000005 ??                  <2> BUFDATAFLAG	db	?
    20 00000006 ??                  <2> BUFPRI          DB      ?       ; Buffer selection priority (see EQUs below)
    21 00000007 ??                  <2> 	alignb 2
    22                              <2> buf_sector:
    23 00000008 ????????            <2> BUFSECNO        dd      ?       ; Sector number of buffer
    24                              <2> 	alignb 2
    25 0000000C ????????            <2> BUFDRVDP        DD      ?       ; Pointer to drive parameters
    26                              <2> BUFFINFO        ENDS
    27                              <2> 
    28                              <2> BUFINSIZ        EQU     BUFFINFO_struc_size
    29                              <2>                                 ; Size of structure in bytes
    30                              <2> BUFINSIZE equ BUFINSIZ
    31                              <2> 
    32                              <2> FREEPRI EQU     0
    33                              <2> LBRPRI  EQU     2               ; Last byte of buffer read
    34                              <2> LBWPRI  EQU     4               ; Last byte written
    35                              <2> RPRI    EQU     6               ; Read but not last byte
    36                              <2> WPRI    EQU     8               ; Written but not last byte
    37                              <2> DIRPRI  EQU     15              ; Directory Sector
    38                              <2> FATPRI  EQU     30              ; FAT sector
    39                              <2> 
    40                              <2> buf_dirty	EQU	01000000B
    41                              <2> buf_isDATA	EQU	00001000B
    42                              <2> buf_isDIR	EQU	00000100B
    43                              <2> buf_isFAT	EQU	00000010B
    44                              <2> buf_type_0	EQU	11110001B	; AND sets type to "none"
    45                              <2> 
    46                              <2> %else
    47                              <2> 
    48                              <2> ; Field definition for I/O buffer information
    49                              <2> 
    50                              <2> BUFFINFO	STRUC
    51                              <2> buf_next	DW	?		; Pointer to next buffer in list
    52                              <2> buf_prev	DW	?		; Pointer to prev buffer in list
    53                              <2> buf_ID		DB	?		; Drive of buffer (bit 7 = 0)
    54                              <2> 					; SFT table index (bit 7 = 1)
    55                              <2> 					; = FFH if buffer free
    56                              <2> buf_flags	DB	?		; Bit 7 = 1 if Remote file buffer
    57                              <2> 					;	= 0 if Local device buffer
    58                              <2> 					; Bit 6 = 1 if buffer dirty
    59                              <2> 					; Bit 5 = Reserved
    60                              <2> 					; Bit 4 = Search bit (bit 7 = 1)
    61                              <2> 					; Bit 3 = 1 if buffer is DATA
    62                              <2> 					; Bit 2 = 1 if buffer is DIR
    63                              <2> 					; Bit 1 = 1 if buffer is FAT
    64                              <2> 					; Bit 0 = Reserved
    65                              <2> buf_sector	DD	?		; Sector number of buffer (bit 7 = 0)
    66                              <2> ; The next two items are often refed as a word (bit 7 = 0)
    67                              <2> buf_wrtcnt	DB	?		; For FAT sectors, # times sector written out
    68                              <2> buf_wrtcntinc	DW	?		; "   "     "   , # sectors between each write
    69                              <2> buf_DPB 	DD	?		; Pointer to drive parameters
    70                              <2> buf_fill	DW	?		; How full buffer is (bit 7 = 1)
    71                              <2> buf_reserved	DB	?		; make DWORD boundary for 386
    72                              <2> BUFFINFO	ENDS
    73                              <2> 
    74                              <2> labelsize buf_offset, dword, buf_sector
    75                              <2> 					;For bit 7 = 1, this is the byte
    76                              <2> 					;offset of the start of the buffer in
    77                              <2> 					;the file pointed to by buf_ID.  Thus
    78                              <2> 					;the buffer starts at location
    79                              <2> 					;buf_offset in the file and contains
    80                              <2> 					;buf_fill bytes.
    81                              <2> 
    82                              <2> BUFINSIZ	EQU	BUFFINFO_struc_size
    83                              <2> 					; Size of structure in bytes
    84                              <2> 
    85                              <2> buf_Free	EQU	0FFh		; buf_id of free buffer
    86                              <2> 
    87                              <2> ;Flag byte masks
    88                              <2> buf_isnet	EQU	10000000B
    89                              <2> buf_dirty	EQU	01000000B
    90                              <2> 
    91                              <2> buf_isDATA	EQU	00001000B
    92                              <2> buf_isDIR	EQU	00000100B
    93                              <2> buf_isFAT	EQU	00000010B
    94                              <2> buf_type_0	EQU	11110001B	; AND sets type to "none"
    95                              <2> 
    96                              <2> buf_NetID	EQU	BUFINSIZ
    97                              <2> 
    98                              <2> ;
    99                              <2> ; Buffer Hash Entry Structure
   100                              <2> 
   101                              <2> BUFFER_HASH_ENTRY	STRUC		; DOS 4.00
   102                              <2> EMS_PAGE_NUM	DW	?		; logical page number for EMS handle
   103                              <2> BUFFER_BUCKET	DD	 ?		; pointer to buffers
   104                              <2> DIRTY_COUNT	DB	 ?		; number of dirty buffers
   105                              <2> BUFFER_RESERVED DB	 ?		; reserved
   106                              <2> BUFFER_HASH_ENTRY	ENDS
   107                              <2> 
   108                              <2> MaxBuffinBucket EQU	15		; Max number of buffers per bucket
   109                              <2> MaxBucketinPage EQU	 2		; Max number of buckets per 16kb page
   110                              <2> 
   111                              <2> %endif
   112                              <2> 
   113                              <2> ;									   ;
   114                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   115                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    51                              <1> 
    52                              <1> BREAK <User stack inside of system call and SysVars>
    53                              <1> ; Location of user registers relative user stack pointer
    54                              <1> 
    55                              <1> user_environ	STRUC
    56 00000000 ????                <1> user_AX     DW	    ?
    57 00000002 ????                <1> user_BX     DW	    ?
    58 00000004 ????                <1> user_CX     DW	    ?
    59 00000006 ????                <1> user_DX     DW	    ?
    60 00000008 ????                <1> user_SI     DW	    ?
    61 0000000A ????                <1> user_DI     DW	    ?
    62 0000000C ????                <1> user_BP     DW	    ?
    63 0000000E ????                <1> user_DS     DW	    ?
    64 00000010 ????                <1> user_ES     DW	    ?
    65 00000012 ????                <1> user_IP     DW	    ?
    66 00000014 ????                <1> user_CS     DW	    ?
    67 00000016 ????                <1> user_F	    DW	    ?
    68                              <1> user_environ	ENDS
    69                              <1> 
    70                              <1> %include "sysvar.mac"
     1                              <2> ;	SCCSID = @(#)sysvar.asm 1.1 85/04/10
     2                              <2> %include "version.mac"
     1                              <3> ; Some modules really want TRUE to be 0FFH.  Best to let them have their way.
     2                              <3> 	TRUE	   EQU	   0FFFFh
     3                              <3> 	TRUEBYTE   EQU     0FFh
     4                              <3> 	FALSE	   EQU	   0
     5                              <3> 
     6                              <3> ;
     7                              <3> ; Use the following switches to control cmacros.inc
     8                              <3> ;
     9                              <3> ?PLM       equ       0
    10                              <3> ?WIN       equ       0
    11                              <3> 
    12                              <3> memS       EQU     1			; Small model
    13                              <3> ;
    14                              <3> ; Use the switches below to produce the standard Microsoft version or the IBM
    15                              <3> ; version of the operating system
    16                              <3> ;
    17                              <3> ; The below chart will indicate how to set the switches to build the various
    18                              <3> ; versions
    19                              <3> ;
    20                              <3> ;                     IBMVER          IBMCOPYRIGHT
    21                              <3> ; --------------------------------------------------------
    22                              <3> ;  IBM Version   |     TRUE              TRUE
    23                              <3> ; --------------------------------------------------------
    24                              <3> ;  MS Version    |     FALSE             FALSE
    25                              <3> ; --------------------------------------------------------
    26                              <3> ;  Clone Version |     TRUE              FALSE
    27                              <3> ;
    28                              <3> IBMVER     EQU     TRUE
    29                              <3> IBMCOPYRIGHT EQU   FALSE
    30                              <3> 
    31                              <3> BUFFERFLAG	EQU	~ IBMCOPYRIGHT
    32                              <3> 
    33                              <3> %ifndef	MSVER	
    34                              <3> MSVER      EQU     ~ IBMVER
    35                              <3> %endif
    36                              <3> IBM	   EQU	   IBMVER
    37                              <3> ;
    38                              <3> ;
    39                              <3> 	%IF IBMVER
    40                              <3> 	    %IF IBMCOPYRIGHT
    41                              <3>               %warning out: ... IBM version build switch on ...
    42                              <3> 	    %ELSE
    43                              <3> 	      %warning out: ... CLONE version build switch on ...
    43          ******************  <3>  warning: out: ... CLONE version build switch on ... [-w+user]
    44                              <3> 	    %ENDIF
    45                              <3> 	%ELSE
    46                              <3> 	    %IFN IBMCOPYRIGHT
    47                              <3> 	      %warning out: ... MS version build switch on ...
    48                              <3> 	    %ELSE
    49                              <3> 	      %warning out: !!!!!!!!!  VERSION SWITCHES SET INCORECTLY  !!!!!!!!!
    50                              <3> 	      %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!!
    51                              <3> 	    %ENDIF
    52                              <3> 	%ENDIF   
    53                              <3> ;
    54                              <3> ;
    55                              <3> ;***************************************************************************
    56                              <3> ;*          The following switches are for DBCS or SBCS support            *
    57                              <3> ;*                                                                         *
    58                              <3> ;*                     Set INTERNAT EQU TRUE FOR DBCS                      *
    59                              <3> ;*                     Set INTERNAT EQU FALSE FOR SBCS                     *
    60                              <3> ;*                                                                         *
    61                              <3> ;***************************************************************************
    62                              <3> ;
    63                              <3> IBMJAPVER  EQU	   FALSE		;If TRUE set KANJI true also
    64                              <3> 
    65                              <3> ;
    66                              <3> ; Switch INTERNAT for DBCS support
    67                              <3> ;
    68                              <3> INTERNAT   EQU	   FALSE
    69                              <3> ;
    70                              <3> 	%IF INTERNAT
    71                              <3> %ifndef KANJI
    72                              <3> KANJI	   EQU	   TRUE
    73                              <3> %endif
    74                              <3> IBMJAPAN   EQU	   TRUE
    75                              <3> 	%ELSE
    76                              <3> %ifndef KANJI
    77                              <3> KANJI	   EQU	   FALSE
    78                              <3> %endif
    79                              <3> IBMJAPAN   EQU	   FALSE
    80                              <3> 	%ENDIF
    81                              <3> 
    82                              <3> %ifndef altvect				; avoid jerking off vector.inc
    83                              <3> ALTVECT    EQU	   FALSE		;Switch to build ALTVECT version
    84                              <3> %endif
    85                              <3> 
    86                              <3> ;
    87                              <3> ; Country code switches
    88                              <3> ; The default contry code is assumed as USA.
    89                              <3> ;
    90                              <3> 	%IF INTERNAT
    91                              <3>  KOREA	   EQU	   TRUE
    92                              <3>  JAPAN	   EQU	   FALSE
    93                              <3> 	%ELSE
    94                              <3>  KOREA	   EQU	   FALSE
    95                              <3>  JAPAN	   EQU	   FALSE
    96                              <3> 	%ENDIF
    97                              <3> ;
    98                              <3> 		%IF INTERNAT
    99                              <3> %warning out: Internat(ECS) version build switch on
   100                              <3> 		%ENDIF
     3                              <2> 
     4                              <2> SysInitVars STRUC
     5 00000000 ????????            <2> SYSI_DPB	    DD	    ?		; DPB chain
     6 00000004 ????????            <2> SYSI_SFT	    DD	    ?		; SFT chain
     7 00000008 ????????            <2> SYSI_CLOCK	    DD	    ?		; CLOCK device
     8 0000000C ????????            <2> SYSI_CON	    DD	    ?		; CON device
     9 00000010 ????                <2> SYSI_MAXSEC	    DW	    ?		; maximum sector size
    10 00000012 ????????            <2> SYSI_BUF	    DD	    ?		; points to Hashinitvar
    11 00000016 ????????            <2> SYSI_CDS	    DD	    ?		; CDS list
    12 0000001A ????????            <2> SYSI_FCB	    DD	    ?		; FCB chain
    13 0000001E ????                <2> SYSI_Keep	    DW	    ?		; keep count
    14 00000020 ??                  <2> SYSI_NUMIO	    DB	    ?		; Number of block devices
    15 00000021 ??                  <2> SYSI_NCDS	    DB	    ?		; number of CDS's
    16 00000022 ????????            <2> SYSI_DEV	    DD	    ?		; device list
    17 00000026 ????                <2> SYSI_ATTR	    DW	    ?		; null device attribute word
    18 00000028 ????                <2> SYSI_STRAT	    DW	    ?		; null device strategy entry point
    19 0000002A ????                <2> SYSI_INTER	    DW	    ?		; null device interrupt entry point
    20 0000002C ????????????????    <2> SYSI_NAME	    DB	 8 DUP(?)	; null device name
    21 00000034 ??                  <2> SYSI_SPLICE	    DB	    ?		; TRUE -> splicees being done
    22 00000035 ????                <2> SYSI_IBMDOS_SIZE    DW	    ?		; DOS size in paragraphs
    23 00000037 ????????            <2> SYSI_IFS_DOSCALL@   DD	    ?		; IFS DOS service rountine entry
    24 0000003B ????????            <2> SYSI_IFS	    DD	    ?		; IFS header chain
    25 0000003F ????????            <2> SYSI_BUFFERS	    DW	    ?,? 	; BUFFERS= values (m,n)
    26 00000043 ??                  <2> SYSI_BOOT_DRIVE     DB	    ?		; boot drive A=1 B=2,..
    27 00000044 ??                  <2> SYSI_DWMOVE	    DB	    ?		; 1 if 386 machine
    28 00000045 ????                <2> SYSI_EXT_MEM	    DW	    ?		; Extended memory size in KB.
    29                              <2> SysInitVars ENDS
    30                              <2> 
    31                              <2> ;This is added for more information exchage between DOS, BIOS.
    32                              <2> ;DOS will give the pointer to SysInitTable in ES:DI. - J.K. 5/29/86
    33                              <2> SysInitVars_Ext struc
    34 00000000 ????????            <2> SYSI_InitVars		DD	?	; Points to the above structure.
    35 00000004 ????????            <2> SYSI_Country_Tab	DD	?	; DOS_Country_cdpg_info
    36                              <2> SysInitVars_Ext ends
    37                              <2> 
    38                              <2> ;The SYSI_BUF of SysInitVars points to the follwong structure
    39                              <2> EMS_MAP_BUFF_SIZE      EQU	12	; EMS map buffer size
    40                              <2> 
    41                              <2> Buffinfo    STRUC
    42 00000000 ????????            <2> Hash_ptr	 DD	 ?		     ; pointer to Hash table
    43 00000004 ????                <2> Hash_count	 DW	 ?		     ; number of Hash entries
    44 00000006 ????????            <2> Cache_ptr	 DD	 ?		     ; pointer to secondary cache
    45 0000000A ????                <2> Cache_count	 DW	 ?		     ; number of secondary cache entries
    46                              <2> 
    47                              <2> %IF	BUFFERFLAG
    48                              <2> 
    49 0000000C ??                  <2> EMS_SAFE_FLAG	DB	?
    50 0000000D ????????            <2> EMS_LAST_PAGE	DW	?, ?
    51 00000011 ????????            <2> EMS_FIRST_PAGE	DW	?, ?
    52 00000015 ????                <2> EMS_NPA640	DW	?
    53                              <2> 
    54                              <2> %ENDIF
    55                              <2> 
    56 00000017 ??                  <2> EMS_mode	 DB	 ?		     ; no EMS = -1
    57 00000018 ????                <2> EMS_handle	 DW	 ?		     ; EMS handle for buffers
    58 0000001A ????                <2> EMS_PageFrame_Number	DW   ?		     ; EMS page frame number
    59 0000001C ????                <2> EMS_Seg_Cnt	 DW	 ?		     ; EMS segment count
    60 0000001E ????                <2> EMS_Page_Frame	 DW	 ?		     ; EMS page frame segment address
    61 00000020 ????                <2> EMS_reserved	 DW	 ?		     ; EMS segment count
    62                              <2> 
    63                              <2> %IF	BUFFERFLAG
    64 00000022 ??                  <2> EMS_Map_Buff	 DB	 ?  ; map buffer
    65                              <2> %ELSE
    66                              <2> EMS_Map_Buff	DB	12 dup(?)
    67                              <2> %ENDIF
    68                              <2> 
    69                              <2> Buffinfo    ENDS
    70                              <2> 
    71                              <2> 
    72                              <2> 
    73                              <2> 
    74                              <2> 
    75                              <2> 
    76                              <2> 
    77                              <2> 
    71                              <1> 
    72                              <1> %include "vector.mac"
     1                              <2> ;	SCCSID = @(#)vector.asm	1.1 85/04/10
     2                              <2> BREAK <interrupt definitions>
     3                              <2> 
     4                              <2> ;Asmvar	AltVect
     5                              <2> %ifndef AltVect
     6                              <2>  %iassign AltVect 0
     7                              <2> %endif
     8                              <2> 
     9                              <2> INTTAB		EQU	20H
    10                              <2> inttab equ INTTAB	; NASM port equate
    11                              <2> INTBASE 	EQU	4 * inttab
    12                              <2> ENTRYPOINT	EQU	INTBASE+40H
    13                              <2> 
    14                              <2> 	%IF	ALTVECT
    15                              <2> ALTTAB	EQU	0F0H
    16                              <2> ALTBASE EQU	4 * ALTTAB
    17                              <2> 	%ENDIF
    18                              <2> 
    19                              <2> ;
    20                              <2> ; interrupt assignments
    21                              <2> ;
    22                              <2> 	%IFN ALTVECT
    23                              <2> int_abort	    EQU     INTTAB	; abort process
    24                              <2> int_command	    EQU     int_abort+1 ; call MSDOS
    25                              <2> int_terminate	    EQU     int_abort+2 ; int to terminate address
    26                              <2> int_ctrl_c	    EQU     int_abort+3 ; ^c trapper
    27                              <2> int_fatal_abort     EQU     int_abort+4 ; hard disk error
    28                              <2> int_disk_read	    EQU     int_abort+5 ; logical sector disk read
    29                              <2> int_disk_write	    EQU     int_abort+6 ; logical sector disk write
    30                              <2> int_keep_process    EQU     int_abort+7 ; terminate program and stay
    31                              <2> 					; resident
    32                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    33                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    34                              <2> ;									   ;
    35                              <2> int_spooler	    EQU     int_abort+8 ; spooler call
    36                              <2> int_fastcon	    EQU     int_abort+9 ; fast CON interrupt
    37                              <2> int_IBM 	    EQU     int_abort+10; critical section maintenance
    38                              <2> ;									   ;
    39                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    40                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    41                              <2> 	%ELSE
    42                              <2> int_abort	    EQU     INTTAB	; abort process
    43                              <2> int_command	    EQU     int_abort+1 ; call MSDOS
    44                              <2> int_terminate	    EQU     ALTTAB	; int to terminate address
    45                              <2> int_ctrl_c	    EQU     int_terminate+1 ; ^c trapper
    46                              <2> int_fatal_abort     EQU     int_terminate+2 ; hard disk error
    47                              <2> int_disk_read	    EQU     int_abort+5 ; logical sector disk read
    48                              <2> int_disk_write	    EQU     int_abort+6 ; logical sector disk write
    49                              <2> int_keep_process    EQU     int_abort+7 ; terminate program and stay resident
    50                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    51                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    52                              <2> ;									   ;
    53                              <2> int_spooler	    EQU     int_terminate+3 ; spooler call
    54                              <2> int_fastcon	    EQU     int_abort+9 ; fast CON interrupt
    55                              <2> ;									   ;
    56                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    57                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    58                              <2> 	%ENDIF
    59                              <2> 
    60                              <2> addr_int_abort		EQU    4 * int_abort
    61                              <2> addr_int_command	EQU    4 * int_command
    62                              <2> addr_int_terminate	EQU    4 * int_terminate
    63                              <2> addr_int_ctrl_c 	EQU    4 * int_ctrl_c
    64                              <2> addr_int_fatal_abort	EQU    4 * int_fatal_abort
    65                              <2> addr_int_disk_read	EQU    4 * int_disk_read
    66                              <2> addr_int_disk_write	EQU    4 * int_disk_write
    67                              <2> addr_int_keep_process	EQU    4 * int_keep_process
    68                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    69                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    70                              <2> ;									   ;
    71                              <2> addr_int_spooler	EQU    4 * int_spooler
    72                              <2> addr_int_fastcon	EQU    4 * int_fastcon
    73                              <2> addr_int_IBM		EQU    4 * int_IBM
    74                              <2> ;									   ;
    75                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    76                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    73                              <1> 
    74                              <1> ;include mult.INC
    75                              <1> 
    76                              <1> BREAK <Disk map>
    77                              <1> ;  MSDOS partitions the disk into 4 sections:
    78                              <1> ;
    79                              <1> ;  phys sector 0:   +-------------------+
    80                              <1> ;	|	    | boot/reserved	|
    81                              <1> ;	|	    +-------------------+
    82                              <1> ;	|	    |  File allocation	|
    83                              <1> ;	v	    |	   table(s)	|
    84                              <1> ;		    |  (multiple copies |
    85                              <1> ;		    |	  are kept)	|
    86                              <1> ;		    +-------------------+
    87                              <1> ;		    |	  Directory	|
    88                              <1> ;		    +-------------------+
    89                              <1> ;		    |	  File space	|
    90                              <1> ;		    +-------------------+
    91                              <1> ;		    |	Unaddressable	|
    92                              <1> ;		    |  (to end of disk) |
    93                              <1> ;		    +-------------------+
    94                              <1> ;
    95                              <1> ; All partition boundaries are sector boundaries.  The size of the FAT is
    96                              <1> ; adjusted to maximize the file space addressable.
    97                              <1> 
    98                              <1> %include "dirent.mac"
     1                              <2> ;	SCCSID = @(#)dirent.asm 1.1 85/04/10
     2                              <2> ;	SCCSID = @(#)dirent.asm 1.1 85/04/10
     3                              <2> Break <Directory entry>
     4                              <2> 
     5                              <2> ;
     6                              <2> ;	+---------------------------+
     7                              <2> ;	|  (12 BYTE) filename/ext   |	    0	    0
     8                              <2> ;	+---------------------------+
     9                              <2> ;	|     (BYTE) attributes     |	    11	    B
    10                              <2> ;	+---------------------------+
    11                              <2> ;	|    (10 BYTE) reserved     |	    12	    C
    12                              <2> ;	+---------------------------+
    13                              <2> ;	| (WORD) time of last write |	    22	    16
    14                              <2> ;	+---------------------------+
    15                              <2> ;	| (WORD) date of last write |	    24	    18
    16                              <2> ;	+---------------------------+
    17                              <2> ;	|   (WORD) First cluster    |	    26	    1A
    18                              <2> ;	+---------------------------+
    19                              <2> ;	|     (DWORD) file size     |	    28	    1C
    20                              <2> ;	+---------------------------+
    21                              <2> ;
    22                              <2> ;   First byte of filename  = E5 -> free directory entry
    23                              <2> ;			    = 00 -> end of allocated directory
    24                              <2> ;   Time:   Bits 0-4=seconds/2, bits 5-10=minute, 11-15=hour
    25                              <2> ;   Date:   Bits 0-4=day, bits 5-8=month, bits 9-15=year-1980
    26                              <2> ;
    27                              <2> 
    28                              <2> dir_entry   STRUC
    29 00000000 <res Bh>            <2> dir_name    DB	    11 DUP (?)		; file name
    30 0000000B ??                  <2> dir_attr    DB	    ?			; attribute bits
    31 0000000C ????                <2> dir_codepg  dw	    ?			; code page DOS 4.00
    32 0000000E ????                <2> dir_extcluster dw   ?			; extended attribute starting cluster
    33 00000010 ??                  <2> dir_attr2   db	    ?			; reserved
    34 00000011 ??????????          <2> dir_pad     DB	    5  DUP (?)		; reserved for expansion
    35 00000016 ????                <2> dir_time    DW	    ?			; time of last write
    36 00000018 ????                <2> dir_date    DW	    ?			; date of last write
    37 0000001A ????                <2> dir_first   DW	    ?			; first allocation unit of file
    38 0000001C ????                <2> dir_size_l  DW	    ?			; low 16 bits of file size
    39 0000001E ????                <2> dir_size_h  DW	    ?			; high 16 bits of file size
    40                              <2> dir_entry   ENDS
    41                              <2> 
    42                              <2> attr_read_only	    EQU      1h
    43                              <2> attr_hidden	    EQU      2h
    44                              <2> attr_system	    EQU      4h
    45                              <2> attr_volume_id	    EQU      8h
    46                              <2> attr_directory	    EQU     10h
    47                              <2> attr_archive	    EQU     20h
    48                              <2> attr_device	    EQU     40h 	; This is a VERY special bit.
    49                              <2> 					;   NO directory entry on a disk EVER
    50                              <2> 					;   has this bit set. It is set non-zero
    51                              <2> 					;   when a device is found by GETPATH
    52                              <2> 
    53                              <2> attr_all	    EQU     attr_hidden+attr_system+attr_directory
    54                              <2> 					; OR of hard attributes for FINDENTRY
    55                              <2> 
    56                              <2> attr_ignore	    EQU     attr_read_only+attr_archive+attr_device
    57                              <2> 					; ignore this(ese) attribute(s) during
    58                              <2> 					; search first/next
    59                              <2> 
    60                              <2> attr_changeable     EQU     attr_read_only+attr_hidden+attr_system+attr_archive
    61                              <2> 					; changeable via CHMOD
    99                              <1> 
   100                              <1> BREAK <File allocation Table information>
   101                              <1> ;
   102                              <1> ; The File Allocation Table uses a 12-bit entry for each allocation unit on
   103                              <1> ; the disk.  These entries are packed, two for every three bytes.  The contents
   104                              <1> ; of entry number N is found by 1) multiplying N by 1.5; 2) adding the result
   105                              <1> ; to the base address of the Allocation Table; 3) fetching the 16-bit word
   106                              <1> ; at this address; 4) If N was odd (so that N*1.5 was not an integer), shift
   107                              <1> ; the word right four bits; 5) mask to 12 bits (AND with 0FFF hex).  Entry
   108                              <1> ; number zero is used as an end-of-file trap in the OS and is passed to the
   109                              <1> ; BIOS to help determine disk format.  Entry 1 is reserved for future use.
   110                              <1> ; The first available allocation unit is assigned entry number two, and even
   111                              <1> ; though it is the first, is called cluster 2.	Entries greater than 0FF8H
   112                              <1> ; (12-bit fats) or 0FFF8H (16-bit fats) are end of file marks; entries of zero
   113                              <1> ; are unallocated.  Otherwise, the contents of a FAT entry is the number of
   114                              <1> ; the next cluster in the file.
   115                              <1> ;
   116                              <1> ; Clusters with bad sectors are tagged with FF7H.  Any non-zero number would
   117                              <1> ; do because these clusters show as allocated, but are not part of any
   118                              <1> ; allocation chain and thus will never be allocated to a file.	A particular
   119                              <1> ; number is selected so that disk checking programs know what to do (ie.  a
   120                              <1> ; cluster with entry FF7H which is not in a chain is not an error).
   121                              <1> 
   122                              <1> %include "dpb.mac"
     1                              <2> ;	SCCSID = @(#)dpb.asm	1.1 85/04/10
     2                              <2> ;	SCCSID = @(#)dpb.asm	1.1 85/04/10
     3                              <2> BREAK <DPB structure>
     4                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     5                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     6                              <2> ;									   ;
     7                              <2> dpb	STRUC
     8 00000000 ??                  <2> dpb_drive	    DB	    ?		; Logical drive # assoc with DPB (A=0,B=1,...)
     9 00000001 ??                  <2> dpb_UNIT	    DB	    ?		; Driver unit number of DPB
    10 00000002 ????                <2> dpb_sector_size     DW	    ?		; Size of physical sector in bytes
    11 00000004 ??                  <2> dpb_cluster_mask    DB	    ?		; Sectors/cluster - 1
    12 00000005 ??                  <2> dpb_cluster_shift   DB	    ?		; Log2 of sectors/cluster
    13 00000006 ????                <2> dpb_first_FAT	    DW	    ?		; Starting record of FATs
    14 00000008 ??                  <2> dpb_FAT_count	    DB	    ?		; Number of FATs for this drive
    15 00000009 ????                <2> dpb_root_entries    DW	    ?		; Number of directory entries
    16 0000000B ????                <2> dpb_first_sector    DW	    ?		; First sector of first cluster
    17 0000000D ????                <2> dpb_max_cluster     DW	    ?		; Number of clusters on drive + 1
    18 0000000F ????                <2> dpb_FAT_size	    DW	    ?		;;Number of records occupied by FAT
    19 00000011 ????                <2> dpb_dir_sector	    DW	    ?		; Starting record of directory
    20 00000013 ????????            <2> dpb_driver_addr     DD	    ?		; Pointer to driver
    21 00000017 ??                  <2> dpb_media	    DB	    ?		; Media byte
    22 00000018 ??                  <2> dpb_first_access    DB	    ?		; This is initialized to -1 to force a media
    23                              <2> 					; check the first time this DPB is used
    24 00000019 ????????            <2> dpb_next_dpb	    DD	    ?		; Pointer to next Drive parameter block
    25 0000001D ????                <2> dpb_next_free	    DW	    ?		; Cluster # of last allocated cluster
    26 0000001F ????                <2> dpb_free_cnt	    DW	    ?		; Count of free clusters, -1 if unknown
    27                              <2> dpb	ENDS
    28                              <2> 
    29                              <2> DPBSIZ	EQU	dpb_struc_size		; Size of the structure in bytes
    30                              <2> 
    31                              <2> DSKSIZ	equ	dpb_max_cluster 	; Size of disk (temp used during init only)
    32                              <2> ;									   ;
    33                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    34                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   123                              <1> 
   124                              <1> %include "curdir.mac"
     1                              <2> ;	SCCSID = @(#)curdir.asm 1.1 85/04/10
     2                              <2> ;	SCCSID = @(#)curdir.asm 1.1 85/04/10
     3                              <2> BREAK <Current directory list structure>
     4                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     5                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     6                              <2> ;									   ;
     7                              <2> ; CDS items are used bu the internal routines to store cluster numbers and ;
     8                              <2> ; network identifiers for each logical name.  The ID field is used dually, ;
     9                              <2> ; both as net ID and for a cluster number for local devices.  In the case  ;
    10                              <2> ; of local devices, the cluster number will be -1 if there is a potential  ;
    11                              <2> ; of the disk being changed or if the path must be recracked.  The END	   ;
    12                              <2> ; field is the location of the end of the definition.  No .. is allowed    ;
    13                              <2> ; past this point							   ;
    14                              <2> 
    15                              <2> DIRSTRLEN	EQU	64+3		; Max length in bytes of directory strings
    16                              <2> TEMPLEN 	EQU	DIRSTRLEN*2
    17                              <2> 
    18                              <2> curdir_list	STRUC
    19 00000000 <res 43h>           <2> curdir_text	DB	DIRSTRLEN DUP (?)   ; text of assignment and curdir
    20 00000043 ????                <2> curdir_flags	DW	?		; various flags
    21 00000045 ????????            <2> curdir_devptr	DD	?		; local pointer to DPB or net device
    22 00000049 ????                <2> curdir_ID	DW	?		; cluster of current dir (net ID)
    23 0000004B ????                <2> 		DW	?
    24 0000004D ????                <2> curdir_user_word DW	?
    25 0000004F ????                <2> curdir_end	DW	?		; end of assignment
    26 00000051 ??                  <2> curdir_type	DB	?		; IFS drive (2=ifs, 4=netuse)
    27 00000052 ????????            <2> curdir_ifs_hdr	DD	?		; Ptr to File System Header
    28 00000056 ????                <2> curdir_fsda	DB	2 DUP (?)	; File System Dependent Data Area
    29                              <2> curdir_list	ENDS
    30                              <2> 
    31                              <2> curdirLen	EQU	curdir_list_struc_size	; Needed for screwed up
    32                              <2> 						; ASM87 which doesn't allow
    33                              <2> 						; Size directive as a macro
    34                              <2> 						; argument
    35                              <2> labelsize curdir_netID, dword, curdir_ID
    36                              <2> 
    37                              <2> ;Flag word masks
    38                              <2> curdir_isnet	EQU	1000000000000000B
    39                              <2> curdir_isifs	EQU	1000000000000000B	; DOS 4.00
    40                              <2> curdir_inuse	EQU	0100000000000000B
    41                              <2> curdir_splice	EQU	0010000000000000B
    42                              <2> curdir_local	EQU	0001000000000000B
    43                              <2> ;									   ;
    44                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    45                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   125                              <1> 
   126                              <1> ;include cpmfcb.INC
   127                              <1> 
   128                              <1> ;include find.INC
   129                              <1> 
   130                              <1> %include "pdb.mac"
     1                              <2> ;	SCCSID = @(#)pdb.asm	1.1 85/04/10
     2                              <2> BREAK <Process data block>
     3                              <2> 
     4                              <2> ;
     5                              <2> ; Process data block (otherwise known as program header)
     6                              <2> ;
     7                              <2> 
     8                              <2> FilPerProc	    EQU     20
     9                              <2> 
    10                              <2> Process_data_block  STRUC
    11 00000000 ????                <2> PDB_Exit_Call	    DW	    ?		; INT int_abort system terminate
    12 00000002 ????                <2> PDB_block_len	    DW	    ?		; size of execution block
    13 00000004 ??                  <2> 		    DB	    ?
    14 00000005 ??????????          <2> PDB_CPM_Call	    DB	5 DUP (?)	; ancient call to system
    15 0000000A ????????            <2> PDB_Exit	    DD	    ?		; pointer to exit routine
    16 0000000E ????????            <2> PDB_Ctrl_C	    DD	    ?		; pointer to ^C routine
    17 00000012 ????????            <2> PDB_Fatal_abort     DD	    ?		; pointer to fatal error
    18                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    19                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    20                              <2> ;									   ;
    21 00000016 ????                <2> PDB_Parent_PID	    DW	    ?		; PID of parent (terminate PID)
    22 00000018 <res 14h>           <2> PDB_JFN_Table	    DB	FilPerProc DUP (?)
    23                              <2> 					; indices into system table
    24                              <2> ;									   ;
    25                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    26                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    27 0000002C ????                <2> PDB_environ	    DW	    ?		; seg addr of environment
    28                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    29                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    30                              <2> ;									   ;
    31 0000002E ????????            <2> PDB_User_stack	    DD	    ?		; stack of self during system calls
    32 00000032 ????                <2> PDB_JFN_Length	    DW	    ?		; number of handles allowed
    33 00000034 ????????            <2> PDB_JFN_Pointer     DD	    ?		; pointer to JFN table
    34 00000038 ????????            <2> PDB_Next_PDB	    DD	    ?		; pointer to nested PDB's
    35 0000003C <res 14h>           <2> PDB_PAD1	    DB	    14h DUP (?)
    36                              <2> ;									   ;
    37                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    38                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    39 00000050 ??????????          <2> PDB_Call_system     DB	    5 DUP (?)	; portable method of system call
    40                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    41                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    42                              <2> ;									   ;
    43 00000055 ??????????????      <2> PDB_PAD2	    DB	    7h DUP (?)
    44                              <2> ;									   ;
    45                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    46                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    47                              <2> Process_data_block  ENDS
    48                              <2> 
    49                              <2> labelsize PDB_InterCon, byte, PDB_PAD1	; 2/12/KK
    50                              <2> labelsize PDB_Append, byte, PDB_PAD1+1	; 2/12/KK
   131                              <1> 
   132                              <1> %include "exe.mac"
     1                              <2> ;	SCCSID = @(#)exe.asm	1.1 85/04/10
     2                              <2> ;	SCCSID = @(#)exe.asm	1.1 85/04/10
     3                              <2> BREAK <EXEC and EXE file structures>
     4                              <2> ;
     5                              <2> ; EXEC arg block - load/go program
     6                              <2> ;
     7                              <2> 
     8                              <2> ;
     9                              <2> ; The following get used as arguments to the EXEC system call.	They indicate
    10                              <2> ; whether or not the program is executed or whether or not a program header
    11                              <2> ; gets created.
    12                              <2> ;
    13                              <2> exec_func_no_execute	EQU 1		; no execute bit
    14                              <2> exec_func_overlay	EQU 2		; overlay bit
    15                              <2> 
    16                              <2> Exec0		STRUC
    17 00000000 ????                <2> Exec0_environ	DW	?		; seg addr of environment
    18 00000002 ????????            <2> Exec0_com_line	DD	?		; pointer to asciz command line
    19 00000006 ????????            <2> Exec0_5C_FCB	DD	?		; default fcb at 5C
    20 0000000A ????????            <2> Exec0_6C_FCB	DD	?		; default fcb at 6C
    21                              <2> Exec0		ENDS
    22                              <2> 
    23                              <2> Exec1		STRUC
    24 00000000 ????                <2> Exec1_environ	DW	?		; seg addr of environment
    25 00000002 ????????            <2> Exec1_com_line	DD	?		; pointer to asciz command line
    26 00000006 ????????            <2> Exec1_5C_FCB	DD	?		; default fcb at 5C
    27 0000000A ????????            <2> Exec1_6C_FCB	DD	?		; default fcb at 6C
    28 0000000E ????                <2> Exec1_SP	DW	?		; stack pointer of program
    29 00000010 ????                <2> Exec1_SS	DW	?		; stack seg register of program
    30 00000012 ????                <2> Exec1_IP	DW	?		; entry point IP
    31 00000014 ????                <2> Exec1_CS	DW	?		; entry point CS
    32                              <2> Exec1		ENDS
    33                              <2> 
    34                              <2> Exec3		STRUC
    35 00000000 ????                <2> Exec3_load_addr DW	?		; seg address of load point
    36 00000002 ????                <2> Exec3_reloc_fac DW	?		; relocation factor
    37                              <2> Exec3		ENDS
    38                              <2> 
    39                              <2> ;
    40                              <2> ; Exit codes in upper byte
    41                              <2> ;
    42                              <2> Exit_terminate	    EQU     0
    43                              <2> Exit_abort	    EQU     0
    44                              <2> Exit_Ctrl_C	    EQU     1
    45                              <2> Exit_Hard_Error     EQU     2
    46                              <2> Exit_Keep_process   EQU     3
    47                              <2> 
    48                              <2> ;
    49                              <2> ; EXE file header
    50                              <2> ;
    51                              <2> 
    52                              <2> EXE_file    STRUC
    53 00000000 ????                <2> exe_signature	DW  ?			; must contain 4D5A  (yay zibo!)
    54 00000002 ????                <2> exe_len_mod_512 DW  ?			; low 9 bits of length
    55 00000004 ????                <2> exe_pages	DW  ?			; number of 512b pages in file
    56 00000006 ????                <2> exe_rle_count	DW  ?			; count of reloc entries
    57 00000008 ????                <2> exe_par_dir	DW  ?			; number of paragraphs before image
    58 0000000A ????                <2> exe_min_BSS	DW  ?			; minimum number of para of BSS
    59 0000000C ????                <2> exe_max_BSS	DW  ?			; max number of para of BSS
    60 0000000E ????                <2> exe_SS		DW  ?			; stack of image
    61 00000010 ????                <2> exe_SP		DW  ?			; SP of image
    62 00000012 ????                <2> exe_chksum	DW  ?			; checksum  of file (ignored)
    63 00000014 ????                <2> exe_IP		DW  ?			; IP of entry
    64 00000016 ????                <2> exe_CS		DW  ?			; CS of entry
    65 00000018 ????                <2> exe_rle_table	DW  ?			; byte offset of reloc table
    66 0000001A ????                <2> exe_iov 	DW  ?			; overlay number (0 for root)
    67 0000001C ????????            <2> exe_sym_tab	DD  ?			; offset of symbol table in file
    68                              <2> EXE_file    ENDS
    69                              <2> 
    70                              <2> exe_valid_signature	EQU 5A4Dh
    71                              <2> exe_valid_old_signature EQU 4D5Ah
    72                              <2> 
    73                              <2> symbol_entry	STRUC
    74 00000000 ????????            <2> sym_value	DD  ?
    75 00000004 ????                <2> sym_type	DW  ?
    76 00000006 ??                  <2> sym_len 	DB  ?
    77 00000007 <res FFh>           <2> sym_name	DB  255 dup (?)
    78                              <2> symbol_entry	ENDS
   133                              <1> 
   134                              <1> %include "sf.mac"
     1                              <2> ;	SCCSID = @(#)sf.asm	1.1 85/04/10
     2                              <2> BREAK <Internal system file table format>
     3                              <2> ;
     4                              <2> ;   AN000   version 4.00   Jan. 1988
     5                              <2> ;   AN003   PTM 3680 --  make NAME offset the same as before (<=3.30)
     6                              <2> ;   AN009   PTM 3839	 reorder SFT for MS WINDOWS
     7                              <2> 
     8                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     9                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    10                              <2> ;									   ;
    11                              <2> ;
    12                              <2> ; system file table
    13                              <2> ;
    14                              <2> 
    15                              <2> SF		STRUC
    16 00000000 ????????            <2> SFLink		DD	?
    17 00000004 ????                <2> SFCount 	DW	?		; number of entries
    18 00000006 ????                <2> SFTable 	DW	?		; beginning of array of the following
    19                              <2> SF		ENDS
    20                              <2> 
    21                              <2> ;
    22                              <2> ; system file table entry
    23                              <2> ;
    24                              <2> 
    25                              <2> sf_entry	STRUC
    26 00000000 ????                <2> sf_ref_count	DW	?		; number of processes sharing entry
    27                              <2> 					;   if FCB then ref count
    28 00000002 ????                <2> sf_mode 	DW	?		; mode of access or high bit on if FCB
    29 00000004 ??                  <2> sf_attr 	DB	?		; attribute of file
    30 00000005 ????                <2> sf_flags	DW	?		;Bits 8-15
    31                              <2> 					; Bit 15 = 1 if remote file
    32                              <2> 					;	 = 0 if local file or device
    33                              <2> 					; Bit 14 = 1 if date/time is not to be
    34                              <2> 					;   set from clock at CLOSE.  Set by
    35                              <2> 					;   FILETIMES and FCB_CLOSE.  Reset by
    36                              <2> 					;   other reseters of the dirty bit
    37                              <2> 					;   (WRITE)
    38                              <2> 					; Bit 13 = Pipe bit (reserved)
    39                              <2> 					;
    40                              <2> 					; Bits 0-7 (old FCB_devid bits)
    41                              <2> 					; If remote file or local file, bit
    42                              <2> 					; 6=0 if dirty Device ID number, bits
    43                              <2> 					; 0-5 if local file.
    44                              <2> 					; bit 7=0 for local file, bit 7
    45                              <2> 					;      =1 for local I/O device
    46                              <2> 					; If local I/O device, bit 6=0 if EOF (input)
    47                              <2> 					;		Bit 5=1 if Raw mode
    48                              <2> 					;		Bit 0=1 if console input device
    49                              <2> 					;		Bit 1=1 if console output device
    50                              <2> 					;		Bit 2=1 if null device
    51                              <2> 					;		Bit 3=1 if clock device
    52 00000007 ????????            <2> sf_devptr	DD	?		; Points to DPB if local file, points
    53                              <2> 					; to device header if local device,
    54                              <2> 					; points to net device header if
    55                              <2> 					; remote
    56 0000000B ????                <2> sf_firclus	DW	?		; First cluster of file (bit 15 = 0)
    57 0000000D ????                <2> sf_time 	DW	?		; Time associated with file
    58 0000000F ????                <2> sf_date 	DW	?		; Date associated with file
    59 00000011 ????????            <2> sf_size 	DD	?		; Size associated with file
    60 00000015 ????????            <2> sf_position	DD	?		; Read/Write pointer or LRU count for FCBs
    61                              <2> ;
    62                              <2> ; Starting here, the next 7 bytes may be used by the file system to store an
    63                              <2> ; ID
    64                              <2> ;
    65 00000019 ????                <2> sf_cluspos	DW	?		; Position of last cluster accessed
    66 0000001B ????????            <2> sf_dirsec	DD	?		; Sector number of directory sector for
    67                              <2> 					; for this file
    68 0000001F ??                  <2> sf_dirpos	DB	?		; Offset of this entry in the above
    69                              <2> ;
    70                              <2> ; End of 7 bytes of file-system specific info.
    71                              <2> ;
    72 00000020 <res Bh>            <2> sf_name 	DB	11 DUP (?)	; 11 character name that is in the
    73                              <2> 					; directory entry.  This is used by
    74                              <2> 					; close to detect file deleted and
    75                              <2> 					; disk changed errors.
    76                              <2> 
    77                              <2> ; SHARING INFO
    78 0000002B ????????            <2> sf_chain	DD	?		; link to next SF
    79 0000002F ????                <2> sf_UID		DW	?
    80 00000031 ????                <2> sf_PID		DW	?
    81 00000033 ????                <2> sf_MFT		DW	?
    82 00000035 ????                <2> sf_lstclus	DW	?		;AN009; Last cluster accessed
    83 00000037 ????????            <2> sf_IFS_HDR	DD	?
    84                              <2> sf_entry	ENDS
    85                              <2> 
    86                              <2> labelsize sf_fsda, byte, sf_cluspos	     ;DOS 4.00
    87                              <2> labelsize sf_serial_ID, word, sf_firclus	     ;DOS 4.00
    88                              <2> labelsize sf_netid, byte, sf_cluspos
    89                              <2> labelsize sf_OpenAge, word, sf_position+2
    90                              <2> labelsize sf_LRU, word, sf_position
    91                              <2> 
    92                              <2> sf_default_number   EQU     5h
    93                              <2> 
    94                              <2> ;
    95                              <2> ; Note that we need to mark an SFT as being busy for OPEN/CREATE.  This is
    96                              <2> ; because an INT 24 may prevent us from 'freeing' it.  We mark this as such
    97                              <2> ; by placing a -1 in the ref_count field.
    98                              <2> ;
    99                              <2> 
   100                              <2> sf_busy EQU -1
   101                              <2> 
   102                              <2> 
   103                              <2> ; mode mask for FCB detection
   104                              <2> sf_isfcb		EQU	1000000000000000B
   105                              <2> 
   106                              <2> ; Flag word masks
   107                              <2> sf_isnet		EQU	1000000000000000B
   108                              <2> sf_close_nodate 	EQU	0100000000000000B
   109                              <2> sf_pipe 		EQU	0010000000000000B
   110                              <2> sf_no_inherit		EQU	0001000000000000B
   111                              <2> sf_net_spool		EQU	0000100000000000B
   112                              <2> Handle_Fail_I24 	EQU	0000000100000000B  ;BIT 8 - DISK FULL I24 ERROR
   113                              <2> 
   114                              <2> ; Local file/device flag masks
   115                              <2> devid_file_clean	EQU	40h	; true if file and not written
   116                              <2> devid_file_mask_drive	EQU	3Fh	; mask for drive number
   117                              <2> 
   118                              <2> devid_device		EQU	80h	; true if a device
   119                              <2> devid_device_EOF	EQU	40h	; true if end of file reached
   120                              <2> devid_device_raw	EQU	20h	; true if in raw mode
   121                              <2> devid_device_special	EQU	10h	; true if special device
   122                              <2> devid_device_clock	EQU	08h	; true if clock device
   123                              <2> devid_device_null	EQU	04h	; true if null device
   124                              <2> devid_device_con_out	EQU	02h	; true if console output
   125                              <2> devid_device_con_in	EQU	01h	; true if consle input
   126                              <2> ;									   ;
   127                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   128                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   129                              <2> 
   130                              <2> ;
   131                              <2> ; structure of devid field as returned by IOCTL is:
   132                              <2> ;
   133                              <2> ;	BIT	7   6	5   4	3   2	1   0
   134                              <2> ;	      |---|---|---|---|---|---|---|---|
   135                              <2> ;	      | I | E | R | S | I | I | I | I |
   136                              <2> ;	      | S | O | A | P | S | S | S | S |
   137                              <2> ;	      | D | F | W | E | C | N | C | C |
   138                              <2> ;	      | E |   |   | C | L | U | O | I |
   139                              <2> ;	      | V |   |   | L | K | L | T | N |
   140                              <2> ;	      |---|---|---|---|---|---|---|---|
   141                              <2> ;	ISDEV = 1 if this channel is a device
   142                              <2> ;	      = 0 if this channel is a disk file
   143                              <2> ;
   144                              <2> ;	If ISDEV = 1
   145                              <2> ;
   146                              <2> ;	      EOF = 0 if End Of File on input
   147                              <2> ;	      RAW = 1 if this device is in Raw mode
   148                              <2> ;		  = 0 if this device is cooked
   149                              <2> ;	      ISCLK = 1 if this device is the clock device
   150                              <2> ;	      ISNUL = 1 if this device is the null device
   151                              <2> ;	      ISCOT = 1 if this device is the console output
   152                              <2> ;	      ISCIN = 1 if this device is the console input
   153                              <2> ;
   154                              <2> ;	If ISDEV = 0
   155                              <2> ;	      EOF = 0 if channel has been written
   156                              <2> ;	      Bits 0-5	are  the  block  device  number  for
   157                              <2> ;		  the channel (0 = A, 1 = B, ...)
   158                              <2> ;
   159                              <2> devid_ISDEV	EQU	80h
   160                              <2> devid_EOF	EQU	40h
   161                              <2> devid_RAW	EQU	20h
   162                              <2> devid_SPECIAL	EQU	10H
   163                              <2> devid_ISCLK	EQU	08h
   164                              <2> devid_ISNUL	EQU	04h
   165                              <2> devid_ISCOT	EQU	02h
   166                              <2> devid_ISCIN	EQU	01h
   167                              <2> 
   168                              <2> devid_block_dev EQU	1Fh		; mask for block device number
   135                              <1> 
   136                              <1> %include "arena.mac"
     1                              <2> ;	SCCSID = @(#)arena.asm	1.1 85/04/09
     2                              <2> ;BREAK <Memory arena structure>
     3                              <2> 
     4                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     5                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     6                              <2> ;									   ;
     7                              <2> ;
     8                              <2> ; arena item
     9                              <2> ;
    10                              <2> arena	STRUC
    11 00000000 ??                  <2> arena_signature     DB	?		; 4D for valid item, 5A for last item
    12 00000001 ????                <2> arena_owner	    DW	?		; owner of arena item
    13 00000003 ????                <2> arena_size	    DW	?		; size in paragraphs of item
    14 00000005 ??????              <2> arena_reserved	    DB	3 DUP(?)	; reserved
    15 00000008 ????????????????    <2> arena_name	    DB	8 DUP(?)	; owner file name
    16                              <2> arena	ENDS
    17                              <2> 
    18                              <2> ;
    19                              <2> ; CAUTION: The routines in ALLOC.ASM rely on the fact that arena_signature
    20                              <2> ; and arena_owner_system are all equal to zero and are contained in DI.  Change
    21                              <2> ; them and change ALLOC.ASM.
    22                              <2> 
    23                              <2> arena_owner_system  EQU 0		; free block indication
    24                              <2> 
    25                              <2> arena_signature_normal	EQU 4Dh 	; valid signature, not end of arena
    26                              <2> arena_signature_end	EQU 5Ah 	; valid signature, last block in arena
    27                              <2> ;									   ;
    28                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    29                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    30                              <2> 
   137                              <1> 
   138                              <1> %include "intnat.mac"
     1                              <2> ;	SCCSID = @(#)intnat.asm	1.1 85/04/10
     2                              <2> BREAK <International data structure format>
     3                              <2> 
     4                              <2> ;
     5                              <2> ; Current structure of the data returned by the international call
     6                              <2> ;
     7                              <2> internat_block STRUC
     8 00000000 ????                <2> Date_tim_format DW	?		; 0-USA, 1-EUR, 2-JAP
     9 00000002 ??                  <2> Currency_sym	DB	?		; Currency Symbol 5 bytes
    10 00000003 ??                  <2> 		DB	?
    11 00000004 ??                  <2> 		DB	?
    12 00000005 ??                  <2> 		DB	?
    13 00000006 ??                  <2> 		DB	?
    14 00000007 ??                  <2> Thous_sep	DB	?		; Thousands separator 2 bytes
    15 00000008 ??                  <2> 		DB	?
    16 00000009 ??                  <2> Decimal_sep	DB	?		; Decimal separator 2 bytes
    17 0000000A ??                  <2> 		DB	?
    18 0000000B ??                  <2> Date_sep	DB	?		; Date separator 2 bytes
    19 0000000C ??                  <2> 		DB	?
    20 0000000D ??                  <2> Time_sep	DB	?		; Decimal separator 2 bytes
    21 0000000E ??                  <2> 		DB	?
    22 0000000F ??                  <2> Bit_field	DB	?		; Bit values
    23                              <2> 					;   Bit 0 = 0 if currency symbol first
    24                              <2> 					;	  = 1 if currency symbol last
    25                              <2> 					;   Bit 1 = 0 if No space after currency symbol
    26                              <2> 					;	  = 1 if space after currency symbol
    27 00000010 ??                  <2> Currency_cents	DB	?		; Number of places after currency dec point
    28 00000011 ??                  <2> Time_24 	DB	?		; 1 if 24 hour time, 0 if 12 hour time
    29 00000012 ????                <2> Map_call	DW	?		; Address of case mapping call (DWORD)
    30 00000014 ????                <2> 		DW	?		; THIS IS TWO WORDS SO IT CAN BE INITIALIZED
    31                              <2> 					;  in pieces.
    32 00000016 ??                  <2> Data_sep	DB	?		; Data list separator character
    33 00000017 ??                  <2> 		DB	?
    34                              <2> internat_block ENDS
    35                              <2> 
    36                              <2> ;
    37                              <2> ; Max size of the block returned by the INTERNATIONAL call
    38                              <2> ;
    39                              <2> internat_block_max	EQU	32
   139                              <1> 
   140                              <1> %include "mi.mac"
     1                              <2> ;	SCCSID = @(#)mi.asm	1.1 85/04/10
     2                              <2> BREAK <Machine instruction, flag definitions and character types>
     3                              <2> 
     4                              <2> mi_INT		EQU	0CDh
     5                              <2> mi_Long_JMP	EQU	0EAh
     6                              <2> mi_Long_CALL	EQU	09Ah
     7                              <2> mi_Long_RET	EQU	0CBh
     8                              <2> mi_Near_RET	EQU	0C3h
     9                              <2> 
    10                              <2> ;			xxxxoditszxaxpxc
    11                              <2> f_Overflow	EQU	0000100000000000B
    12                              <2> f_Direction	EQU	0000010000000000B
    13                              <2> f_Interrupt	EQU	0000001000000000B
    14                              <2> f_Trace 	EQU	0000000100000000B
    15                              <2> f_Sign		EQU	0000000010000000B
    16                              <2> f_Zero		EQU	0000000001000000B
    17                              <2> f_Aux		EQU	0000000000010000B
    18                              <2> f_Parity	EQU	0000000000000100B
    19                              <2> f_Carry 	EQU	0000000000000001B
   141                              <1> 
   142                              <1> fChk	equ 1
   143                              <1> fDelim	equ 2
   144                              <1> fSpChk	equ 4
   145                              <1> fFCB	equ 8
   146                              <1> 
   147                              <1> ;include filemode.INC
   148                              <1> 
   149                              <1> ;include error.INC
   150                              <1> 
   151                              <1> %include "syscall.mac"
     1                              <2> ;	SCCSID = @(#)syscall.asm	1.1 85/04/10
     2                              <2> ;BREAK <system call definitions>
     3                              <2> ;SUBTTL	system call definitions
     4                              <2> ;PAGE
     5                              <2> 
     6                              <2> Abort				EQU 0	;  0	  0
     7                              <2> Std_Con_Input			EQU 1	;  1	  1
     8                              <2> Std_Con_Output			EQU 2	;  2	  2
     9                              <2> Std_Aux_Input			EQU 3	;  3	  3
    10                              <2> Std_Aux_Output			EQU 4	;  4	  4
    11                              <2> Std_Printer_Output		EQU 5	;  5	  5
    12                              <2> Raw_Con_IO			EQU 6	;  6	  6
    13                              <2> Raw_Con_Input			EQU 7	;  7	  7
    14                              <2> Std_Con_Input_No_Echo		EQU 8	;  8	  8
    15                              <2> Std_Con_String_Output		EQU 9	;  9	  9
    16                              <2> Std_Con_String_Input		EQU 10	; 10	  A
    17                              <2> Std_Con_Input_Status		EQU 11	; 11	  B
    18                              <2> Std_Con_Input_Flush		EQU 12	; 12	  C
    19                              <2> Disk_Reset			EQU 13	; 13	  D
    20                              <2> Set_Default_Drive		EQU 14	; 14	  E
    21                              <2> FCB_Open			EQU 15	; 15	  F
    22                              <2> FCB_Close			EQU 16	; 16	 10
    23                              <2> Dir_Search_First		EQU 17	; 17	 11
    24                              <2> Dir_Search_Next 		EQU 18	; 18	 12
    25                              <2> FCB_Delete			EQU 19	; 19	 13
    26                              <2> FCB_Seq_Read			EQU 20	; 20	 14
    27                              <2> FCB_Seq_Write			EQU 21	; 21	 15
    28                              <2> FCB_Create			EQU 22	; 22	 16
    29                              <2> FCB_Rename			EQU 23	; 23	 17
    30                              <2> Get_Default_Drive		EQU 25	; 25	 19
    31                              <2> Set_DMA 			EQU 26	; 26	 1A
    32                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    33                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    34                              <2> ;									   ;
    35                              <2> Get_Default_DPB 		EQU 31	; 31	 1F
    36                              <2> ;									   ;
    37                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    38                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    39                              <2> FCB_Random_Read 		EQU 33	; 33	 21
    40                              <2> FCB_Random_Write		EQU 34	; 34	 22
    41                              <2> Get_FCB_File_Length		EQU 35	; 35	 23
    42                              <2> Get_FCB_Position		EQU 36	; 36	 24
    43                              <2> Set_Interrupt_Vector		EQU 37	; 37	 25
    44                              <2> Create_Process_Data_Block	EQU 38	; 38	 26
    45                              <2> FCB_Random_Read_Block		EQU 39	; 39	 27
    46                              <2> FCB_Random_Write_Block		EQU 40	; 40	 28
    47                              <2> Parse_File_Descriptor		EQU 41	; 41	 29
    48                              <2> Get_Date			EQU 42	; 42	 2A
    49                              <2> Set_Date			EQU 43	; 43	 2B
    50                              <2> Get_Time			EQU 44	; 44	 2C
    51                              <2> Set_Time			EQU 45	; 45	 2D
    52                              <2> Set_Verify_On_Write		EQU 46	; 46	 2E
    53                              <2> ; Extended functionality group
    54                              <2> Get_DMA 			EQU 47	; 47	 2F
    55                              <2> Get_Version			EQU 48	; 48	 30
    56                              <2> Keep_Process			EQU 49	; 49	 31
    57                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    58                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    59                              <2> ;									   ;
    60                              <2> Get_DPB 			EQU 50	; 50	 32
    61                              <2> ;									   ;
    62                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    63                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
    64                              <2> Set_CTRL_C_Trapping		EQU 51	; 51	 33
    65                              <2> Get_InDOS_Flag			EQU 52	; 52	 34
    66                              <2> Get_Interrupt_Vector		EQU 53	; 53	 35
    67                              <2> Get_Drive_Freespace		EQU 54	; 54	 36
    68                              <2> Char_Oper			EQU 55	; 55	 37
    69                              <2> International			EQU 56	; 56	 38
    70                              <2> ;   Directory Group
    71                              <2> MKDir				EQU 57	; 57	 39
    72                              <2> RMDir				EQU 58	; 58	 3A
    73                              <2> CHDir				EQU 59	; 59	 3B
    74                              <2> ;   File Group
    75                              <2> Creat				EQU 60	; 60	 3C
    76                              <2> Open				EQU 61	; 61	 3D
    77                              <2> Close				EQU 62	; 62	 3E
    78                              <2> Read				EQU 63	; 63	 3F
    79                              <2> Write				EQU 64	; 64	 40
    80                              <2> Unlink				EQU 65	; 65	 41
    81                              <2> LSeek				EQU 66	; 66	 42
    82                              <2> CHMod				EQU 67	; 67	 43
    83                              <2> IOCtl				EQU 68	; 68	 44
    84                              <2> XDup				EQU 69	; 69	 45
    85                              <2> XDup2				EQU 70	; 70	 46
    86                              <2> Current_Dir			EQU 71	; 71	 47
    87                              <2> ;    Memory Group
    88                              <2> Alloc				EQU 72	; 72	 48
    89                              <2> Dealloc 			EQU 73	; 73	 49
    90                              <2> Setblock			EQU 74	; 74	 4A
    91                              <2> ;    Process Group
    92                              <2> Exec				EQU 75	; 75	 4B
    93                              <2> Exit				EQU 76	; 76	 4C
    94                              <2> WaitProcess			EQU 77	; 77	 4D
    95                              <2> Find_First			EQU 78	; 78	 4E
    96                              <2> ;   Special Group
    97                              <2> Find_Next			EQU 79	; 79	 4F
    98                              <2> ; SPECIAL SYSTEM GROUP
    99                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   100                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   101                              <2> ;									   ;
   102                              <2> Set_Current_PDB 		EQU 80	; 80	 50
   103                              <2> Get_Current_PDB 		EQU 81	; 81	 51
   104                              <2> Get_In_Vars			EQU 82	; 82	 52
   105                              <2> SetDPB				EQU 83	; 83	 53
   106                              <2> ;									   ;
   107                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   108                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   109                              <2> Get_Verify_On_Write		EQU 84	; 84	 54
   110                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   111                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   112                              <2> ;									   ;
   113                              <2> Dup_PDB 			EQU 85	; 85	 55
   114                              <2> ;									   ;
   115                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   116                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   117                              <2> Rename				EQU 86	; 86	 56
   118                              <2> File_Times			EQU 87	; 87	 57
   119                              <2> AllocOper			EQU 88	; 88	 58
   120                              <2> ; Network extention system calls
   121                              <2> GetExtendedError		EQU 89	; 89	 59
   122                              <2> CreateTempFile			EQU 90	; 90	 5A
   123                              <2> CreateNewFile			EQU 91	; 91	 5B
   124                              <2> LockOper			EQU 92	; 92	 5C Lock and Unlock
   125                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   126                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   127                              <2> ;									   ;
   128                              <2> ServerCall			EQU 93	; 93	 5D CommitAll, ServerDOSCall,
   129                              <2> 					;	    CloseByName, CloseUser,
   130                              <2> 					;	    CloseUserProcess,
   131                              <2> 					;	    GetOpenFileList
   132                              <2> ;									   ;
   133                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   134                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   135                              <2> UserOper			EQU 94	; 94	 5E Get and Set
   136                              <2> AssignOper			EQU 95	; 95	 5F On, Off, Get, Set, Cancel
   137                              <2> xNameTrans			EQU 96	; 96	 60
   138                              <2> PathParse			EQU 97	; 97	 61
   139                              <2> GetCurrentPSP			EQU 98	; 98	 62
   140                              <2> Hongeul 			EQU 99	; 99	 63
   141                              <2> ECS_CALL			EQU 99	; 99	 63  ;; DBCS support
   142                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   143                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   144                              <2> ;									   ;
   145                              <2> Set_Printer_Flag		EQU 100 ; 100	 64
   146                              <2> ;									   ;
   147                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
   148                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   149                              <2> GetExtCntry			EQU 101 ; 101	 65
   150                              <2> GetSetCdPg			EQU 102 ; 102	 66
   151                              <2> ExtHandle			EQU 103 ; 103	 67
   152                              <2> Commit				EQU 104 ; 104	 68
   153                              <2> GetSetMediaID			EQU 105 ; 105	 69
   154                              <2> IFS_IOCTL			EQU 107 ; 107	 6B
   155                              <2> ExtOpen 			EQU 108 ; 108	 6C
   156                              <2> ;
   157                              <2> ;
   158                              <2> Set_Oem_Handler 		EQU 248 ; 248	 F8
   159                              <2> OEM_C1				EQU 249 ; 249	 F9
   160                              <2> OEM_C2				EQU 250 ; 250	 FA
   161                              <2> OEM_C3				EQU 251 ; 251	 FB
   162                              <2> OEM_C4				EQU 252 ; 252	 FC
   163                              <2> OEM_C5				EQU 253 ; 253	 FD
   164                              <2> OEM_C6				EQU 254 ; 254	 FE
   165                              <2> OEM_C7				EQU 255 ; 255	 FF
   152                              <1> 
   153                              <1> %include "doscntry.mac"		;J.K. 5/26/86
     1                              <2> ;
     2                              <2> ;Equates for COUNTRY INFORMATION.
     3                              <2> SetCountryInfo		EQU	1	;country info
     4                              <2> SetUcase		EQU	2	;uppercase table
     5                              <2> SetLcase		EQU	3	;lowercase table (Reserved)
     6                              <2> SetUcaseFile		EQU	4	;uppercase file spec table
     7                              <2> SetFileList		EQU	5	;valid file character list
     8                              <2> SetCollate		EQU	6	;collating sequence
     9                              <2> SetDBCS 		EQU	7	;double byte character set
    10                              <2> SetALL			EQU	-1	;all the entries
    11                              <2> 
    12                              <2> 
    13                              <2> ;DOS country and code page information table structure.
    14                              <2> ;Internally, DOS gives a pointer to this table.
    15                              <2> ;IBMBIO, MODE and NLSFUNC modules communicate with DOS through
    16                              <2> ;this structure.
    17                              <2> DOS_country_cdpg_info struc
    18 00000000 ????????????????    <2> ccInfo_reserved 	db	8 dup (?) ;reserved for internal use
    19 00000008 <res 40h>           <2> ccPath_CountrySys	db	64 dup (?);path and filename for country info
    20 00000048 ????                <2> ccSysCodePage		dw	? ;0	;system code page id
    21 0000004A ????                <2> ccNumber_of_entries	dw	? ;6	; 6 entries
    22 0000004C ??                  <2> ccSetUcase		db	? ;SetUcase
    23 0000004D ????????            <2> ccUcase_ptr		dd	?	;pointer to Ucase table
    24                              <2> 
    25 00000051 ??                  <2> ccSetUcaseFile		db	? ;SetUcaseFile
    26 00000052 ????????            <2> ccFileUcase_ptr 	dd	?	;pointer to File Ucase table
    27                              <2> 
    28 00000056 ??                  <2> ccSetFileList		db	? ;SetFileList
    29 00000057 ????????            <2> ccFileChar_ptr		dd	?	;pointer to File char list table
    30                              <2> 
    31 0000005B ??                  <2> ccSetCollate		db	? ;SetCollate
    32 0000005C ????????            <2> ccCollate_ptr		dd	?	;pointer to collate table
    33                              <2> 
    34 00000060 ??                  <2> ccSetDBCS		db	? ;SetDBCS
    35 00000061 ????????            <2> ccDBCS_ptr		dd	?	;pointer to DBCS  table
    36                              <2> 
    37 00000065 ??                  <2> ccSetCountryInfo	db	?; SetCountryInfo
    38 00000066 ????                <2> ccCountryInfoLen	dw	?	;length of country info
    39 00000068 ????                <2> ccDosCountry		dw	?	;active country code id
    40 0000006A ????                <2> ccDosCodePage		dw	?	;active code page id
    41 0000006C ????                <2> ccDFormat		dw	?	;date format
    42 0000006E ??????????          <2> ccCurSymbol		db	5 dup (?) ;"    ",0;5 byte of (currency symbol+0)
    43 00000073 ????                <2> cc1000Sep		db	?,? ;" ",0   ;2 byte of (1000 sep. + 0)
    44 00000075 ????                <2> ccDecSep		db	?,? ;" ",0   ;2 byte of (Decimal sep. + 0)
    45 00000077 ????                <2> ccDateSep		db	?,? ;" ",0   ;2 byte of (date sep. + 0)
    46 00000079 ????                <2> ccTimeSep		db	?,? ;" ",0   ;2 byte of (time sep. + 0)
    47 0000007B ??                  <2> ccCFormat		db	?	;currency format flags
    48 0000007C ??                  <2> ccCSigDigits		db	?	;# of digits in currency
    49 0000007D ??                  <2> ccTFormat		db	?	;time format
    50 0000007E ????????            <2> ccMono_Ptr		dd	?	;monocase routine entry point
    51 00000082 ????                <2> ccListSep		db	?,? ;" ",0   ;data list separator
    52 00000084 <res Ah>            <2> ccReserved_area 	dw	5 dup(?);reserved
    53                              <2> 
    54                              <2> DOS_country_cdpg_info ends
    55                              <2> 
    56                              <2> ;Ucase table
    57                              <2> CC_UCASE_TAB	struc
    58 00000000 ????                <2> ccUcase_leng	       dw	? ;128
    59 00000002 <res 80h>           <2> ccUcase_data	       db	128 dup (?)
    60                              <2> CC_UCASE_TAB	ends
    61                              <2> 
    62                              <2> ;File Ucase table
    63                              <2> CC_FILE_UCASE_TAB	struc
    64 00000000 ????                <2> ccFileucase_leng	dw	? ;128
    65 00000002 <res 80h>           <2> ccFileucase_data	db	128 dup (?)
    66                              <2> CC_FILE_UCASE_TAB	ends
    67                              <2> 
    68                              <2> ;File char list
    69                              <2> CC_FILE_CHAR_TAB	struc
    70 00000000 ????                <2> ccFilechar_leng 	dw	?
    71 00000002 <res 2Eh>           <2> ccFilechar_data 	db	46 dup (?)
    72                              <2> CC_FILE_CHAR_TAB	ends
    73                              <2> 
    74                              <2> ;collate table
    75                              <2> CC_COLLATE_TAB	struc
    76 00000000 ????                <2> ccCollate_leng		dw	? ;256
    77 00000002 <res 100h>          <2> ccCollate_data		db	256 dup (?)
    78                              <2> CC_COLLATE_TAB	ends
    79                              <2> 
    80                              <2> ;DBCS table -  for DOS 4.00
    81                              <2> CC_DBCS_TAB	struc
    82 00000000 ????                <2> ccDBCS_leng	       dw      ? ;6
    83 00000002 ????????????        <2> ccDBCS_data	       db      6 dup (?)
    84                              <2> CC_DBCS_TAB	ends
    85                              <2> 
    86                              <2> ;						2/12/KK
    87                              <2> ; Define subfunctions of ECS_call ( 63H )	2/12/KK
    88                              <2> ;						2/12/KK
    89                              <2> GetLeadBTBL	EQU	0	;		2/12/KK
    90                              <2> SetInterimMode	EQU	1	;		2/12/KK
    91                              <2> GetInterimMode	EQU	2	;		2/12/KK
    92                              <2> 				;		2/12/KK
    93                              <2> NonInterimMode	EQU	0	;		2/12/KK
    94                              <2> InterimMode	EQU	1	;		2/12/KK
    95                              <2> 
    96                              <2> OLD_COUNTRY_SIZE    equ     (DOS_country_cdpg_info_struc_size - ccDFormat - 10)
    97                              <2> NEW_COUNTRY_SIZE    equ     (DOS_country_cdpg_info_struc_size - ccDosCountry)
    98                              <2> 
    99                              <2> ;CAPITALIZATION equates
   100                              <2> CAP_ONE_CHAR	    equ      20H
   101                              <2> CAP_STRING	    equ      21H
   102                              <2> CAP_ASCIIZ	    equ      22H
   103                              <2> CHECK_YES_NO	    equ      23H
   104                              <2> UPPER_TABLE	    equ      80H
   105                              <2> 
   106                              <2> ;NLS_YES	     equ      59H
   107                              <2> ;NLS_yes2	     equ      79H
   108                              <2> ;NLS_NO 	     equ      4EH
   109                              <2> ;NLS_no2	     equ      6EH
   154                              <1> 
   155                              <1> ;SUBTTL
   156                              <1> 
    59                                  	%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
    60                                  	%include "ioctl.mac"
     1                              <1> 
     2                              <1> %warning out: IOCTL.INC...
     2          ******************  <1>  warning: out: IOCTL.INC... [-w+user]
     3                              <1> ; THESE ARE ALL THE IMPORTANT STRUCTURES AND EQUATES FOR IOCTL
     4                              <1> ;==============================================================================
     5                              <1> ;REVISION HISTORY:
     6                              <1> ;AN000 - New for DOS Version 4.00 - J.K.
     7                              <1> ;AC000 - Changed for DOS Version 4.00 - J.K.
     8                              <1> ;AN00x - PTM number for DOS Version 4.00 - J.K.
     9                              <1> ;==============================================================================
    10                              <1> ;AN001; D241 Provide support of Multi-track Format/Verify	   9/23/87 J.K.
    11                              <1> ;AN002; P1535 Unformatted hard file problem			  10/15/87 J.K.
    12                              <1> ;AN003; D490 IOCTL subfunction 63h,43h,64h,44h conflicts with OS2  2/26/88 J.K.
    13                              <1> ;==============================================================================
    14                              <1> 
    15                              <1> ;*** J.K.
    16                              <1> ;General Guide -
    17                              <1> ;Category Code:
    18                              <1> ; 0... .... DOS Defined
    19                              <1> ; 1... .... User defined
    20                              <1> ; .xxx xxxx Code
    21                              <1> 
    22                              <1> ;Function Code:
    23                              <1> ; 0... .... Return error if unsupported
    24                              <1> ; 1... .... Ignore if unsupported
    25                              <1> ; .0.. .... Intercepted by DOS
    26                              <1> ; .1.. .... Passed to driver
    27                              <1> ; ..0. .... Sends data/commands to device
    28                              <1> ; ..1. .... Quries data/info from device
    29                              <1> ; ...x .... Subfunction
    30                              <1> ;
    31                              <1> ; Note that "Sends/queries" data bit is intended only to regularize the
    32                              <1> ; function set.  It plays no critical role; some functions may contain both
    33                              <1> ; command and query elements. The convention is that such commands are
    34                              <1> ; defined as "sends data".
    35                              <1> 
    36                              <1> ;*****************************;*
    37                              <1> ; BLOCK DRIVERS 	      ;*
    38                              <1> ;*****************************;*
    39                              <1> 
    40                              <1> ; IOCTL SUB-FUNCTIONS
    41                              <1> IOCTL_GET_DEVICE_INFO	EQU	0
    42                              <1> IOCTL_SET_DEVICE_INFO	EQU	1
    43                              <1> IOCTL_READ_HANDLE	EQU	2
    44                              <1> IOCTL_WRITE_HANDLE	EQU	3
    45                              <1> IOCTL_READ_DRIVE	EQU	4
    46                              <1> IOCTL_WRITE_DRIVE	EQU	5
    47                              <1> IOCTL_GET_INPUT_STATUS	EQU	6
    48                              <1> IOCTL_GET_OUTPUT_STATUS EQU	7
    49                              <1> IOCTL_CHANGEABLE?	EQU	8
    50                              <1> IOCTL_DeviceLocOrRem?	EQU	9
    51                              <1> IOCTL_HandleLocOrRem?	EQU	0Ah   ;10
    52                              <1> IOCTL_SHARING_RETRY	EQU	0Bh   ;11
    53                              <1> GENERIC_IOCTL_HANDLE	EQU	0Ch   ;12
    54                              <1> GENERIC_IOCTL		EQU	0Dh   ;13
    55                              <1> 
    56                              <1> ; GENERIC IOCTL CATEGORY CODES
    57                              <1> IOC_OTHER		EQU	0	; Other device control J.K. 4/29/86
    58                              <1> IOC_SE			EQU	1	; SERIAL DEVICE CONTROL
    59                              <1> IOC_TC			EQU	2	; TERMINAL CONTROL
    60                              <1> IOC_SC			EQU	3	; SCREEN CONTROL
    61                              <1> IOC_KC			EQU	4	; KEYBOARD CONTROL
    62                              <1> IOC_PC			EQU	5	; PRINTER CONTROL
    63                              <1> IOC_DC			EQU	8	; DISK CONTROL (SAME AS RAWIO)
    64                              <1> 
    65                              <1> ; GENERIC IOCTL SUB-FUNCTIONS
    66                              <1> RAWIO			EQU	8
    67                              <1> 
    68                              <1> ; RAWIO SUB-FUNCTIONS
    69                              <1> GET_DEVICE_PARAMETERS	EQU	60H
    70                              <1> SET_DEVICE_PARAMETERS	EQU	40H
    71                              <1> READ_TRACK		EQU	61H
    72                              <1> WRITE_TRACK		EQU	41H
    73                              <1> VERIFY_TRACK		EQU	62H
    74                              <1> FORMAT_TRACK		EQU	42H
    75                              <1> GET_MEDIA_ID		EQU	66h		;AN000;AN003;changed from 63h
    76                              <1> SET_MEDIA_ID		EQU	46h		;AN000;AN003;changed from 43h
    77                              <1> GET_ACCESS_FLAG 	EQU	67h		;AN002;AN003;Unpublished function.Changed from 64h
    78                              <1> SET_ACCESS_FLAG 	EQU	47h		;AN002;AN003;Unpublished function.Changed from 44h
    79                              <1> 
    80                              <1> ; SPECIAL FUNCTION FOR GET DEVICE PARAMETERS
    81                              <1> BUILD_DEVICE_BPB	EQU	000000001B
    82                              <1> 
    83                              <1> ; SPECIAL FUNCTIONS FOR SET DEVICE PARAMETERS
    84                              <1> INSTALL_FAKE_BPB	EQU	000000001B
    85                              <1> ONLY_SET_TRACKLAYOUT	EQU	000000010B
    86                              <1> TRACKLAYOUT_IS_GOOD	EQU	000000100B
    87                              <1> 
    88                              <1> ; SPECIAL FUNCTION FOR FORMAT TRACK
    89                              <1> STATUS_FOR_FORMAT		EQU	000000001B
    90                              <1> DO_FAST_FORMAT			equ	000000010B	;AN001;
    91                              <1> ; CODES RETURNED FROM FORMAT STATUS CALL
    92                              <1> FORMAT_NO_ROM_SUPPORT		EQU	000000001B
    93                              <1> FORMAT_COMB_NOT_SUPPORTED	EQU	000000010B
    94                              <1> 
    95                              <1> ; DEVICETYPE VALUES
    96                              <1> MAX_SECTORS_IN_TRACK	EQU	63	; MAXIMUM SECTORS ON A DISK.(Was 40 in DOS 3.2)
    97                              <1> DEV_5INCH		EQU	0
    98                              <1> DEV_5INCH96TPI		EQU	1
    99                              <1> DEV_3INCH720KB		EQU	2
   100                              <1> DEV_8INCHSS		EQU	3
   101                              <1> DEV_8INCHDS		EQU	4
   102                              <1> DEV_HARDDISK		EQU	5
   103                              <1> DEV_OTHER		EQU	7
   104                              <1> 
   105                              <1> MAX_DEV_TYPE		EQU	7	; MAXIMUM DEVICE TYPE THAT WE
   106                              <1> 					; CURRENTLY SUPPORT.
   107                              <1> 
   108                              <1> %include "bpb.mac"
     1                              <2> 	%warning out: BPB.INC...
     1          ******************  <2>  warning: out: BPB.INC... [-w+user]
     2                              <2> ;	SCCSID = @(#)BPB.ASM	1.1 85/04/29
     3                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     4                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     5                              <2> ;									   ;
     6                              <2> 
     7                              <2> ; BIOS PARAMETER BLOCK DEFINITION
     8                              <2> ; THIS STRUCTURE IS USED TO BUILD A FULL DPB
     9                              <2> 
    10                              <2> BPBLOCK STRUC
    11 00000000 ????                <2> BPSECSZ DW	?			; SIZE IN BYTES OF PHYSICAL SECTOR
    12 00000002 ??                  <2> BPCLUS	DB	?			; SECTORS/ALLOC UNIT
    13 00000003 ????                <2> BPRES	DW	?			; NUMBER OF RESERVED SECTORS
    14 00000005 ??                  <2> BPFTCNT DB	?			; NUMBER OF FATS
    15 00000006 ????                <2> BPDRCNT DW	?			; NUMBER OF DIRECTORY ENTRIES
    16 00000008 ????                <2> BPSCCNT DW	?			; TOTAL NUMBER OF SECTORS
    17 0000000A ??                  <2> BPMEDIA DB	?			; MEDIA DESCRIPTOR BYTE
    18 0000000B ????                <2> BPFTSEC DW	?			; NUMBER OF SECTORS TAKEN UP BY ONE FAT
    19                              <2> BPBLOCK ENDS
    20                              <2> 
    21                              <2> A_BPB			STRUC
    22 00000000 ????                <2> BPB_BYTESPERSECTOR	DW	?
    23 00000002 ??                  <2> BPB_SECTORSPERCLUSTER	DB	?
    24 00000003 ????                <2> BPB_RESERVEDSECTORS	DW	?
    25 00000005 ??                  <2> BPB_NUMBEROFFATS	DB	?
    26 00000006 ????                <2> BPB_ROOTENTRIES 	DW	?
    27 00000008 ????                <2> BPB_TOTALSECTORS	DW	?
    28 0000000A ??                  <2> BPB_MEDIADESCRIPTOR	DB	?
    29 0000000B ????                <2> BPB_SECTORSPERFAT	DW	?
    30 0000000D ????                <2> BPB_SECTORSPERTRACK	DW	?
    31 0000000F ????                <2> BPB_HEADS		DW	?
    32 00000011 ????                <2> BPB_HIDDENSECTORS	DW	?
    33 00000013 ????                <2> 			DW	?
    34 00000015 ????                <2> BPB_BIGTOTALSECTORS	DW	?
    35 00000017 ????                <2> 			DW	?
    36 00000019 ????????????        <2> 			DB	6 DUP(?)
    37                              <2> A_BPB			ENDS
    38                              <2> ;									   ;
    39                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    40                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   109                              <1> 
   110                              <1> A_SECTORTABLE	    STRUC
   111 00000000 ????                <1> ST_SECTORNUMBER 	DW	?
   112 00000002 ????                <1> ST_SECTORSIZE		DW	?
   113                              <1> A_SECTORTABLE	    ENDS
   114                              <1> 
   115                              <1> A_DEVICEPARAMETERS  STRUC
   116 00000000 ??                  <1> DP_SPECIALFUNCTIONS	DB	?
   117 00000001 ??                  <1> DP_DEVICETYPE		DB	?
   118 00000002 ????                <1> DP_DEVICEATTRIBUTES	DW	?
   119 00000004 ????                <1> DP_CYLINDERS		DW	?
   120 00000006 ??                  <1> DP_MEDIATYPE		DB	?
   121 00000007 <res 1Fh>           <1> DP_BPB			DB	A_BPB_struc_size DUP (?)
   122 00000026 ????                <1> DP_TRACKTABLEENTRIES	DW	?
   123 00000028 <res FCh>           <1> DP_SECTORTABLE		DB MAX_SECTORS_IN_TRACK * A_SECTORTABLE_struc_size DUP (?)
   124                              <1> A_DEVICEPARAMETERS  ENDS
   125                              <1> 
   126                              <1> A_TRACKREADWRITEPACKET STRUC
   127 00000000 ??                  <1> TRWP_SPECIALFUNCTIONS	DB	?
   128 00000001 ????                <1> TRWP_HEAD		DW	?
   129 00000003 ????                <1> TRWP_CYLINDER		DW	?
   130 00000005 ????                <1> TRWP_FIRSTSECTOR	DW	?
   131 00000007 ????                <1> TRWP_SECTORSTOREADWRITE DW	?
   132 00000009 ????????            <1> TRWP_TRANSFERADDRESS	DD	?
   133                              <1> A_TRACKREADWRITEPACKET ENDS
   134                              <1> 
   135                              <1> ;AN001; - FP_TRACKCOUNT is only meaningful when FP_SPECIALFUNCTIONS bit 1 = 1.
   136                              <1> A_FORMATPACKET	    STRUC
   137 00000000 ??                  <1> FP_SPECIALFUNCTIONS	DB	?
   138 00000001 ????                <1> FP_HEAD 		DW	?
   139 00000003 ????                <1> FP_CYLINDER		DW	?
   140 00000005 ????                <1> FP_TRACKCOUNT		DW	? ;1
   141                              <1> A_FORMATPACKET	    ENDS
   142                              <1> 
   143                              <1> A_VERIFYPACKET	    STRUC
   144 00000000 ??                  <1> VP_SPECIALFUNCTIONS	DB	?
   145 00000001 ????                <1> VP_HEAD 		DW	?
   146 00000003 ????                <1> VP_CYLINDER		DW	?
   147                              <1> A_VERIFYPACKET	    ENDS
   148                              <1> 
   149                              <1> A_MEDIA_ID_INFO     STRUC
   150 00000000 ????                <1> MI_LEVEL		DW	? ;0		;J.K. 87 Info. level
   151 00000002 ????????            <1> MI_SERIAL		DD	?		;J.K. 87 Serial #
   152 00000006 <res Bh>            <1> MI_LABEL		DB     11 DUP (?) ;(' ')     ;J.K. 87 volume label
   153 00000011 ????????????????    <1> MI_SYSTEM		DB	8 DUP (?) ;(' ')     ;J.K. 87 File system type
   154                              <1> A_MEDIA_ID_INFO     ENDS
   155                              <1> 
   156                              <1> A_DISKACCESS_CONTROL	STRUC			;AN002; Unpublished function. Only for Hard file.
   157 00000000 ??                  <1> DAC_SPECIALFUNCTIONS	DB	? ;0		;AN002; Always 0
   158 00000001 ??                  <1> DAC_ACCESS_FLAG 	DB	? ;0		;AN002; Non Zero - allow disk I/O to unformatted hard file
   159                              <1> A_DISKACCESS_CONTROL	ENDS			;AN002; 0 - Disallow disk I/O to unformatted hard file
   160                              <1> 
   161                              <1> ;********************************;*
   162                              <1> ; CHARACTER DEVICES (PRINTERS)	 ;*
   163                              <1> ;********************************;*
   164                              <1> 
   165                              <1> ;RAWIO SUB-FUNCTIONS
   166                              <1> GET_RETRY_COUNT 	EQU	65H
   167                              <1> SET_RETRY_COUNT 	EQU	45H
   168                              <1> 
   169                              <1> A_RETRYCOUNT	    STRUC
   170 00000000 ????                <1> RC_COUNT		DW	?
   171                              <1> A_RETRYCOUNT	    ENDS
   172                              <1> 
   173                              <1> ;********************************;*		;J.K. 4/29/86
   174                              <1> ; CHARACTER DEVICES (SCREEN)	 ;*
   175                              <1> ;********************************;*		;J.K. 4/29/86
   176                              <1> ;
   177                              <1> ;SC_MODE_INFO	 struc
   178                              <1> ;SC_INFO_LENGTH 	 DW	 9
   179                              <1> ;SC_MODE		 DB	 0
   180                              <1> ;SC_COLORS		 DW	 0
   181                              <1> ;SC_WIDTH		 DW	 0
   182                              <1> ;SC_LENGTH		 DW	 0
   183                              <1> ;SC_MODE_INFO	 ends
   184                              <1> ;
   185                              <1> ;SC_INFO_PACKET_LENGTH	 EQU	 9		 ;LENGTH OF THE INFO PACKET.
   186                              <1> 
   187                              <1> ;SUBFUNCTIONS FOR CON$GENIOCTL
   188                              <1> ;GET_SC_MODE		 EQU	 60h
   189                              <1> ;SET_SC_MODE		 EQU	 40h
   190                              <1> ;The following subfunctions are reserved for installable CODE PAGE switch
   191                              <1> ;console devices. - J.K. 4/29/86
   192                              <1> ;Get_active_codepage	 equ	 6Ah
   193                              <1> ;Invoke_active_codepage  equ	 4Ah
   194                              <1> ;Start_designate_codepage equ	 4Ch
   195                              <1> ;End_designate_codepage  equ	 4Dh
   196                              <1> ;Get_list_of_designated_codepage equ 6Bh
   197                              <1> ;J.K. 4/29/86 *** End of Con$genioctl equates & structures
    61                                  	%include "devmark.mac"
     1                              <1> ;Structure, Equtes for DEVMARK for MEM command.
     2                              <1> 
     3                              <1> DEVMARK struc
     4 00000000 ??                  <1> DEVMARK_ID	  db	  ?
     5 00000001 ????                <1> DEVMARK_SEG	  dw	  ?
     6 00000003 ????                <1> DEVMARK_SIZE	  dw	  ?
     7 00000005 ??????              <1> DEVMARK_DUM	  db	  3 dup (?)
     8 00000008 ????????????????    <1> DEVMARK_FILENAME  db	  8 dup (?) ; (' ')
     9                              <1> DEVMARK ends
    10                              <1> 
    11                              <1> DEVMARK_STK	equ	'S'
    12                              <1> DEVMARK_DEVICE	equ	'D'
    13                              <1> DEVMARK_IFS	equ	'I'
    14                              <1> DEVMARK_BUF	equ	'B'
    15                              <1> DEVMARK_CDS	equ	'L' ;lastdrive
    16                              <1> DEVMARK_FILES	equ	'F'
    17                              <1> DEVMARK_FCBS	equ	'X'
    18                              <1> DEVMARK_INST	equ	'T' ;used for SYSINIT BASE for INSTALL= command.
    19                              <1> DEVMARK_EMS_STUB equ	'E'
    20                              <1> 
    21                              <1> SETBRKDONE	equ	00000001b
    22                              <1> FOR_DEVMARK	equ	00000010b
    23                              <1> NOT_FOR_DEVMARK equ	11111101b
    62                                  	%include "lstruct.mac"
     1                              <1> [list -]
    13                              <1> [list -]
    63                                  [list +]
    64                                  
    65                                  	%IFN IBM
    66                                  	%IFN IBMJAPVER
    67                                  	EXTRN	RE_INIT:FAR
    68                                  	%ENDIF
    69                                  	%ENDIF
    70                                  
    71                                  	extrn EC35_Flag: byte
    72                                  ; (no prior section) ; code ends
    73                                  
    74                                  section SYSINITSEG PUBLIC class=INIT align=1
    75                                  
    76                                  	EXTRN	BADOPM:BYTE,CRLFM:BYTE,BADCOM:BYTE,BADMEM:BYTE,BADBLOCK:BYTE
    77                                  	EXTRN	BADSIZ_PRE:BYTE,BADLD_PRE:BYTE
    78                                  ;	 EXTRN	 BADSIZ_POST:BYTE,BADLD_POST:BYTE
    79                                  	EXTRN	SYSSIZE:BYTE,BADCOUNTRY:BYTE
    80                                  
    81                                  	EXTRN  dosinfo:dword,entry_point:dword
    82                                  	EXTRN  MEMORY_SIZE:WORD,fcbs:byte,keep:byte
    83                                  	EXTRN  DEFAULT_DRIVE:BYTE,conf_block:word
    84                                  	EXTRN  BUFFERS:WORD,zero:byte,sepchr:byte
    85                                  	EXTRN  FILES:BYTE
    86                                  	EXTRN  count:word,chrptr:word
    87                                  	EXTRN  bufptr:byte
    88                                  	EXTRN  area:word,PACKET:BYTE,UNITCOUNT:BYTE
    89                                  	EXTRN  BREAK_ADDR:DWORD,BPB_ADDR:DWORD,drivenumber:byte
    90                                  	extrn  COM_Level:byte, CMMT:byte, CMMT1:byte, CMMT2:byte
    91                                  	extrn  Cmd_Indicator:byte
    92                                  	extrn  DoNotShowNum:byte
    93                                  	extrn  MultDeviceFlag:byte
    94                                  	extrn  DevMark_Addr:word			;AN005;
    95                                  	extrn  SetDevMarkFlag:byte			;AN005;
    96                                  	extrn  Org_Count:word				;AN012;
    97                                  	extern devicehighflag, devicehighdata, devicehighafter, devicehighsd
    98                                  	extern deviceafter
    99                                  	extern sysinit_get_ds_dosbiodata
   100                                  
   101                                  	EXTRN  Stall:near
   102                                  	EXTRN  Error_Line:near
   103                                  
   104                                  Open_Dev equ OPEN_DEV	; NASM port label
   105                                  Organize equ ORGANIZE	; NASM port label
   106                                  Mem_Err equ MEM_ERR	; NASM port label
   107                                  Newline equ NEWLINE	; NASM port label
   108                                  CallDev equ CALLDEV	; NASM port label
   109                                  Badload equ BADLOAD	; NASM port label
   110                                  	PUBLIC Open_Dev,Organize,Mem_Err,Newline,CallDev,Badload
   111                                  PrnDev equ PRNDEV	; NASM port label
   112                                  AuxDev equ AUXDEV	; NASM port label
   113                                  Commnd equ COMMND	; NASM port label
   114                                  Condev equ CONDEV	; NASM port label
   115                                  GetNum equ GETNUM	; NASM port label
   116                                  BadFil equ BADFIL	; NASM port label
   117                                  PrnErr equ PRNERR	; NASM port label
   118                                  	PUBLIC PrnDev,AuxDev,Commnd,Condev,GetNum,BadFil,PrnErr
   119                                  Delim equ DELIM	; NASM port label
   120                                  Print equ PRINT	; NASM port label
   121                                  Set_Break equ SET_BREAK	; NASM port label
   122                                  	PUBLIC Delim,Print,Set_Break
   123                                  	PUBLIC SetParms, ParseLine, sysinit_DiddleBack
   124                                  Skip_delim equ SKIP_DELIM	; NASM port label
   125                                  Set_Country_Path equ SET_COUNTRY_PATH	; NASM port label
   126                                  Move_Asciiz equ MOVE_ASCIIZ	; NASM port label
   127                                  	PUBLIC Skip_delim,SetDOSCountryInfo,Set_Country_Path,Move_Asciiz
   128                                  Cntry_Drv equ CNTRY_DRV	; NASM port label
   129                                  Cntry_Root equ CNTRY_ROOT	; NASM port label
   130                                  Cntry_Path equ CNTRY_PATH	; NASM port label
   131                                  	PUBLIC Cntry_Drv,Cntry_Root,Cntry_Path
   132                                  	PUBLIC Delim
   133                                  	public PathString				;AN014;
   134                                  	public LShare					;AN014;
   135                                  
   136                                  ;
   137                                  ; The following set of routines is used to parse the DRIVPARM = command in
   138                                  ; the CONFIG.SYS file to change the default drive parameters.
   139                                  ;
   140                                  SetParms:
   141                                   assume ds:nothing, es:nothing, ss:nothing
   142 00000000 1E                      	push	ds
   143 00000001 50                      	push	ax
   144 00000002 53                      	push	bx
   145 00000003 51                      	push	cx
   146 00000004 52                      	push	dx
   147 00000005 0E                      	push	cs
   148 00000006 1F                      	pop	ds
   149                                   assume ds:SYSINITGROUP
   150 00000007 31DB                    	xor	bx,bx
   151 00000009 8A1E[320C]              	mov	bl,byte ptr [sysinit_drive]
   152 0000000D FEC3                    	inc	bl		    ; get it correct for IOCTL call (1=A,2=B...)
   153 0000000F BA[0A0B]                	mov	dx,offset DeviceParameters
   154                                  IOCTL equ IOCtl	; NASM port equate
   155 00000012 B444                    	mov	ah, IOCTL
   156 00000014 B00D                    	mov	al, GENERIC_IOCTL
   157 00000016 B508                    	mov	ch, RAWIO
   158 00000018 B140                    	mov	cl, SET_DEVICE_PARAMETERS
   159 0000001A CD21                    	int	21H
   160 0000001C F706[330C]0400          	test	word [Switches], flagec35
   161 00000022 740F                    	jz	Not_EC35
   162                                  
   163 00000024 8A0E[320C]              	mov	cl, byte ptr [sysinit_drive]	; which drive was this for?
   164 00000028 E8(0000)                	call sysinit_get_ds_dosbiodata
   165                                   assume ds:DOSGROUP
   166 0000002B B001                    	mov	al, 1			; assume drive 0
   167 0000002D D2E0                    	shl	al, cl			; set proper bit depending on drive
   168 0000002F 0806[0000]              	or	[EC35_Flag], al	; set the bit in the permanent flags
   169                                  
   170                                  Not_EC35:
   171 00000033 5A                      	pop	dx			; fix up all the registers
   172 00000034 59                      	pop	cx
   173 00000035 5B                      	pop	bx
   174 00000036 58                      	pop	ax
   175 00000037 1F                      	pop	ds
   176                                   assume ds:nothing
   177 00000038 C3                      	ret
   178                                  
   179                                  ;
   180                                  ; Replace default values for further DRIVPARM commands
   181                                  ;
   182                                  sysinit_DiddleBack:
   183                                   assume ds:nothing
   184 00000039 1E                      	push	ds
   185 0000003A 0E                      	push	cs
   186 0000003B 1F                      	pop	ds
   187                                   assume ds:SYSINITGROUP
   188                                  DP_Cylinders equ DP_CYLINDERS	; NASM port equate
   189 0000003C C706[0E0B]5000          	mov	word [DeviceParameters + DP_Cylinders],80
   190                                  DP_DeviceType equ DP_DEVICETYPE	; NASM port equate
   191 00000042 C606[0B0B]02            	mov	byte [DeviceParameters + DP_DeviceType], DEV_3INCH720KB
   192                                  DP_DeviceAttributes equ DP_DEVICEATTRIBUTES	; NASM port equate
   193 00000047 C706[0C0B]0000          	mov	word [DeviceParameters + DP_DeviceAttributes],0
   194                                  switches equ Switches	; NASM port label
   195 0000004D C706[330C]0000          	mov	word [switches],0	    ; zero all switches
   196 00000053 1F                      	pop	ds
   197                                   assume ds:nothing
   198 00000054 C3                      	ret
   199                                  
   200                                  ;
   201                                  ; Entry point is ParseLine. AL contains the first character in command line.
   202                                  ;
   203                                  ParseLine:			    ; don't get character first time
   204                                   assume ds:nothing
   205 00000055 1E                      	push	ds
   206 00000056 0E                      	push	cs
   207 00000057 1F                      	pop	ds
   208                                   ASSUME DS:SYSINITGROUP
   209                                  NextSwtch:
   210 00000058 3C0D                    	cmp	al,CR			; carriage return?
   211 0000005A 7422                    	jz	done_line
   212 0000005C 3C0A                    	cmp	al,LF			; linefeed?
   213 0000005E 743E                    	jz	put_back		; put it back and done
   214                                  ; Anything less or equal to a space is ignored.
   215 00000060 3C20                    	cmp	al,' '                  ; space?
   216 00000062 7610                    	jbe	get_next		; skip over space
   217 00000064 3C2F                    	cmp	al,'/'
   218 00000066 7403                    	jz	getparm
   219 00000068 F9                      	stc			    ; mark error invalid-character-in-input
   220 00000069 EB31                    	jmp	short exitpl
   221                                  
   222                                  getparm:
   223 0000006B E83A00                  	call	Check_Switch
   224 0000006E 891E[330C]              	mov	word ptr [Switches],BX	     ; save switches read so far
   225 00000072 7207                    	jc	swterr
   226                                  get_next:
   227 00000074 E8(0000)                	invoke	getchr
   228 00000077 7205                    	jc	done_line
   229 00000079 EBDD                    	jmp	NextSwtch
   230                                  swterr:
   231 0000007B EB1F                    	jmp	exitpl		    ; exit if error
   232 0000007D 90                      	nop	; identicalise
   233                                  
   234                                  done_line:
   235 0000007E F706[330C]0800          	test	word [Switches],flagdrive  ; see if drive specified
   236 00000084 7503                    	jnz	okay
   237 00000086 F9                      	stc			    ; mark error no-drive-specified
   238 00000087 EB13                    	jmp	short exitpl
   239                                  
   240                                  okay:
   241 00000089 A1[330C]                	mov	ax,word ptr [switches]
   242 0000008C 83E003                  	and	ax,0003H	    ; get flag bits for changeline and non-rem
   243 0000008F A3[0C0B]                	mov	word ptr [DeviceParameters + DP_DeviceAttributes],ax
   244                                  DP_TrackTableEntries equ DP_TRACKTABLEENTRIES	; NASM port equate
   245 00000092 C706[300B]0000          	mov	word [DeviceParameters + DP_TrackTableEntries], 0
   246 00000098 F8                      	clc			    ; everything is fine
   247 00000099 E8A000                  	call	sysinit_SetDeviceParameters
   248                                  exitpl:
   249 0000009C 1F                      	pop	ds
   250                                   assume ds:nothing
   251 0000009D C3                      	ret
   252                                  
   253                                  put_back:
   254                                   assume ds:SYSINITGROUP
   255 0000009E FF06[0000]              	inc	word [count]			; one more char to scan
   256 000000A2 FF0E[0000]              	dec	word [chrptr]			; back up over linefeed
   257 000000A6 EBD6                    	jmp	short done_line
   258                                  ;
   259                                  ; Processes a switch in the input. It ensures that the switch is valid, and
   260                                  ; gets the number, if any required, following the switch. The switch and the
   261                                  ; number *must* be separated by a colon. Carry is set if there is any kind of
   262                                  ; error.
   263                                  ;
   264                                  Check_Switch:
   265 000000A8 E8(0000)                	invoke	getchr
   266 000000AB 7252                    	jc	err_check
   267 000000AD 24DF                    	and	al,0DFH 	    ; convert it to upper case
   268 000000AF 3C41                    	cmp	al,'A'
   269 000000B1 724C                    	jb	err_check
   270 000000B3 3C5A                    	cmp	al,'Z'
   271 000000B5 7748                    	ja	err_check
   272 000000B7 06                      	push	es
   273 000000B8 0E                      	push	cs
   274 000000B9 07                      	pop	es
   275                                   assume es:SYSINITGROUP
   276 000000BA 8A0E[A90C]              	mov	cl,byte ptr [switchlist]	     ; get number of valid switches
   277 000000BE B500                    	mov	ch,0
   278 000000C0 BF[AA0C]                	mov	di,1+offset switchlist	; point to string of valid switches
   279 000000C3 F2AE                    	repne	scasb
   280 000000C5 07                      	pop	es
   281                                   assume es:nothing
   282 000000C6 7537                    	jnz	err_check
   283 000000C8 B80100                  	mov	ax,1
   284 000000CB D3E0                    	shl	ax,cl		; set bit to indicate switch
   285 000000CD 8B1E[330C]              	mov	bx,word ptr [switches]	 ; get switches so far
   286 000000D1 09C3                    	or	bx,ax		; save this with other switches
   287 000000D3 89C1                    	mov	cx,ax
   288 000000D5 A9F800                  	test	ax, switchnum	; test against switches that require number to follow
   289 000000D8 90                      	nop	; identicalise
   290 000000D9 7420                    	jz	done_swtch
   291 000000DB E8(0000)                	invoke	getchr
   292                                  err_Swtch equ err_swtch	; NASM port label
   293 000000DE 721D                    	jc	err_Swtch
   294 000000E0 3C3A                    	cmp	al,':'
   295 000000E2 7519                    	jnz	err_swtch
   296 000000E4 E8(0000)                	invoke	getchr
   297 000000E7 53                      	push	bx			; preserve switches
   298 000000E8 2EC606[0000]20          	mov	byte [cs:sepchr],' '          ; allow space separators
   299 000000EE E81304                  	call	GetNum
   300 000000F1 2EC606[0000]00          	mov	byte [cs:sepchr],0
   301 000000F7 5B                      	pop	bx			; restore switches
   302                                  ; Because GetNum does not consider carriage-return or line-feed as OK, we do
   303                                  ; not check for carry set here. If there is an error, it will be detected
   304                                  ; further on (hopefully).
   305 000000F8 E80600                  	call	Process_Num
   306                                  
   307                                  done_swtch:
   308 000000FB F8                      	clc
   309 000000FC C3                      	ret
   310                                  
   311                                  err_swtch:
   312 000000FD 31CB                    	xor	bx,cx			; remove this switch from the records
   313                                  err_check:
   314 000000FF F9                      	stc
   315 00000100 C3                      	ret
   316                                  
   317                                  ;
   318                                  ; This routine takes the switch just input, and the number following (if any),
   319                                  ; and sets the value in the appropriate variable. If the number input is zero
   320                                  ; then it does nothing - it assumes the default value that is present in the
   321                                  ; variable at the beginning. Zero is OK for form factor and drive, however.
   322                                  ;
   323                                  Process_Num:
   324 00000101 850E[330C]              	test	word ptr [Switches],cx	 ; if this switch has been done before,
   325 00000105 7533                    	jnz	done_ret	    ; ignore this one.
   326 00000107 F7C10800                	test	cx,flagdrive
   327 0000010B 7405                    	jz	try_f
   328 0000010D A2[320C]                	mov	byte ptr [sysinit_drive],al
   329 00000110 EB28                    	jmp	short done_ret
   330                                  
   331                                  try_f:
   332 00000112 F7C18000                	test	cx,flagff
   333 00000116 7405                    	jz	try_t
   334                                  ; Ensure that we do not get bogus form factors that are not supported
   335                                  	;cmp	al,Max_Dev_Type
   336                                  	;ja	done_ret
   337 00000118 A2[0B0B]                	mov	byte ptr [DeviceParameters + DP_DeviceType],al
   338 0000011B EB1D                    	jmp	short done_ret
   339                                  
   340                                  try_t:
   341 0000011D 09C0                    	or	ax,ax
   342 0000011F 7419                    	jz	done_ret	    ; if number entered was 0, assume default value
   343 00000121 F7C11000                	test	cx,flagcyln
   344 00000125 7405                    	jz	try_s
   345 00000127 A3[0E0B]                	mov	word ptr [DeviceParameters + DP_Cylinders],ax
   346 0000012A EB0E                    	jmp	short done_ret
   347                                  
   348                                  try_s:
   349 0000012C F7C12000                	test	cx,flagseclim
   350 00000130 7405                    	jz	try_h
   351 00000132 A3[300C]                	mov	word ptr [slim],ax
   352 00000135 EB03                    	jmp	short done_ret
   353                                  ;
   354                                  ; Must be for number of heads
   355                                  try_h:
   356 00000137 A3[2E0C]                	mov	word ptr [hlim],ax
   357                                  
   358                                  done_ret:
   359 0000013A F8                      	clc
   360 0000013B C3                      	ret
   361                                  
   362                                  ;
   363                                  ; sysinit_SetDeviceParameters sets up the recommended BPB in each BDS in the
   364                                  ; system based on the form factor. It is assumed that the BPBs for the
   365                                  ; various form factors are present in the BPBTable. For hard files,
   366                                  ; the Recommended BPB is the same as the BPB on the drive.
   367                                  ; No attempt is made to preserve registers since we are going to jump to
   368                                  ; SYSINIT straight after this routine.
   369                                  ;
   370                                  sysinit_SetDeviceParameters:
   371                                   assume ds:SYSINITGROUP, es:nothing
   372 0000013C 06                      	push	es
   373 0000013D 0E                      	push	cs
   374 0000013E 07                      	pop	es
   375                                   ASSUME ES:SYSINITGROUP
   376 0000013F 31DB                    	xor	bx,bx
   377 00000141 8A1E[0B0B]              	mov	bl,byte ptr [DeviceParameters + DP_DeviceType]
   378 00000145 80FB00                  	cmp	bl,DEV_5INCH
   379 00000148 7507                    	jnz	Got_80
   380 0000014A B92800                  	mov	cx,40			; 48tpi has 40 cylinders
   381 0000014D 890E[0E0B]              	mov	word ptr [DeviceParameters + DP_Cylinders],cx
   382                                  Got_80:
   383 00000151 D1E3                    	shl	bx,1			; get index into BPB table
   384 00000153 BE[990C]                	mov	si,offset sysinit_BPBTable
   385 00000156 8B30                    	mov	si,word ptr [si+bx]	; get address of BPB
   386                                  .Set_RecBPB:
   387 00000158 BF[110B]                	mov	di,offset DeviceParameters + DP_BPB	 ; es:di -> BPB
   388                                  a_BPB_struc_size equ A_BPB_struc_size	; NASM port equate
   389 0000015B B91F00                  	mov	cx,a_BPB_struc_size
   390 0000015E FC                      	cld
   391 0000015F F3A4                    	repe	movsb
   392 00000161 07                      	pop	es
   393                                  ASSUME ES:NOTHING
   394 00000162 F706[330C]2000          	test	word [switches],flagseclim
   395 00000168 7406                    	jz	see_heads
   396 0000016A A1[300C]                	mov	ax,word ptr [slim]
   397                                  BPB_SectorsPerTrack equ BPB_SECTORSPERTRACK	; NASM port equate
   398 0000016D A3[1E0B]                	mov	word ptr [DeviceParameters + DP_BPB + BPB_SectorsPerTrack],ax
   399                                  see_heads:
   400 00000170 F706[330C]4000          	test	word [switches],flagheads
   401 00000176 743E                    	jz	Set_All_Done
   402 00000178 A1[2E0C]                	mov	ax,word ptr [hlim]
   403                                  BPB_Heads equ BPB_HEADS	; NASM port equate
   404 0000017B A3[200B]                	mov	word ptr [DeviceParameters + DP_BPB + BPB_Heads],ax
   405                                  ;
   406                                  ; We need to set the media byte and the total number of sectors to reflect the
   407                                  ; number of heads. We do this by multiplying the number of heads by the number
   408                                  ; of 'sectors per head'. This is not a fool-proof scheme!!
   409                                  ;
   410 0000017E 89C1                    	mov	cx,ax			; cx has number of heads
   411 00000180 FEC9                    	dec	cl			; get it 0-based
   412                                  BPB_TotalSectors equ BPB_TOTALSECTORS	; NASM port equate
   413 00000182 A1[190B]                	mov	ax,[DeviceParameters + DP_BPB + BPB_TotalSectors]	; this is OK for two heads
   414 00000185 D1F8                    	sar	ax,1			; ax contains # of sectors/head
   415 00000187 D3E0                    	sal	ax,cl
   416 00000189 722B                    	jc	Set_All_Done		; We have too many sectors - overflow!!
   417 0000018B A3[190B]                	mov	[DeviceParameters + DP_BPB + BPB_TotalSectors],ax
   418                                  ; Set up correct Media Descriptor Byte
   419 0000018E 80F901                  	cmp	cl,1
   420 00000191 B3F0                    	mov	bl,0F0H
   421 00000193 B002                    	mov	al,2			; AL contains sectors/cluster
   422 00000195 7717                    	ja	Got_Correct_Mediad
   423                                  BPB_MediaDescriptor equ BPB_MEDIADESCRIPTOR	; NASM port equate
   424 00000197 8A1E[1B0B]              	mov	bl,byte ptr [DeviceParameters + DP_BPB + BPB_MediaDescriptor]
   425 0000019B 7411                    	je	Got_Correct_Mediad
   426                                  ; We have one head - OK for 48tpi medium
   427 0000019D B001                    	mov	al,1			; AL contains sectors/cluster
   428 0000019F 8A2E[0B0B]              	mov	ch,[DeviceParameters + DP_DeviceType]
   429 000001A3 80FD00                  	cmp	ch,DEV_5INCH
   430 000001A6 7404                    	jz	Dec_Mediad
   431 000001A8 B3F0                    	mov	bl,0F0H
   432 000001AA EB02                    	jmp	short Got_Correct_Mediad
   433                                  Dec_Mediad:
   434 000001AC FECB                    	dec	bl			; adjust for one head
   435                                  Got_Correct_Mediad:
   436 000001AE 881E[1B0B]              	mov	byte ptr [DeviceParameters + DP_BPB + BPB_MediaDescriptor],bl
   437                                  BPB_SectorsPerCluster equ BPB_SECTORSPERCLUSTER	; NASM port equate
   438 000001B2 A2[130B]                	mov	byte ptr [DeviceParameters + DP_BPB + BPB_SectorsPerCluster],al
   439 000001B5 F8                      	clc
   440                                  Set_All_Done:
   441 000001B6 C3                      	RET
   442                                  
   443                                  ASSUME DS:NOTHING, ES:NOTHING
   444                                  
   445 000001B7 F9                      NOCHAR1: STC
   446 000001B8 C3                      	 return
   447                                  
   448                                  ORGANIZE:
   449                                   assume ds:nothing, es:nothing, ss:SYSINITGROUP
   450                                  COUNT equ count	; NASM port label
   451 000001B9 2E8B0E[0000]            	MOV	CX,[cs:COUNT]
   452 000001BE E3F7                    	JCXZ	NOCHAR1
   453 000001C0 E86D02                  	CALL	MAPCASE
   454 000001C3 31F6                    	XOR	SI,SI
   455 000001C5 89F7                    	MOV	DI,SI
   456 000001C7 31C0                    	xor	ax,ax
   457 000001C9 2EC606[0000]00          	mov	byte [cs:COM_Level], 0
   458                                  
   459                                  ;ORG1:	 CALL	 GET			 ;SKIP LEADING CONTROL CHARACTERS
   460                                  ;	 CMP	 AL,' '
   461                                  ;	 JB	 ORG1
   462                                  Org1:
   463 000001CF E8E801                  	call	Skip_Comment		;AN000;
   464 000001D2 740E                    	jz	End_Commd_Line		;AN000; found a comment string and skipped.
   465                                  Get2 equ GET2	; NASM port label
   466 000001D4 E8DB01                  	call	Get2			;AN000; Not a comment string. Then get a char.
   467 000001D7 3C0A                    	cmp	al, LF			;AN000;
   468 000001D9 7407                    	je	End_Commd_Line		;AN000; starts with a blank line.
   469 000001DB 3C20                    	cmp	al, ' '                 ;AN000;
   470 000001DD 76F0                    	jbe	Org1			;AN000; skip leading control characters
   471 000001DF EB0A                    	jmp	org1_Findit		;AN000;
   472 000001E1 90                      	nop	; identicalise
   473                                  End_Commd_Line: 			;AN000;
   474 000001E2 AA                      	stosb				;AN000; store line feed char in buffer for the LineCount.
   475 000001E3 2EC606[0000]00          	mov	byte [cs:COM_Level], 0		;AN000; reset the command level.
   476 000001E9 EBE4                    	jmp	Org1			;AN000;
   477                                  org1_Findit:				;AN000;
   478 000001EB 51                      	PUSH	CX
   479 000001EC 56                      	PUSH	SI
   480 000001ED 57                      	PUSH	DI
   481 000001EE 89F5                    	MOV	BP,SI
   482 000001F0 4D                      	DEC	BP
   483 000001F1 BE[D009]                	MOV	SI,OFFSET COMTAB	;Prepare to search command table
   484 000001F4 B500                    	MOV	CH,0
   485                                  FINDCOM:
   486 000001F6 89EF                    	MOV	DI,BP
   487 000001F8 8A0C                    	MOV	CL,[SI]
   488 000001FA 46                      	INC	SI
   489 000001FB E324                    	JCXZ	NOCOM
   490 000001FD F3A6                    	REPE	CMPSB
   491 000001FF 9F                      	LAHF
   492 00000200 01CE                    	ADD	SI,CX			;Bump to next position without affecting flags
   493 00000202 9E                      	SAHF
   494 00000203 AC                      	LODSB				;Get indicator letter
   495 00000204 75F0                    	JNZ	FINDCOM
   496 00000206 26803D0D                	cmp	byte ptr [es:di], CR	;AN011;The next char might be CR,LF
   497 0000020A 7410                    	je	GotCom0 		;AN011; such as in "REM",CR,LF case.
   498 0000020C 26803D0A                	cmp	byte ptr [es:di], LF	;AN011;
   499 00000210 740A                    	je	GotCom0 		;AN011;
   500 00000212 50                      	push	ax			;AN010;
   501 00000213 268A05                  	mov	al, byte ptr [es:di]	;AN010;Now the next char. should be a delim.
   502                                  delim equ DELIM	; NASM port label
   503 00000216 E8DC01                  	call	delim			;AN010;
   504 00000219 58                      	pop	ax			;AN010;
   505                                  findcom equ FINDCOM	; NASM port label
   506 0000021A 75DA                    	jnz	findcom 		;AN010;
   507                                  GotCom0:
   508 0000021C 5F                      	POP	DI
   509 0000021D 5E                      	POP	SI
   510 0000021E 59                      	POP	CX
   511 0000021F EB0F                    	JMP	SHORT GOTCOM
   512                                  
   513                                  NOCOM:
   514 00000221 5F                      	POP	DI
   515 00000222 5E                      	POP	SI
   516 00000223 59                      	POP	CX
   517 00000224 B05A                    	MOV	AL,'Z'
   518 00000226 AA                      	stosb				;AN000; save indicator char.
   519                                  Skip_Line:				;AN000;
   520 00000227 E88801                  	call	Get2			;AN000;
   521 0000022A 3C0A                    	cmp	al, LF			;AN000; skip this bad command line
   522 0000022C 75F9                    	jne	Skip_Line		;AN000;
   523 0000022E EBB2                    	jmp	End_Commd_Line		;AN000; handle next command line
   524                                  
   525 00000230 AA                      GOTCOM: STOSB				;SAVE INDICATOR CHAR IN BUFFER
   526 00000231 2EA2[0000]              	mov	[cs:Cmd_Indicator], al	;AN000; save it for the future use.
   527                                  
   528 00000235 E87A01                  ORG2:	CALL	GET2			;SKIP the commad name UNTIL DELIMITER
   529 00000238 3C0A                    	cmp	al, LF			;AN011;
   530 0000023A 740B                    	je	Org21			;AN011;
   531 0000023C 3C0D                    	cmp	al, CR			;AN011;
   532 0000023E 7407                    	je	Org21			;AN011;
   533 00000240 E8B201                  	CALL	DELIM			;
   534 00000243 75F0                    	JNZ	ORG2
   535 00000245 EB02                    	jmp	short	Org3		;AN011;
   536                                  Org21:					;AN011;if CR or LF then
   537 00000247 4E                      	dec	si			;AN011; undo SI, CX register
   538 00000248 41                      	inc	cx			;AN011;  and continue
   539                                  
   540                                  ;ORG4:	 CALL	 GET2
   541                                  ;	 call	 Delim			 ;J.K. 5/30/86. To permit "device=filename/p..." stuff.
   542                                  ;	 jz	 ORG_EXT		 ;J.K. 5/30/86
   543                                  ;Org4_Cont:
   544                                  ;	 STOSB
   545                                  ;	 CMP	 AL,' '
   546                                  ;	 JA	 ORG4
   547                                  ;	 CMP	 AL,10
   548                                  ;	 JZ	 ORG1
   549                                  ;
   550                                  ;	 MOV	 BYTE PTR [ES:DI-1],0
   551                                  
   552                                  Org3:
   553 00000249 2E803E[0000]59          	cmp	byte [cs:Cmd_Indicator], 'Y'      ;AN000; Comment= command?
   554                                  Get_Cmt_Token equ Get_Cmt_token	; NASM port label
   555 0000024F 7503E9B900              	je	Get_Cmt_Token		;AN000;
   556 00000254 2E803E[0000]69          	cmp	byte [cs:Cmd_Indicator], 'i'      ; InstallHigh= command?
   557 0000025A 747F                    	je	Org_file
   558 0000025C 2E803E[0000]49          	cmp	byte [cs:Cmd_Indicator], 'I'      ;AN000; Install= command?
   559 00000262 7477                    	je	Org_file		;AN000;
   560 00000264 2E803E[0000]E9          	cmp	byte [cs:Cmd_Indicator], 'i' | 80h; InstallLastHigh= command?
   561 0000026A 746F                    	je	Org_file
   562 0000026C 2E803E[0000]C9          	cmp	byte [cs:Cmd_Indicator], 'I' | 80h; InstallLast= command?
   563 00000272 7467                    	je	Org_file		;AN000;
   564 00000274 2E803E[0000]34          	cmp	byte [cs:Cmd_Indicator], '4'	; InstallFirstHigh= command?
   565 0000027A 745F                    	je	Org_file
   566 0000027C 2E803E[0000]33          	cmp	byte [cs:Cmd_Indicator], '3'	; InstallFirst= command?
   567 00000282 7457                    	je	Org_file
   568 00000284 2E803E[0000]36          	cmp	byte [cs:Cmd_Indicator], '6'	; InstallMidHigh= command?
   569 0000028A 744F                    	je	Org_file
   570 0000028C 2E803E[0000]35          	cmp	byte [cs:Cmd_Indicator], '5'	; InstallMid= command?
   571 00000292 7447                    	je	Org_file
   572 00000294 2E803E[0000]64          	cmp	byte [cs:Cmd_Indicator], 'd'	; DEVICEHIGH= command?
   573 0000029A 743F                    	je	Org_file		;AN000;
   574 0000029C 2E803E[0000]44          	cmp	byte [cs:Cmd_Indicator], 'D'      ;AN000; Device= command?
   575 000002A2 7437                    	je	Org_file		;AN000;
   576 000002A4 2E803E[0000]4A          	cmp	byte [cs:Cmd_Indicator], 'J'      ;AN000; IFS= command?
   577 000002AA 742F                    	je	Org_file		;AN000;
   578 000002AC 2E803E[0000]73          	cmp	byte [cs:Cmd_Indicator], 's'
   579 000002B2 7427                    	je	Org_file
   580 000002B4 2E803E[0000]53          	cmp	byte [cs:Cmd_Indicator], 'S'      ;AN000; Shell= is a special one!!!
   581 000002BA 741F                    	je	Org_file		;AN000;
   582 000002BC 2E803E[0000]31          	cmp	byte [cs:Cmd_Indicator], '1'      ;AN013; SWITCHES= command?
   583 000002C2 7403                    	je	Org_Switch		;AN013;
   584 000002C4 E9AA00                  	jmp	Org4			;AN000;
   585                                  Org_Switch:
   586 000002C7 E8F000                  	call	Skip_Comment		;AN013;
   587 000002CA 7503E98200              	jz	End_Commd_Line_Brdg	;AN013;
   588 000002CF E8E000                  	call	Get2			;AN013;
   589 000002D2 E82801                  	call	Org_Delim		;AN013;
   590 000002D5 74F0                    	jz	Org_Switch		;AN013;
   591 000002D7 AA                      	stosb				;AN013;
   592 000002D8 E9A600                  	jmp	Org5			;AN013;
   593                                  Org_file:				;AN000; Get the filename and put 0 at end,
   594 000002DB E8DC00                  	call	Skip_Comment		;AN000;
   595 000002DE 7474                    	jz	Org_Put_Zero		;AN000;
   596 000002E0 E8CF00                  	call	Get2			;AN000; Not a comment
   597 000002E3 3C0D                    	cmp al, 13
   598 000002E5 740B                    	je .zero
   599 000002E7 3C0A                    	cmp al, 10
   600 000002E9 7407                    	je .zero
   601 000002EB E80701                  	call	Delim			;AN000;
   602 000002EE 74EB                    	jz	Org_file		;AN000; Skip the possible delimeters
   603 000002F0 AA                      	stosb				;AN000; copy the first non delim char found in buffer
   604 000002F1 A9                      	db __TEST_IMM16			; skip dec, inc
   605                                  .zero:
   606 000002F2 4E                      	dec si
   607 000002F3 41                      	inc cx
   608                                  Org_Copy_File:				;AN000;
   609 000002F4 E8C300                  	call	Skip_Comment		;AN000; comment char in the filename?
   610 000002F7 745B                    	jz	Org_Put_Zero		;AN000; then stop copying filename at that point
   611 000002F9 E8B600                  	call	Get2			;AN000;
   612 000002FC 3C2F                    	cmp	al, '/'                 ;AN000; a switch char? (device=filename/xxx)
   613                                  End_File_slash equ End_file_slash	; NASM port label
   614 000002FE 745C                    	je	End_File_slash		;AN000; this will be the special case.
   615 00000300 AA                      	stosb				;AN000; save the char. in buffer
   616 00000301 E8F100                  	call	Delim			;AN000;
   617 00000304 745F                    	jz	End_Copy_File		;AN000;
   618 00000306 3C20                    	cmp	al, ' '                 ;AN000;
   619 00000308 77EA                    	ja	Org_Copy_File		;AN000; keep copying
   620 0000030A EB59                    	jmp	End_Copy_File		;AN000; otherwise, assume end of the filename.
   621 0000030C 90                      	nop	; identicalise
   622                                  Get_Cmt_token:				;AN000; get the token. Just max. 2 char.
   623 0000030D E8A200                  	call	Get2			;AN000;
   624 00000310 3C20                    	cmp	al, ' '                 ;AN000; skip white spaces or "=" char.
   625 00000312 74F9                    	je	Get_Cmt_Token		;AN000; (we are allowing the other special
   626 00000314 3C09                    	cmp	al, TAB 		;AN000;  charaters can used for comment id.
   627 00000316 74F5                    	je	Get_Cmt_Token		;AN000;  character.)
   628 00000318 3C3D                    	cmp	al, '='                 ;AN000; = is special in this case.
   629 0000031A 74F1                    	je	Get_Cmt_Token		;AN000;
   630 0000031C 3C0D                    	cmp	al, CR			;AN000;
   631 0000031E 742A                    	je	Get_Cmt_End		;AN000; cannot accept the carridge return
   632 00000320 3C0A                    	cmp	al, LF			;AN000;
   633 00000322 7426                    	je	Get_Cmt_End		;AN000;
   634 00000324 2EA2[0000]              	mov	[cs:CMMT1], al		;AN000; store it
   635 00000328 2EC606[0000]01          	mov	byte [cs:CMMT], 1 		;AN000; 1 char. so far.
   636 0000032E E88100                  	call	Get2			;AN000;
   637 00000331 3C20                    	cmp	al, ' '                 ;AN000;
   638 00000333 7415                    	je	Get_Cmt_End		;AN000;
   639 00000335 3C09                    	cmp	al, TAB 		;AN000;
   640 00000337 7411                    	je	Get_Cmt_End		;AN000;
   641 00000339 3C0D                    	cmp	al, CR			;AN000;
   642 0000033B 740D                    	je	Get_Cmt_End		;AN000;
   643 0000033D 3C0A                    	cmp	al, LF			;AN000;
   644 0000033F 7410                    	je	End_Commd_Line_Brdg	;AN000;
   645 00000341 2EA2[0000]              	mov	[cs:CMMT2], al		;AN000;
   646 00000345 2EFE06[0000]            	inc	byte [cs:CMMT]			;AN000;
   647                                  Get_Cmt_End:				;AN000;
   648 0000034A E86500                  	call	Get2			;AN000;
   649 0000034D 3C0A                    	cmp	al, LF			;AN000;
   650 0000034F 75F9                    	jne	Get_Cmt_End		;AN000; skip it.
   651 00000351 E98EFE                  End_Commd_Line_Brdg: jmp End_Commd_Line ;AN000; else jmp to End_Commd_Line
   652                                  
   653                                  Org_Put_Zero:				;AN000; Make the filename in front of
   654 00000354 26C60500                	mov	byte ptr [es:di], 0	;AN000;  the comment string to be an asciiz.
   655 00000358 47                      	inc	di			;AN000;
   656 00000359 E986FE                  	jmp	End_Commd_Line		;AN000;  (Maybe null if device=/*)
   657                                  End_file_slash: 			;AN000; AL = "/" option char.
   658 0000035C 26C60500                	mov	byte ptr [es:di],0	;AN000; make a filename an asciiz
   659 00000360 47                      	inc	di			;AN000; and
   660 00000361 AA                      	stosb				;AN000; store "/" after that.
   661 00000362 EB1D                    	jmp	Org5			;AN000; continue with the rest of the line
   662 00000364 90                      	nop	; identicalise
   663                                  
   664                                  End_Copy_File:				;AN000;
   665 00000365 26C645FF00              	mov	byte ptr [es:di-1], 0	;AN000; make it an asciiz and handle the next char.
   666 0000036A 3C0A                    	cmp	al, LF			;AN000;
   667                                  End_Commd_Line_brdg equ End_Commd_Line_Brdg	; NASM port label
   668 0000036C 74E3                    	je	End_Commd_Line_brdg	;AN000;
   669 0000036E EB11                    	jmp	Org5			;AN000;
   670 00000370 90                      	nop	; identicalise
   671                                  
   672                                  Org4:					;AN000; Org4 skips all delimiters after the command name except for '/'
   673 00000371 E84600                  	call	Skip_Comment		;AN000;
   674 00000374 74DB                    	jz	End_Commd_Line_brdg	;AN000;
   675 00000376 E83900                  	call	Get2			;AN000;
   676 00000379 E88100                  	call	Org_Delim		;AN000; skip delimiters EXCEPT '/' (mrw 4/88)
   677 0000037C 74F3                    	jz	Org4			;AN000;
   678 0000037E EB09                    	jmp	Org51			;AN000;
   679 00000380 90                      	nop	; identicalise
   680                                  Org5:					;AN000; rest of the line
   681 00000381 E83600                  	call	Skip_Comment		;AN000; Comment?
   682 00000384 74CB                    	jz	End_Commd_Line_brdg	;AN000;
   683 00000386 E82900                  	call	Get2			;AN000; Not a comment.
   684                                  Org51:					;AN000;
   685 00000389 AA                      	stosb				;AN000; copy the character
   686 0000038A 3C22                    	cmp	al, '"'                 ;AN000; a quote ?
   687 0000038C 740D                    	je	At_Quote		;AN000;
   688 0000038E 3C20                    	cmp	al, ' '                 ;AN000;
   689 00000390 77EF                    	ja	Org5			;AN000;
   690 00000392 3C0A                    	cmp	al, LF			;AN000; line feed?
   691 00000394 7402                    	je	Org1_brdg		;AN000; handles the next command line.
   692 00000396 EBE9                    	jmp	Org5			;AN000; handles next char in this line.
   693 00000398 E934FE                  Org1_brdg: jmp	 Org1			;AN000;
   694                                  At_Quote:				;AN000;
   695 0000039B 2E803E[0000]00          	cmp	byte [cs:COM_Level], 0		;AN000;
   696 000003A1 7408                    	je	Up_Level		;AN000;
   697 000003A3 2EC606[0000]00          	mov	byte [cs:COM_Level], 0		;AN000; reset it.
   698 000003A9 EBD6                    	jmp	Org5			;AN000;
   699                                  Up_Level:				;AN000;
   700                                  COM_level equ COM_Level	; NASM port label
   701 000003AB 2EFE06[0000]            	inc	byte [cs:COM_level]		;AN000; set it.
   702 000003B0 EBCF                    	jmp	Org5			;AN000;
   703                                  
   704                                  
   705                                  ;ORG5:	 CALL	 GET2
   706                                  ;	 STOSB
   707                                  ;	 CMP	 AL,10
   708                                  ;	 JNZ	 ORG5
   709                                  ;	 JMP	 ORG1
   710                                  ;
   711                                  ;ORG_EXT:
   712                                  ;	 cmp	 al,' '                  ;space?
   713                                  ;	 je	 Org4_Cont		 ;then do not make an exception. Go back.
   714                                  ;	 cmp	 al,9			 ;Tab?
   715                                  ;	 je	 Org4_Cont
   716                                  ;	 mov	 byte ptr [es:di], 0	 ;put 0 at the current DI to make it an ASCIIZ
   717                                  ;	 inc	 DI			 ;
   718                                  ;	 stosb				 ;and copy the delimeter char.
   719                                  ;	 jmp	 short ORG5		 ;and continue as usual.
   720                                  
   721                                  
   722                                  GET2:
   723                                   assume ds:nothing, es:nothing, ss:SYSINITGROUP
   724 000003B2 E35C                    	JCXZ	NOGET
   725 000003B4 268A04                  	MOV	AL,[ES:SI]
   726 000003B7 46                      	INC	SI
   727 000003B8 49                      	DEC	CX
   728 000003B9 C3                      	return
   729                                  
   730                                  ;GET:	 JCXZ	 NOGET
   731                                  ;	 MOV	 AL,[ES:SI]
   732                                  ;	 INC	 SI
   733                                  ;	 DEC	 CX
   734                                  ;	 CALL	 Org_DELIM
   735                                  ;	 JZ	 GET
   736                                  ;	 return
   737                                  
   738                                  Skip_Comment:
   739                                  ;J.K.Skip the commented string until LF, if current es:si-> a comment string.
   740                                  ;J.K.In) ES:SI-> sting
   741                                  ;J.K.	 CX -> length.
   742                                  ;J.K.Out) Zero flag not set if not found a comment string.
   743                                  ;J.K.	  Zero flag set if found a comment string and skipped it. AL will contain
   744                                  ;J.K.	  the line feed charater at this moment when return.
   745                                  ;J.K.	  AX register destroyed.
   746                                  ;J.K.	  If found, SI, CX register adjusted accordingly.
   747                                  
   748                                  NoGet equ NOGET	; NASM port label
   749 000003BA E354                    	jcxz	NoGet		;AN000; Get out of the Organize routine.
   750 000003BC 2E803E[0000]00          	cmp	byte [cs:COM_Level], 0	;AN000; only check it if parameter level is 0.
   751 000003C2 7530                    	jne	No_Commt	;AN000;  (Not inside quotations)
   752                                  
   753 000003C4 2E803E[0000]01          	cmp	byte [cs:CMMT], 1 	;AN000;
   754 000003CA 7228                    	jb	No_Commt	;AN000;
   755 000003CC 268A04                  	mov	al, [es:si]	;AN000;
   756 000003CF 2E3806[0000]            	cmp	[cs:CMMT1], al	;AN000;
   757 000003D4 751E                    	jne	No_Commt	;AN000;
   758 000003D6 2E803E[0000]02          	cmp	byte [cs:CMMT], 2 	;AN000;
   759 000003DC 750B                    	jne	Skip_Cmmt	;AN000;
   760 000003DE 268A4401                	mov	al, [es:si+1]	;AN000;
   761 000003E2 2E3806[0000]            	cmp	[cs:CMMT2], al	;AN000;
   762 000003E7 750B                    	jne	No_Commt	;AN000;
   763                                  Skip_Cmmt:			;AN000;
   764 000003E9 E325                    	jcxz	NoGet		;AN000; get out of Organize routine.
   765 000003EB 268A04                  	mov	al, [es:si]	;AN000;
   766 000003EE 46                      	inc	si		;AN000;
   767 000003EF 49                      	dec	cx		;AN000;
   768 000003F0 3C0A                    	cmp	al, LF		;AN000; line feed?
   769 000003F2 75F5                    	jne	Skip_Cmmt	;AN000;
   770                                  No_Commt:			;AN000;
   771 000003F4 C3                      	ret			;AN000;
   772                                  
   773                                  
   774                                  DELIM:
   775 000003F5 3C2F                    	CMP	AL,'/'          ;J.K. 5/30/86. IBM will assume "/" as an delimeter.
   776 000003F7 74C0                    	retz
   777 000003F9 3C00                    	cmp	al, 0		;J.K. 5/23/86 Special case for sysinit!!!
   778 000003FB 74BC                    	retz
   779                                  Org_Delim:			;AN000;  Used by Organize routine except for getting
   780 000003FD 3C20                    	CMP	AL,' '          ;the filename.
   781 000003FF 74B8                    	retz
   782 00000401 3C09                    	CMP	AL,9
   783 00000403 74B4                    	retz
   784 00000405 3C3D                    	CMP	AL,'='
   785 00000407 74B0                    	retz
   786 00000409 3C2C                    	CMP	AL,','
   787 0000040B 74AC                    	retz
   788 0000040D 3C3B                    	CMP	AL,';'
   789 0000040F C3                      	return
   790                                  
   791                                  
   792 00000410 59                      NOGET:	POP	CX
   793 00000411 2E893E[0000]            	MOV	[cs:COUNT],DI
   794 00000416 2E893E[0000]            	mov	[cs:Org_Count], DI	;AN012;
   795 0000041B 31F6                    	XOR	SI,SI
   796                                  CHRPTR equ chrptr	; NASM port label
   797 0000041D 2E8936[0000]            	MOV	[cs:CHRPTR],SI
   798 00000422 C3                      	return
   799                                  
   800                                  ;Get3:	 jcxz	 NOGET		 ;J.K.do not consider '/',',' as a delim.
   801                                  ;	 mov	 al, [es:si]
   802                                  ;	 inc	 si
   803                                  ;	 dec	 cx
   804                                  ;	 call	 DELIM
   805                                  ;	 jnz	 Get3_ret
   806                                  ;	 cmp	 al,'/'
   807                                  ;	 je	 Get3_ret
   808                                  ;	 cmp	 al,','
   809                                  ;	 jne	 Get3
   810                                  ;Get3_ret:
   811                                  ;	 ret
   812                                  
   813                                  
   814                                  
   815                                  ;
   816                                  ;  NEWLINE RETURNS WITH FIRST CHARACTER OF NEXT LINE
   817                                  ;
   818 00000423 E8(0000)                NEWLINE:invoke	GETCHR			;SKIP NON-CONTROL CHARACTERS
   819 00000426 72FA                    	retc
   820 00000428 3C0A                    	CMP	AL,LF			;LOOK FOR LINE FEED
   821 0000042A 75F7                    	JNZ	NEWLINE
   822 0000042C E8(0000)                	invoke	GETCHR
   823 0000042F C3                      	return
   824                                  
   825                                  MAPCASE:
   826 00000430 51                      	PUSH	CX
   827 00000431 56                      	PUSH	SI
   828 00000432 1E                      	PUSH	DS
   829 00000433 06                      	PUSH	ES
   830 00000434 1F                      	POP	DS
   831                                   assume ds:nothing
   832 00000435 31F6                    	XOR	SI,SI
   833                                  CONVLOOP:
   834 00000437 AC                      	LODSB
   835                                  
   836                                  	%IF	KANJI
   837                                  	CALL	TESTKANJ
   838                                  	JZ	NORMCONV
   839                                  	INC	SI			;Skip next char
   840                                  	DEC	CX
   841                                  	JCXZ	CONVDONE		;Just ignore 1/2 kanji error
   842                                  ;Fall through, know AL is not in 'a'-'z' range
   843                                  NORMCONV:
   844                                  	%ENDIF
   845                                  
   846 00000438 3C61                    	CMP	AL,'a'
   847 0000043A 7209                    	JB	NOCONV
   848 0000043C 3C7A                    	CMP	AL,'z'
   849 0000043E 7705                    	JA	NOCONV
   850 00000440 2C20                    	SUB	AL,20H
   851 00000442 8844FF                  	MOV	[SI-1],AL
   852                                  NOCONV:
   853 00000445 E2F0                    	LOOP	CONVLOOP
   854                                  CONVDONE:
   855 00000447 1F                      	POP	DS
   856                                   assume ds:nothing
   857 00000448 5E                      	POP	SI
   858 00000449 59                      	POP	CX
   859 0000044A C3                      	return
   860                                  
   861                                  	%IF	KANJI
   862                                  TESTKANJ:
   863                                  	CMP	AL,81H
   864                                  	JB	NOTLEAD
   865                                  	CMP	AL,9FH
   866                                  	JBE	ISLEAD
   867                                  	CMP	AL,0E0H
   868                                  	JB	NOTLEAD
   869                                  	CMP	AL,0FCH
   870                                  	JBE	ISLEAD
   871                                  NOTLEAD:
   872                                  	PUSH	AX
   873                                  	XOR	AX,AX			;Set zero
   874                                  	POP	AX
   875                                  	return
   876                                  
   877                                  ISLEAD:
   878                                  	PUSH	AX
   879                                  	XOR	AX,AX			;Set zero
   880                                  	INC	AX			;Reset zero
   881                                  	POP	AX
   882                                  	return
   883                                  	%ENDIF
   884                                  
   885                                  ASSUME DS:NOTHING
   886                                  
   887                                  Yes_Break_Failed:			;device driver Init failed and aborted.
   888 0000044B F9                      	stc
   889 0000044C 58                      	pop	ax
   890 0000044D C3                      	return
   891                                  
   892                                  SET_BREAK:
   893                                  ;J.K. 8/14/86  For DOS 3.3, this routine is modified to take care of the
   894                                  ;Device driver's initialization error and abort.
   895                                  ;If [break_addr+2] == [memhi] && [break_addr] = 0 then assume
   896                                  ;that the device driver's initialization has an error and wanted to
   897                                  ;abort the device driver.  In this case, this routine will set carry
   898                                  ;and return to the caller.
   899                                  ;J.K. 6/26/87 If MultDeviceFlag <> 0, then do not perform the check.
   900                                  ;This is to allow the multiple character device driver which uses
   901                                  ;the same ending address segment with the offset value 0 for each
   902                                  ;of the drives.
   903                                  
   904 0000044E 50                      	PUSH	AX
   905 0000044F 2EA1[0000]              	MOV AX, WORD PTR [cs:BREAK_ADDR]
   906 00000453 83C00F                  	add ax, 15			; round up
   907 00000456 D1D8                    	rcr ax, 1
   908 00000458 D1E8                    	shr ax, 1
   909 0000045A D1E8                    	shr ax, 1
   910 0000045C D1E8                    	shr ax, 1			; = paragraphs
   911 0000045E 2E0306[0200]            	add ax, WORD PTR [cs:BREAK_ADDR+2]  ;REMOVE THE INIT CODE
   912                                  					; ax => behind keep address
   913 00000463 72E6                    	jc Yes_Break_Failed
   914 00000465 2E803E[0000]00          	cmp	byte [cs:MultDeviceFlag], 0	    ;AN001;
   915 0000046B 7507                    	jne	Set_Break_Continue	    ;AN001;Do not check it.
   916                                  
   917                                  ;	rol byte [cs:devicehighflag], 1
   918                                  ;	jnc .low1
   919                                  .high1:
   920 0000046D 2E3B06[0000]            	cmp ax, [cs:devicehighdata]	; at start ?
   921                                  ;	jmp .common1
   922                                  ; .low1:
   923                                  ; MEMHI equ memhi	; NASM port label
   924                                  ;	cmp	ax, [cs:MEMHI]
   925                                  .common1:
   926                                  Yes_Break_failed equ Yes_Break_Failed	; NASM port label
   927 00000472 76D7                    	jbe	Yes_Break_failed	; <= start, failed
   928                                  
   929                                  Set_Break_Continue:
   930 00000474 2E800E[0000]01          	or	byte [cs:SetDevMarkFlag], SETBRKDONE	;AN005; Signal the successful Set_break
   931                                  
   932                                  	; rol byte [cs:devicehighflag], 1
   933                                  	; jnc .low2
   934                                  .high2:
   935 0000047A 2E3B06[0000]            	cmp ax, [cs:devicehighafter]
   936 0000047F 773E                    	ja MEM_ERR
   937                                  
   938 00000481 53                      	push bx
   939 00000482 06                      	push es
   940 00000483 2E8B1E[0000]            	mov bx, word [cs:devicehighdata]
   941 00000488 4B                      	dec bx				; => MCB
   942 00000489 8EC3                    	mov es, bx
   943                                   assume es:nothing
   944 0000048B 43                      	inc bx				; => memory block
   945 0000048C F7DB                    	neg bx				; - memory block
   946 0000048E 01C3                    	add bx, ax			; end - memory block
   947 00000490 26891E0300              	mov word [es:mcbSize], bx
   948 00000495 2E8B1E[0000]            	mov bx, word [cs:devicehighsd]
   949 0000049A 53                      	 push bx
   950 0000049B 43                      	inc bx				; => SD memory block
   951 0000049C 8EC3                    	mov es, bx			; 21.4A input
   952                                   assume es:nothing
   953 0000049E F7DB                    	neg bx				; - SD memory block
   954 000004A0 01C3                    	add bx, ax			; end - SD memory block
   955 000004A2 B44A                    	mov ah, 4Ah
   956 000004A4 CD21                    	int 21h				; shrink
   957 000004A6 8CC0                    	mov ax, es
   958 000004A8 01D8                    	add ax, bx
   959 000004AA 2EA3[0000]              	mov [cs:devicehighafter], ax
   960 000004AE 2EA3[0000]              	mov [cs:deviceafter], ax
   961 000004B2 07                      	 pop es
   962                                   assume es:MCB
   963 000004B3 26C70601000800          	mov word [es:mcbOwner], 8	; reset owner
   964 000004BA 07                      	pop es
   965                                   assume ds:nothing, es:nothing
   966 000004BB 5B                      	pop bx
   967 000004BC 58                      	pop ax
   968 000004BD F8                      	clc
   969 000004BE C3                      	retn
   970                                  
   971                                  %if 0
   972                                  .low2:
   973                                  	MOV	AX,WORD PTR [cs:BREAK_ADDR + 2]
   974                                  	MOV	[cs:MEMHI],AX
   975                                  	MOV	AX,WORD PTR [cs:BREAK_ADDR]
   976                                  MEMLO equ memlo	; NASM port label
   977                                  	MOV	[cs:MEMLO],AX
   978                                  	POP	AX			    ; NOTE FALL THROUGH
   979                                  	or	byte [cs:SetDevMarkFlag], FOR_DEVMARK
   980                                  
   981                                  ;
   982                                  ; Round the values in MEMLO and MEMHI to paragraph boundary.
   983                                  ; Perform bounds check.
   984                                  ;
   985                                  ROUND:
   986                                  	PUSH	AX
   987                                  	MOV	AX,[cs:MEMLO]
   988                                  
   989                                  	invoke	ParaRound		; para round up
   990                                  
   991                                  	ADD	[cs:MEMHI],AX
   992                                  	jc MEM_ERR
   993                                  	and	word [cs:MEMLO],0
   994                                  	mov	ax,[cs:memhi]		; ax = new memhi
   995                                  ALLOCLIM equ alloclim	; NASM port label
   996                                  	CMP	AX,[cs:ALLOCLIM]		; if new memhi >= alloclim, error
   997                                  	JAE	MEM_ERR
   998                                  	test	byte [cs:SetDevMarkFlag], FOR_DEVMARK	    ;AN005;
   999                                  	jz	Skip_Set_DEVMARKSIZE			;AN005;
  1000                                  	push	es					;AN005;
  1001                                  	push	si					;AN005;
  1002                                  	mov	si, [cs:DevMark_Addr]			;AN005;
  1003                                  	mov	es, si					;AN005;
  1004                                  	sub	ax, si					;AN005;
  1005                                  	dec	ax					;AN005;
  1006                                  	mov	[es:DEVMARK_SIZE], ax			;AN005; Paragraph
  1007                                  	and	byte [cs:SetDevMarkFlag], NOT_FOR_DEVMARK	    ;AN005;
  1008                                  	pop	si					;AN005;
  1009                                  	pop	es					;AN005;
  1010                                  Skip_Set_DEVMARKSIZE:					;AN005;
  1011                                  	POP	AX
  1012                                  	clc				;clear carry
  1013                                  	return
  1014                                  %endif
  1015                                  
  1016                                  MEM_ERR:
  1017 000004BF BA[0000]                	MOV	DX,OFFSET BADMEM
  1018 000004C2 0E                      	PUSH	CS
  1019 000004C3 1F                      	POP	DS
  1020                                   assume ds:SYSINITGROUP
  1021 000004C4 E88502                  	CALL	PRINT
  1022                                  STALL equ Stall	; NASM port label
  1023 000004C7 E9(0000)                	JMP	STALL
  1024                                  
  1025                                  ENTRY_POINT equ entry_point	; NASM port label
  1026 000004CA 2E8E1E[0200]            CALLDEV:MOV	DS,WORD PTR [CS:ENTRY_POINT+2]
  1027                                   assume ds:nothing
  1028 000004CF 2E031E[0000]            	ADD	BX,WORD PTR [CS:ENTRY_POINT]	;Do a little relocation
  1029 000004D4 8B07                    	MOV	AX,[BX]
  1030 000004D6 2EFF36[0000]            	PUSH	WORD PTR [CS:ENTRY_POINT]
  1031 000004DB 2EA3[0000]              	MOV	WORD PTR [CS:ENTRY_POINT],AX
  1032 000004DF BB[0000]                	MOV	BX,OFFSET PACKET
  1033 000004E2 2EFF1E[0000]            	CALL	far [cs:ENTRY_POINT]
  1034 000004E7 2E8F06[0000]            	POP	WORD PTR [CS:ENTRY_POINT]
  1035 000004EC C3                      	return
  1036                                  
  1037                                  BADNUM:
  1038 000004ED 2EC606[0000]00          	MOV	byte [cs:sepchr],0
  1039 000004F3 31C0                    	XOR	AX,AX		; Set Zero flag, and AX = 0
  1040 000004F5 5B                      	pop	bx		; J.K.
  1041 000004F6 F9                      	stc			; AND carry set
  1042 000004F7 C3                      	return
  1043                                  
  1044                                  ToDigit:
  1045 000004F8 2C30                    	SUB	AL,'0'
  1046 000004FA 7206                    	JB	NotDig
  1047 000004FC 3C09                    	CMP	AL,9
  1048 000004FE 7702                    	JA	NotDig
  1049 00000500 F8                      	CLC
  1050 00000501 C3                      	return
  1051 00000502 F9                      NotDig: STC
  1052 00000503 C3                      	return
  1053                                  
  1054                                  ; GetNum parses a decimal number.
  1055                                  ; Returns it in AX, sets zero flag if AX = 0 (MAY BE considered an
  1056                                  ; error), if number is BAD carry is set, zero is set, AX=0.
  1057                                  GETNUM:
  1058                                   assume ds:nothing, es:nothing, ss:SYSINITGROUP
  1059 00000504 53                      	push	bx			; J.K.
  1060 00000505 31DB                    	XOR	BX,BX			; running count is zero
  1061 00000507 E8EEFF                  B2:	CALL	ToDigit 		; do we have a digit
  1062                                  BadNum equ BADNUM	; NASM port label
  1063 0000050A 72E1                    	JC	BadNum			; no, bomb
  1064 0000050C 93                      	XCHG	AX,BX			; put total in AX
  1065 0000050D 53                      	PUSH	BX			; save digit
  1066 0000050E BB0A00                  	MOV	BX,10			; base of arithmetic
  1067 00000511 F7E3                    	MUL	BX			; shift by one decimal di...
  1068 00000513 5B                      	POP	BX			; get back digit
  1069 00000514 00D8                    	ADD	AL,BL			; get total
  1070 00000516 80D400                  	ADC	AH,0			; make that 16 bits
  1071 00000519 72D2                    	JC	BADNUM			; too big a number
  1072 0000051B 93                      	XCHG	AX,BX			; stash total
  1073                                  
  1074 0000051C E8(0000)                	invoke	GETCHR			;GET NEXT DIGIT
  1075 0000051F 722F                    	JC	B1			; no more characters
  1076 00000521 3C20                    	cmp	al, ' '                 ;J.K. 5/23/86 space?
  1077                                  B15 equ b15	; NASM port label
  1078 00000523 7421                    	jz	B15			;J.K. 5/23/86 then end of digits
  1079 00000525 3C2C                    	cmp	al, ','                 ;J.K. 5/23/86 ',' is a seperator!!!
  1080 00000527 741D                    	jz	B15			;J.K. 5/23/86 then end of digits.
  1081 00000529 3C09                    	cmp	al, TAB 		;J.K. 5/23/86 TAB
  1082 0000052B 7419                    	jz	B15			;J.K.
  1083                                  SepChr equ sepchr	; NASM port label
  1084 0000052D 2E3A06[0000]            	CMP	AL,[cs:SepChr]		; allow 0 or special separators
  1085 00000532 7412                    	JZ	b15
  1086 00000534 3C2F                    	cmp	al,SWTCHR		; See if another switch follows
  1087 00000536 90                      	nop	; identicalise
  1088 00000537 90                      	nop	; identicalise
  1089 00000538 740C                    	JZ	b15
  1090 0000053A 3C0A                    	cmp	al,LF			; Line-feed?
  1091 0000053C 7408                    	jz	b15
  1092 0000053E 3C0D                    	cmp	al,CR			; Carriage return?
  1093 00000540 7404                    	jz	b15
  1094 00000542 08C0                    	OR	AL,AL			; end of line separator?
  1095 00000544 75C1                    	JNZ	B2			; no, try as a valid char...
  1096 00000546 2EFF06[0000]            b15:	INC	word [cs:COUNT]			; one more character to s...
  1097 0000054B 2EFF0E[0000]            	DEC	word [cs:CHRPTR]			; back up over separator
  1098 00000550 89D8                    B1:	MOV	AX,BX			; get proper count
  1099 00000552 09C0                    	OR	AX,AX			; Clears carry, sets Zero accordingly
  1100 00000554 5B                      	pop	bx
  1101 00000555 C3                      	return
  1102                                  
  1103                                  SKIP_DELIM	proc	near		;J.K.
  1104                                  ;Skip the delimeters pointed by CHRPTR.  AL will contain the first non delimeter
  1105                                  ;character encountered and CHRPTR will point to the next character.
  1106                                  ;This rouitne will assume the second "," found as a non delimiter character. So
  1107                                  ;in case if the string is " , , ", this routine will stop at the second ",". At
  1108                                  ;this time, Zero flag is set.
  1109                                  ;If COUNT is exhausted, then carry will be set.
  1110                                  Skip_delim_char:
  1111 00000556 E8(0000)                	call	getchr
  1112 00000559 7219                    	jc	Skip_delim_exit
  1113 0000055B 3C2C                    	cmp	al, ','                 ;the first comma?
  1114 0000055D 7407                    	je	Skip_delim_next
  1115 0000055F E893FE                  	call	delim			;check the charater in AL.
  1116 00000562 74F2                    	jz	Skip_delim_char
  1117 00000564 EB0E                    	jmp	short Skip_delim_exit	;found a non delim char
  1118                                  Skip_delim_next:
  1119 00000566 E8(0000)                	call	getchr
  1120 00000569 7209                    	jc	Skip_delim_exit
  1121 0000056B 3C2C                    	cmp	al, ','                 ;the second comma?
  1122 0000056D 7405                    	je	Skip_delim_exit 	;done
  1123 0000056F E883FE                  	call	delim
  1124 00000572 74F2                    	jz	Skip_delim_next
  1125                                  Skip_delim_exit:
  1126 00000574 C3                      	return
  1127                                  SKIP_DELIM	endp
  1128                                  
  1129                                  ;J.K. 5/26/86 *****************************************************************
  1130                                  SetDOSCountryInfo	proc	near
  1131                                   assume ds:nothing, es:nothing, ss:SYSINITGROUP
  1132                                  ;Input: ES:DI -> pointer to DOS_COUNTRY_CDPG_INFO
  1133                                  ;	DS:0  -> buffer.
  1134                                  ;	SI = 0
  1135                                  ;	AX = country id
  1136                                  ;	DX = code page id. (If 0, then use ccSysCodePage as a default.)
  1137                                  ;	BX = file handle
  1138                                  ;	This routine can handle maxium 72 COUNTRY_DATA entries.
  1139                                  ;Output: DOS_country_cdpg_info set.
  1140                                  ;	 Carry set if any file read failure or wrong information in the file.
  1141                                  ;	 Carry set and CX = -1 if cannot find the matching COUNTRY_id, CODEPAGE
  1142                                  ;	 _id in the file.
  1143                                  
  1144 00000575 57                      	push	di
  1145 00000576 50                      	push	ax
  1146 00000577 52                      	push	dx
  1147                                  
  1148 00000578 31C9                    	xor	cx,cx
  1149 0000057A 31D2                    	xor	dx,dx
  1150 0000057C B80002                  	mov	ax, 512 		;read 512 bytes
  1151 0000057F E83101                  	call	ReadInControlBuffer	;Read the file header
  1152 00000582 724C                    	jc	SetDOSData_fail
  1153 00000584 06                      	push	es
  1154 00000585 56                      	push	si
  1155 00000586 0E                      	push	cs
  1156 00000587 07                      	pop	es
  1157                                   assume es:SYSINITGROUP
  1158 00000588 BF[3508]                	mov	di, offset COUNTRY_FILE_SIGNATURE
  1159 0000058B B90800                  	mov	cx, 8			;length of the signature
  1160 0000058E F3A6                    	repz	cmpsb
  1161 00000590 5E                      	pop	si
  1162 00000591 07                      	pop	es
  1163                                   assume es:nothing
  1164 00000592 753C                    	jnz	SetDOSData_fail 	;signature mismatch
  1165                                  
  1166 00000594 83C612                  	add	si, 18			;SI -> county info type
  1167 00000597 803C01                  	cmp	byte ptr [si], 1	;Only accept type 1 (Currently only 1 header type)
  1168 0000059A 7534                    	jne	SetDOSData_fail 	;cannot proceed. error return
  1169 0000059C 46                      	inc	si			;SI -> file offset
  1170 0000059D 8B14                    	mov	dx, word ptr [si]	;Get the INFO file offset.
  1171 0000059F 8B4C02                  	mov	cx, word ptr [si+2]
  1172 000005A2 B80004                  	mov	ax, 1024		;read 1024 bytes.
  1173 000005A5 E80B01                  	call	ReadInControlBuffer	;Read INFO
  1174 000005A8 7226                    	jc	SetDOSData_fail
  1175 000005AA 8B0C                    	mov	cx, word ptr [si]	;get the # of country, codepage combination entries
  1176 000005AC 83F948                  	cmp	cx, 72			;cannot handle more than 72 entries.
  1177 000005AF 771F                    	ja	SetDOSData_fail
  1178 000005B1 46                      	inc	si
  1179 000005B2 46                      	inc	si			;SI -> entry information packet
  1180 000005B3 5A                      	pop	dx			;restore code page id
  1181 000005B4 58                      	pop	ax			;restore country id
  1182 000005B5 5F                      	pop	di
  1183                                  
  1184                                  SetDOSCntry_find:			;Search for desired country_id,codepage_id.
  1185 000005B6 3B4402                  	cmp	ax, word ptr [si+2]	;compare country_id
  1186 000005B9 750A                    	jne	SetDOSCntry_next
  1187 000005BB 83FA00                  	cmp	dx, 0			;No user specified code page ?
  1188                                  SetDOSCntry_any_codepage equ SetDOSCntry_any_CodePage	; NASM port label
  1189 000005BE 7415                    	je	SetDOSCntry_any_codepage;then no need to match code page id.
  1190 000005C0 3B5404                  	cmp	dx, word ptr [si+4]	;compare code page id
  1191 000005C3 7413                    	je	SetDOSCntry_got_it
  1192                                  SetDOSCntry_next:
  1193 000005C5 0334                    	add	si, word ptr [si]	;next entry
  1194 000005C7 46                      	inc	si
  1195 000005C8 46                      	inc	si			;take a word for size of entry itself
  1196 000005C9 E2EB                    	loop	SetDOSCntry_find
  1197 000005CB B9FFFF                  	mov	cx, -1			;signals that bad country id entered.
  1198                                  SetDOSCntry_fail:
  1199 000005CE F9                      	stc
  1200 000005CF C3                      	ret
  1201                                  
  1202                                  SetDOSData_fail:
  1203 000005D0 5E                      	pop	si
  1204 000005D1 59                      	pop	cx
  1205 000005D2 5F                      	pop	di
  1206 000005D3 EBF9                    	jmp	short	SetDOSCntry_fail
  1207                                  
  1208                                  SetDOSCntry_any_CodePage:		;use the code_page_id of the country_id found.
  1209 000005D5 8B5404                  	mov	dx, word ptr [si+4]
  1210                                  SetDOSCntry_got_it:			;found the matching entry
  1211 000005D8 2E8916[3D08]            	mov	[cs:CntryCodePage_Id], dx ;save code page ID for this country.
  1212 000005DD 8B540A                  	mov	dx, word ptr [si+10] ;get the file offset of country data
  1213 000005E0 8B4C0C                  	mov	cx, word ptr [si+12]
  1214 000005E3 B80002                  	mov	ax, 512 		;read 512 bytes
  1215 000005E6 E8CA00                  	call	ReadInControlBuffer
  1216 000005E9 72E3                    	jc	SetDOSCntry_fail
  1217 000005EB 8B0C                    	mov	cx, word ptr [si]	;get the number of entries to handle.
  1218 000005ED 46                      	inc	si
  1219 000005EE 46                      	inc	si			;SI -> first entry
  1220                                  
  1221                                  SetDOSCntry_data:
  1222 000005EF 57                      	push	di			;ES:DI -> DOS_COUNTRY_CDPG_INFO
  1223 000005F0 51                      	push	cx			;save # of entry left
  1224 000005F1 56                      	push	si			;si -> current entry in Control buffer
  1225                                  
  1226 000005F2 8A4402                  	mov	al, byte ptr [si+2]	;get data entry id
  1227 000005F5 E88D00                  	call	GetCountryDestination	;get the address of destination in ES:DI
  1228                                   assume es:nothing
  1229 000005F8 727A                    	jc strict short SetDOSCntry_data_next	;No matching data entry id in DOS
  1230                                  
  1231                                  
  1232 000005FA 8B5404                  	mov	dx, word ptr [si+4]	;get offset of data
  1233 000005FD 8B4C06                  	mov	cx, word ptr [si+6]
  1234 00000600 B80042                  	mov	ax, 4200h
  1235 00000603 F9                      	stc
  1236 00000604 CD21                    	int	21h			;move pointer
  1237 00000606 72C8                    	jc	SetDOSData_fail
  1238 00000608 BA0002                  	mov	dx, 512 		;start of data buffer
  1239                                  ;	 mov	 cx, word ptr [es:di]	 ;length of the corresponding data in DOS.
  1240                                  ;	 add	 cx, 10 		 ;Signature + A word for the length itself
  1241 0000060B B91400                  	mov	cx, 20			;read 20 bytes only. We only need to
  1242 0000060E B43F                    	mov	ah, 3fh 		;look at the length of the data in the file.
  1243 00000610 F9                      	stc
  1244 00000611 CD21                    	int	21h			;read the country.sys data
  1245 00000613 72BB                    	jc	SetDOSData_fail 	;read failure
  1246 00000615 39C8                    	cmp	ax, cx
  1247 00000617 75B7                    	jne	SetDOSData_fail
  1248                                  
  1249 00000619 8B5404                  	mov	dx, word ptr [si+4]	;AN008;get offset of data again.
  1250 0000061C 8B4C06                  	mov	cx, word ptr [si+6]	;AN008;
  1251 0000061F B80042                  	mov	ax, 4200h		;AN008;
  1252 00000622 F9                      	stc				;AN008;
  1253 00000623 CD21                    	int	21h			;AN008;move pointer back again
  1254 00000625 72A9                    	jc	SetDOSData_fail 	;AN008;
  1255                                  
  1256 00000627 56                      	push	si			;AN008;
  1257 00000628 BE0802                  	mov	si, (512+8)		;AN008;get length of the data from the file
  1258 0000062B 8B0C                    	mov	cx, word ptr [si]	;AN008;
  1259 0000062D 5E                      	pop	si			;AN008;
  1260 0000062E BA0002                  	mov	dx, 512 		;AN008;start of data buffer
  1261 00000631 83C10A                  	add	cx, 10			;AN008;Signature + A word for the length itself
  1262 00000634 B43F                    	mov	ah, 3fh 		;AN008;Read the data from the file.
  1263 00000636 F9                      	stc				;AN008;
  1264 00000637 CD21                    	int	21h			;AN008;
  1265 00000639 7295                    	jc	SetDOSData_fail 	;AN008;
  1266 0000063B 39C8                    	cmp	ax, cx			;AN008;
  1267 0000063D 7591                    	jne	SetDOSData_fail 	;AN008;
  1268                                  
  1269 0000063F 8A4402                  	mov	al, byte ptr [si+2]	;save Data id for future use.
  1270 00000642 BE0802                  	mov	si, (512+8)		;SI-> data buffer + id tag field
  1271 00000645 8B0C                    	mov	cx, word ptr [si]	;get the length of the file
  1272 00000647 41                      	inc	cx			;Take care of a word for lenght of tab
  1273 00000648 41                      	inc	cx			;itself.
  1274 00000649 81F9F805                	cmp	cx, (2048 - 512 - 8)	;Fit into the buffer?
  1275 0000064D 7781                    	ja	SetDOSData_fail
  1276 0000064F 3C01                    	cmp	al, SetCountryInfo	;is the data for SetCountryInfo table?
  1277 00000651 7512                    	jne	SetDOSCntry_Mov 	;no, don't worry
  1278 00000653 26FF7518                	push	word ptr [es:di+ccMono_Ptr-ccCountryInfoLen]	;AN009;Cannot destroy ccMono_ptr address. Save them.
  1279 00000657 26FF751A                	push	word ptr [es:di+ccMono_Ptr-ccCountryInfoLen+2]	;AN009;At this time DI -> ccCountryInfoLen
  1280 0000065B 57                      	push	di			;save DI
  1281                                  
  1282 0000065C 50                      	push	ax
  1283 0000065D 2EA1[3D08]              	mov	ax,[cs:CntryCodePage_Id]	;Do not use the Code Page info in Country_Info
  1284 00000661 894404                  	mov	[si+4], ax		;Use the saved one for this !!!!
  1285 00000664 58                      	pop	ax
  1286                                  
  1287                                  SetDOSCntry_Mov:
  1288 00000665 F3A4                    	rep	movsb			;copy the table into DOS
  1289 00000667 3C01                    	cmp	al, SetCountryInfo	;was the ccMono_ptr saved?
  1290 00000669 7509                    	jne	SetDOSCntry_data_next
  1291 0000066B 5F                      	pop	di			;restore DI
  1292 0000066C 268F451A                	pop	word ptr [es:di+ccMono_Ptr-ccCountryInfoLen+2]	 ;AN009;restore
  1293 00000670 268F4518                	pop	word ptr [es:di+ccMono_Ptr-ccCountryInfoLen]	 ;AN009;
  1294                                  
  1295                                  SetDOSCntry_data_next:
  1296 00000674 5E                      	pop	si			;restore control buffer pointer
  1297 00000675 59                      	pop	cx			;restore # of entries left
  1298 00000676 5F                      	pop	di			;restore pointer to DSO_COUNTRY_CDPG
  1299 00000677 0334                    	add	si, word ptr [si]	;try to get the next entry
  1300 00000679 46                      	inc	si
  1301 0000067A 46                      	inc	si			;take a word of entry length itself
  1302                                  ;	 loop	 SetDOSCntry_data
  1303 0000067B 49                      	dec	cx			;AN008;
  1304 0000067C 83F900                  	cmp	cx,0			;AN008;
  1305 0000067F 7403                    	je	SetDOSCntry_OK		;AN008;
  1306 00000681 E96BFF                  	jmp	SetDOSCntry_data	;AN008;
  1307                                  SetDOSCntry_OK: 			;AN008;
  1308 00000684 C3                      	ret
  1309                                  SetDOSCountryInfo	endp
  1310                                  ;
  1311                                  
  1312                                  GetCountryDestination	proc	near
  1313                                   assume ds:nothing, es:nothing, ss:SYSINITGROUP
  1314                                  ;Get the destination address in the DOS country info table.
  1315                                  ;Input: AL - Data ID
  1316                                  ;	ES:DI -> DOS_COUNTRY_CDPG_INFO
  1317                                  ;On return:
  1318                                  ;	ES:DI -> Destination address of the matching data id
  1319                                  ;	carry set if no matching data id found in DOS.
  1320                                  
  1321 00000685 51                      	push	cx
  1322 00000686 83C74A                  	add	di, ccNumber_of_entries ;skip the reserved area, syscodepage etc.
  1323 00000689 268B0D                  	mov	cx, word ptr [es:di]	;get the number of entries
  1324 0000068C 47                      	inc	di
  1325 0000068D 47                      	inc	di			;SI -> the first start entry id
  1326                                  GetCntryDest:
  1327 0000068E 263805                  	cmp	byte ptr [es:di], al
  1328 00000691 7413                    	je	GetCntryDest_OK
  1329 00000693 26803D01                	cmp	byte ptr [es:di], SetCountryInfo ;was it SetCountryInfo entry?
  1330 00000697 7405                    	je	GetCntryDest_1
  1331 00000699 83C705                  	add	di, 5			;next data id
  1332 0000069C EB03                    	jmp	short GetCntryDest_loop
  1333                                  GetCntryDest_1:
  1334 0000069E 83C729                  	add	di, NEW_COUNTRY_SIZE + 3 ;next data id
  1335                                  GetCntryDest_loop:
  1336 000006A1 E2EB                    	loop	GetCntryDest
  1337 000006A3 F9                      	stc
  1338                                  GetCntryDest_exit equ GetCntryDest_Exit	; NASM port label
  1339 000006A4 EB0B                    	jmp	short	GetCntryDest_exit
  1340                                  GetCntryDest_OK:
  1341 000006A6 3C01                    	cmp	al, SetCountryInfo	;select country info?
  1342 000006A8 7503                    	jne	GetCntryDest_OK1
  1343 000006AA 47                      	inc	di			;now DI -> ccCountryInfoLen
  1344 000006AB EB04                    	jmp	short	GetCntryDest_exit
  1345                                  GetCntryDest_OK1:
  1346 000006AD 26C47D01                	les	di, [es:di+1] ;get the destination in ES:DI
  1347                                   assume es:nothing
  1348                                  GetCntryDest_Exit:
  1349 000006B1 59                      	pop	cx
  1350 000006B2 C3                      	ret
  1351                                  GetCountryDestination	endp
  1352                                  
  1353                                  ;
  1354                                  ReadInControlBuffer	proc	near
  1355                                  ;Move file pointer to CX:DX
  1356                                  ;Read AX bytes into the control buffer. (Should be less than 2 Kb)
  1357                                  ;SI will be set to 0 hence DS:SI points to the control buffer.
  1358                                  ;Entry:  CX,DX offset from the start of the file where the read/write pointer
  1359                                  ;	 be moved.
  1360                                  ;	 AX - # of bytes to read
  1361                                  ;	 BX - file handle
  1362                                  ;	 DS - buffer seg.
  1363                                  ;Return: The control data information is read into DS:0 - DS:0200.
  1364                                  ;	 CX,DX value destroyed.
  1365                                  ;	 Carry set if error in Reading file.
  1366                                  ;
  1367 000006B3 50                      	push	ax			;# of bytes to read
  1368 000006B4 B80042                  	mov	ax, 4200h
  1369 000006B7 F9                      	stc
  1370 000006B8 CD21                    	int	21h			;move pointer
  1371 000006BA 59                      	pop	cx			;# of bytes to read
  1372 000006BB 7209                    	jc	RICB_exit
  1373 000006BD 31D2                    	xor	dx,dx			;ds:dx -> control buffer
  1374 000006BF 31F6                    	xor	si,si
  1375 000006C1 B43F                    	mov	ah,3fh			;read into the buffer
  1376 000006C3 F9                      	stc
  1377 000006C4 CD21                    	int	21h			;should be less than 1024 bytes.
  1378                                  RICB_exit:
  1379 000006C6 C3                      	ret
  1380                                  ReadInControlBuffer	endp
  1381                                  
  1382                                  ;
  1383                                  SET_COUNTRY_PATH	proc	near
  1384                                  ;In:  DS - SYSINITSEG, ES - CONFBOT, SI -> start of the asciiz path string
  1385                                  ;     DOSINFO_EXT, CNTRY_DRV, CNTRY_ROOT, CNTRY_PATH
  1386                                  ;     Assumes current directory is the ROOT directory.
  1387                                  ;Out: DS:DI -> full path (CNTRY_DRV).
  1388                                  ;     Set the CNTRY_DRV string from the COUNTRY=,,path command.
  1389                                  ;     DS, ES, SI value saved.
  1390                                   assume ds:SYSINITGROUP, es:nothing, ss:SYSINITGROUP
  1391                                  
  1392 000006C7 56                      	push	si
  1393 000006C8 1E                      	push	ds			;switch ds, es
  1394 000006C9 06                      	push	es
  1395 000006CA 1F                      	pop	ds
  1396 000006CB 07                      	pop	es			;now DS -> CONFBOT, ES -> SYSINITSEG
  1397                                   assume ds:nothing, es:SYSINITGROUP, ss:SYSINITGROUP
  1398                                  
  1399                                  chk_drive_letter equ CHK_DRIVE_LETTER	; NASM port label
  1400 000006CC E83100                  	call	chk_drive_letter	;current [DS:SI] is a drive letter?
  1401 000006CF 7206                    	jc	SCP_Default_drv 	;no, use current default drive.
  1402 000006D1 8A04                    	mov	al, byte ptr [SI]
  1403 000006D3 46                      	inc	si
  1404 000006D4 46                      	inc	si			;SI -> next char after ":"
  1405 000006D5 EB06                    	jmp	short SCP_SetDrv
  1406                                  SCP_Default_drv:
  1407 000006D7 B419                    	mov	ah, 19h
  1408 000006D9 CD21                    	int	21h
  1409 000006DB 0441                    	add	al, "A"                 ;convert it to a character.
  1410                                  SCP_SetDrv:
  1411 000006DD 2EA2[F207]              	mov	[cs:CNTRY_DRV], al	;set the drive letter.
  1412 000006E1 BF[F507]                	mov	di, offset CNTRY_PATH
  1413 000006E4 8A04                    	mov	al, byte ptr [SI]
  1414 000006E6 3C5C                    	cmp	al, "\"
  1415 000006E8 7409                    	je	SCP_Root_Dir
  1416 000006EA 2E3A062F00              	cmp	al, [cs:SWTCHR]		;let's accept "/" as an directory delim
  1417 000006EF 7402                    	je	SCP_Root_Dir
  1418 000006F1 EB01                    	jmp	short SCP_Path
  1419                                  SCP_Root_Dir:
  1420 000006F3 4F                      	dec	di			;DI -> CNTRY_ROOT
  1421                                  SCP_Path:
  1422 000006F4 E81F00                  	call	MOVE_ASCIIZ		;copy it
  1423 000006F7 BF[F207]                	mov	di, offset CNTRY_DRV
  1424                                  SCPath_Exit:
  1425 000006FA 1E                      	push	ds			;switch ds, es
  1426 000006FB 06                      	push	es
  1427 000006FC 1F                      	pop	ds
  1428 000006FD 07                      	pop	es			;DS, ES value restored
  1429                                   assume ds:SYSINITGROUP, es:nothing, ss:SYSINITGROUP
  1430 000006FE 5E                      	pop	si
  1431 000006FF C3                      	RET
  1432                                  SET_COUNTRY_PATH	endp
  1433                                  
  1434                                  ;
  1435                                  CHK_DRIVE_LETTER	proc	near
  1436                                  ;Check if [DS:SI] is a drive letter followed by ":".
  1437                                  ;Assume that every alpha charater is already converted to UPPER CASE.
  1438                                  ;Carry set if not.
  1439                                   assume ds:nothing
  1440 00000700 50                      	push	ax
  1441 00000701 803C41                  	cmp	byte ptr [si], "A"
  1442 00000704 720D                    	jb	CDLetter_NO
  1443 00000706 803C5A                  	cmp	byte ptr [si], "Z"
  1444 00000709 7708                    	ja	CDLetter_NO
  1445 0000070B 807C013A                	cmp	byte ptr [si+1], ":"
  1446 0000070F 7502                    	jne	CDLetter_NO
  1447 00000711 EB01                    	jmp	short CDLetter_exit
  1448                                  CDLetter_NO:
  1449 00000713 F9                      	stc
  1450                                  CDLetter_exit:
  1451 00000714 58                      	pop	ax
  1452 00000715 C3                      	ret
  1453                                  CHK_DRIVE_LETTER	endp
  1454                                  
  1455                                  ;
  1456                                  MOVE_ASCIIZ	proc	near
  1457                                   assume ds:nothing, es:nothing
  1458                                  ;In: DS:SI -> source ES:DI -> target
  1459                                  ;Out: copy the string until 0.
  1460                                  ;Assumes there exists a 0.
  1461                                  MASCIIZ_loop:
  1462 00000716 A4                      	movsb
  1463 00000717 807CFF00                	cmp	byte ptr [SI-1], 0	;Was it 0?
  1464 0000071B 75F9                    	jne	MASCIIZ_loop
  1465 0000071D C3                      	ret
  1466                                  MOVE_ASCIIZ	endp
  1467                                  
  1468                                  ;
  1469                                  ;	DS:DX POINTS TO STRING TO OUTPUT (ASCIZ)
  1470                                  ;
  1471                                  ;	PRINTS <BADLD_PRE> <STRING> <BADLD_POST>
  1472                                  ;
  1473                                  ;
  1474                                  ;
  1475                                  BADFIL:
  1476 0000071E 0E                      	PUSH	CS
  1477 0000071F 07                      	POP	ES
  1478                                   assume es:SYSINITGROUP
  1479 00000720 89D6                    	MOV	SI,DX
  1480                                  BADLOAD:
  1481 00000722 BA[0000]                	MOV	DX,OFFSET BADLD_PRE	;WANT TO PRINT CONFIG ERROR
  1482                                  ;	 MOV	 BX,OFFSET BADLD_POST
  1483 00000725 BB[0000]                	mov	bx, offset CRLFM	;AN006;
  1484                                  PRNERR:
  1485                                   assume es:nothing
  1486 00000728 0E                      	PUSH	CS
  1487 00000729 1F                      	POP	DS
  1488                                   assume ds:SYSINITGROUP
  1489 0000072A E81F00                  	call	Print
  1490 0000072D 268A14                  PRN1:	MOV	DL,[ES:SI]
  1491 00000730 08D2                    	OR	DL,DL
  1492 00000732 7407                    	JZ	PRN2
  1493                                  STD_CON_OUTPUT equ Std_Con_Output	; NASM port equate
  1494 00000734 B402                    	MOV	AH,STD_CON_OUTPUT
  1495 00000736 CD21                    	INT	21H
  1496 00000738 46                      	INC	SI
  1497 00000739 EBF2                    	JMP	PRN1
  1498 0000073B 89DA                    PRN2:	MOV	DX,BX
  1499 0000073D E80C00                  	call	Print
  1500 00000740 2E803E[0000]01          	cmp	byte [cs:DoNotShowNum], 1 	;AN000;  suppress line number when handling COMMAND.COM
  1501                                  Prnexit equ PRNEXIT	; NASM port label
  1502 00000746 7403                    	je	Prnexit
  1503 00000748 E8(0000)                	call	Error_Line
  1504                                  PRNEXIT:
  1505 0000074B C3                      	return
  1506                                  
  1507                                  STD_CON_STRING_OUTPUT equ Std_Con_String_Output	; NASM port equate
  1508                                  PRINT:
  1509                                   assume ds:SYSINITGROUP
  1510 0000074C B409                    	MOV	AH,STD_CON_STRING_OUTPUT
  1511 0000074E CD21                    	INT	21H
  1512 00000750 C3                      	return
  1513                                  
  1514                                  
  1515                                  OPEN equ Open	; NASM port equate
  1516                                  CLOSE equ Close	; NASM port equate
  1517                                  	%IF	NOEXEC
  1518                                  ;
  1519                                  ; LOAD NON EXE FILE CALLED [DS:DX] AT MEMORY LOCATION ES:BX
  1520                                  ;
  1521                                  LDFIL:
  1522                                  	PUSH	AX
  1523                                  	PUSH	BX
  1524                                  	PUSH	CX
  1525                                  	PUSH	DX
  1526                                  	PUSH	SI
  1527                                  	PUSH	DS
  1528                                  	PUSH	BX
  1529                                  	XOR	AX,AX			;OPEN THE FILE
  1530                                  	MOV	AH,OPEN
  1531                                  	STC				;IN CASE OF INT 24
  1532                                  	INT	21H
  1533                                  	POP	DX			;Clean stack in case jump
  1534                                  	JC	LDRET
  1535                                  	PUSH	DX
  1536                                  	MOV	BX,AX			;Handle in BX
  1537                                  	XOR	CX,CX
  1538                                  	XOR	DX,DX
  1539                                  LSEEK equ LSeek	; NASM port equate
  1540                                  	MOV	AX,(LSEEK << 8) | 2
  1541                                  	STC				;IN CASE OF INT 24
  1542                                  	INT	21H			; Get file size in DX:AX
  1543                                  	JC	LDCLSP
  1544                                  	OR	DX,DX
  1545                                  	JNZ	LDERRP			; File >64K
  1546                                  	POP	DX
  1547                                  	PUSH	DX
  1548                                  	MOV	CX,ES			; CX:DX is xaddr
  1549                                  	ADD	DX,AX			; Add file size to Xaddr
  1550                                  	JNC	DOSIZE
  1551                                  	ADD	CX,1000H		; ripple carry
  1552                                  DOSIZE:
  1553                                  	mov	ax,dx
  1554                                  	call	ParaRound
  1555                                  	mov	dx,ax
  1556                                  
  1557                                  	ADD	CX,DX
  1558                                  	CMP	CX,[cs:ALLOCLIM]
  1559                                  	JB	OKLD
  1560                                  	JMP	MEM_ERR
  1561                                  
  1562                                  OKLD:
  1563                                  	XOR	CX,CX
  1564                                  	XOR	DX,DX
  1565                                  	MOV	AX,LSEEK << 8		;Reset pointer to beginning of file
  1566                                  	STC				;IN CASE OF INT 24
  1567                                  	INT	21H
  1568                                  	JC	LDCLSP
  1569                                  	POP	DX
  1570                                  	PUSH	ES			;READ THE FILE IN
  1571                                  	POP	DS			;Trans addr is DS:DX
  1572                                  	MOV	CX,0FF00H		; .COM files arn't any bigger than
  1573                                  					; 64k-100H
  1574                                  READ equ Read	; NASM port equate
  1575                                  	MOV	AH,READ
  1576                                  	STC				;IN CASE OF INT 24
  1577                                  	INT	21H
  1578                                  	JC	LDCLS
  1579                                  	MOV	SI,DX			;CHECK FOR EXE FILE
  1580                                  	CMP	WORD PTR [SI],"MZ"	; NASM port swapped text literals
  1581                                  	CLC				; Assume OK
  1582                                  	JNZ	LDCLS			; Only know how to do .COM files
  1583                                  	STC
  1584                                  	JMP	SHORT LDCLS
  1585                                  
  1586                                  LDERRP:
  1587                                  	STC
  1588                                  LDCLSP:
  1589                                  	POP	DX			;Clean stack
  1590                                  LDCLS:
  1591                                  	PUSHF
  1592                                  	MOV	AH,CLOSE		;CLOSE THE FILE
  1593                                  	STC
  1594                                  	INT	21H
  1595                                  	POPF
  1596                                  
  1597                                  LDRET:	POP	DS
  1598                                  	POP	SI
  1599                                  	POP	DX
  1600                                  	POP	CX
  1601                                  	POP	BX
  1602                                  	POP	AX
  1603                                  	return
  1604                                  	%ENDIF
  1605                                  
  1606                                  ;
  1607                                  ;  OPEN DEVICE POINTED TO BY DX, AL HAS ACCESS CODE
  1608                                  ;   IF UNABLE TO OPEN DO A DEVICE OPEN NULL DEVICE INSTEAD
  1609                                  ;
  1610                                  OPEN_DEV:
  1611                                   assume ds:SYSINITGROUP
  1612 00000751 50                      	push ax				; preserve open mode
  1613 00000752 E81C00                  	CALL	OPEN_FILE
  1614 00000755 7308                    	JNC	OPEN_DEV3
  1615                                  OPEN_DEV1:
  1616 00000757 58                      	pop ax				; restore al = open mode
  1617 00000758 BA[D607]                	MOV	DX,OFFSET NULDEV_name
  1618 0000075B E81300                  	CALL	OPEN_FILE
  1619 0000075E C3                      	return
  1620                                  
  1621                                  OPEN_DEV3:
  1622 0000075F 93                      	xchg bx, ax			; Handle from open to BX
  1623 00000760 B80044                  	mov ax, IOCTL << 8		; GET DEVICE INFO
  1624 00000763 CD21                    	INT	21H
  1625 00000765 84D2                    	test dl, dl
  1626 00000767 7806                    	js @F
  1627 00000769 B43E                    	MOV	AH,CLOSE
  1628 0000076B CD21                    	INT	21H
  1629 0000076D EBE8                    	JMP	OPEN_DEV1
  1630                                  
  1631                                  @@:
  1632 0000076F 58                      	pop ax				; discard open mode
  1633 00000770 C3                      	retn
  1634                                  
  1635                                  OPEN_FILE:
  1636 00000771 B43D                    	MOV	AH,OPEN
  1637 00000773 F9                      	STC
  1638 00000774 CD21                    	INT	21H
  1639 00000776 C3                      	return
  1640                                  
  1641                                  %if 0
  1642                                  ;J.K. TEST INT24. Return back to DOS with the fake user response of "FAIL"
  1643                                  INT24:
  1644                                  	mov	al, 3			;AN000; Fail the system call
  1645                                  	iret				;AN000; Return back to DOS.
  1646                                  
  1647                                  
  1648                                  ;INT24:  ADD	 SP,6			 ;RESTORE MACHINE STATE
  1649                                  ;	 POP	 AX
  1650                                  ;	 POP	 BX
  1651                                  ;	 POP	 CX
  1652                                  ;	 POP	 DX
  1653                                  ;	 POP	 SI
  1654                                  ;	 POP	 DI
  1655                                  ;	 POP	 BP
  1656                                  ;	 POP	 DS
  1657                                  ;	 POP	 ES
  1658                                  ;	 PUSH	 AX
  1659                                  ;	 MOV	 AH,GET_DEFAULT_DRIVE	 ;INITIALIZE DOS
  1660                                  ;	 INT	 21H
  1661                                  ;	 POP	 AX
  1662                                  ;	 IRET				 ;BACK TO USER
  1663                                  %endif
  1664                                  
  1665                                  	%IF	ALTVECT
  1666                                  BOOTMES DB	13,10,"MS-DOS version "
  1667                                  	DB	MAJOR_VERSION + "0"
  1668                                  	DB	"."
  1669                                  	DB	(MINOR_VERSION / 10) + "0"
  1670                                  	DB	(MINOR_VERSION MOD 10) + "0"
  1671                                  	DB	13,10
  1672                                  	DB	"Copyright 1981,88 Microsoft Corp.",13,10,"$"
  1673                                  	%ENDIF
  1674                                  
  1675                                  %include "copyrigh.mac"			;P1821; Copyright statement
     1 00000777 4D5320444F53205665- <1> 	DB	"MS DOS Version 4.00 (C)Copyright 1988 Microsoft Corp"
     1 00000780 7273696F6E20342E30- <1>
     1 00000789 3020284329436F7079- <1>
     1 00000792 726967687420313938- <1>
     1 0000079B 38204D6963726F736F- <1>
     1 000007A4 667420436F7270      <1>
     2 000007AB 4C6963656E73656420- <1> 	DB	"Licensed Material - Property of Microsoft  "
     2 000007B4 4D6174657269616C20- <1>
     2 000007BD 2D2050726F70657274- <1>
     2 000007C6 79206F66204D696372- <1>
     2 000007CF 6F736F66742020      <1>
  1676                                  
  1677 000007D6 4E554C00                NULDEV_name	DB	"NUL",0
  1678 000007DA 434F4E00                CONDEV	DB	"CON",0
  1679 000007DE 41555800                AUXDEV	DB	"AUX",0
  1680 000007E2 50524E00                PRNDEV	DB	"PRN",0
  1681                                  
  1682                                  global OLDCONFIG_name
  1683 000007E6 5C434F4E4649472E53-     OLDCONFIG_name:	DB	"\CONFIG.SYS",0
  1683 000007EF 595300             
  1684                                  
  1685 000007F2 413A                    CNTRY_DRV   DB	  "A:"
  1686 000007F4 5C                      CNTRY_ROOT  DB	  "\"
  1687 000007F5 434F554E5452592E53-     CNTRY_PATH  DB	  "COUNTRY.SYS",0
  1687 000007FE 595300             
  1688 00000801 000000000000000000-     	    DB	  52 DUP (0)
  1688 0000080A 000000000000000000-
  1688 00000813 000000000000000000-
  1688 0000081C 000000000000000000-
  1688 00000825 000000000000000000-
  1688 0000082E 00000000000000     
  1689                                  
  1690 00000835 FF434F554E545259        COUNTRY_FILE_SIGNATURE db 0FFh,'COUNTRY'
  1691                                  
  1692 0000083D ????                    CntryCodePage_Id DW ?
  1693                                  
  1694 0000083F 5C434F4D4D414E442E-     COMMND	DB	"\COMMAND.COM",0
  1694 00000848 434F4D00           
  1695 0000084C 000000000000000000-     	DB	51 dup (0)
  1695 00000855 000000000000000000-
  1695 0000085E 000000000000000000-
  1695 00000867 000000000000000000-
  1695 00000870 000000000000000000-
  1695 00000879 000000000000       
  1696                                  
  1697 0000087F 000000000000000000-     PathString db	64 dup (0)		;AN014;
  1697 00000888 000000000000000000-
  1697 00000891 000000000000000000-
  1697 0000089A 000000000000000000-
  1697 000008A3 000000000000000000-
  1697 000008AC 000000000000000000-
  1697 000008B5 000000000000000000-
  1697 000008BE 00                 
  1698 000008BF 53484152452E455845-     LShare	db	"SHARE.EXE",0,"/NC",0Dh,0Ah ;AN014;AN015;To be used by Load/exec.
  1698 000008C8 002F4E430D0A       
  1699                                  					;/NC parm will disable file sharing check.
  1700                                  
  1701                                   global linein
  1702 000008CE FF                      linein:		db 255
  1703 000008CF 00                      		db 0
  1704 000008D0 0D                      		db 13
  1705 000008D1 00<rep FEh>             		times 254 db 0
  1706 000009CF 26                      		db 26h
  1707                                  
  1708                                  COMTAB	LABEL	BYTE
  1709                                  ;;;;	   DB	   8,"AVAILDEV",'A'     ; NO LONGER SUPPORTED
  1710 000009D0 074255464645525342      	DB	7,"BUFFERS",  'B'
  1711 000009D9 05425245414B43          	DB	5,"BREAK",    'C'
  1712 000009E0 0A4445564943454849-     	DB	10,"DEVICEHIGH",'d'
  1712 000009E9 474864             
  1713 000009EC 0644455649434544        	DB	6,"DEVICE",   'D'
  1714 000009F4 0546494C455346          	DB	5,"FILES",    'F'
  1715 000009FB 044643425358            	DB	4,"FCBS",     'X'
  1716 00000A01 094C41535444524956-     	DB	9,"LASTDRIVE",'L'
  1716 00000A0A 454C               
  1717 00000A0C 0A4D554C5449545241-     	db     10,"MULTITRACK", 'M'     ;AN002;
  1717 00000A15 434B4D             
  1718 00000A18 08445249565041524D-     	DB	8,"DRIVPARM", 'P'       ; RS for DOS 3.2
  1718 00000A21 50                 
  1719                                  		%IF     STACKSW
  1720 00000A22 06535441434B534B        	DB	6,"STACKS",   'K'       ; BAS for DOS 3.2
  1721                                  		%ENDIF
  1722 00000A2A 07434F554E54525951      	DB	7,"COUNTRY",  'Q'
  1723 00000A33 095348454C4C484947-     	DB	9,"SHELLHIGH",'s'
  1723 00000A3C 4873               
  1724 00000A3E 055348454C4C53          	DB	5,"SHELL",    'S'
  1725 00000A45 0B494E5354414C4C48-     	db	11,"INSTALLHIGH",'i'
  1725 00000A4E 49474869           
  1726 00000A52 07494E5354414C4C49      	db	7,"INSTALL",  'I'       ;AN000;
  1727 00000A5B 0F494E5354414C4C4C-     	db	15,"INSTALLLASTHIGH",'i' | 80h
  1727 00000A64 41535448494748E9   
  1728 00000A6C 0B494E5354414C4C4C-     	db	11,"INSTALLLAST",  'I' | 80h
  1728 00000A75 415354C9           
  1729 00000A79 10494E5354414C4C46-     	counted "INSTALLFIRSTHIGH"
  1729 00000A82 4952535448494748   
  1730 00000A8A 34                      	db '4'
  1731 00000A8B 0C494E5354414C4C46-     	counted "INSTALLFIRST"
  1731 00000A94 49525354           
  1732 00000A98 33                      	db '3'
  1733 00000A99 0E494E5354414C4C4D-     	counted "INSTALLMIDHIGH"
  1733 00000AA2 494448494748       
  1734 00000AA8 36                      	db '6'
  1735 00000AA9 0A494E5354414C4C4D-     	counted "INSTALLMID"
  1735 00000AB2 4944               
  1736 00000AB4 35                      	db '5'
  1737 00000AB5 034946534A              	db	3,"IFS",      'J'       ;AN000;
  1738 00000ABA 044350535757            	db	4,"CPSW",     'W'       ;AN000;
  1739                                  ;;;;	   DB	   8,"SWITCHAR",'W'     ; NO LONGER SUPPORTED
  1740 00000AC0 07434F4D4D454E5459      	db	7,"COMMENT",  'Y'       ;AN000;
  1741 00000AC9 0352454D30              	db	3,"REM",      '0'       ;AN004;
  1742 00000ACE 085357495443484553-     	db	8,"SWITCHES", '1'       ;AN013;
  1742 00000AD7 31                 
  1743 00000AD8 06434F4D50415432        	db	6,"COMPAT",   '2'
  1744 00000AE0 0A414D49534E554D42-     	counted "AMISNUMBER"
  1744 00000AE9 4552               
  1745 00000AEB 37                      	db '7'
  1746 00000AEC 0B434845434B444556-     	counted "CHECKDEVICE"
  1746 00000AF5 494345             
  1747 00000AF8 38                      	db '8'
  1748 00000AF9 0E4541524C594C4153-     	counted "EARLYLASTDRIVE"
  1748 00000B02 544452495645       
  1749 00000B08 39                      	db '9'
  1750 00000B09 00                      	DB	0
  1751                                  
  1752                                  public DeviceParameters
  1753                                  DeviceParameters: ; NASM structure instance
  1754                                  A_DEVICEPARAMETERS_size equ A_DEVICEPARAMETERS_struc_size	; NASM port equate
  1755                                  istruc A_DEVICEPARAMETERS
  1756                                  at DP_SPECIALFUNCTIONS
  1757 00000B0A 00                      	db 0
  1758                                  at DP_DEVICETYPE
  1759 00000B0B 02                      	db DEV_3INCH720KB
  1760                                  at DP_DEVICEATTRIBUTES
  1761 00000B0C 0000                    	dw 0
  1762                                  at DP_CYLINDERS
  1763 00000B0E 5000                    	dw 80
  1764 00000B10 00<rep 11Eh>            iend
  1765                                  
  1766 00000C2E 0200                    hlim	    dw	    2
  1767 00000C30 0900                    slim	    dw	    9
  1768                                  
  1769                                  public sysinit_drive
  1770 00000C32 ??                      sysinit_drive	db	?
  1771                                  
  1772                                  public switches
  1773 00000C33 0000                    Switches    dw	0
  1774                                  
  1775                                  ;
  1776                                  ; The following are the recommended BPBs for the media that we know of so
  1777                                  ; far.
  1778                                  
  1779                                  ; 48 tpi diskettes
  1780                                  
  1781                                  sysinit_BPB48T:
  1782 00000C35 0002                    	DW	512
  1783 00000C37 02                      	DB	2
  1784 00000C38 0100                    	DW	1
  1785 00000C3A 02                      	DB	2
  1786 00000C3B 7000                    	DW	112
  1787 00000C3D D002                    	DW	2*9*40
  1788 00000C3F FD                      	DB	0FDH
  1789 00000C40 0200                    	DW	2
  1790 00000C42 0900                    	DW	9
  1791 00000C44 0200                    	DW	2
  1792 00000C46 00000000                	DD	0
  1793 00000C4A 00000000                        DD      0
  1794                                  
  1795                                  ; 96tpi diskettes
  1796                                  
  1797                                  sysinit_BPB96T:
  1798 00000C4E 0002                    	DW	512
  1799 00000C50 01                      	DB	1
  1800 00000C51 0100                    	DW	1
  1801 00000C53 02                      	DB	2
  1802 00000C54 E000                    	DW	224
  1803 00000C56 6009                    	DW	2*15*80
  1804 00000C58 F9                      	DB	0F9H
  1805 00000C59 0700                    	DW	7
  1806 00000C5B 0F00                    	DW	15
  1807 00000C5D 0200                    	DW	2
  1808 00000C5F 00000000                	DD	0
  1809 00000C63 00000000                        DD      0
  1810                                  
  1811                                  ; 3 1/2 inch diskette BPB
  1812                                  
  1813                                  sysinit_BPB35:
  1814 00000C67 0002                    	DW	512
  1815 00000C69 02                      	DB	2
  1816 00000C6A 0100                    	DW	1
  1817 00000C6C 02                      	DB	2
  1818 00000C6D 7000                    	DW	70h
  1819 00000C6F A005                    	DW	2*9*80
  1820 00000C71 F9                      	DB	0F9H
  1821 00000C72 0300                    	DW	3
  1822 00000C74 0900                    	DW	9
  1823 00000C76 0200                    	DW	2
  1824 00000C78 00000000                	DD	0
  1825 00000C7C 00000000                        DD      0
  1826                                        
  1827                                  sysinit_BPB35H:
  1828 00000C80 0002                    	DW	0200H
  1829 00000C82 01                      	DB	01H
  1830 00000C83 0100                    	DW	0001H
  1831 00000C85 02                      	DB	02H
  1832 00000C86 E000                    	DW	0E0h
  1833 00000C88 400B                    	DW	0B40H
  1834 00000C8A F0                      	DB	0F0H
  1835 00000C8B 0900                    	DW	0009H
  1836 00000C8D 1200                    	DW	0012H
  1837 00000C8F 0200                    	DW	0002H
  1838 00000C91 00000000                	DD	0
  1839 00000C95 00000000                        DD      0
  1840                                  
  1841                                  sysinit_BPBTable:
  1842 00000C99 [350C]                  	    dw	    sysinit_BPB48T		; 48tpi drives
  1843 00000C9B [4E0C]                  	    dw	    sysinit_BPB96T		; 96tpi drives
  1844 00000C9D [670C]                  	    dw	    sysinit_BPB35		; 3.5" drives
  1845                                  ; The following are not supported, so default to 3.5" media layout
  1846 00000C9F [670C]                  	    dw	    sysinit_BPB35		; Not used - 8" drives
  1847 00000CA1 [670C]                  	    dw	    sysinit_BPB35		; Not Used - 8" drives
  1848 00000CA3 [670C]                  	    dw	    sysinit_BPB35		; Not Used - hard files
  1849 00000CA5 [670C]                  	    dw	    sysinit_BPB35		; Not Used - tape drives
  1850 00000CA7 [800C]                  	    dw	    sysinit_BPB35H		; 3-1/2" 1.44MB drive
  1851                                  
  1852 00000CA9 08464853544449434E      switchlist  db	8,"FHSTDICN"         ; Preserve the positions of N and C.
  1853                                  
  1854                                  ; The following depend on the positions of the various letters in SwitchList
  1855                                  
  1856                                  switchnum	equ 11111000B		; which switches require number
  1857                                  
  1858                                  flagec35	equ 00000100B		; electrically compatible 3.5 inch disk drive
  1859                                  flagdrive	equ 00001000B
  1860                                  flagcyln	equ 00010000B
  1861                                  flagseclim	equ 00100000B
  1862                                  flagheads	equ 01000000B
  1863                                  flagff		equ 10000000B
  1864                                  
  1865                                  SWTCHR	    EQU     "/"             ; switch follows this character
  1866                                  
  1867                                  ; (no prior section) ; SYSINITSEG	ENDS
  1868                                  	END
