;       SCCSID = @(#)inicmd.asm 6.20 92/03/15

        SCCSID equ "@(#)inicmd.asm      6.20 92/03/15"
page ,132
Title INICMD.ASM -- CONFIG.SYS command parsing routines

; ****************************************************************************
; *                                                                          *
; *                       IBM/Microsoft Confidential                         *
; *                                                                          *
; *                 Copyright (c) IBM Corporation  1987, 1990                *
; *                 Copyright (c) Microsoft Corp.  1987, 1990                *
; *                           All Rights Reserved                            *
; *                                                                          *
; ****************************************************************************

;******************* Start of Specifications *******************
;*                                                             *
;* SOURCE FILE NAME:  INICMD.ASM                               *
;*                                                             *
;* DESCRIPTIVE NAME:  CONFIG.SYS processor                     *
;*                                                             *
;* FUNCTION:     To process CONFIG.SYS commands                *
;*                                                             *
;* NOTES:                                                      *
;*    DEPENDENCIES  The Token tables must be in the InitCode   *
;*               group.                                        *
;*    RESTRICTIONS                                             *
;*                                                             *
;* ENTRY POINTS:  Config_ProcessCommand                        *
;*                                                             *
;* EXTERNAL REFERENCES:  Config_GetComma                       *
;*               Config_GetEqualSign                           *
;*               Config_GetLongNumber                          *
;*               Config_GetHexNumber        ;### a25207        *
;*               Config_GetNumber                              *
;*               Config_GetOpenParen                           *
;*               Config_GetCloseParen                          *
;*               Config_GetYesNo                               *
;*               Config_GetOnOff                               *
;*               Config_GetMemManToken                         *
;*               Config_GetAbsDyn                              *
;*               Config_GetCodePage                            *
;*               Config_GetCountry                             *
;*               Config_GetRom                                 *
;*               Config_GetDevType                             *
;*               Config_GetSubType                             *
;*               Config_GetEndOfLine                           *
;*               Config_GetToken                               *
;*               Config_LinkPacket                             *
;*               Check_U_ModName                               *
;*               StrTransPathChar                              *
;*                                                             *
;* REVISIONS:                                                  *
;*                                                             *
;*   -  001     2/22/91   Mark Rogalski,   IBM                 *
;*      CP20 DCR 1329  Add DOS=UMB  and DEVICEHIGH support     *
;*                                                             *
;*   -  002     4/19/91   Mark Rogalski,   IBM                 *
;*      CP20 DCR 1360  Add DOS=HIGH support                    *
;*                                                             *
;***********************************************************************;BN011;
; 19Jun91 - G.L.Fulk                                                    ;BN011;
; Add support for a DOS ONLY "FILES=" statement in CONFIG.SYS.          ;BN011;
;***********************************************************************;BN011;
; 28Jun91 - Bob Heath
; Before calling Config_RangeCheck within Config_CMD_DiskCache,         ;BN012;
; insure that eax, ebx, and ecx have their upper word cleared.          ;BN012;
;***********************************************************************;BN011;
; 17Jun92 - Jon Grimm
; DEVICEHIGH=SIZE=xx should support hex values not decimal              ;a25207
; defect a25207                                                         ;a25207
;***********************************************************************;a25207
; 03Nov92 - Allen Wynn
;  Bring Jon's changes (above) into R205 and R206.  Defect 56564
;***********************************************************************78486
; 11Mar94 - Franz Tigges  Feature 78693 put in under defect             78486
;  Allow automatic reboot for Ring 0 traps and IPEs DCR AIPL            78486
;***********************************************************************78486
; 11May94 - D.Azzarito  Defect 83390                                    @83390
;  Support FORCEd Autocheck (AC:CD+EF checks C,D,F if dirty, E ALWAYS)  @83390
;***********************************************************************78486
;*   -  93272   8/11/94   Scott Cottrill   ChgTeam             *
;*      Added code to allow a way to shut off VME via          *
;*      software.  The VME command was added to config.sys     *
;*      processing to allow for this.  VME=YES is the default  *
;*      value.                                                 *
;*                                                             *
;******************** End of Specifications ********************
; 01Apr96 - D.R. Brown  Defect 150371                                 D150371
;  System Anchor Block support                                        D150371
;*********************************************************************D150371
.sall

;include dosseg.inc
;include basemaca.inc
;include osmaca.inc
;include mi.inc
;include struc.inc
;include fisam.inc
;include inicfg.inc
;include inicmd.inc
;include iniequ.inc
;include basemid.inc
;include infoseg.inc
.xlist
include dosseg.inc
include basemaca.inc
include fnoinit.inc
include osmaca.inc
include mi.inc
include struc.inc
include fisam.inc
include inicfg.inc
include inicmd.inc
include iniequ.inc
include basemid.inc
include infoseg.inc
include ldrvars.inc
include advprop.inc                                                     ;BN011;
include prtinit.inc
.list
        CpuMode 386
        ModName inicmd, FNO_INICMD_ASM

extrn           Check_U_ModName:near
extrn           Config_GetComma:near
extrn           Config_GetChar:near                        ;### AC DCR 1520
extrn           Config_GetEqualSign:near
extrn           Config_GetLongNumber:near
extrn           Config_GetHexNumber:near                   ;### a25207
extrn           Config_GetNumber:near
extrn           Config_GetOpenParen:near
extrn           Config_GetCloseParen:near
extrn           Config_GetYesNo:near

IF        RAS                                                          ;83839
extrn           Config_GetTrapdump:near                                ;78486
ENDIF  ;  RAS                                                          ;83839

extrn           Config_GetOnOff:near
extrn           Config_GetMemManToken:near
extrn           Config_GetAbsDyn:near
extrn           Config_GetCodePage:near
extrn           Config_GetCountry:near
extrn           Config_GetRom:near
extrn           Config_GetDevType:near
extrn           Config_GetSubType:near
extrn           Config_GetEndOfLine:near
extrn           Config_GetToken:near
extrn           Config_LinkPacket:near
extrn           Config_RangeCheck:near
extrn           Config_GetDosFlags:near                    ;BC002
extrn           Config_VerifyToken:near
extrn           StrTransPathChar:near
extrn           Config_GetDiskThresh:near
extrn           Config_GetLazyWrite:near
extrn           Config_GetAutoCheck:near                   ;### AC DCR 1520

ReferInitGlobal CFG_AutoCheck,BYTE                         ;### AC DCR 1520
ReferInitGlobal CFG_Break,BYTE
ReferInitGlobal CFG_Dos_Flags,BYTE                         ;BN002
ReferInitGlobal CFG_Buffers,WORD
ReferInitGlobal CFG_DiskCache,DWORD
ReferInitGlobal CFG_DiskThresh,WORD                                      ;@9312
ReferInitGlobal CFG_LazyWrite,BYTE
ReferInitGlobal CFG_FCBCount,WORD
ReferInitGlobal CFG_FCBKeep,WORD
ReferInitGlobal CFG_FILESCount,WORD                                     ;BN011;
ReferInitGlobal CFG_Prompt,BYTE
ReferInitGlobal CFG_PrtBufSize,WORD
ReferInitGlobal CFG_ProtectOnly,BYTE
ReferInitGlobal CFG_RMSize,WORD
ReferInitGlobal syiLowMem,WORD                              ; 94242
ReferInitGlobal syiHighMem,WORD                             ; 94242
ReferInitGlobal syiExtendMem,DWORD                          ; 159603

if RAS
ReferInitGlobal CFG_TraceBuf,WORD
ReferInitGlobal CFG_TraceBits,BYTE
ReferInitGlobal CFG_LocalTraceBits,BYTE
endif ;RAS

ReferInitGlobal CFG_LocalSubType,BYTE
ReferInitGlobal Config_Sys_Data,WORD
ReferInitGlobal Config_Sys_File,WORD
ReferInitGlobal CFG_Token,BYTE
ReferInitGlobal SizeTokenTable,BYTE                        ;BN001
ReferInitGlobal CFG_LastDrive,BYTE
ReferInitGlobal CFG_ReserveDriveLetter,BYTE
ReferInitGlobal CFG_Defaultcache,BYTE

ReferGlobal     REIPL_ON,BYTE                       ;78486
ReferGlobal     SISData,BYTE
;ReferGlobal     IoplEnabled,BYTE                   ;d62519
ReferGlobal     ProtOnlySystem,BYTE                 ;### PTR B786008
ReferGlobal     FSPrtyIO_Mode,BYTE                  ;### Pio dcr
ReferGlobal     MaxThreads,WORD
ReferGlobal     DUMP_ON,BYTE
ReferGlobal     DumpDevice,BYTE                     ;TrapDump device
ReferGlobal     _SMswapping,BYTE
ReferGlobal     _SMCommit,BYTE
ReferGlobal     DynTimeSlice,BYTE                   ; DCR1203

ReferFlat       _VMProtectedMem,BYTE
ReferFlat       _VMPackedMem,BYTE

ReferFlat       _smDelaySwap,BYTE

ReferGlobal     _SMCFGMinFree,dword
ReferGlobal     _SMCFGSwapSize,dword

public          _GlobalVME                                  ;93272
public          _GlobalAutoFail, GlobalAutoFail            ; D150371
public          _DumpProcess
public          _PopUpLogDrive                             ;157614
public          _SuppressPopUps
public          _UMB_ON                                    ;BN001

DATA segment
_GlobalVME       db     DefaultGlobalVME                    ;93272
_GlobalAutoFail label  BYTE                                ; D150371
GlobalAutoFail  db     DefaultGlobalAutoFail
_DumpProcess    db     0
_SuppressPopUps db     0
_PopUpLogDrive  db     2                                   ;157614
_UMB_ON         db     1                                   ;BN001
DATA ends

        FARCODE INIT
INITCODE segment


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_ProcessCommand                     *
;*                                                             *
;* DESCRIPTIVE NAME:  Process a command                        *
;*                                                             *
;* FUNCTION:     To process a Config.Sys command               *
;*                                                             *
;* NOTES:        This procedure scans the given command        *
;*               processing table and invokes each procedure   *
;*               listed.  It stops when a carry is returned    *
;*               or when the end of the table is reached.      *
;*                                                             *
;* ENTRY POINT:  Config_ProcessCommand                         *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               AX        -> command processing table         *
;*               DS:SI     -> command line to be processed     *
;*               ES        -> DOSINITDATA                      *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               DS:SI     -> within the current line          *
;*               AX        undefined                           *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               DS:SI     -> within the current line          *
;*               AX        = error code                        *
;*                                                             *
;* EFFECTS:      CFG_Token                                     *
;*               ParmValue1 and ParmValue2 are initialized     *
;*               to zero but may be set by called routines     *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Initialize ParmValue1 and ParmValue2 and ParmSize
;Address first table entry
;Repeat
;        Call routine in table
;        IF carry THEN exit loop
;        Address next table entry
;Until end of table encountered
Procedure       Config_ProcessCommand
                assume  ds:nothing,es:DOSINITDATA
                LocalVar ParmValue1,WORD
                LocalVar ParmValue2,WORD
                LocalVar ParmValue3,WORD
                LocalVar ParmSize,DWORD            ;BN001
                LocalVar LongParmValue1,DWORD       ;PTR B783548
                LocalVar LongParmValue2,DWORD
                EnterProc
                push    bx

                mov     ParmValue1,0
                mov     ParmValue2,0
                mov     ParmValue3,0
                mov     ParmSize, -1            ;default - load driver low  BN001
                mov     LongParmValue1,0
                mov     LongParmValue2,0

                mov     bx,ax                   ;BX -> Command processing table
                clc

                .repeat                               ;repeat for entries in processing table
                  call    es:[bx].SemanticRoutine       ;Call a routine from the table
                  .leave  c                             ;If error, stop processing
                  add     bx,size CmdTableStruc         ;Get the next routine
                .until  <<word ptr es:[bx]> eq 0>     ;Until no more routines

                pop     bx
                LeaveProc
                ret
EndProc         Config_ProcessCommand


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_SetParmValue1                      *
;*                                                             *
;* DESCRIPTIVE NAME:  Set parameter 1                          *
;*                                                             *
;* FUNCTION:     To save the value of AX in parameter 1        *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via a command table.    *
;*                                                             *
;* ENTRY POINT:  Config_SetParmValue1                          *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               AX        = value to save                     *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               ParmValue1  set                               *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Store parameter value
;Clear carry
Procedure       Config_SetParmValue1,NEAR,LOCAL
                mov     ParmValue1,ax           ;Save parameter value
                clc                             ;No error
                ret
EndProc         Config_SetParmValue1


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_SetParmValue2                      *
;*                                                             *
;* DESCRIPTIVE NAME:  Set parameter 2                          *
;*                                                             *
;* FUNCTION:     To save the value of AX in parameter 2        *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via a command table.    *
;*                                                             *
;* ENTRY POINT:  Config_SetParmValue2                          *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               AX        = value to save                     *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               ParmValue2  set                               *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Store parameter value
;Clear carry
Procedure       Config_SetParmValue2,NEAR,LOCAL
                mov     ParmValue2,ax           ;Save parameter value
                clc                             ;No error
                ret
EndProc         Config_SetParmValue2



;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_SetParmValue3                      *
;*                                                             *
;* DESCRIPTIVE NAME:  Set parameter 3                          *
;*                                                             *
;* FUNCTION:     To save the value of AX in parameter 3        *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via a command table.    *
;*                                                             *
;* ENTRY POINT:  Config_SetParmValue3                          *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               AX        = value to save                     *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               ParmValue3  set                               *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Store parameter value
;Clear carry
Procedure       Config_SetParmValue3,NEAR,LOCAL
                mov     ParmValue3,ax           ;Save parameter value
                clc                             ;No error
                ret
EndProc         Config_SetParmValue3



;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_GetParmString                      *
;*                                                             *
;* DESCRIPTIVE NAME:  Get a parameter string                   *
;*                                                             *
;* FUNCTION:     To get a mixed case delimited string token    *
;*               and put it in the packet segment              *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via a command table.    *
;*                                                             *
;* ENTRY POINT:  Config_GetParmString                          *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               DS:SI     -> token to get                     *
;*               ES        -> DOSINITDATA                      *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        -> string in packet segment         *
;*               SI        -> next token to get                *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     clear                               *
;*               AX        0                                   *
;*               SI        unchanged                           *
;*                                                             *
;* EFFECTS:      CFG_FreePtr                                   *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_GetString                              *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
Procedure       Config_GetParmString,NEAR,LOCAL
                mov     ax,2                    ;Get a mixed case delimited string
                call    Config_GetString
                ret
EndProc         Config_GetParmString


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_GetParmList                        *
;*                                                             *
;* DESCRIPTIVE NAME:  Get a parameter list                     *
;*                                                             *
;* FUNCTION:     To get a mixed case undelimited string token  *
;*               and put it in the packet segment              *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via a command table.    *
;*                                                             *
;* ENTRY POINT:  Config_GetParmList                            *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               DS:SI     -> token to get                     *
;*               ES        -> DOSINITDATA                      *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        -> string in packet segment         *
;*               SI        -> next token to get                *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     clear                               *
;*               AX        0                                   *
;*               SI        unchanged                           *
;*                                                             *
;* EFFECTS:      CFG_FreePtr                                   *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_GetString                              *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
Procedure       Config_GetParmList,NEAR,LOCAL
                mov     ax,3                    ;Get a mixed case undelimited string
                call    Config_GetString
                ret
EndProc         Config_GetParmList


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_GetString                          *
;*                                                             *
;* DESCRIPTIVE NAME:  Get a string                             *
;*                                                             *
;* FUNCTION:     To get a string token and put it in the       *
;*               packet segment                                *
;*                                                             *
;* NOTES:                                                      *
;*                                                             *
;* ENTRY POINT:  Config_GetString                              *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               AX        0 = get uppercase delimited string  *
;*                         1 = get uppercase undelimited string*
;*                         2 = get mixed case delimited string *
;*                         3 = get mixed case undelimited      *
;*                             string                          *
;*               DS:SI     -> token to get                     *
;*               ES        -> DOSINITDATA                      *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        -> string in packet segment         *
;*               SI        -> next token to get                *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     clear                               *
;*               AX        0                                   *
;*               SI        unchanged                           *
;*                                                             *
;* EFFECTS:      CFG_FreePtr                                   *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Get a token (call Config_GetToken)
;IF Token did not exist
;        Indicate no string
;ELSE
;        Move token string to packet segment
;        Update the free pointer (word aligned)
;ENDIF
;Clear carry
Procedure       Config_GetString,NEAR,LOCAL
                assume  ds:nothing,es:DOSINITDATA
                call    Config_GetToken         ;Get a token
                .if     c                       ;If token did not exist
                  .if     <CFG_Token eq 0>        ;If no token
                    xor     ax,ax                   ;Indicate no string
                    clc                             ;no error
                  .else                           ;Else
                    stc                             ;Preserve other errors
                  .endif                          ;Endif
                .else                           ;Else
                  push    ds
                  push    es
                  push    si
                  push    di

                  push    es
                  pop     ds                      ;DS -> DOSINITDATA
                  mov     es,Config_Sys_Data      ;ES -> Config.Sys packets
                  lea     si,DOSINITDATA:CFG_Token  ;Move token to packet segment
                  mov     di,es:[0].CFG_FreePtr   ;Get free area
                  .repeat                         ;Move ASCIIZ string
                    lodsb
                    stosb
                  .until  <zero al>
                  inc     di                      ;Word align the free area
                  and     di,not 1
                  mov     ax,es:[0].CFG_FreePtr   ;Remember where we put the string
                  .if     <di b ax>
                    InternalError <Config_GetString Config_Sys_Data segment corrupted>
                  .endif
                  mov     es:[0].CFG_FreePtr,di   ;Update the free pointer

                  pop     di
                  pop     si
                  pop     es
                  pop     ds
                  clc
                .endif                          ;Endif
                ret
EndProc         Config_GetString



;This command processing table gives Config_ProcessCommand the steps for
;processing the AUTOFAIL command.

CmdTable        Config_AutoFail
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetYesNo
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_AutoFail
EndCmdTable     Config_AutoFail


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_AutoFail                       *
;*                                                             *
;* DESCRIPTIVE NAME:  AutoFail                                 *
;*                                                             *
;* FUNCTION:     To process the AutoFail command               *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_AutoFail *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_AutoFail                           *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = Yes/No value found              *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DosGroup:GlobalAutoFail  set                  *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:                                                *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:                                                *
;*                                                             *
;******************** End of Specifications ********************
;Store AutoFail value
;Clear carry
Procedure       Config_CMD_AutoFail,NEAR,LOCAL
                assume ds:nothing,es:DOSINITDATA
                mov     ax,ParmValue1           ;Get the AutoFail value
                push    ds
                DosContext ds
                mov     GlobalAutoFail,al       ;Save it
                pop     ds
                assume  ds:nothing
                clc                             ;No error
                ret
EndProc         Config_CMD_AutoFail

;93272 start of code insertion
;This command processing table gives Config_ProcessCommand the steps for
;processing the VME command.

CmdTable        Config_VME
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetYesNo
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_VME
EndCmdTable     Config_VME


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_VME                            *
;*                                                             *
;* DESCRIPTIVE NAME:  VME                                      *
;*                                                             *
;* FUNCTION:     To process the VME command                    *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_VME      *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_VME                                *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = Yes/No value found              *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DosGroup:GlobalVME set                        *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:                                                *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:                                                *
;*                                                             *
;******************** End of Specifications ********************
;Store VME value
;Clear carry
Procedure       Config_CMD_VME,NEAR,LOCAL
                assume ds:nothing,es:DOSINITDATA
                mov     ax,ParmValue1           ;Get the VME value
                push    ds
                DosContext ds
                mov     _GlobalVME,al            ;Save it
                pop     ds
                assume  ds:nothing
                clc                             ;No error
                ret
EndProc         Config_CMD_VME

;93272 end of code insertion

IF        RAS                                                          ;83839
;                                                                      ;78486
;This command processing table gives Config_ProcessCommand the         ;78486
;steps for processing the REIPL command.                               ;78486
                                                                       ;78486
CmdTable        Config_Reipl                                           ;78486
CmdTableEntry     Config_GetEqualSign                                  ;78486
CmdTableEntry     Config_GetOnOff                                      ;78486
CmdTableEntry     Config_SetParmValue1                                 ;78486
CmdTableEntry     Config_GetEndOfLine                                  ;78486
CmdTableEntry     Config_CMD_Reipl                                     ;78486
EndCmdTable     Config_Reipl                                           ;78486
                                                                       ;78486
                                                                       ;78486
;******************* Start of Specifications *******************       ;78486
;*                                                             *       ;78486
;* SUBROUTINE NAME:  Config_CMD_Reipl                          *       ;78486
;*                                                             *       ;78486
;* DESCRIPTIVE NAME:  Reipl                                    *       ;78486
;*                                                             *       ;78486
;* FUNCTION:     To process the REIPL command                  *       ;78486
;*                                                             *       ;78486
;* NOTES:        This procedure is called indirectly by        *       ;78486
;*               Config_ProcessCommand via the Config_Reipl    *       ;78486
;*               table                                         *       ;78486
;*                                                             *       ;78486
;* ENTRY POINT:  Config_CMD_Reipl                              *       ;78486
;*    LINKAGE:   call near                                     *       ;78486
;*                                                             *       ;78486
;* INPUT:                                                      *       ;78486
;*                                                             *       ;78486
;*               ES        addresses DOSINITDATA               *       ;78486
;*               ParmValue1  = On/Off value found              *       ;78486
;*                                                             *       ;78486
;* EXIT-NORMAL:                                                *       ;78486
;*                                                             *       ;78486
;*               Carry     clear                               *       ;78486
;*               AX        undefined                           *       ;78486
;*               DosGroup:GlobalReipl set                      *       ;78486
;*                                                             *       ;78486
;* EXIT-ERROR:   none                                          *       ;78486
;*                                                             *       ;78486
;* EFFECTS:      none                                          *       ;78486
;*                                                             *       ;78486
;* INTERNAL REFERENCES:                                        *       ;78486
;*    ROUTINES:                                                *       ;78486
;*                                                             *       ;78486
;* EXTERNAL REFERENCES:                                        *       ;78486
;*    ROUTINES:                                                *       ;78486
;*                                                             *       ;78486
;******************** End of Specifications ********************       ;78486
;Store Reipl value                                                     ;78486
;Clear carry                                                           ;78486
Procedure       Config_CMD_Reipl,NEAR,LOCAL                            ;78486
                assume ds:nothing,es:DOSINITDATA                       ;78486
                mov     ax,ParmValue1           ;Get the REIPL value   ;78486
                push    ds                                             ;78486
                DosContext ds                                          ;78486
                mov     REIPL_ON,al             ;Save it               ;78486
                pop     ds                                             ;78486
                assume  ds:nothing                                     ;78486
                clc                             ;No error              ;78486
                ret                                                    ;78486
EndProc         Config_CMD_Reipl                                       ;78486
ENDIF  ;  RAS                                                          ;83839

;This command processing table gives Config_ProcessCommand the steps for
;processing the BASEDEV commands.

CmdTable        Config_Basedev
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetParmString
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetParmList
CmdTableEntry     Config_SetParmValue2
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Basedev
EndCmdTable     Config_Basedev


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAfME:  Config_CMD_Basedev                       *
;*                                                             *
;* DESCRIPTIVE NAME:  Basedev                                  *
;*                                                             *
;* FUNCTION:     To process the BASEDEV                        *
;*
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Basedev  *
;*               table                                         *
;*
;* ENTRY POINT:  Config_CMD_Basedev                            *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = address of filespec in packet   *
;*                         segment                             *
;*               ParmValue2  = address of parameters in        *
;*                         packet segment                      *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               BASEDEV packets Built and linked into list    *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  StrTransPathChar                              *
;*                                                             *
;******************** End of Specifications ********************
;IF a filespec was given
;        Store ptr to filespec
;        Store ptr to parameters
;        Link packet into Device chain
;        Update free pointer
;        Clear carry
;ELSE
;        Set error code
;        Set carry
;ENDIF
Procedure Config_CMD_Basedev
          assume ds:nothing,es:DOSINITDATA
          push    ds
          push    si
          push    di

          mov     ds,Config_Sys_Data      ;DS -> Config.Sys data
          mov     di,ds:[0].CFG_FreePtr   ;Get free pointer
          mov     eax,ParmSize            ; save the Size value   BN001
          mov     ds:[di].CFG_Size,eax    ; store size val in config struc BN001
          mov     ax,ParmValue1           ;Get ptr to device name
          .if     <nonzero ax>            ;If a device was specified
            mov     ds:[di].CFG_FileSpec,ax       ;Save ptr to filespec
            mov     si,ax                 ; ds:si -> filespec
            call    StrTransPathChar      ; make sure no / as path seps
            mov     ax,ParmValue2                 ;Save ptr to parameters
            mov     ds:[di].CFG_Parameters,ax
            lea     si,ds:[0].CFG_Basedev         ;Link packet into device chain
            call    Config_LinkPacket
            add     di,size CFG_Packet3           ;Update free pointer
            .if     c
              InternalError <Config_CMD_Device_IFS Config_Sys_Data segment corrupted>
            .endif
            mov     ds:[0].CFG_FreePtr,di
            clc                                   ;No error
          .else                           ;Else
            mov     ax,MSG_SYSINIT_MISSING_PARM
            stc                                   ;Indicate missing parameter error
          .endif                          ;Endif

          pop     di
          pop     si
          pop     ds
          ret
EndProc   Config_CMD_Basedev



;This command processing table gives Config_ProcessCommand the steps for
;processing the BREAK command.

CmdTable        Config_Break
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetOnOff
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Break
EndCmdTable     Config_Break


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Break                          *
;*                                                             *
;* DESCRIPTIVE NAME:  Break                                    *
;*                                                             *
;* FUNCTION:     To process the Break command                  *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Break    *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Break                              *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = On/Off value found              *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DOSINITDATA:CFG_Break  set                    *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:                                                *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:                                                *
;*                                                             *
;******************** End of Specifications ********************
;Store Break value
;Clear carry
Procedure       Config_CMD_Break,NEAR,LOCAL
                assume ds:nothing,es:DOSINITDATA
                mov     ax,ParmValue1           ;Get the break value
                mov     CFG_Break,al            ;Save it
                clc                             ;No error
                ret
EndProc         Config_CMD_Break



;This command processing table gives Config_ProcessCommand the steps for
;processing the BUFFERS command.

CmdTable        Config_Buffers
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetNumber
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Buffers
EndCmdTable     Config_Buffers

;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Buffers                        *
;*                                                             *
;* DESCRIPTIVE NAME:  Buffers                                  *
;*                                                             *
;* FUNCTION:     To process the Buffers command                *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Bruffers *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Buffers                            *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = Buffers value                   *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DOSINITDATA:CFG_Buffers  set                  *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF Buffers value out of range
;        Set error code
;        Set carry
;ELSE
;        Store Buffers value
;        Clear carry
;ENDIF
Procedure       Config_CMD_Buffers
                assume ds:nothing,es:DOSINITDATA
                push    cx
                push    dx
                movzx   eax,ParmValue1           ;Get buffers value
                xor     ecx,ecx
                mov     cx,MinBuffers
                xor     edx,edx
                mov     edx,MaxBuffers
                call    Config_RangeCheck
                .if     nc
                  mov     CFG_Buffers,ax          ;Save buffers value
                .endif
                pop     dx
                pop     cx
                ret
EndProc         Config_CMD_Buffers



;This command processing table gives Config_ProcessCommand the steps for
;processing the CALL command.

CmdTable        Config_Call
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetParmString
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetParmList
CmdTableEntry     Config_SetParmValue2
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Call
EndCmdTable     Config_Call


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Call                           *
;*                                                             *
;* DESCRIPTIVE NAME:  Call                                     *
;*                                                             *
;* FUNCTION:     To process the Call command                   *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Call     *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Call                               *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = address of filespec in packet   *
;*                         segment                             *
;*               ParmValue2  = address of parameters in        *
;*                         packet segment                      *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               Call packet  Built and linked into list       *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF a filespec was given
;        Store ptr to filespec
;        Store ptr to parameters
;        Link packet into Run chain (call Config_LinkPacket)
;        Update free pointer
;        Clear carry
;ELSE
;        Set error code
;        Set carry
;ENDIF
Procedure       Config_CMD_Call
                assume ds:nothing,es:DOSINITDATA
                push    ds
                push    si
                push    di

                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                mov     di,ds:[0].CFG_FreePtr   ;DI -> Call packet
                mov     ax,ParmValue1           ;Get filespec ptr
                .if     <nonzero ax>            ;If filespec given
                  mov     ds:[di].CFG_FileSpec,ax       ;Store filespec
                  mov     ax,ParmValue2                 ;Store Parmlist
                  mov     ds:[di].CFG_Parameters,ax
                  mov     ds:[di].CFG_Type,CFG_Type_Call ;Tag as a Call packet
                  lea     si,ds:[0].CFG_Run             ;Link packet into run list
                  call    Config_LinkPacket
                  add     di,size CFG_Packet3           ;Calculate end address of packet
                  .if     c
                    InternalError <Config_CMD_Call Config_SysData segment corrupted>
                  .endif
                  mov     ds:[0].CFG_FreePtr,di         ;Update free pointer
                  clc                                   ;No error
                .else                           ;Else
                  mov     ax,MSG_SYSINIT_MISSING_PARM
                  stc                                   ;Missing parameter error
                .endif                          ;Endif

                pop     di
                pop     si
                pop     ds
                ret
EndProc         Config_CMD_Call



;This command processing table gives Config_ProcessCommand the steps for
;processing the CODEPAGE command.

CmdTable        Config_CodePage
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_CMD_CodePage
EndCmdTable     Config_CodePage


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_CodePage                       *
;*                                                             *
;* DESCRIPTIVE NAME:  CodePage                                 *
;*                                                             *
;* FUNCTION:     To process the CodePage command               *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_CodePage *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_CodePage                           *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               DS:SI     -> command line following the =     *
;*               ES        addresses DOSINITDATA               *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DS:SI     -> end of the command line          *
;*               CodePage packet  built and linked into list   *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*               DS:SI     -> within the command line          *
;*               Token     invalid token                       *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*               Config_GetCodePage                            *
;*               Config_GetComma                               *
;*               Config_GetEndOfLine                           *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Setup CodePage packet
;N = 0
;State CodePageStart
;        Call Config_GetCodePage
;        IF carry THEN change to CodePageEnd state
;        Store value in packet
;        N = N+1
;        Call Config_GetComma
;        IF carry THEN change to CodePageEOL state
;        Repeat
;
;State CodePageEOL
;        Call Config_GetEndOfLine
;        IF carry THEN change to CodePageEnd state
;        IF N <= 2
;                Link packet into CodePage chain (call Config_LinkPacket)
;                Freeze space for packet
;                Clear carry
;        ELSE
;                Set error code
;                Set carry
;        ENDIF
;        Change to CodePageEnd state
;
;State CodePageEnd
;        Return
Procedure       Config_CMD_CodePage
                assume ds:nothing,es:DOSINITDATA
                push    ds
                push    bx
                push    cx
                push    si
                push    di

                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                mov     di,ds:[0].CFG_FreePtr   ;DI -> Packet to be
                xor     bx,bx                   ;BX -> First codepage
                mov     cx,size CFG_Packet1     ;CX = Size of packet

                mov     ds,Config_Sys_File      ;DS -> Config.Sys file

state           CodePageStart
                call    Config_GetCodePage      ;Get the codepage value
                nextstate CodePageEnd c         ;If error then quit
                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                mov     ds:[bx+di].CFG_IDs,ax   ;Save codepage id
                add     bx,2                    ;BX -> next codepage slot
                mov     ds,Config_Sys_File      ;DS -> Config.Sys file
                call    Config_GetComma         ;Get a comma
                nextstate CodePageEol c         ;If no comma then get end of line
                add     cx,2                    ;Extend packet to accomodate codepage
endstate        CodePageStart repeat            ;Repeat

state           CodePageEol                     ;Verify end of line
                call    Config_GetEndOfLine     ;Get the EOL
                nextstate CodePageEnd c         ;If no eol then quit
                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                shr     bx,1                    ;BX = codepage count
                .if     <bx be 2>               ;If 1 or 2 codpages
                  mov     ds:[di].CFG_nIDs,bx     ;Save ID count
                  lea     si,ds:[0].CFG_CodePage  ;Link packet into codepage chain
                  call    Config_LinkPacket
                  add     ds:[0].CFG_FreePtr,cx   ;Update free pointer
                  .if     c
                    InternalError <Config_CMD_CodePage Config_Sys_Data segment corrupted>
                  .endif
                  clc                             ;No error
                .else                           ;Else
                  mov     ax,MSG_SYSINIT_TOO_MANY_PARMS
                  stc                             ;Error--2 codepages max
                .endif                          ;Endif
                nextstate CodePageEnd
endstate        CodePageEol

state           CodePageEnd
                pop     di
                pop     si
                pop     cx
                pop     bx
                pop     ds
                ret
endstate        CodePageEnd
EndProc         Config_CMD_CodePage



;This command processing table gives Config_ProcessCommand the steps for
;processing the COUNTRY command.

CmdTable        Config_Country
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetCountry
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_CMD_Country
EndCmdTable     Config_Country


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Country                        *
;*                                                             *
;* DESCRIPTIVE NAME:  Country                                  *
;*                                                             *
;* FUNCTION:     To process the Country command                *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Country  *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Country                            *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = country code                    *
;*               DS:SI     -> command after the country code   *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               Country packet  built and linked into list    *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;
;Check for optional end of line (call Config_GetEndOfLine)
;If additional info found (c)
;    Get an optional comma (call Config_GetComma)
;    Get the country file name (call Config_GetParmString)
;    If no file name found (AX=0)
;        Set carry and error code
;    Else
;        Remember string found
;        Verify end of line (call Config_GetEndOfLine)
;    Endif
;Endif
;If everything parsed ok (nc)
;    Store Country code
;    Store filespec
;    Link packet into Country chain (call Config_LinkPacket)
;    Update free pointer
;Endif
Procedure       Config_CMD_Country
                assume ds:nothing,es:DOSINITDATA

                call    Config_GetEndOfLine     ;This statement optionally ends
                .if     c                       ;If additional info on statement
                    call    Config_GetComma         ;Eat the comma (if any)
                    call    Config_GetParmString    ;Get the filespec
                    .if     <zero ax>               ;If no parameter found
                        mov     ax,MSG_SYSINIT_MISSING_PARM
                        stc
                    .else
                        mov     ParmValue2,ax           ;Remember the filespec
                        call    Config_GetEndOfLine     ;Check for end of line
                    .endif
                .endif
                .if     nc                      ;If everything parsed ok
                    push    ds
                    push    si
                    push    di

                    mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                    mov     di,ds:[0].CFG_FreePtr   ;Get free area
                    mov     ax,ParmValue1           ;Set country code
                    mov     ds:[di].CFG_CountryCode,ax
                    mov     ax,ParmValue2           ;Set filespec
                    mov     ds:[di].CFG_FileSpec,ax
                    lea     si,ds:[0].CFG_Country   ;Link packet into Country chain
                    call    Config_LinkPacket
                    add     di,size CFG_Packet2     ;Update free pointer
                    .if     c
                      InternalError <Config_CMD_Country Config_Sys_Data segment corrupted>
                    .endif
                    mov     ds:[0].CFG_FreePtr,di
                    clc                             ;No error

                    pop     di
                    pop     si
                    pop     ds
                .endif
                ret
EndProc         Config_CMD_Country




;This command processing table gives Config_ProcessCommand the steps for
;processing the DEVICEHIGH commands.

CmdTable        Config_DeviceHigh                                  ;BN001
CmdTableEntry     Config_GetEqualSign                              ;BN001
CmdTableEntry     Config_GetSizeToken                              ;BN001
CmdTableEntry     Config_GetParmString                             ;BN001
CmdTableEntry     Config_SetParmValue1                             ;BN001
CmdTableEntry     Config_GetParmList                               ;BN001
CmdTableEntry     Config_SetParmValue2                             ;BN001
CmdTableEntry     Config_GetEndOfLine                              ;BN001
CmdTableEntry     Config_CMD_Device                                ;BN001
EndCmdTable     Config_DeviceHigh                                  ;BN001


;
; SUBROUTINE NAME:  Config_GetSizeToken
;
; DESCRIPTIVE NAME:  Get a SIZE token
;
; FUNCTION:      To verify and consume a SIZE token
;
; NOTES:
;
; ENTRY POINT:   Config_GetSizeToken
;    LINKAGE:    call near
;
; INPUT:
;
;                DS:SI     -> position to scan for token
;                ES        addresses DOSINITDATA
;
; EXIT-NORMAL:
;
;                Carry     clear
;                AX        token found (0=SIZE)
;                DS:SI     -> position to scan for next token
;
; EXIT-ERROR:
;
;                Carry     set
;                AX        error code
;                DS:SI     unchanged
;                Token     invalid token
;
; EFFECTS:       none
;
; INTERNAL REFERENCES:
;    ROUTINES:   Config_VerifyToken
;                Config_GetEqualSign
;                Config_GetHexNumber
;
; EXTERNAL REFERENCES:
;    ROUTINES:
;
;Verify token (call Config_VerifyToken)                                                 ;BN001
Procedure       Config_GetSizeToken                                                     ;BN001
                push    bx                                                              ;BN001
                lea     bx,DOSINITDATA:SizeTokenTable  ;Address the size token table    ;BN001
                call    Config_VerifyToken             ;Get and verify the token        ;BN001
                .if     nc                             ;if size token then              ;BN001
                  Call  Config_GetEqualSign            ;get size value                  ;BN001
                  Call  Config_GetHexNumber            ;get a four byte number          ;a25207
                  .if   nc                             ;if value gotten then            ;BN001
                    mov ParmSize,eax                   ;store value                     ;BN001
                  .endif                                                                ;BN001
                .else                                  ;allow to continue               ;BN001
                  clc                                  ;clear error                     ;BN001
                  mov ParmSize, 0                      ;default size                    ;BN001
                .endif                                                                  ;BN001
                pop     bx                                                              ;BN001
                ret                                                                     ;BN001
EndProc         Config_GetSizeToken                                                     ;BN001

;This command processing table gives Config_ProcessCommand the steps for
;processing the DEVICE commands.

CmdTable        Config_Device
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetParmString
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetParmList
CmdTableEntry     Config_SetParmValue2
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Device
EndCmdTable     Config_Device


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAfME:  Config_CMD_Device_IFS                     *
;*                                                             *
;* DESCRIPTIVE NAME:  Device and IFS                           *
;*                                                             *
;* FUNCTION:     To process the DEVICE and the IFS commands    *
;*
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Device   *
;*               and the Config_IFS tables                     *
;*
;* ENTRY POINT:  Config_CMD_Device                             *
;*               Config_CMD_IFS                                *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = address of filespec in packet   *
;*                         segment                             *
;*               ParmValue2  = address of parameters in        *
;*                         packet segment                      *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DEVICE/IFS packets Built and linked into list *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  StrTransPathChar                              *
;*                                                             *
;******************** End of Specifications ********************
;IF a filespec was given
;        Store ptr to filespec
;        Store type (DEVICE or IFS)
;        Store ptr to parameters
;        Link packet into Device chain
;        Update free pointer
;        Clear carry
;ELSE
;        Set error code
;        Set carry
;ENDIF
Procedure       Config_CMD_Device_IFS
                assume ds:nothing,es:DOSINITDATA
Entry           Config_CMD_Device
                mov     al,EXT_DEVICE           ; we have a device
                jmp     short entry_DeviceIFS

Entry           Config_CMD_IFS
                mov     al,EXT_FSD              ; we have an IFS
entry_DeviceIFS:
                push    ds
                push    si
                push    di

                mov     ds,Config_Sys_Data      ;DS -> Config.Sys data
                mov     di,ds:[0].CFG_FreePtr   ;Get free pointer
                mov     ds:[di].CFG_Type,al     ; save the packet type
                mov     eax,ParmSize            ; save the Size value   BN001
                mov     ds:[di].CFG_Size,eax    ; store size val in conifg struc BN001
                mov     ax,ParmValue1           ;Get ptr to device name
                .if     <nonzero ax>            ;If a device was specified
                  mov     ds:[di].CFG_FileSpec,ax       ;Save ptr to filespec
                  mov     si,ax                 ; ds:si -> filespec
                  call    StrTransPathChar      ; make sure no / as path seps
                  mov     ax,ParmValue2                 ;Save ptr to parameters
                  mov     ds:[di].CFG_Parameters,ax
                  lea     si,ds:[0].CFG_Device          ;Link packet into device chain
                  call    Config_LinkPacket
                  add     di,size CFG_Packet3           ;Update free pointer
                  .if     c
                    InternalError <Config_CMD_Device_IFS Config_Sys_Data segment corrupted>
                  .endif
                  mov     ds:[0].CFG_FreePtr,di
                  clc                                   ;No error
                .else                           ;Else
                  mov     ax,MSG_SYSINIT_MISSING_PARM
                  stc                                   ;Indicate missing parameter error
                .endif                          ;Endif

                pop     di
                pop     si
                pop     ds
                ret
EndProc         Config_CMD_Device_IFS



;This command processing table gives Config_ProcessCommand the steps for
;processing the DEVINFO command.

CmdTable        Config_DevInfo
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetDevType
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetComma
CmdTableEntry     Config_CMD_DevInfo
EndCmdTable     Config_DevInfo


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_DevInfo                        *
;*                                                             *
;* DESCRIPTIVE NAME:  DevInfo                                  *
;*                                                             *
;* FUNCTION:     To process the DevInfo command                *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_DevInfo  *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_DevInfo                            *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               Line      current line number                 *
;*               DS:SI     -> command line after the =         *
;*               ES        addresses DOSINITDATA               *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DS:SI     -> end of the command line          *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*               DS:SI     -> within the command line          *
;*               Token     invalid token                       *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*               Config_GetComma                               *
;*               Config_GetParmString                          *
;*               Config_GetRom                                 *
;*               Config_GetOpenParen                           *
;*               Config_GetNumber                              *
;*               Config_GetCloseParen                          *
;*               Config_GetEndOfLine                           *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;State DevInfoStart
;        Call Config_GetSubType
;        IF carry THEN change to DevInfoEnd state
;        Copy string to buffer with blank fill.
;        Call Config_GetComma
;        IF carry THEN change to DevInfoEnd state
;        Call Config_GetParmString
;        IF null string THEN change to DevInfoEnd state
;        Call Config_GetComma
;        IF carry THEN change to DevInfoEOL state
;        Call Config_GetRom
;        IF carry THEN change to DevInfoEnd state
;        N = 1
;        Change to DevInfoIDs state
;
;State DevInfoIDs
;        Call Config_GetOpenParen
;        IF carry
;                Call Config_GetNumber
;                IF carry THEN change to DevInfoEnd state
;                Store (Number,0) pair in packet
;        ELSE
;                Call Config_GetNumber
;                IF carry THEN change to DevInfoEnd state
;                Call Config_GetComma
;                IF carry THEN change to DevInfoEnd state
;                Call Config_GetNumber
;                IF carry THEN change to DevInfoEnd state
;                Call Config_GetCloseParen
;                IF carry THEN change to DevInfoEnd state
;                Store (Number,Number) pair in packet
;                Call    Config_GetCloseParen
;                IF carry THEN change to DevInfoEnd state
;        ENDIF
;        Call Config_GetComma
;        IF carry THEN change to DevInfoEOL state
;        Repeat
;
;State DevInfoEOL
;        Call Config_GetEndOfLine
;        IF carry THEN change to DevInfoEnd state
;        Calculate size of packet
;        Update Free pointer
;        Store DevType
;        Store number of ID pairs
;        Store SubType
;        Link packet into DevInfo list (call Config_LinkPacket)
;        Clear carry
;        Change to DevInfoEnd state
;
;State DevInfoEnd
;        Return
Procedure       Config_CMD_DevInfo
                assume ds:nothing,es:DOSINITDATA
state           DevInfoStart
                push    ds
                push    bx
                push    cx
                push    si
                push    di

                mov     ax,ParmValue1           ;Get Device type
                call    Config_GetSubType       ;Get Subtype
                nextstate DevInfoEnd c          ;If error then quit
                mov     al,' '                  ;Blank initialize subtype string
                mov     cx,8
                lea     di,DOSINITDATA:CFG_LocalSubType
                rep stosb

                push    es                      ;DS -> DOSINITDATA
                pop     ds
                push    si
                lea     si,DOSINITDATA:CFG_Token        ;Copy subtype token
                lea     di,DOSINITDATA:CFG_LocalSubType ;to blank-filled localsubtype
                .repeat                                 ;Copy ASCIIZ string
                  lodsb
                  .leave  <zero al>
                  stosb
                .until
                pop     si

                xor     di,di                   ;DI -> IDpair 0
                xor     cx,cx                   ;CX = size of IDpairs (0)
                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                mov     bx,ds:[0].CFG_FreePtr   ;BX -> Devinfo packet

                mov     ds,Config_Sys_File      ;DS -> Config.Sys file
                call    Config_GetComma         ;Get a comma
                nextstate DevInfoEnd c          ;If error then quit
                call    Config_GetParmString    ;Get filespec
                .if     <zero ax>               ;If no filespec
                  mov     ax,MSG_SYSINIT_MISSING_PARM
                  stc                             ;Error
                  nextstate DevInfoEnd            ;Quit
                .endif                          ;Endif
                mov     ParmValue2,ax           ;Save ptr to filespec
                call    Config_GetComma         ;Get comma
                nextstate DevInfoEol c          ;If no comma then get EOL
                call    Config_GetRom           ;Get ROM keyword
                nextstate DevInfoEnd c          ;If error then quit
                call    Config_GetEqualSign     ;Get an equal sign
                nextstate DevInfoEnd c          ;If error then quit

                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                mov     bx,ds:[0].CFG_FreePtr   ;BX -> Devinfo packet
                mov     ds,Config_Sys_File
                nextstate DevInfoIDs
endstate        DevInfoStart

state           DevInfoIDs
                call    Config_GetOpenParen     ;Get a "("
                .if     c                       ;If not found
                  call    Config_GetNumber        ;Get a number
                  nextstate DevInfoEnd c          ;If error then quit
                  mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                  mov     ds:[bx+di].CFG_IDpairs.CFG_CodePageID,ax
                                                  ;Save CodePage id
                  mov     ds:[bx+di].CFG_IDpairs.CFG_FontID,0
                                                  ;Default Font id to 0
                  mov     ds,Config_Sys_File      ;DS -> Config.Sys file
                .else                           ;Else
                  call    Config_GetNumber        ;Get a number
                  nextstate DevInfoEnd c          ;If error then quit
                  mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                  mov     ds:[bx+di].CFG_IDpairs.CFG_CodePageID,ax
                                                  ;Save CodePage id
                  mov     ds,Config_Sys_File      ;DS -> Config.Sys file
                  call    Config_GetComma         ;Get a comma
                  nextstate DevInfoEnd c          ;If error then quit
                  call    Config_GetNumber        ;Get a second number
                  nextstate DevInfoEnd c          ;If error then quit
                  mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                  mov     ds:[bx+di].CFG_IDpairs.CFG_FontID,ax
                                                  ;Save Font id
                  mov     ds,Config_Sys_File      ;DS -> Config.Sys file
                  call    Config_GetCloseParen    ;Get a ")"
                  nextstate DevInfoEnd c          ;If error then quit
                .endif                          ;Endif
                inc     cx                      ;One more id pair was found
                add     di,size CFG_Packet4a    ;Remember the space it takes
                call    Config_GetComma         ;Get a comma
                nextstate DevInfoEol c          ;If not found then get EOL
endstate        DevInfoIDs repeat               ;Repeat

state           DevInfoEol
                call    Config_GetEndOfLine     ;Verify end of line
                nextstate DevInfoEnd c          ;if not eol then quit
                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                mov     bx,ds:[0].CFG_FreePtr   ;Get packet address
                lea     di,[bx+di].CFG_IDpairs  ;Get address of packet end
                .if     c
                  InternalError <Config_CMD_DevInfo Config_Sys_Data segment corrupted>
                .endif
                mov     ds:[0].CFG_FreePtr,di   ;Update Free pointer
                mov     ax,ParmValue1           ;Save Device type
                mov     ds:[bx].CFG_DevType,ax
                mov     ax,ParmValue2           ;Save FileSpec pointer
                mov     ds:[bx].CFG_FileSpec,ax
                mov     ds:[bx].CFG_nIDpairs,cx ;Save number of ID pairs
                push    ds
                push    es
                pop     ds                      ;DS -> DOSINITDATA
                pop     es                      ;ES -> Config.Sys packets
                assume  ds:DOSINITDATA,es:nothing
                lea     si,DOSINITDATA:CFG_LocalSubType ;Copy local subtype
                lea     di,[bx].CFG_SubType     ;to subtype in packet
                mov     cx,8                    ;Copy 8 bytes
                rep movsb
                push    ds
                push    es
                pop     ds                      ;DS -> Config.Sys packets
                pop     es                      ;ES -> DOSINITDATA
                assume  ds:nothing,es:DOSINITDATA

                mov     di,bx                   ;Link packet into DevInfo chain
                lea     si,ds:[0].CFG_DevInfo
                call    Config_LinkPacket
                clc                             ;No error
                nextstate DevInfoEnd
endstate        DevInfoEol

state           DevInfoEnd
                pop     di
                pop     si
                pop     cx
                pop     bx
                pop     ds
                ret
endstate        DevInfoEnd
EndProc         Config_CMD_DevInfo



;This command processing table gives Config_ProcessCommand the steps for
;processing the DISKCACHE command.

CmdTable        Config_DiskCache
; #94242 CmdTableEntry     Config_GetEqualSign
; #94242 CmdTableEntry     Config_GetNumber
; #94242 CmdTableEntry     Config_SetParmValue1
; 9312CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_DiskCache
EndCmdTable     Config_DiskCache

;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_DiskCache                      *
;*                                                             *
;* DESCRIPTIVE NAME:  DiskCache                                *
;*                                                             *
;* FUNCTION:     To process the DiskCache command              *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_DiskCache*
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_DiskCache                          *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  DiskCache value                   *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Check for optional end of line (call Config_GetEndOfLine)               ;@9312
;ParmValue2 = DefaultDiskThresh                                          ;@9312
;If additional information (c)                                           ;@9312
;        Get the optional comma (call Config_GetComma)                   ;@9312
;        Get the second value (call Config_GetNumber)                    ;@9312
;        If the value was found (nc)                                     ;@9312
;              Remember the value                                        ;@9312
;              Validate end of line (call Config_GetEndOfLine)           ;@9312
;        Endif                                                           ;@9312
;Endif                                                                   ;@9312
;If everything parsed ok (nc)                                            ;@9312
;        If DiskCache and DiskThresh values in range                     ;@9312
;                Store DiskThresh value                                  ;@9312
;                Store DiskCache value                                   ;@9312
;                Clear carry                                             ;@9312
;        Endif                                                           ;@9312
;ENDIF                                                                   ;@9312
Procedure       Config_CMD_DiskCache
                LocalVar DS_save,WORD                   ; #94242
                LocalVar SI_save,WORD                   ; #94242
                ;LocalVar w10,WORD                       ; #94242
                LocalVar w20,WORD                        ; 159603
                assume ds:nothing,es:DOSINITDATA

                Call Config_GetEqualSign
                mov  DS_save,ds
                mov  SI_save,si
                call Config_GetNumber
                jnc  short cfg_dc11
;
; We got a non-numerical data in DISKCACHE=
; This should be D (default cache) or D2 (installation cache)
;
                mov  ds,DS_save
                mov  si,SI_save
                call Config_GetParmString
                mov  DS_save,ds
                push es
                pop  ds
                mov  ds,Config_Sys_Data
                push si
                mov  si,ax
                cmp  byte ptr ds:[si],'D'
                jne  short cfg_dc2
                cmp  byte ptr ds:[si+1],'2'
                jne  short cfg_dc2
                mov  ax,-2                     ; This must be Installation
cfg_dc1:
                pop  si
                mov  ds,DS_save
cfg_dc11:
                call Config_SetParmValue1
                jmp  short cmd_dc0

cfg_dc2:        ; Set the cachevalue to default.
                mov  ax,-1
                mov  CFG_Defaultcache,1
                jmp  short cfg_dc1

cmd_dc0:        ; Default Cache Size

                SaveReg <cx,dx,bx>              ;

               ;Always autocheck boot drive
               ; (it's ok if it isn't FAT, we check for that condition)
                push    ds
                DosContext ds
                mov     ax,SISData.SIS_BootDrv      ;get the boot drive from
                add     al,'A' - 1                  ;the system infoseg
                mov     CFG_AutoCheck[0],al        ;Always autocheck boot drv
                assume  ds:nothing
                pop     ds


state           DiskCacheStart
                xor     eax,eax             ; clear upper word of regs   ;BN012
                xor     ebx,ebx                                          ;BN012
                xor     ecx,ecx                                          ;BN012
                mov     ax,ParmValue1       ; Get Diskcache value
; #94242 begin
                ;mov     w10,10
                mov     w20,20              ; 159603
                mov     cx,syiLowMem
                add     cx,syiHighMem
                add     ecx,syiExtendMem    ; 159603
                cmp     ax,-1
                je      short cmd_dc1
                cmp     ax,-2
                je      short cmd_dc2
                jmp     cmd_dc3

cmd_dc1:        ; Default Cache Size
                cmp     ecx,4096          ;4MB
                jbe     short cmd_dc11
                cmp     ecx,5120          ;5MB
                jbe     short cmd_dc12
                cmp     ecx,6144          ;6MB
                jbe     short cmd_dc13
                cmp     ecx,8192          ;8MB
                jbe     short cmd_dc14
                cmp     ecx,81920         ;80MB       159603
                jae     short cmd_dc15
                ; Above 8MB memory, take 10% as Cache Size.
                ; 159603 8MB to 80MB memory, take 5% as Cache Size.
                mov     ax,cx
                mov     edx,ecx
                shr     edx, 16
                ;div     w10
                div     w20               ; 159603
                jmp     cmd_dc3
cmd_dc11:       ; 4MB memory or below
                mov     ax,48             ;48K
                jmp     short cmd_dc3
cmd_dc12:       ; 5MB memory or below
                mov     ax,64             ;64K
                jmp     short cmd_dc3
cmd_dc13:       ; 6MB memory or below
                mov     ax,128            ;128K
                jmp     short cmd_dc3
cmd_dc14:       ; 8MB memory or below
                mov     ax,512            ;512K
                jmp     short cmd_dc3
cmd_dc15:       ; 80MB memory or above    ; set a 4MB ceiling
                mov     ax,4096           ;4096K
                jmp     short cmd_dc3
cmd_dc2:        ; Default Installation Cache Size
                cmp     ecx,4096           ;4MB
                jbe     short cmd_dc21
                cmp     ecx,5120           ;5MB
                jbe     short cmd_dc22
                cmp     ecx,6144           ;6MB
                jbe     short cmd_dc23
                cmp     ecx,8192           ;8MB
                jbe     short cmd_dc24
                cmp     ecx,81920          ;80MB       159603
                jae     short cmd_dc25
                ; Above 8MB memory, take 10% as Cache Size.
                ; 159603 8MB to 80MB memory, take 5% as Cache Size.
                mov     ax,cx
                mov     edx,ecx
                shr     edx, 16
                ;div     w10
                div     w20               ; 159603
                jmp     short cmd_dc3
cmd_dc21:       ; 4MB memory or below
                mov     ax,128            ;128K
                jmp     short cmd_dc3
cmd_dc22:       ; 5MB memory or below
                mov     ax,192            ;192K
                jmp     short cmd_dc3
cmd_dc23:       ; 6MB memory or below
                mov     ax,256            ;256K
                jmp     short cmd_dc3
cmd_dc24:       ; 8MB memory or below
                mov     ax,640            ;640K
                jmp     short cmd_dc3
cmd_dc25:       ; 80MB memory or above    ; set a 4MB ceiling
                mov     ax,4096           ; 4096K
cmd_dc3:
; #94242 end
                xor     ecx,ecx             ;159603
                xor     edx,edx             ;159603
                mov     cx,MinDiskCache     ;
                mov     dx,MaxDiskCache     ;
                call    Config_RangeCheck   ;
                .if     nc                  ; If both values in range
                    mov     dx,1024         ;  (multiply by 1024)
                    mul     dx
                    mov     CFG_DiskCache.msw,dx ; diskcache value
                    mov     CFG_DiskCache.lsw,ax
                    mov     ax,DefaultDiskThresh
                    mov     CFG_DiskThresh,ax ;
                    mov     al,DefaultLazyWrite
                    mov     CFG_LazyWrite,al
                .else
                    nextstate DiskCacheError
                .endif
                call    Config_GetEndOfLine     ; The stmt optionly ends ;@9312
                .if     c                       ;                        ;@9312
                    call    Config_GetComma     ; Consume comma (if any) ;@9312
                    .if  c
                       nextstate DiskCacheError
                    .else
                       call    Config_GetDiskThresh
                       .if     nc
                          nextstate DiskThresh
                       .else
                          .if c
                            .if <zero ax> or       ; special out of range
                            .if <ax eq MSG_SYSINIT_MISSING_PARM>
                              .if <zero ax>
                                 mov ax,MSG_SYSINIT_INVAL_PARM
                              .endif
                              stc
                              nextstate DiskCacheError
                            .endif
                          .endif
                       .endif
                       call    Config_GetLazyWrite
                       .if     nc
                          nextstate LazyWrite
                       .endif
                       call    Config_GetAutoCheck                            ;### AC DCR 1520
                       .if     nc                                             ;### AC DCR 1520
                          nextstate AutoCheck                                 ;### AC DCR 1520
                       .endif                                                 ;### AC DCR 1520
                    .endif
                .endif
                nextstate DiskCacheEnd
endstate        DiskCacheStart

state           DiskCacheError
                mov     CFG_DiskCache.msw,0
                mov     CFG_DiskCache.lsw,0
                mov     ax,MSG_SYSINIT_INVAL_PARM
                stc
                nextstate DiskCacheEnd
endstate        DiskCacheError

state           DiskThresh
                mov     CFG_DiskThresh,ax
                call    Config_GetEndOfLine ;If EOL quit
                .if nc
                   xor  ax,ax
                   nextstate DiskCacheEnd
                .endif
                call    Config_GetComma     ; Consume comma (if any) ;@9312
                .if  c
                   nextstate DiskCacheError
                .else
                   call    Config_GetLazyWrite
                .endif
                .if     nc
                   nextstate LazyWrite
                .endif
                call    Config_GetAutoCheck                            ;### AC DCR 1520
                .if     nc                                             ;### AC DCR 1520
                   nextstate AutoCheck                                 ;### AC DCR 1520
                .endif                                                 ;### AC DCR 1520
                nextstate DiskCacheEnd
endstate        DiskThresh

state           LazyWrite
                mov     CFG_LazyWrite,al
                call    Config_GetEndOfLine ;If EOL quit
                .if nc
                   xor  ax,ax
                   nextstate DiskCacheEnd
                .endif
                call    Config_GetComma     ; Consume comma (if any) ;@9312
                .if  c
                   nextstate DiskCacheError
                .else
                   call    Config_GetDiskThresh
                .endif
                .if     nc
                   nextstate DiskThresh
                .else
                   .if c
                     .if <zero ax> or       ; special out of range
                     .if <ax eq MSG_SYSINIT_MISSING_PARM>
                       .if <zero ax>
                          mov ax,MSG_SYSINIT_INVAL_PARM
                       .endif
                       stc
                       nextstate DiskCacheError
                     .endif
                   .endif
                   call    Config_GetAutoCheck                            ;### AC DCR 1520
                  .if     nc                                             ;### AC DCR 1520
                     nextstate AutoCheck                                 ;### AC DCR 1520
                  .endif                                                 ;### AC DCR 1520
                .endif
                nextstate DiskCacheEnd
endstate        LazyWrite

state           AutoCheck                                                      ;### AC DCR 1520
; DS:SI points to the char after the AC: token.                                ;### AC DCR 1520
                xor     bx,bx            ;BX = byte index                      ;### AC DCR 1520
                .repeat                                                        ;### AC DCR 1520
                    call     Config_GetChar                                    ;### AC DCR 1520
                    .if   nc                                                   ;### AC DCR 1520
                       .if <al eq comma> or                                    ;### AC DCR 1520
                       .if <al eq cr>
                                mov  bx,26         ;Set end condition          ;### AC DCR 1520
                                dec  si            ;Point si back to char      ;### AC DCR 1520
                       .else                                                   ;### AC DCR 1520
                                .if     <al ae 'a'> and         ;Upshift char
                                .if     <al be 'z'>
                                      and al,not 32
                                .endif
                                .if <al a 'B'> and
                                .if <al be 'Z'>
; @83390 If there's a '+' in the string where we want to put this drive,
; that means this drive should be FORCEd.  We lowercase the drive to tell
; CHKDSK to run even if it's clean
                                     .if <CFG_AutoCheck[bx] e '+'>   ; @83390
                                        or      al,32                ; @83390
                                     .endif
                                     mov     CFG_AutoCheck[bx],al                 ;### AC DCR 1520
                                     inc     bx                                   ;### AC DCR 1520
; @83390 If we encounter a '+', put it in the string, but DON'T increment
; the counter - the next drive through will see it and be lowercased.
                                .elseif <al e '+'>                   ; @83390
                                     mov     CFG_AutoCheck[bx],al    ; @83390
                                 .else                               ; @83390
                                     mov     CFG_AutoCheck[0],0                   ;### AC DCR 1520
                                     mov ax,MSG_SYSINIT_INVAL_PARM                ;### AC DCR 1520
                                     stc                                          ;### AC DCR 1520
                                     nextstate DiskCacheError                     ;### AC DCR 1520
                                .endif                                            ;### AC DCR 1520
                       .endif                                                     ;### AC DCR 1520
                    .else
                         xor    ax,ax                                             ;### AC DCR 1520
                         nextstate DiskCacheEnd                                   ;### AC DCR 1520
                    .endif
                .until <bx eq 26>                                    ;### AC DCR 1520
                call    Config_GetEndOfLine ;If EOL quit             ;### AC DCR 1520
                .if nc                                               ;### AC DCR 1520
                   xor  ax,ax                                        ;### AC DCR 1520
                   nextstate DiskCacheEnd                            ;### AC DCR 1520
                .endif                                               ;### AC DCR 1520
                call    Config_GetComma     ; Consume comma (if any) ;### AC DCR 1520
                .if  c                                               ;### AC DCR 1520
                   nextstate DiskCacheError                          ;### AC DCR 1520
                .else                                                ;### AC DCR 1520
                   call    Config_GetDiskThresh                      ;### AC DCR 1520
                .endif                                               ;### AC DCR 1520
                .if     nc                                           ;### AC DCR 1520
                   nextstate DiskThresh                              ;### AC DCR 1520
                .else                                                ;### AC DCR 1520
                   .if c                                             ;### AC DCR 1520
                     .if <zero ax> or       ; special out of range   ;### AC DCR 1520
                     .if <ax eq MSG_SYSINIT_MISSING_PARM>            ;### AC DCR 1520
                       .if <zero ax>                                 ;### AC DCR 1520
                          mov ax,MSG_SYSINIT_INVAL_PARM              ;### AC DCR 1520
                       .endif                                        ;### AC DCR 1520
                       stc                                           ;### AC DCR 1520
                       nextstate DiskCacheError                      ;### AC DCR 1520
                     .endif                                          ;### AC DCR 1520
                   .endif                                            ;### AC DCR 1520
                .endif                                               ;### AC DCR 1520
                call    Config_GetLazyWrite                          ;### AC DCR 1520
                .if     nc                                           ;### AC DCR 1520
                  nextstate LazyWrite                                ;### AC DCR 1520
                .endif                                               ;### AC DCR 1520
                nextstate DiskCacheEnd                               ;### AC DCR 1520
endstate        AutoCheck                                            ;### AC DCR 1520

state           DiskCacheEnd
                RestoreReg <bx,dx,cx>
                ret
endstate        DiskCacheEnd
EndProc         Config_CMD_DiskCache

;**@9312;IF DiskCache value out of range
;**@9312;        Set error code
;**@9312;        Set carry
;**@9312;ELSE
;**@9312;        Store DiskCache value
;**@9312;        Clear carry
;**@9312;ENDIF
;**@9312
;**@9312Procedure       Config_CMD_DiskCache
;**@9312                assume ds:nothing,es:DOSINITDATA
;**@9312                SaveReg <cx,dx>
;**@9312
;**@9312                movzx   eax,ParmValue1           ;Get Diskcache value
;**@9312                xor     ecx,ecx
;**@9312                mov     cx,MinDiskCache
;**@9312                xor     edx,edx
;**@9312                mov     dx,MaxDiskCache
;**@9312                call    Config_RangeCheck
;**@9312                .if     nc                      ;If in range
;**@9312                  push    dx                      ;Convert kbytes to bytes
;**@9312                  mov     dx,1024                 ;  (multiply by 1024)
;**@9312                  mul     dx
;**@9312                  mov     CFG_DiskCache.msw,dx    ;Store diskcache value
;**@9312                  mov     CFG_DiskCache.lsw,ax
;**@9312                  pop     dx
;**@9312                  clc                             ;No error
;**@9312                .endif                          ;Endif
;**@9312                RestoreReg <dx,cx>
;**@9312                ret
;**@9312EndProc         Config_CMD_DiskCache




;This command processing table gives Config_ProcessCommand the steps for
;processing the DUMP command.

CmdTable        Config_Dump
CmdTableEntry     Config_GetEqualSign

; CmdTableEntry     Config_GetOnOff                                     78486
IF        RAS                                                          ;83839
CmdTableEntry     Config_GetTrapdump                                   ;78486
ENDIF  ;  RAS                                                          ;83839

CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_CMD_Dump
EndCmdTable     Config_Dump


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Dump                           *
;*                                                             *
;* DESCRIPTIVE NAME:  Dump                                     *
;*                                                             *
;* FUNCTION:     To process the Dump command                   *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Dump     *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Dump                               *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = On/Off value found              *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DosGroup:DUMP_ON set                          *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:                                                *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:                                                *
;*                                                             *
;******************** End of Specifications ********************
;Store Dump value
;Clear carry
Procedure Config_CMD_Dump,NEAR,LOCAL
          assume ds:nothing,es:DOSINITDATA
          push    bx
          push    ds
          mov     ax,ParmValue1           ;Get the dump value
          DosContext ds
          mov     DUMP_ON,al              ;Save it
          pop     ds
          call    Config_GetEndOfLine
          .if     nc
             clc                             ;No error
             jmp DumpEnd
          .endif
          call    Config_GetComma     ; Consume comma (if any)
          .if  c
             mov ax,MSG_SYSINIT_INVAL_PARM ;not a comma
             stc
             jmp DumpError
          .endif

          mov     ax,2                    ;mixed case, delimited token
          call    Config_GetToken         ; Get a token
          .if     c
             mov     ax,MSG_SYSINIT_MISSING_PARM
             stc
             jmp DumpError
          .endif

          push    di
          lea     di,DOSINITDATA:CFG_Token ;Examine the token
          mov     al,byte ptr es:[di]
          mov     ah,byte ptr es:[di+1]
          mov     bh,byte ptr es:[di+2]
          pop     di

          .if     <ah ne ':'>
             mov ax,MSG_SYSINIT_INVAL_PARM ;2nd char not a colon
             stc
             jmp DumpError
          .endif

          .if     <bh ne 00>
             mov ax,MSG_SYSINIT_INVAL_PARM ;too many characters
             stc
             jmp DumpError
          .endif


          .if <al nb 'a'>         ; if character > 'a'
             sub     al,'a'-'A'   ; Converted to uppercase
          .endif

          .if <al b 'A'> or       ; if not in range of A-Z,
          .if <al a 'Z'>          ; then error
             mov ax,MSG_SYSINIT_INVAL_PARM ;not a comma
             stc
             jmp DumpError
          .endif

          push    ds
          DosContext ds
          mov     DumpDevice,al      ; Store away the dump device
          pop     ds

          call    Config_GetEndOfLine
          .if     nc
             clc                     ;end of line, no error
             jmp DumpEnd
          .endif
          mov ax,MSG_SYSINIT_INVAL_PARM ;not endofline
          stc                           ;Error
          ;fall through to DumpError

DumpError:
          push    ds
          DosContext ds
          mov     DumpDevice,'A'
          pop     ds
          stc

DumpEnd:
          pop     bx
          ret

EndProc         Config_CMD_Dump

;This command processing table gives Config_ProcessCommand the steps for
;processing the DOS command.

CmdTable        Config_Dos
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetDosFlags                                ;BC002
CmdTableEntry     Config_SetParmValue1                              ;BC002
CmdTableEntry     Config_GetComma                                   ;BC002
CmdTableEntry     Config_GetDosFlags                                ;BC002
CmdTableEntry     Config_SetParmValue2                              ;BC002
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Dos
EndCmdTable     Config_Dos


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Dos                            *
;*                                                             *
;* DESCRIPTIVE NAME:  Dos                                      *
;*                                                             *
;* FUNCTION:     To process the Dos  command                   *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Dos      *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Dos                                *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = UMB/NOUMB value found           *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DosGroup:UMB_ON set                           *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:                                                *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:                                                *
;*                                                             *
;******************** End of Specifications ********************
;Store Dos UMB value
;Clear carry
Procedure       Config_CMD_Dos,NEAR,LOCAL
                assume ds:nothing,es:DOSINITDATA
                mov     ax,ParmValue1           ;Get the first DOS parm  ;BC002
                or      ax,ParmValue2           ;Get the second DOS parm ;BN002
                and     CFG_Dos_Flags,al        ;modify default flags    ;BN002
                clc                             ;No error
                ret
EndProc         Config_CMD_Dos


;This command processing table gives Config_ProcessCommand the steps for
;processing the FCBS command.

CmdTable        Config_FCBs
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetNumber
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetComma
CmdTableEntry     Config_GetNumber
CmdTableEntry     Config_SetParmValue2
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_FCBs
EndCmdTable     Config_FCBs


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_FCBs                           *
;*                                                             *
;* DESCRIPTIVE NAME:  FCBs                                     *
;*                                                             *
;* FUNCTION:     To process the FCBs command                   *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_FCBs     *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_FCBs                               *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = FCB count value                 *
;*               ParmValue2  = FCB keep value                  *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF FCB count is out of range
;        Set error code
;        Set carry
;ELSEIF FCB keep is out of range
;        Set error code
;        Set carry
;ELSE
;        Store FCB count
;        Store FCB keep
;        Clear carry
;ENDIF
Procedure       Config_CMD_FCBs
                assume ds:nothing,es:DOSINITDATA
                SaveReg <bx,cx,dx>
                movzx   eax,ParmValue1           ;Get FCB count
                xor     ecx,ecx
                mov     cx,MinFCBCount
                xor     edx,edx
                mov     dx,MaxFCBCount
                call    Config_RangeCheck
                .if     nc                      ;If FCB count in range
                  mov     dx,ax
                  mov     cx,MinFCBKeep
                  movzx   eax,ParmValue2        ;Get FCB keep count
                  call    Config_RangeCheck
                  .if     nc                      ;If FCB keep count in range
                    mov     CFG_FCBCount,dx         ;Store FCB count
                    mov     CFG_FCBKeep,ax          ;Store FCB keep count
                  .endif                          ;Endif
                .endif                          ;Endif
                RestoreReg <dx,cx,bx>
                ret
EndProc         Config_CMD_FCBs
                                                                        ;BN011;
                                                                        ;BN011;
                                                                        ;BN011;
;This command processing table gives Config_ProcessCommand the steps    ;BN011;
;for processing the FILES command.                                      ;BN011;
                                                                        ;BN011;
CmdTable        Config_FILES                                            ;BN011;
CmdTableEntry     Config_GetEqualSign                                   ;BN011;
CmdTableEntry     Config_GetNumber                                      ;BN011;
CmdTableEntry     Config_SetParmValue1                                  ;BN011;
CmdTableEntry     Config_GetEndOfLine                                   ;BN011;
CmdTableEntry     Config_CMD_FILES                                      ;BN011;
EndCmdTable     Config_FILES                                            ;BN011;
                                                                        ;BN011;
                                                                        ;BN011;
;******************* Start of Specifications *******************        ;BN011;
;*                                                             *        ;BN011;
;* SUBROUTINE NAME:  Config_CMD_FILES                          *        ;BN011;
;*                                                             *        ;BN011;
;* DESCRIPTIVE NAME:  FILES                                    *        ;BN011;
;*                                                             *        ;BN011;
;* FUNCTION:     To process the FILES command                  *        ;BN011;
;*                                                             *        ;BN011;
;* NOTES:        This procedure is called indirectly by        *        ;BN011;
;*               Config_ProcessCommand via the Config_FILES    *        ;BN011;
;*               table                                         *        ;BN011;
;*                                                             *        ;BN011;
;* ENTRY POINT:  Config_CMD_FILES                              *        ;BN011;
;*    LINKAGE:   call near                                     *        ;BN011;
;*                                                             *        ;BN011;
;* INPUT:                                                      *        ;BN011;
;*                                                             *        ;BN011;
;*               ES        addresses DOSINITDATA               *        ;BN011;
;*               ParmValue1  = FILES count value               *        ;BN011;
;*                                                             *        ;BN011;
;* EXIT-NORMAL:                                                *        ;BN011;
;*                                                             *        ;BN011;
;*               Carry     clear                               *        ;BN011;
;*               AX        undefined                           *        ;BN011;
;*                                                             *        ;BN011;
;* EXIT-ERROR:                                                 *        ;BN011;
;*                                                             *        ;BN011;
;*               Carry     set                                 *        ;BN011;
;*               AX        error code                          *        ;BN011;
;*                                                             *        ;BN011;
;* EFFECTS:                                                    *        ;BN011;
;*                                                             *        ;BN011;
;* INTERNAL REFERENCES:                                        *        ;BN011;
;*    ROUTINES:  none                                          *        ;BN011;
;*                                                             *        ;BN011;
;* EXTERNAL REFERENCES:                                        *        ;BN011;
;*    ROUTINES:  none                                          *        ;BN011;
;*                                                             *        ;BN011;
;******************** End of Specifications ********************        ;BN011;
;IF FILES count is out of range                                         ;BN011;
;        Set error code                                                 ;BN011;
;        Set carry                                                      ;BN011;
;ELSE                                                                   ;BN011;
;        Store FILES count                                              ;BN011;
;        Clear carry                                                    ;BN011;
;ENDIF                                                                  ;BN011;
Procedure       Config_CMD_FILES                                        ;BN011;
                assume ds:nothing,es:DOSINITDATA                        ;BN011;
                push    bx                                              ;BN011;
                push    cx                                              ;BN011;
                push    dx                                              ;BN011;
                movzx   eax,ParmValue1           ;Get FILES count       ;BN011;
                xor     ecx,ecx                                         ;BN011;
                mov     cx,MinFILESCount                                ;BN011;
                xor     edx,edx                                         ;BN011;
                mov     dx,MaxFILESCount                                ;BN011;
                call    Config_RangeCheck                               ;BN011;
                .if     nc                      ;If FILES count in range;BN011;
                  mov     CFG_FILESCount,ax     ;then Store FILES count ;BN011;
                .endif                                                  ;BN011;
                pop     dx                                              ;BN011;
                pop     cx                                              ;BN011;
                pop     bx                                              ;BN011;
                ret                                                     ;BN011;
EndProc         Config_CMD_FILES                                        ;BN011;


;This command processing table gives Config_ProcessCommand the steps for
;processing the IFS commands.

CmdTable        Config_IFS
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetParmString
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetParmList
CmdTableEntry     Config_SetParmValue2
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_IFS
EndCmdTable     Config_IFS



;d62519 ;This command processing table gives Config_ProcessCommand the steps for
;d62519 ;processing the IOPL command.
;d62519
;d62519 CmdTable        Config_IOPL
;d62519 CmdTableEntry     Config_GetEqualSign
;d62519 CmdTableEntry     Config_CMD_IOPL
;d62519 EndCmdTable     Config_IOPL
;d62519
;d62519
;d62519 ;******************* Start of Specifications *******************
;d62519 ;*                                                             *
;d62519 ;* SUBROUTINE NAME:  Config_CMD_IOPL                           *
;d62519 ;*                                                             *
;d62519 ;* DESCRIPTIVE NAME:  IOPL                                     *
;d62519 ;*                                                             *
;d62519 ;* FUNCTION:     To process the IOPL command                   *
;d62519 ;*                                                             *
;d62519 ;* NOTES:        This procedure is called indirectly by        *
;d62519 ;*               Config_ProcessCommand via the Config_IOPL     *
;d62519 ;*               table                                         *
;d62519 ;*                                                             *
;d62519 ;* ENTRY POINT:  Config_CMD_IOPL                               *
;d62519 ;*    LINKAGE:   call near                                     *
;d62519 ;*                                                             *
;d62519 ;* INPUT:                                                      *
;d62519 ;*               DS:SI     -> IOPL command after the "="       *
;d62519 ;*               ES        addresses DOSINITDATA               *
;d62519 ;*                                                             *
;d62519 ;* EXIT-NORMAL:                                                *
;d62519 ;*                                                             *
;d62519 ;*               Carry     clear                               *
;d62519 ;*               AX        undefined                           *
;d62519 ;*               DosGroup:IoplEnabled  set                     *
;d62519 ;*               IOPL packet filled in                         *
;d62519 ;*                                                             *
;d62519 ;* EXIT-ERROR:                                                 *
;d62519 ;*               Carry     set                                 *
;d62519 ;*               AX        error code                          *
;d62519 ;*                                                             *
;d62519 ;* EFFECTS:                                                    *
;d62519 ;*                                                             *
;d62519 ;* INTERNAL REFERENCES:                                        *
;d62519 ;*    ROUTINES:  none                                          *
;d62519 ;*                                                             *
;d62519 ;* EXTERNAL REFERENCES:                                        *
;d62519 ;*    ROUTINES:  Check_U_ModName                               *
;d62519 ;*                                                             *
;d62519 ;******************** End of Specifications ********************
;d62519 ;Get a Yes/No parameter (call Config_GetYesNo)
;d62519 ;IF Yes/No found
;d62519 ;   Get end of line (call Config_GetEndOfLine)
;d62519 ;   IF EOL found
;d62519 ;      Store IOPL value
;d62519 ;      Clear carry
;d62519 ;   ENDIF
;d62519 ;ELSE
;d62519 ;   REPEAT
;d62519 ;      Get a string (call Config_GetString)
;d62519 ;      IF no string found then abort loop with error
;d62519 ;      Link string packet into list
;d62519 ;      Check string is valid module name (call Check_U_ModName)
;d62519 ;      IF Invalid module name then abort loop with error
;d62519 ;      Get a comma (call Config_GetComma)
;d62519 ;      IF no comma found
;d62519 ;         Get end of line (call Config_GetEndOfLine)
;d62519 ;         exit the loop
;d62519 ;      ENDIF
;d62519 ;   FOREVER
;d62519 ;   IF the loop exited with no error
;d62519 ;      Fill in the head ptr in the IOPL Packet
;d62519 ;      Link IOPL packet into IOPL chain
;d62519 ;      Clear carry
;d62519 ;   ENDIF
;d62519 ;ENDIF
;d62519 Procedure       Config_CMD_IOPL
;d62519                 assume ds:nothing,es:DOSINITDATA
;d62519                 call    Config_GetYesNo
;d62519                 .if     nc
;d62519                   mov     ParmValue1,ax
;d62519                   call    Config_GetEndOfLine
;d62519                   .if     nc
;d62519                     mov     ax,ParmValue1           ;Get IOPL value
;d62519                     push    ds
;d62519                     DosContext ds
;d62519                     mov     IoplEnabled,al          ;Store IOPL value
;d62519                     pop     ds
;d62519                     assume  ds:nothing
;d62519                     clc                             ;No error
;d62519                   .endif
;d62519                 .else near
;d62519                 ;process iopl=list
;d62519                   push    di
;d62519                   mov     ParmValue2,0              ;Set Head ptr to null
;d62519                   .repeat
;d62519                     push    ds                      ;Get ptr to next string
;d62519                     mov     ds,Config_Sys_Data
;d62519                     mov     ax,ds:[0].CFG_FreePtr
;d62519                     mov     ParmValue1,ax
;d62519                     add     ax,size CFG_IOPL_Next
;d62519                     .if     c
;d62519                       InternalError <Config_CMD_IOPL Config_Sys_Data segment corrupted 1>
;d62519                     .endif
;d62519                     mov     ds:[0].CFG_FreePtr,ax
;d62519                     pop     ds
;d62519
;d62519                     xor     ax,ax
;d62519                     call    Config_GetString            ;Get the list item
;d62519                     .if     <zero ax>
;d62519                       mov     ax,MSG_SYSINIT_MISSING_PARM
;d62519                       stc
;d62519                       .leave                              ;Abort the loop on error
;d62519                     .endif
;d62519
;d62519                     push    ds                          ;Link item into list
;d62519                     mov     ds,Config_Sys_Data
;d62519                     mov     di,ParmValue1               ;Get ptr to this item
;d62519                     push    di
;d62519                     add     di,CFG_IOPL_String          ;point to name string
;d62519                     call    Check_U_ModName             ;check for valid module name
;d62519                     pop     di                          ;Restore offset of item
;d62519                     mov     ax,ParmValue2               ;Get ptr to head of list
;d62519                     mov     ds:[di].CFG_IOPL_Next,ax    ;This.next -> head
;d62519                     mov     ParmValue2,di               ;Head -> this
;d62519                     pop     ds
;d62519                     .if     c                           ;If invalid module name
;d62519                       mov       ax,MSG_SYSINIT_INVAL_PARM
;d62519                       stc
;d62519                       .leave
;d62519                     .endif
;d62519                     call    Config_GetComma             ;Get delimiter
;d62519                     .if     c                           ;If no delimeter
;d62519                       call    Config_GetEndOfLine         ;Check for EOL
;d62519                       .leave                              ;And exit loop
;d62519                     .endif                              ;Endif
;d62519                   .until
;d62519                   .if     nc
;d62519                     push    ds
;d62519                     push    si
;d62519                     mov     ds,Config_Sys_Data          ;Figure out where to put the IOPL packet
;d62519                     mov     di,ds:[0].CFG_FreePtr
;d62519                     mov     ax,ParmValue2               ;Fill in the head ptr field
;d62519                     mov     DS:[di].CFG_IOPL_Head,ax
;d62519                     lea     si,ds:[0].CFG_IOPL          ;Link the packet into the IOPL chain
;d62519                     call    Config_LinkPacket
;d62519                     add     di,size CFG_Packet7         ;Update free pointer
;d62519                     .if     c
;d62519                       InternalError <Config_CMD_IOPL Config_Sys_Data segment corrupted 2>
;d62519                     .endif
;d62519                     mov     ds:[0].CFG_FreePtr,di
;d62519                     pop     si
;d62519                     pop     ds
;d62519                     clc                                 ;Return with success
;d62519                   .endif
;d62519                   pop     di
;d62519                 .endif
;d62519                 ret
;d62519 EndProc         Config_CMD_IOPL
;d62519

;This command processing table gives Config_LastDrive the steps for
;processing the LastDrive command.

CmdTable        Config_LastDrive
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_CMD_LastDrive
EndCmdTable     Config_LastDrive


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_LastDrive                      *
;*                                                             *
;* DESCRIPTIVE NAME:  LastDrive                                *
;*                                                             *
;* FUNCTION:     To process the LastDrive command              *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_LastDrive*
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_LastDrive                          *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*               DS:SI     -> LastDrive command after the "="  *
;*               ES        addresses DOSINITDATA               *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               LastDrive packet filled in                    *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* NOTES:                                                      *
;*               in True DOS Tradition only the first char will*
;*               will be taken into acount. So if config.sys   *
;*               has lasrdrivr=klm 'k' will be taken.          *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*                                                             *
;******************** End of Specifications ********************
Procedure   Config_CMD_LastDrive

        assume ds:nothing,es:DOSINITDATA

        mov     ax,2                    ; Mixed Case delimited string
        call    Config_GetToken         ; Get a token
        push    di
        lea     di,DOSINITDATA:CFG_Token ;Examine the token
        mov     al,byte ptr es:[di]
        pop     di
        jnc     short cld_test
        mov     ax,MSG_SYSINIT_MISSING_PARM
        stc
        jmp     cld_exit
cld_test:
        cmp     al,'a'
        jb      short cld_uppercase     ; Try Upper case
        sub     al,'a'-'A'                  ; Converted to 0 based
cld_uppercase:
        sub     al,'A'
        jc      short cld_err
        cmp     al,26
        jae     short cld_err
        mov     [CFG_LastDrive],al      ; Store away the last drive
        clc
        jmp     short cld_exit          ; Note it is zero based (A=0)

cld_err:
        mov     ax,MSG_SYSINIT_INVAL_PARM
        stc

cld_exit:
        ret
EndProc     Config_CMD_LastDrive



;This command processing table gives Config_ReserveDriveLetter the steps for
;processing the ReserveDriveLetter command.

CmdTable        Config_ReserveDriveLetter
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_CMD_ReserveDriveLetter
EndCmdTable     Config_ReserveDriveLetter


;******************* Start of Specifications ******************************
;*                                                                        *
;* SUBROUTINE NAME:  Config_CMD_ReserveDriveLetter                        *
;*                                                                        *
;* DESCRIPTIVE NAME:  ReserveDriveLetter                                  *
;*                                                                        *
;* FUNCTION:     To process the ReserveDriveLetter command                *
;*               which is the drive letter to start assigning             *
;*               DEVICE= block devices                                    *
;*                                                                        *
;* NOTES:        This procedure is called indirectly by                   *
;*               Config_ProcessCommand via the Config_ReserveDriveLetter  *
;*               table                                                    *
;*                                                                        *
;* ENTRY POINT:  Config_CMD_ReserveDriveLetter                            *
;*    LINKAGE:   call near                                                *
;*                                                                        *
;* INPUT:                                                                 *
;*               DS:SI     -> ReserveDriveLetter command after the "="    *
;*               ES        addresses DOSINITDATA                          *
;*                                                                        *
;* EXIT-NORMAL:                                                           *
;*                                                                        *
;*               Carry     clear                                          *
;*               AX        undefined                                      *
;*               ReserveDriveLetter packet filled in                      *
;*                                                                        *
;* EXIT-ERROR:                                                            *
;*               Carry     set                                            *
;*               AX        error code                                     *
;*                                                                        *
;* NOTES:                                                                 *
;*               in True DOS Tradition only the first char will           *
;*               will be taken into acount. So if config.sys              *
;*               has ReserveDriveLetter=klm 'k' will be taken.            *
;* EFFECTS:                                                               *
;*                                                                        *
;* INTERNAL REFERENCES:                                                   *
;*    ROUTINES:  none                                                     *
;*                                                                        *
;* EXTERNAL REFERENCES:                                                   *
;*                                                                        *
;******************** End of Specifications *******************************
Procedure   Config_CMD_ReserveDriveLetter

        assume ds:nothing,es:DOSINITDATA

        mov     ax,2                    ; Mixed Case delimited string
        call    Config_GetToken         ; Get a token
        push    di
        lea     di,DOSINITDATA:CFG_Token ;Examine the token
        mov     al,byte ptr es:[di]
        pop     di
        jnc     short clg_test
        mov     ax,MSG_SYSINIT_MISSING_PARM
        stc
        jmp     clg_exit
clg_test:
        cmp     al,'a'
        jb      short clg_uppercase     ; Try Upper case
        sub     al,'a'-'A'                  ; Converted to 0 based
clg_uppercase:
        sub     al,'A'
        jc      short clg_err
        cmp     al,26
        jae     short clg_err
        mov     [CFG_ReserveDriveLetter],al      ; Store away the ReserveDriveLetter
        clc
        jmp     short clg_exit          ; Note it is zero based (A=0)

clg_err:
        mov     ax,MSG_SYSINIT_INVAL_PARM
        stc

clg_exit:
        ret
EndProc     Config_CMD_ReserveDriveLetter



;This command processing table gives Config_ProcessCommand the steps for
;processing the Protect16 command.

CmdTable        Config_Protect16
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_CMD_Protect16
EndCmdTable     Config_Protect16


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Protect16                      *
;*                                                             *
;* DESCRIPTIVE NAME:  Protect16                                *
;*                                                             *
;* FUNCTION:     To process the Protect16 command              *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the                 *
;*               Config_Protect16 table.                       *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Protect16                          *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*               DS:SI     -> Protect16 command after the "="  *
;*               ES        addresses DOSINITDATA               *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               Protect16 packet filled in                    *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  Check_U_ModName                               *
;*                                                             *
;******************** End of Specifications ********************
; REPEAT
;    Get a string (call Config_GetString)
;    IF no string found then abort loop with error
;    Link string packet into list
;    Check string is valid module name (call Check_U_ModName)
;    IF Invalid module name then abort loop with error
;    Get a comma (call Config_GetComma)
;    IF no comma found
;       Get end of line (call Config_GetEndOfLine)
;       exit the loop
;    ENDIF
; FOREVER
; IF the loop exited with no error
;    Fill in the head ptr in the Protect16 Packet
;    Link Protect16 packet into Protect16 chain
;    Clear carry
; ENDIF
;ENDIF
Procedure       Config_CMD_Protect16
                assume ds:nothing,es:DOSINITDATA
                ;process Protect16=list
                  push    di
                  mov     ParmValue2,0              ;Set Head ptr to null
                  .repeat
                    push    ds                      ;Get ptr to next string
                    mov     ds,Config_Sys_Data
                    mov     ax,ds:[0].CFG_FreePtr
                    mov     ParmValue1,ax
                    add     ax,size CFG_Protect16_Next
                    .if     c
                      InternalError <Config_CMD_Protect16 Config_Sys_Data segment corrupted 1>
                    .endif
                    mov     ds:[0].CFG_FreePtr,ax
                    pop     ds

                    xor     ax,ax
                    call    Config_GetString            ;Get the list item
                    .if     <zero ax>
                      mov     ax,MSG_SYSINIT_MISSING_PARM
                      stc
                      .leave                              ;Abort the loop on error
                    .endif

                    push    ds                          ;Link item into list
                    mov     ds,Config_Sys_Data
                    mov     di,ParmValue1               ;Get ptr to this item
                    push    di
                    add     di,CFG_Protect16_String          ;point to name string
                    call    Check_U_ModName             ;check for valid module name
                    pop     di                          ;Restore offset of item
                    mov     ax,ParmValue2               ;Get ptr to head of list
                    mov     ds:[di].CFG_Protect16_Next,ax    ;This.next -> head
                    mov     ParmValue2,di               ;Head -> this
                    pop     ds
                    .if     c                           ;If invalid module name
                      mov       ax,MSG_SYSINIT_INVAL_PARM
                      stc
                      .leave
                    .endif
                    call    Config_GetComma             ;Get delimiter
                    .if     c                           ;If no delimeter
                      call    Config_GetEndOfLine         ;Check for EOL
                      .leave                              ;And exit loop
                    .endif                              ;Endif
                  .until
                  .if     nc
                    push    ds
                    push    si
                    mov     ds,Config_Sys_Data          ;Figure out where to put the Protect16 packet
                    mov     di,ds:[0].CFG_FreePtr
                    mov     ax,ParmValue2               ;Fill in the head ptr field
                    mov     DS:[di].CFG_Protect16_Head,ax
                    lea     si,ds:[0].CFG_Protect16          ;Link the packet into the Protect16 chain
                    call    Config_LinkPacket
                    add     di,size CFG_Packet10        ;Update free pointer
                    .if     c
                      InternalError <Config_CMD_Protect16 Config_Sys_Data segment corrupted 2>
                    .endif
                    mov     ds:[0].CFG_FreePtr,di
                    pop     si
                    pop     ds
                    clc                                 ;Return with success
                  .endif
                  pop     di
                ret
EndProc         Config_CMD_Protect16



;This command processing table gives Config_ProcessCommand the steps for
;processing the LibPath command.

CmdTable        Config_LibPath
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetParmList
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_LibPath
EndCmdTable     Config_LibPath


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_LibPath                        *
;*                                                             *
;* DESCRIPTIVE NAME:  LibPath                                  *
;*                                                             *
;* FUNCTION:     To process the LibPath command                *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_LibPath  *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_LibPath                            *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               Line      current line number                 *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = address of path in packet       *
;*                         segment                             *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               LibPath packet  built and linked into list    *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF path given
;        Store the path ptr
;        Link packet into LibPath list (call Config_LinkPacket)
;        Update the free pointer
;        Clear carry
;ELSE
;        Set error code
;        Set carry
;ENDIF
Procedure       Config_CMD_LibPath
                assume ds:nothing,es:DOSINITDATA
                push    ds
                push    si
                push    di

                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                mov     di,ds:[0].CFG_FreePtr   ;DI -> Libpath packet
                mov     ax,ParmValue1           ;Get path ptr
                .if     <nonzero ax>            ;If path given
                  mov     ds:[di].CFG_Path,ax     ;Save the path ptr
                  lea     si,ds:[0].CFG_LibPath   ;Link packet into libpath chain
                  call    Config_LinkPacket
                  add     di,size CFG_Packet2     ;Update the free pointer
                  .if     c
                    InternalError <Config_CMD_LibPath Config_Sys_Data segment corrupted>
                  .endif
                  mov     ds:[0].CFG_FreePtr,di
                  clc                             ;No error
                .else                           ;Else
                  mov     ax,MSG_SYSINIT_MISSING_PARM
                  stc                             ;Missing parameter error
                .endif                          ;Endif

                pop     di
                pop     si
                pop     ds
                ret
EndProc         Config_CMD_LibPath



; Removed LOG= processing by CP20 DCR 1152   @PEN
;This command processing table gives Config_ProcessCommand the steps for
;processing the Log command.

;CmdTable        Config_Log
;CmdTableEntry     Config_GetEqualSign
;CmdTableEntry     Config_GetOnOff
;CmdTableEntry     Config_SetParmValue1
;CmdTableEntry     Config_CMD_Log
;EndCmdTable     Config_Log


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Log                            *
;*                                                             *
;* DESCRIPTIVE NAME:  Log                                      *
;*                                                             *
;* FUNCTION:     To process the Log command                    *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Log      *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Log                                *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               Line      current line number                 *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = On/Off                          *
;*               ParmValue2  = Log Daemon parameter pointer    *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               Log packet  built and linked into list        *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;parse remainder of line
;Store On/Off value
;Store parameter pointer
;Link packet into Log list (call Config_LinkPacket)
;Update the free pointer
;Clear carry

; Removed LOG= processing by CP20 DCR 1152   @PEN
;Procedure       Config_CMD_Log
;                assume ds:nothing,es:DOSINITDATA
;                call    Config_GetComma         ;Eat the optional comma
;                call    Config_GetParmList      ;Get the optional parameters
;                mov     ParmValue2,ax           ;Save the parmlist pointer
;
;                push    ds
;                push    si
;                push    di
;
;                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
;                mov     di,ds:[0].CFG_FreePtr   ;DI -> Log packet
;                mov     ax,ParmValue1           ;Get On/Off
;                mov     ds:[di].CFG_LogOnOff,ax ;Save On/Off
;                mov     ax,ParmValue2           ;Get parameter ptr
;                mov     ds:[di].CFG_LogParms,ax ;Save the parm ptr
;                lea     si,ds:[0].CFG_Log       ;Link packet into Log chain
;                call    Config_LinkPacket
;                add     di,size CFG_Packet9     ;Update the free pointer
;                .if     c
;                  InternalError <Config_CMD_Log Config_Sys_Data segment corrupted>
;                .endif
;                mov     ds:[0].CFG_FreePtr,di
;                clc                             ;No error
;
;                pop     di
;                pop     si
;                pop     ds
;                ret
;EndProc         Config_CMD_Log



;This command processing table gives Config_ProcessCommand the steps for
;processing the MAXWAIT command.

CmdTable        Config_MaxWait
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetNumber
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_MaxWait
EndCmdTable     Config_MaxWait


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_MaxWait                        *
;*                                                             *
;* DESCRIPTIVE NAME:  MaxWait                                  *
;*                                                             *
;* FUNCTION:     To process the MaxWait command                *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_MaxWait  *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_MaxWait                            *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = MaxWait value                   *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DosGroup:SISData.SIS_MaxWait  set             *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF MaxWait value out of range
;        Set error code
;        Set carry
;ELSE
;        Store MaxWait value
;        Clear carry
;ENDIF
Procedure       Config_CMD_MaxWait
                assume ds:nothing,es:DOSINITDATA
                SaveReg <cx,dx>
                movzx   eax,ParmValue1           ;Get Maxwait value
                xor     ecx,ecx
                mov     cx,MinMaxWait
                xor     edx,edx
                mov     dx,MaxMaxWait
                call    Config_RangeCheck
                .if     nc                      ;If in range
                  push    ds
                  DosContext ds
                  mov     SISData.SIS_MaxWait,al  ;Save Maxwait value
                  pop     ds
                .endif                          ;Endif
                RestoreReg <dx,cx>
                ret
EndProc         Config_CMD_MaxWait



;This command processing table gives Config_ProcessCommand the steps for
;processing the MEMMAN command.

CmdTable        Config_MemMan
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_CMD_MemMan
EndCmdTable     Config_MemMan


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_MemMan                         *
;*                                                             *
;* DESCRIPTIVE NAME:  MemMan                                   *
;*                                                             *
;* FUNCTION:     To process the MemMan command                 *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_MemMan   *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_MemMan                             *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               DS:SI     -> rest of the command line         *
;*               ES        addresses DOSINITDATA               *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DS:SI     -> end of the command line          *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*               DS:SI     -> within the command line          *
;*               Token     invalid token                       *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_GetMemManToken                         *
;*               Config_GetComma                               *
;*               Config_GetEndOfLine                           *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Procedure Config_CMD_MemMan
;        Get current values for Swap, Pack, Protect, and Commit
;                    (Move has no meaning)
;        Repeat
;           Scan for token
;           If not found jump to MMErrorLabel
;           ;;;;;;
;              If token = Swap
;                 Set Swap temp flag      (DL register)
;              Else If token = NoSwap
;                 Clear Swap temp flag    (DL register)
;              Else If token = Pack
;                 Set Pack temp flag      (BH register)
;              Else If token = NoPack
;                 Clear Pack temp flag    (BH register)
;              Else If token = Protect
;                 Set Protect temp flag   (BL register)
;              Else If token = NoProtect
;                 Clear Protect temp flag (BL register)
;              Else If token = Commit
;                 Set Commit temp flag    (DH register)
;              Else If token = NoCommit
;                 Clear Commit temp flag  (DH register)
;             (else token = MOVE or NOMOVE so ignore)
;           ;;;;;;;
;           Get Comma
;           If not found jump to MMCheckForEOL (normal way to leave loop)
;        Until    (forever, or until we jump out of the loop)
;     MMCheckForEOL:
;        Get EOL
;        If not found jump to MMErrorLabel
;     MMFinishedLabel:
;        Set values for Swap, Pack, Protect, and Commit
;                    (Move has no meaning)
;     MMErrorLabel:  (Same as finished label, except skip setting values)
;        Return
Procedure       Config_CMD_MemMan
        assume ds:nothing,es:DOSINITDATA
        push    bx
        push    cx
        push    dx
        push    ds
        FlatContext ds
        mov     bl,_VMProtectedMem       ;Get current Protect value
        mov     bh,_VMPackedMem          ;Get current Pack value
        DosContext ds
        mov     dh,_SMCommit             ;Get current Commit value
        mov     dl,_SMswapping           ;Get current Swap value
        pop     ds
        assume  ds:nothing

;Top of loop ---------------------------------------------------------
MMTop:
        call    Config_GetMemManToken    ;Get a Token
        .if     c                        ;if not found
          Jmp     MMError                ;  Return error
        .endif
        ;---------------------------------------------------
        .if     <al eq CFG_MemMan_Swap>
           mov     dl,1
        .elseif <al eq CFG_MemMan_NoSwap>
           mov     dl,0
        .elseif <al eq CFG_MemMan_Pack>
           mov     bh,1
        .elseif <al eq CFG_MemMan_NoPack>
           mov     bh,0
        .elseif <al eq CFG_MemMan_Protect>
           mov     bl,1
        .elseif <al eq CFG_MemMan_NoProtect>
           mov     bl,0
        .elseif <al eq CFG_MemMan_Commit>
           mov     dh,1
        .elseif <al eq CFG_MemMan_NoCommit>
           mov     dh,0
        .elseif <al eq CFG_MemMan_DelaySwap>
           push    ds
           FlatContext ds
           mov     _smDelaySwap, 1
           pop     ds
        .endif
        ;----------------------------------------------------

        call    Config_GetComma         ;Get a comma
        jc      MMCheckForEOL           ;No comma, must be end of line

        jmp     MMTop                   ;Get next token
;Bottom of loop-------------------------------------------------------

MMCheckForEOL:
        call    Config_GetEndOfLine     ;Verify end of line
        jc      MMError                 ;If error then quit

        push    ds
        FlatContext ds
        mov     _VMProtectedMem,bl      ;Store Protect value
        mov     _VMPackedMem,bh         ;Store Pack value
        DosContext ds
        mov     _SMCommit,dh            ;Store Commit value
        mov     _SMswapping,dl          ;Store Swap value
        pop     ds
        assume  ds:nothing
        clc                             ;No error, clear carry

MMError:
        pop     dx
        pop     cx
        pop     bx
        ret
EndProc         Config_CMD_MemMan

;This command processing table gives Config_ProcessCommand the steps for
;processing the PRIORITY command.

CmdTable        Config_Priority
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetAbsDyn
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Priority
EndCmdTable     Config_Priority


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Priority                       *
;*                                                             *
;* DESCRIPTIVE NAME:  Priority                                 *
;*                                                             *
;* FUNCTION:     To process the Priority command               *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Priority *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Priority                           *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = Prioirty value                  *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DosGroup:SISData.SIS_Dynamic  set             *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Store Priority value
;Clear carry
Procedure       Config_CMD_Priority
                assume ds:nothing,es:DOSINITDATA
                mov     ax,ParmValue1           ;Get Dynamic value
                push    ds
                DosContext ds
                mov     SISData.SIS_Dynamic,al  ;Store Dynamic value
                pop     ds
                clc                             ;No error
                ret
EndProc         Config_CMD_Priority



;This command processing table gives Config_ProcessCommand the steps for
;processing the PROMPT command.

CmdTable        Config_Prompt
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetYesNo
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Prompt
EndCmdTable     Config_Prompt


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Prompt                         *
;*                                                             *
;* DESCRIPTIVE NAME:  Prompt                                   *
;*                                                             *
;* FUNCTION:     To process the Prompt command                 *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the                 *
;*               Config_Prompt table.                          *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Prompt                             *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = Prioirty value                  *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DOSINITDATA:CFG_Prompt  set                   *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Store Prompt value
;Clear carry
Procedure       Config_CMD_Prompt
                assume ds:nothing,es:DOSINITDATA
                mov     ax,ParmValue1           ;Get Prompt value
                mov     CFG_Prompt,al           ;Store Prompt value
                clc                             ;No error
                ret
EndProc         Config_CMD_Prompt



;This command processing table gives Config_ProcessCommand the steps for
;processing the PRINTMONBUFSIZE command.

CmdTable        Config_PrintBufSize
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetNumber
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetComma
CmdTableEntry     Config_GetNumber
CmdTableEntry     Config_SetParmValue2
CmdTableEntry     Config_GetComma
CmdTableEntry     Config_GetNumber
CmdTableEntry     Config_SetParmValue3
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_PrintBufSize
EndCmdTable     Config_PrintBufSize


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_PrintBufSize                   *
;*                                                             *
;* DESCRIPTIVE NAME:  Prompt                                   *
;*                                                             *
;* FUNCTION:     To process the PRINTMONBUFSIZE command        *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the                 *
;*               Config_PrintBufSize table.                    *
;*                                                             *
;* ENTRY POINT:  Config_CMD_PrintBufSize                       *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1 = PRN/LPT1 parallel port buf size  *
;*               ParmValue2 = LPT2 parallel port buffer size   *
;*               ParmValue3 = LPT3 parallel port buffer size   *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DOSINITDATA:CFG_PrtBufSize set                *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Store Parallel port buffer sizes
;Clear carry
Procedure       Config_CMD_PrintBufSize
                assume ds:nothing,es:DOSINITDATA
                SaveReg <bx,cx,dx>              ;Save registers
                lea     bx,CFG_PrtBufSize       ;ES:BX -> dev driver init table

                movzx   eax,ParmValue1          ;Get PRN/LPT1 value
                xor     ecx,ecx                 ;Clear extended register
                mov     cx,MinPBUFCount         ;Get minimum buffer size
                xor     edx,edx                 ;Clear extended register
                mov     dx,MaxPBUFCount         ;Get maximum buffer size
                call    Config_RangeCheck       ;Perform range check
                .if     <nc>                    ;If within range then
                mov     es:[bx].LPT1BufSize,ax  ;Store PRN/LPT1 buffer size
                .endif

                movzx   eax,ParmValue2          ;Get LPT2 value
                call    Config_RangeCheck       ;Perform range check
                .if     <nc>                    ;If within range then
                mov     es:[bx].LPT2BufSize,ax  ;Store LPT2 buffer size
                .endif

                movzx   eax,ParmValue3          ;Get LPT3 value
                call    Config_RangeCheck       ;Perform range check
                .if     <nc>                    ;If within range then
                mov     es:[bx].LPT3BufSize,ax  ;Store LPT3 buffer size
                .endif

                RestoreReg <dx,cx,bx>           ;Restore registers
                clc                             ;No error
                ret
EndProc         Config_CMD_PrintBufSize



;This command processing table gives Config_ProcessCommand the steps for
;processing the PROTECTONLY command.

CmdTable        Config_ProtectOnly
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetYesNo
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_ProtectOnly
EndCmdTable     Config_ProtectOnly


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_ProtectOnly                    *
;*                                                             *
;* DESCRIPTIVE NAME:  ProtectOnly                              *
;*                                                             *
;* FUNCTION:     To process the ProtectOnly command            *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the                 *
;*               Config_ProtectOnly table.                     *
;*                                                             *
;* ENTRY POINT:  Config_CMD_ProtectOnly                        *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = Prioirty value                  *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DOSINITDATA:CFG_ProtectOnly  set              *
;*               DosGroup:SISData.SIS_ProtMdOnly  set          *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Store ProtectOnly value
;Clear carry
Procedure       Config_CMD_ProtectOnly
                assume ds:nothing,es:DOSINITDATA
                mov     ax,ParmValue1           ;Get ProtectOnly value
                push    ds                        ;## PTR B706479
                DosContext ds                     ;## Set value earlier
                mov     ProtOnlySystem,al         ;## PTR 786008 indicate OS/2 mode only system if al = 01
                mov     SISData.SIS_ProtMdOnly,al ;## Set up value in infoseg
                pop     ds                        ;## PTR B706479
                mov     CFG_ProtectOnly,al      ;Store ProtectOnly value
                clc                             ;No error
                ret
EndProc         Config_CMD_ProtectOnly



;This command processing table gives Config_ProcessCommand the steps for
;processing the PROTSHELL command.

CmdTable        Config_ProtShell
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetParmString
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetParmList
CmdTableEntry     Config_SetParmValue2
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_ProtShell
EndCmdTable     Config_ProtShell


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_ProtShell                      *
;*                                                             *
;* DESCRIPTIVE NAME:  ProtShell                                *
;*                                                             *
;* FUNCTION:     To process the ProtShell command              *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_ProtShell*
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_ProtShell                          *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = address of filespec in packet   *
;*                         segment                             *
;*               ParmValue2  = address of parameters in        *
;*                         packet segment                      *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               ProtShell packet  Built and linked into list  *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF a filespec was given
;        Store ptr to filespec
;        Store ptr to parameters
;        Link packet into ProtShell chain (call Config_LinkPacket)
;        Update free pointer
;        Clear carry
;ELSE
;        Set error code
;        Set carry
;ENDIF
Procedure       Config_CMD_ProtShell
                assume ds:nothing,es:DOSINITDATA
                push    ds
                push    si
                push    di

                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                mov     di,ds:[0].CFG_FreePtr   ;DI -> Protshell packet
                mov     ax,ParmValue1           ;Get address of filespec
                .if     <nonzero ax>            ;If filespec given
                  mov     ds:[di].CFG_FileSpec,ax       ;Store the Filespec
                  mov     ax,ParmValue2                 ;Store the Parmlist
                  mov     ds:[di].CFG_Parameters,ax
                  mov     word ptr ds:[di].CFG_Size,-1      ; initialize with default BN001
                  mov     word ptr ds:[di].CFG_Size+2,-1    ; initialize with default BN001
                  lea     si,ds:[0].CFG_ProtShell       ;Link packet into Protshell list
                  call    Config_LinkPacket
                  add     di,size CFG_Packet3           ;Calculate end of packet
                  .if     c
                    InternalError <Config_CMD_ProtShell Config_Sys_Data segment corrupted>
                  .endif
                  mov     ds:[0].CFG_FreePtr,di         ;Update free pointer
                  clc                                   ;No error
                .else                           ;Else
                  mov     ax,MSG_SYSINIT_MISSING_PARM
                  stc                                   ;Missing parm error
                .endif                          ;Endif

                pop     di
                pop     si
                pop     ds
                ret
EndProc         Config_CMD_ProtShell


;This command processing table gives Config_ProcessCommand the steps for ;### Pio dcr
;processing the PrtyIO command.                                          ;### Pio dcr
                                                                         ;### Pio dcr
CmdTable        Config_PrtyIO                                            ;### Pio dcr
CmdTableEntry     Config_GetEqualSign                                    ;### Pio dcr
CmdTableEntry     Config_GetYesNo                                        ;### Pio dcr
CmdTableEntry     Config_SetParmValue1                                   ;### Pio dcr
CmdTableEntry     Config_GetEndOfLine                                    ;### Pio dcr
CmdTableEntry     Config_CMD_PrtyIO                                      ;### Pio dcr
EndCmdTable     Config_PrtyIO                                            ;### Pio dcr

;******************* Start of Specifications *******************         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;* SUBROUTINE NAME:  Config_CMD_PrtyIO                         *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;* DESCRIPTIVE NAME:  Priority_Disk_IO                         *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;* FUNCTION:     To process the PrtyIO command                 *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;* NOTES:        This procedure is called indirectly by        *         ;### Pio dcr
;*               Config_ProcessCommand via the Config_PrtyIO   *         ;### Pio dcr
;*               table                                         *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;* ENTRY POINT:  Config_CMD_PrtyIO                             *         ;### Pio dcr
;*    LINKAGE:   call near                                     *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;* INPUT:                                                      *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;*               ES        addresses DosInitData               *         ;### Pio dcr
;*               ParmValue1  = PrtyIO  value                   *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;* EXIT-NORMAL:                                                *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;*               Carry     clear                               *         ;### Pio dcr
;*               AX        undefined                           *         ;### Pio dcr
;*               DosInitData:CFG_PrtyIO  set                   *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;* EXIT-ERROR:                                                 *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;*               Carry     set                                 *         ;### Pio dcr
;*               AX        error code                          *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;* EFFECTS:                                                    *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;* INTERNAL REFERENCES:                                        *         ;### Pio dcr
;*    ROUTINES:  none                                          *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;* EXTERNAL REFERENCES:                                        *         ;### Pio dcr
;*    ROUTINES:  none                                          *         ;### Pio dcr
;*                                                             *         ;### Pio dcr
;******************** End of Specifications ********************         ;### Pio dcr
                                                                         ;### Pio dcr
Procedure       Config_CMD_PrtyIO                                        ;### Pio dcr
                assume ds:nothing,es:DOSINITDATA                         ;### Pio dcr
                mov     ax,ParmValue1           ;Get PrtyIO value        ;### Pio dcr
                push  ds                                                 ;### Pio dcr
                DosContext ds                                            ;### Pio dcr
                mov   FSPrtyIO_Mode,al          ;Save PrtyIO value  ;### Pio dcr
                pop   ds                                                 ;### Pio dcr
                ret                                                      ;### Pio dcr
EndProc         Config_CMD_PrtyIO                                        ;### Pio dcr



;This command processing table gives Config_ProcessCommand the steps for
;processing the RMSIZE command.

CmdTable        Config_RMSize
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetNumber
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_RMSize
EndCmdTable     Config_RMSize


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_RMSize                         *
;*                                                             *
;* DESCRIPTIVE NAME:  RMSize                                   *
;*                                                             *
;* FUNCTION:     To process the RMSize command                 *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_RMSize   *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_RMSize                             *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = RMSize value                    *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DOSINITDATA:CFG_RMSize  set                   *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF RMSize value out of range
;        Set error code
;        Set carry
;ELSE
;        Store RMSize value
;        Clear carry
;ENDIF
Procedure       Config_CMD_RMSize
                assume ds:nothing,es:DOSINITDATA
                SaveReg <cx,dx>
                movzx   eax,ParmValue1           ;Get real mode size
                xor     ecx,ecx
                mov     cx,MinRMSize
                xor     edx,edx
                mov     dx,MaxRMSize
                call    Config_RangeCheck
                .if     nc                      ;If in range
                  mov     CFG_RMSize,ax
                  clc                             ;No error
                .endif                          ;Endif
                RestoreReg <dx,cx>
                ret
EndProc         Config_CMD_RMSize



;This command processing table gives Config_ProcessCommand the steps for
;processing the RUN command.

CmdTable        Config_Run
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetParmString
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetParmList
CmdTableEntry     Config_SetParmValue2
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Run
EndCmdTable     Config_Run


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Run                            *
;*                                                             *
;* DESCRIPTIVE NAME:  Run                                      *
;*                                                             *
;* FUNCTION:     To process the Run command                    *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Run      *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Run                                *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = address of filespec in packet   *
;*                         segment                             *
;*               ParmValue2  = address of parameters in        *
;*                         packet segment                      *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               Run packet  Built and linked into list        *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF a filespec was given
;        Store ptr to filespec
;        Store ptr to parameters
;        Link packet into Run chain (call Config_LinkPacket)
;        Update free pointer
;        Clear carry
;ELSE
;        Set error code
;        Set carry
;ENDIF
Procedure       Config_CMD_Run
                assume ds:nothing,es:DOSINITDATA
                push    ds
                push    si
                push    di

                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                mov     di,ds:[0].CFG_FreePtr   ;DI -> Run packet
                mov     ax,ParmValue1           ;Get filespec ptr
                .if     <nonzero ax>            ;If filespec given
                  mov     ds:[di].CFG_FileSpec,ax       ;Store filespec
                  mov     ax,ParmValue2                 ;Store Parmlist
                  mov     ds:[di].CFG_Parameters,ax
                  mov     ds:[di].CFG_Type,CFG_Type_Run ;Tag as a Run packet
                  lea     si,ds:[0].CFG_Run             ;Link packet into run list
                  call    Config_LinkPacket
                  add     di,size CFG_Packet3           ;Calculate end address of packet
                  .if     c
                    InternalError <Config_CMD_Run Config_SysData segment corrupted>
                  .endif
                  mov     ds:[0].CFG_FreePtr,di         ;Update free pointer
                  clc                                   ;No error
                .else                           ;Else
                  mov     ax,MSG_SYSINIT_MISSING_PARM
                  stc                                   ;Missing parameter error
                .endif                          ;Endif

                pop     di
                pop     si
                pop     ds
                ret
EndProc         Config_CMD_Run



;This command processing table gives Config_ProcessCommand the steps for
;processing the Set command.

CmdTable        Config_Set
CmdTableEntry     Config_GetParmList
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Set
EndCmdTable     Config_Set


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Set                            *
;*                                                             *
;* DESCRIPTIVE NAME:  Set                                      *
;*                                                             *
;* FUNCTION:     To process the Set command                    *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Set      *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Set                                *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               Line      current line number                 *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = address of path in packet       *
;*                         segment                             *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               Set packet  built and linked into list        *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF set given
;        Store the path ptr
;        Link packet into Set list (call Config_LinkPacket)
;        Update the free pointer
;        Clear carry
;ELSE
;        Set error code
;        Set carry
;ENDIF
Procedure       Config_CMD_Set
                assume ds:nothing,es:DOSINITDATA
                push    ds
                push    si
                push    di

                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                mov     di,ds:[0].CFG_FreePtr   ;DI -> Set packet
                mov     ax,ParmValue1           ;Get set ptr
                .if     <nonzero ax>            ;If set given
                  mov     ds:[di].CFG_EnvStr,ax   ;Save the string ptr
                  lea     si,ds:[0].CFG_Set       ;Link packet into Set chain
                  call    Config_LinkPacket
                  add     di,size CFG_Packet8     ;Update the free pointer
                  .if     c
                    InternalError <Config_CMD_Set Config_Sys_Data segment corrupted>
                  .endif
                  mov     ds:[0].CFG_FreePtr,di
                  clc                             ;No error
                .else                           ;Else
                  mov     ax,MSG_SYSINIT_MISSING_PARM
                  stc                             ;Missing parameter error
                .endif                          ;Endif

                pop     di
                pop     si
                pop     ds
                ret
EndProc         Config_CMD_Set



;This command processing table gives Config_ProcessCommand the steps for
;processing the SHELL command.

CmdTable        Config_Shell
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetParmString
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetParmList
CmdTableEntry     Config_SetParmValue2
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Shell
EndCmdTable     Config_Shell


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Shell                          *
;*                                                             *
;* DESCRIPTIVE NAME:  Shell                                    *
;*                                                             *
;* FUNCTION:     To process the Shell command                  *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Shell    *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Shell                              *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = address of filespec in packet   *
;*                         segment                             *
;*               ParmValue2  = address of parameters in        *
;*                         packet segment                      *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               Shell packet  Built and linked into list      *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF a filespec was given
;        Store ptr to filespec
;        Store ptr to parameters
;        Link packet into Shell chain (call Config_LinkPacket)
;        Update free pointer
;        Clear carry
;ELSE
;        Set error code
;        Set carry
;ENDIF
Procedure       Config_CMD_Shell
                assume ds:nothing,es:DOSINITDATA
                push    ds
                push    si
                push    di

                mov     ds,Config_Sys_Data      ;DS -> Config.Sys packets
                mov     di,ds:[0].CFG_FreePtr   ;DI -> Shell packet
                mov     ax,ParmValue1           ;Get filespec ptr
                .if     <nonzero ax>            ;If filespec given
                  mov     ds:[di].CFG_FileSpec,ax       ;Store filespec
                  mov     ax,ParmValue2                 ;Store Parmlist
                  mov     ds:[di].CFG_Parameters,ax
                  mov     word ptr ds:[di].CFG_Size,-1      ; initialize with default BN001
                  mov     word ptr ds:[di].CFG_Size+2,-1    ; initialize with default BN001
                  lea     si,ds:[0].CFG_Shell           ;Link packet into Shell list
                  call    Config_LinkPacket
                  add     di,size CFG_Packet3           ;Calculate end address of packet
                  .if     c
                    InternalError <Config_CMD_Shell Config_Sys_Data segment corrupted>
                  .endif
                  mov     ds:[0].CFG_FreePtr,di         ;Update free pointer
                  clc                                   ;No error
                .else                           ;Else
                  mov     ax,MSG_SYSINIT_MISSING_PARM
                  stc                                   ;Missing parameter error
                .endif                          ;Endif

                pop     di
                pop     si
                pop     ds
                ret
EndProc         Config_CMD_Shell



;This command processing table gives Config_ProcessCommand the steps for
;processing the SWAPPATH command.

CmdTable        Config_SwapPath
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetParmString
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_CMD_SwapPath
EndCmdTable     Config_SwapPath


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_SwapPath                       *
;*                                                             *
;* DESCRIPTIVE NAME:  SwapPath                                 *
;*                                                             *
;* FUNCTION:     To process the SwapPath command               *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_SwapPath *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_SwapPath                           *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               Line      current line number                 *
;*               DS:SI     -> command line after the string    *
;*                         parameter                           *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = address of path in packet       *
;*                         segment                             *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               SwapPath packet  built and linked into list   *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_LinkPacket                             *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;
;State  SwapPathBegin
;       If no path was given
;           Indicate missing parameter
;           change to SwapPathEnd state
;       Endif
;       Remember current Swap_Minfree value
;       Get a comma (call Config_GetComma)
;       If no tokens (carry) change to SwapPathEOL state
;       Get a number (call Config_GetNumber)
;       If no valid number was found (carry) change to SwapPathEnd state
;       Check the range (call Config_RangeCheck)
;       If out of range (carry) change to SwapPathEnd state
;       Remember the new Swap_Minfree value
;       Get a comma (call Config_GetComma)
;       If no tokens (carry) change to SwapPathEOL state
;       Get a number (call Config_GetNumber)
;       Remember the new default swappath value
;       Change to SwapPathEOL state
;
;State  SwapPathEOL
;       Verify the end of line (call Config_GetEndOfLine)
;       If extra tokens found (carry) change to SwapPathEnd state
;       Store the path ptr
;       Link packet into SwapPath list (call Config_LinkPacket)
;       Update the free pointer
;       Store the Swap_Minfree value
;       Clear carry
;       Change to SwapPathEnd state
;
;State  SwapPathEnd
;       Return

Procedure       Config_CMD_SwapPath
                assume ds:nothing,es:DOSINITDATA
state           SwapPathBegin
                push    ds
                push    cx
                push    dx
                push    si
                push    di
                .if     <ParmValue1 eq 0>      ;If no swappath given
                  mov     ax,MSG_SYSINIT_MISSING_PARM
                  stc                          ;Missing parameter error
                  nextstate SwapPathEnd
                .endif
                push    ds
                DosContext ds
                mov     eax,[_SMCFGMinFree]
                DosContext ds
                mov     LongParmValue1,eax     ;Get existing MinFree value
                mov     eax,[_SMCFGSwapSize]
                mov     LongParmValue2,eax     ;Get existing Default size
                pop     ds
                assume  ds:nothing
             ;check for MinFree value
                call    Config_GetComma        ;Check for a comma
                nextstate SwapPathEOL c        ;If no comma then check for end of line
                call    Config_GetLongNumber   ;Get a number
                nextstate SwapPathEnd c        ;If no number then quit
                xor     ecx,ecx
                mov     cx,MinSwap_Minfree     ;Make sure number is in range
                mov     edx,MaxSwap_Minfree
                call    Config_RangeCheck
                nextstate SwapPathEnd c        ;If out of range then quit
                mov     LongParmValue1,eax     ;We have a valid number--remember it.
             ;check for default swapfile size
                call    Config_GetComma        ;Check for a comma
                nextstate SwapPathEOL c        ;If no comma then check for end of line
                call    Config_GetLongNumber   ;Get a number
                nextstate SwapPathEnd c        ;If no number then quit
                mov     LongParmValue2,eax     ;We have a valid number--remember it.

                nextstate SwapPathEOL          ;Verify end of line
endstate        SwapPathBegin

state           SwapPathEOL
                call    Config_GetEndOfLine    ;Check for end of line
                nextstate SwapPathEnd c        ;If no end of line then quit

                                               ;We have a valid command--process it
                mov     ds,Config_Sys_Data     ;DS -> Config.Sys packets
                mov     di,ds:[0].CFG_FreePtr  ;DI -> SwapPath packet
                mov     ax,ParmValue1          ;Get path
                mov     ds:[di].CFG_Path,ax    ;Store path
                lea     si,ds:[0].CFG_SwapPath ;Link packet into swappath list
                call    Config_LinkPacket
                add     di,size CFG_Packet2    ;Calculate end of packet
                .if     c
                  InternalError <Config_CMD_SwapPath Config_Sys_Data segment corrupted>
                .endif
                mov     ds:[0].CFG_FreePtr,di  ;Update free pointer
                mov     eax,LongParmValue1     ;Get MinFree value
                DosContext ds
                mov     [_SMCFGMinFree],eax    ;Store MinFree value
                mov     eax,LongParmValue2     ;Get Default swapfile size
                mov     [_SMCFGSwapSize],eax  ;Store Default swapfile size
                assume ds:nothing
                clc
                nextstate SwapPathEnd
endstate        SwapPathEOL


state           SwapPathEnd
                pop     di
                pop     si
                pop     dx
                pop     cx
                pop     ds
                ret
endstate        SwapPathEnd
EndProc         Config_CMD_SwapPath



;This command processing table gives Config_ProcessCommand the steps for
;processing the THREADS command.

CmdTable        Config_Threads
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetNumber
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_Threads
EndCmdTable     Config_Threads


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Threads                        *
;*                                                             *
;* DESCRIPTIVE NAME:  Threads                                  *
;*                                                             *
;* FUNCTION:     To process the Threads command                *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Threads  *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Threads                            *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = Threads value                   *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DosGroup:MaxThreads  set                      *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF Threads value out of range
;        Set error code
;        Set carry
;ELSE
;        Store Threads value
;        Clear carry
;ENDIF
Procedure       Config_CMD_Threads
                assume ds:nothing,es:DOSINITDATA
                SaveReg <cx,dx>
                movzx   eax,ParmValue1           ;Get threads value
                xor     ecx,ecx
                mov     cx,MinMaxThreads
                xor     edx,edx
                mov     dx,MaxMaxThreads
                call    Config_RangeCheck
                .if     nc                      ;If in range
                  push    ds
                  DosContext ds                 ;### PTR B787573 MaxThreads must
                  inc     ax                    ;###   include the zeroth thread
                  mov     MaxThreads,ax         ;Store MaxThreads value
                  pop     ds
                .endif                          ;Endif
                RestoreReg <dx,cx>
                ret
EndProc         Config_CMD_Threads



;This command processing table gives Config_ProcessCommand the steps for
;processing the TIMESLICE command.

CmdTable        Config_TimeSlice
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetNumber
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_SetParmValue2
CmdTableEntry     Config_CMD_TimeSlice
EndCmdTable     Config_TimeSlice


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_TimeSlice                      *
;*                                                             *
;* DESCRIPTIVE NAME:  TimeSlice                                *
;*                                                             *
;* FUNCTION:     To process the TimeSlice command              *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_TiemSlice*
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_TimeSlice                          *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = First value                     *
;*               ParmValue2  = First value                     *
;*               DS:SI     -> command after the first value    *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DosGroup:SISData.SIS_MinSlice  set            *
;*               DosGroup:SISData.SIS_MaxSlice  set            *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;
;Check for optional end of line (call Config_GetEndOfLine)
;If additional information (c)
;        Get the optional comma (call Config_GetComma)
;        Get the second value (call Config_GetNumber)
;        If the value was found (nc)
;              Remember the value
;              Validate end of line (call Config_GetEndOfLine)
;        Endif
;Endif
;If everything parsed ok (nc)
;    IF MinSlice is out of range
;            Set error code
;            Set carry
;    ELSEIF MaxSlice is out of range
;            Set error code
;            Set carry
;    ELSE
;            Store MinSlice
;            Store MaxSlice
;            Clear carry
;    ENDIF
;Endif

Procedure       Config_CMD_TimeSlice
                assume ds:nothing,es:DOSINITDATA
                call    Config_GetEndOfLine     ;The statement optionally ends
                .if     c
                    call    Config_GetComma         ;Consume comma (if any)
                    call    Config_GetNumber
                    .if     nc
                        mov     ParmValue2,ax
                        call    Config_GetEndOfLine     ;Validate end of line
                    .endif
                .endif
                .if     nc
                    SaveReg <cx,dx>
                    movzx   eax,ParmValue1           ;Get min timeslice
                    xor     ecx,ecx
                    mov     cx,MinTimeSlice
                    xor     edx,edx
                    mov     dx,MaxTimeSlice
                    call    Config_RangeCheck
                    .if     nc                      ;If MinSlice in range
                      mov     ecx,eax
                      movzx   eax,ParmValue2          ;Get max timeslice
                      call    Config_RangeCheck
                      .if     nc                      ;If MaxSlice in range
                        push    ds
                        DosContext ds
                        mov     SISData.SIS_MinSlice,cx       ;Store Minslice
                        mov     SISData.SIS_MaxSlice,ax       ;Store Maxslice
                        mov     DynTimeSlice,0         ;Insure Static Timeslice Allocation DCR1203
                        pop     ds
                      .endif                          ;Endif
                    .endif                          ;Endif
                    RestoreReg <dx,cx>
                .endif
                ret
EndProc         Config_CMD_TimeSlice


if RAS

;This command processing table gives Config_ProcessCommand the steps for
;processing the TRACE command.

CmdTable        Config_Trace
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetOnOff
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_CMD_Trace
EndCmdTable     Config_Trace


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_Trace                          *
;*                                                             *
;* DESCRIPTIVE NAME:  Trace                                    *
;*                                                             *
;* FUNCTION:     To process the Trace command                  *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_Trace    *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_Trace                              *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               DS:SI     -> command line after the on/off    *
;*                         parameter                           *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = the on/off parameter            *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DS:SI     -> end of the command line          *
;*               DOSINITDATA:CFG_TraceBits  set                *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*               DS:SI     -> within the command line          *
;*               Token     invalid token                       *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_GetNumber                              *
;*               Config_GetComma                               *
;*               Config_GetEndOfLine                           *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;State TraceStart
;        Initialize local bit flags to 0
;        Call Config_GetNumber
;        IF carry THEN change to TraceAll state
;        Change to TraceNumbers state
;
;State TraceAll
;        Set all bits in local flags on
;        Change to TraceEOL state
;
;State TraceNumbers
;        IF value is out of range
;                Set error code
;                Set carry
;                Change to TraceEnd state
;        ENDIF
;        Set bit position in local flags
;        Call Config_GetComma
;        IF carry THEN change to TraceEOL state
;        Call Config_GetNumber
;        IF carry THEN change to TraceEnd state
;        Repeat
;
;State TraceEOL
;        Call Config_GetEndOfLine
;        IF carry THEN change to TraceEnd state
;        IF "off" specified
;                AND not(local bit flags) into global flags
;        ELSE
;                OR local bit flags into global flags
;        ENDIF
;        IF no trace buffer allocated
;                Set default trace buffer size
;        ENDIF
;        Clear carry
;        Change to TraceEnd state
;
;State TraceEnd
;        Return
Procedure       Config_CMD_Trace
                assume ds:nothing,es:DOSINITDATA
state           TraceStart
                push    bx
                push    cx
                push    dx
                push    di

                mov     cx,32                   ;Zero out local trace bits
                lea     di,DOSINITDATA:CFG_LocalTraceBits
                xor     al,al
                rep stosb
                call    Config_GetComma         ;Get an optional comma
                nextstate TraceAll c            ;If end of line then trace all
                call    Config_GetNumber        ;Get a number
                nextstate TraceEnd c            ;If invalid token then abort
                nextstate TraceNumbers          ;Trace specific events
endstate        TraceStart

state           TraceAll
                mov     cx,32                   ;Set all trace bits
                lea     di,DOSINITDATA:CFG_LocalTraceBits
                mov     al,not 0
                rep stosb
                nextstate TraceEOL              ;Verify end of line
endstate        TraceAll

state           TraceNumbers
                xor     ecx,ecx
                mov     cx,MinTrace
                xor     edx,edx
                mov     dx,MaxTrace
                call    Config_RangeCheck
                nextstate TraceEnd c
                mov     bx,ax                   ;Convert event code to byte address
                shr     bx,3                    ;Divide by 8 to get byte number
                mov     cx,ax                   ;Convert event code to bit address
                and     cx,7                    ;Bit# = 7-(ID mod 8)
                mov     al,80h                  ;Shift bit into correct position
                shr     al,cl
                or      CFG_LocalTraceBits[bx],al ;OR trace bit into local trace flags
                call    Config_GetComma         ;Get a comma
                nextstate TraceEOL c            ;If not found, get end of line
                call    Config_GetNumber        ;Get a number
                nextstate TraceEnd c            ;If error then quit
endstate        TraceNumbers repeat             ;Repeat

state           TraceEOL
                call    Config_GetEndOfLine     ;Get end of line
                nextstate TraceEnd c            ;If error then quit
                mov     cx,32                     ;CX = number of bytes in tracebits
                xor     bx,bx                     ;BX = byte index
                .if     <ParmValue1 eq 0>         ;If trace=off
                  .repeat                         ;Loop through trace bytes
                    mov     al,CFG_LocalTraceBits[bx]   ;Get byte
                    not     al                          ;Convert to mask
                    and     CFG_TraceBits[bx],al        ;Clear appropriate bits in trace byte
                    inc     bx                          ;Address next byte
                  .loop                           ;End loop
                .else                           ;Else
                  .repeat                         ;Loop through trace bytes
                    mov     al,CFG_LocalTraceBits[bx]   ;Get Byte
                    or      CFG_TraceBits[bx],al        ;Set appropriate bits in trace byte
                    inc     bx
                  .loop                           ;End Loop
                .endif                          ;Endif
                .if     <CFG_TraceBuf eq 0>     ;If no trace buffer allocated
                  mov     CFG_TraceBuf,DefaultTraceBuf*1024  ;Set default trace buffer size
                .endif                          ;Endif
                clc                             ;No error
                nextstate TraceEnd
endstate        TraceEOL

state           TraceEnd
                pop     di
                pop     dx
                pop     cx
                pop     bx
                ret
endstate        TraceEnd

EndProc         Config_CMD_Trace



;This command processing table gives Config_ProcessCommand the steps for
;processing the TRACEBUF command.

CmdTable        Config_TraceBuf
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_GetNumber
CmdTableEntry     Config_SetParmValue1
CmdTableEntry     Config_GetEndOfLine
CmdTableEntry     Config_CMD_TraceBuf
EndCmdTable     Config_TraceBuf


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_TraceBuf                       *
;*                                                             *
;* DESCRIPTIVE NAME:  TraceBuf                                 *
;*                                                             *
;* FUNCTION:     To process the TraceBuf command               *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the Config_TraceBuf *
;*               table                                         *
;*                                                             *
;* ENTRY POINT:  Config_CMD_TraceBuf                           *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*                                                             *
;*               ES        addresses DOSINITDATA               *
;*               ParmValue1  = TraceBuf value                  *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               DOSINITDATA:CFG_TraceBuf  set                 *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*                                                             *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  Config_GetEqualSign                           *
;*               Config_GetNumber                              *
;*               Config_GetEndOfLine                           *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;IF TraceBuf value out of range
;        Set error code
;        Set carry
;ELSE
;        Store TraceBuf value
;        Clear carry
;ENDIF
Procedure       Config_CMD_TraceBuf
                assume ds:nothing,es:DOSINITDATA
                SaveReg <cx,dx>
                movzx   eax,ParmValue1           ;Get Trace buffer size
                xor     ecx,ecx
                mov     cx,MinTraceBuf
                xor     edx,edx
                mov     dx,MaxTraceBuf
                call    Config_RangeCheck
                .if     nc                      ;If in range
                  mov     dx,1024                 ;Convert bytes to kbytes
                  mul     dx                      ;  Multiply by 1024
                  mov     CFG_TraceBuf,ax         ;Store trace buffer size
                  clc                             ;No error
                .endif                          ;Endif
                RestoreReg <dx,cx>
                ret
EndProc         Config_CMD_TraceBuf


endif ;RAS


;This command processing table gives Config_DumpProcess the steps for
;processing the DumpProcess command.

CmdTable        Config_DumpProcess
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_CMD_DumpProcess
EndCmdTable     Config_DumpProcess


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_DumpProcess                    *
;*                                                             *
;* DESCRIPTIVE NAME:  DumpProcess                              *
;*                                                             *
;* FUNCTION:     To process the DumpProcess command            *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the                 *
;*               Config_DumpProcess table                      *
;*                                                             *
;* ENTRY POINT:  Config_CMD_DumpProcess                        *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*               DS:SI     -> DumpProcess command after "="    *
;*               ES        addresses DOSINITDATA               *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               _DumpProcess packet filled in                 *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* NOTES:                                                      *
;*               in True DOS Tradition only the first char will*
;*               will be taken into acount. So if config.sys   *
;*               has DumpProcess=klm, 'k' will be taken.       *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*                                                             *
;******************** End of Specifications ********************
Procedure   Config_CMD_DumpProcess

        assume ds:nothing,es:DOSINITDATA

        mov     ax,2                            ; Mixed case delimited string
        call    Config_GetToken                 ; Get a token
        push    di
        lea     di,DOSINITDATA:CFG_Token        ; Examine the token
        mov     al,byte ptr es:[di]
        pop     di
        jnc     short cdp_test
        mov     ax,MSG_SYSINIT_MISSING_PARM
        stc
        jmp     cdp_exit
cdp_test:
        cmp     al,'a'
        jb      short cdp_uppercase             ; Try upper case
        sub     al,'a'-'A'                      ; Converted to upper case based
cdp_uppercase:
        cmp     al,'A'
        jb      short cdp_err
        cmp     al,'Z'
        ja      short cdp_err

        push    ds
        DosContext ds
        mov     _DumpProcess,al                 ; Store away the value
        pop     ds
        assume  ds:nothing
        clc
        jmp     short cdp_exit

cdp_err:
        mov     ax,MSG_SYSINIT_INVAL_PARM
        stc

cdp_exit:
        ret
EndProc     Config_CMD_DumpProcess



;This command processing table gives Config_SuppressPopUps the steps for
;processing the SuppressPopUps command.

CmdTable        Config_SuppressPopUps
CmdTableEntry     Config_GetEqualSign
CmdTableEntry     Config_CMD_SuppressPopUps
EndCmdTable     Config_SuppressPopUps


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_SuppressPopUps                 *
;*                                                             *
;* DESCRIPTIVE NAME:  SuppressPopUps                           *
;*                                                             *
;* FUNCTION:     To process the SuppressPopUps command         *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the                 *
;*               Config_SuppressPopUps table                   *
;*                                                             *
;* ENTRY POINT:  Config_CMD_SuppressPopUps                     *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:                                                      *
;*               DS:SI     -> SuppressPopUps command after "=" *
;*               ES        addresses DOSINITDATA               *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*               AX        undefined                           *
;*               _SuppressPopUps packet filled in              *
;*                                                             *
;* EXIT-ERROR:                                                 *
;*               Carry     set                                 *
;*               AX        error code                          *
;*                                                             *
;* NOTES:                                                      *
;*               in True DOS Tradition only the first char will*
;*               will be taken into acount. So if config.sys   *
;*               has suppresspopups=klm, 'k' will be taken.    *
;* EFFECTS:                                                    *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*                                                             *
;******************** End of Specifications ********************

;* 157614 changes SuppressPopUps in the following way:
;* By default logging is active. SuppressPopUps now controls only
;* the suppression of the PopUp. PopUpLogDrive controls the logging.
;* PopUpLogDrive is set to an initial value of 2 to indicate that
;* PopUpLogDrive should be initialised to the Boot Drive. Having
;* called the logging function once, PopUpLogDrive is converted to
;* the boot drive. Thereafter DosSuppressPopUps controls these
;* values. A special value of SUPPRESSPOPUPS=0 will force 
;* the original behaviour with logging disabled and popups enabled.

Procedure   Config_CMD_SuppressPopUps

        assume ds:nothing,es:DOSINITDATA

        mov     ax,2                            ; Mixed case delimited string
        call    Config_GetToken                 ; Get a token
        push    di
        lea     di,DOSINITDATA:CFG_Token        ; Examine the token
        mov     al,byte ptr es:[di]
        pop     di
        jnc     short cspu_test
        mov     ax,MSG_SYSINIT_MISSING_PARM
        stc
        jmp     cspu_exit

cspu_test:
        mov     ah,1                            ; 157614 suppress popups
        cmp     al,'0'                          ; 157614 suppress logging? enabled popups?
        jne     short cspu_test1                ; 157614
        mov     ax,0                            ; 157614 enable popups and disable logging
        jmp     short cspu_setvalue             ; 157614
cspu_test1:                                     ; 157614
        cmp     al,'a'
        jb      short cspu_uppercase            ; Try upper case
        sub     al,'a'-'A'                      ; Converted to upper case based
cspu_uppercase:
        cmp     al,'A'
        jb      short cspu_err
        cmp     al,'Z'
        ja      short cspu_err

cspu_setvalue:                                  ; 157614
        push    ds
        DosContext ds
        mov     _PopUpLogDrive,al               ; 157614 Store away the value
        mov     _SuppressPopUps,ah              ; 157614 Store away the value
        pop     ds
        assume  ds:nothing
        clc
        jmp     short cspu_exit

cspu_err:
        mov     ax,MSG_SYSINIT_INVAL_PARM
        stc

cspu_exit:
        ret
EndProc     Config_CMD_SuppressPopUps


;This command processing table gives Config_ProcessCommand the steps for
;processing a null command.

CmdTable        Config_NullCommand
CmdTableEntry     Config_GetParmList
CmdTableEntry     Config_GetEndOfLine
EndCmdTable     Config_NullCommand


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_NullCommand                    *
;*                                                             *
;* DESCRIPTIVE NAME:  Null command hanlder                     *
;*                                                             *
;* FUNCTION:     To handle a null command                      *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the                 *
;*               Config_NullCommand table.                     *
;*                                                             *
;* ENTRY POINT:  Config_CMD_NullCommand                        *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:        none                                          *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     clear                               *
;*                                                             *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Clear carry
Procedure       Config_CMD_NullCommand
                assume ds:nothing,es:DOSINITDATA
                clc                             ;No error
                ret
EndProc         Config_CMD_NullCommand



;This command processing table gives Config_ProcessCommand the steps for
;processing an invalid command.

CmdTable        Config_InvalidCommand
CmdTableEntry     Config_CMD_InvalidCommand
EndCmdTable     Config_InvalidCommand


;******************* Start of Specifications *******************
;*                                                             *
;* SUBROUTINE NAME:  Config_CMD_InvalidCommand                 *
;*                                                             *
;* DESCRIPTIVE NAME:  Bad command handler                      *
;*                                                             *
;* FUNCTION:     To handle invalid commands                    *
;*                                                             *
;* NOTES:        This procedure is called indirectly by        *
;*               Config_ProcessCommand via the                 *
;*               Config_InvalidCommand table.                  *
;*                                                             *
;* ENTRY POINT:  Config_CMD_InvalidCommand                     *
;*    LINKAGE:   call near                                     *
;*                                                             *
;* INPUT:        none                                          *
;*                                                             *
;* EXIT-NORMAL:                                                *
;*                                                             *
;*               Carry     set                                 *
;*               AX        = error code                        *
;* EXIT-ERROR:   none                                          *
;*                                                             *
;* EFFECTS:      none                                          *
;*                                                             *
;* INTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;* EXTERNAL REFERENCES:                                        *
;*    ROUTINES:  none                                          *
;*                                                             *
;******************** End of Specifications ********************
;Set error code
;Set carry
Procedure       Config_CMD_InvalidCommand
                assume ds:nothing,es:DOSINITDATA
                mov     ax,MSG_SYSINIT_INVAL_CMD
                stc                             ;Unrecognized command error
                ret
EndProc         Config_CMD_InvalidCommand

INITCODE        ends
                end
