        page    ,132
        title   MSCONST - List of lists

        subttl  Initialized data and data used at DOS initialization

;********************************************************************** ;BN003;
;  23Jan92 - G.L.Fulk                                                   ;BN003;
;  Add DOS Swappable area.                                              ;BN003;
;********************************************************************** ;BN003;
;  23Jan92 - G.L.Fulk                                                   ;BN004;
;  Add Fake SFT.                                                        ;BN004;
;********************************************************************** ;BN004;
;  10Aug92 - G.L.Fulk                                                   ;BN005;
;  Add 4 bytes to keep the offsets the same between DOS and MVDM.       ;BN005;
;********************************************************************** ;BN005;
;  18Aug92 - G.L.Fulk                                                   ;BN006;
;  Change the UmbFlag variable from word to byte.                       ;BN006;
;********************************************************************** ;BN006;
;  10Aug95 - J.M.Hare  defect 108828                                    ;BN007;
;  Change the BUFFERS=value to 40 decimal for Falcon Gold.              ;BN007;
;********************************************************************** ;BN007;

;*** DOS 5 note ***                                                     ;BN005;
;All variables which have UU_ as prefix can be reused for other purposes;BN005;
;and can be renamed. All these variables were used for EMS support      ;BN005;
;of Buffer Manager. Now they are useless for Buffer manager ---- MOHANS ;BN005;

.xlist
include v86seg.inc
.xcref
include devhdr.inc                      ;{DOSINC} DEV_ definitions in NULDEV
include dem_vars.inc                    ;{INC}    MEM_UTIL_UMB_HEAD
.cref
.list


V86DATA SEGMENT
        EXTRN   RMDevHandleInfo: byte
V86DATA ENDS


V86CODE SEGMENT
        EXTRN   LeaveDOS:NEAR
        EXTRN   OkCall:near             ;MsCode.asm
        EXTRN   BadCall:near            ;MsCode.asm
        EXTRN   CONDEV:word
        EXTRN   INULDEV: near           ;MsCode.asm
        EXTRN   SNULDEV: near           ;MsCode.asm
        EXTRN   RetExePatch: near       ;MsProc.asm
V86CODE ENDS

;
; We need to identify the parts of the data area that are relevant to tasks
; and those that are relevant to the system as a whole.  Under 3.0, the system
; data will be gathered with the system code.  The process data under 2.x will
; be available for swapping and under 3.0 it will be allocated per-process.
;
; The data that is system data will be identified by [SYSTEM] in the comments
; describing that data item.
;

V86CONST SEGMENT
        EXTRN   sfTabl:DWORD
        EXTRN   FCBTabl:DWORD
V86CONST ENDS

V86LoL  SEGMENT
        org     0                                                       ;55160;
        EXTRN   DosKrnl_entry:near
        EXTRN   v86init_Initialize: near
public  $_cp20_MsConst
$_cp20_MsConst label byte

;------ The old DOS kernel had a JUMP instruction here.
        public  pfnInt24Handler
pfnInt24Handler label   dword
        jmp     v86init_Initialize      ; Jump to the intialization code
        db      0Dh


;------ make all the object visible in the segment
public  DataVersion,BugTyp,BugLev,MYNUM,FCBLRU,OpenLRU,OEM_HANDLER
public  LeaveAddr,RetryCount,RetryLoop,LastBuffer,ContPos,arena_head
public  DPBHEAD,sft_addr,BCLOCK,BCON,MAXSEC,BUFFHEAD,CDSADDR,sftFCB
public  KeepCount,NUMIO,CDSCOUNT,NULDEV,Splices,Special_entries
public  IFS_DOS_CALL,IFS_HEADER,BUFFERS_PARM1,BUFFERS_PARM2,BootDrive
public  DDMOVE,EXT_MEM_SIZE,umb_head,UmbFlag,START_ARENA,WinOldPatch1
public  HASHINITVAR,BufferQueue,BUF_HASH_PTR,DirtyBufferCount
public  BUF_HASH_COUNT,SC_CACHE_PTR,SC_CACHE_COUNT,BuffInHMA
public  LoMemBuff,UU_BUF_EMS_FIRST_PAGE,CL0FATENTRY,IoStatFail
public  ALLOCMSAVE,A20OFF_COUNT,DOS_FLAG,UNPACK_OFFSET,SAVE_AX
public  ChkCopyProt,A20OFF_PSP

;
; WANGO!!!  The following word is used by SHARE and REDIR to determin data
; area compatability.  This location must be incremented EACH TIME the data
; area here gets mucked with.
;
; Also, do NOT change this position relative to DOSGROUP:0.
;
;BUGBUG 06-Sep-1989 bens Hack to make Works 2.0, FlightSim 4.0 work
;
; The Microsoft Apps group added code to their apps to detect DOS clones.
; Setting DataVersion greater than 1 will make this code pass, for now.
;
; Another possible solution is to make the tests pass when dataversion is 1.
; This involves getting several fields at the correct offset.  I may prefer
; the current solution, since any app that depends upon the DataVersion is
; probably a network redirector or 3270 program, and if it needs this much
; internal DOS knowledge, it may not work anyway.

;---------------
DataVersion     dw      ?       ;-22h version number for DOS DATA
                                ;     OS/2 2.0 DataVersion=20           ;BN005;
                                ;     DOS 5.0 DataVersion=1             ;BN005;
                                ;     DOS 4.0 DataVersion=1             ;BN005;
                                ;     DOS 3.4 DataVersion=0             ;BN005;
;---------------
                                ;     NOT [SYSTEM] DATA
WinoldPatch1    label   byte    ;-20h -20h DOS 5.0 moved "BUG ",BugTyp,&;BN005;
                                ;     BugLev to DosCode segment; and put;BN005;
                                ;     this new name with 8 dup (?) here.;BN005;
                db      ?,?,?,? ;
BugTyp          dw      ?       ;-1Ch
BugLev          dw      ?       ;-1Ah
;---------------
MYNUM           dw      ?       ;-18h A number that goes with MYNAME.
                                ;     User number from i21.5E00 and 5E01.
;*WARNING* All data object used above this point must use the low memory
;space and cannot use the HMA segment.  {First 10h bytes of FFFFh}
;---------------
FCBLRU          dw      ?       ;-16h LRU count for FCB cache
;---------------
OpenLRU         dw      ?       ;-14h LRU count for FCB cache opens
;---------------
OEM_HANDLER     dd      ?       ;-12h Pointer to OEM handler code
                                ;     DOS note: We include this declaration in
                                ;     IBM DOS even though it isn't used.  This
                                ;     allows Redirector to work on IBM or MS.
;===============================
;LowMem_InitBlock equ    $
        org     4
        include msconst.inc
        DB      1Ah                     ;=end of file
;       .errnz  ((offset $)-(offset DosKrnl_entry)) LT ((offset LowMem_InitBlock)-(offset DosKrnl_entry))
        org     18h
;===============================
;---------------
LeaveAddr       label   word    ;-0Eh DOS 5.0 questions the value of this.
                dw      offset V86GROUP:LeaveDOS
;---------------
RetryCount      dw      3       ;-0Ch Share retries (?see i21.440B)
;---------------
RetryLoop       dw      1       ;-0Ah Share retries (?see i21.440B)
;---------------
LastBuffer      dd      -1      ;-08h Buffer queue recency pointer.
                                ;     Pointer to the current disk buffer.
;---------------
ContPos         dw      0       ;-04h Location in buffer of next read.
                                ;     Pointer in DOS code segment of unread
                                ;     CON input.  When CON is read via a
                                ;     handle, DOS reads an entire line, and
                                ;     returns the requested portion, buffering
                                ;     the rest for the next read.  0 indicates
                                ;     no unread input.
;---------------
arena_head      dw      ?       ;-02h Segment # of first arena in memory
;---------------


                                      PUBLIC  SYSINITVAR    ;[SYSTEM]
SYSINITVAR      label   word          ;<---int 21h AH=52h, ES:BX=&SysInitVar


DPBHEAD         dd      0       ;+00h Pointer to head of DPB-FAT list.
                                ;     Pointer to the 1st DPB (see i21.32).
;---------------                ;
sft_addr        label   dword   ;+04h Pointer to first SFT table
                dw      offset V86GROUP:SFTabl
                dw      ?       ;
;---------------                ;
BCLOCK          dd      -1      ;+08h The "CLOCK$" device driver.
;---------------                ;
BCON            label   dword   ;+0Ch Console device entry points
                dw      offset V86GROUP:CONDEV
                dw      ?       ;
;---------------                ;
MAXSEC          dw      128     ;+10h Maximum allowed sector size
                                ;     Bytes/block of any block device.
;---------------                ;
BUFFHEAD        dd      -1      ;+12h Pointer to head of buffer queue
;---------------                ;
CDSADDR         dd      -1      ;+16h Pointer to curdir structure table
;---------------                ;
sftFCB          label   dword   ;+1Ah Pointer to FCB cache table.
                                ;     Pointer to FCB table (if FCBS= exists).
                dw      offset V86GROUP:FCBTabl
                dw      ?       ;
;---------------                ;
KeepCount       dw      -1      ;+1Eh Count of FCB opens to keep.
                                ;     The y value in FCBS=x,y.
;---------------                ;
NUMIO           db      0       ;+20h Number of disk tables
                                ;     Number of block devices.
;---------------                ;
CDSCOUNT        db      0       ;+21h Number of CDS structures in above
                                ;     Value of LastDrive.
                                ;     LastDrive=E, means CDScount=5.
;---------------                ;
NULDEV          label   dword   ;+22h Link to rest of device list
                dw      offset V86GROUP:CONDEV
                dw      ?
                dw      DEV_CHAR_DEV or DEV_NULL ;8000=CharDev, 0004=NUL
                dw      offset V86GROUP:SNULDEV  ;strategy
                dw      offset V86GROUP:INULDEV  ;interrupt
                db      "NUL     "               ;char name
;---------------                ;
Splices         db      0       ;+34h TRUE => splices being done
                                ;     Number of JOIN'ed drives.
;---------------                ;
IBMDOS_SIZE     label   word    ;+35h DOS 3.4=size of IBMDOS in pagragraph
Special_entries dw      0       ;     DOS 4 & 5=address of special entries
;---------------                ;
UU_IFS_DOS_CALL label   dword   ;+37h DOS 5 considers this expendable,so;BN005;
                                ;     they added "UU_" on the name.
IFS_DOS_CALL    dd      0       ;     Entry for IFS DOS service.
;---------------                ;
IFS_HEADER      label   dword   ;+3Bh IFS header chain, DOS 5 uses space;BC005;
                                ;     for these 2 new DW instead.  They ;BC005;
                                ;     support copy protected apps.      ;BC005;
ChkCopyProt     label   word    ;     +3Bh new DOS 5 object             ;BC005;
                dw      offset V86GROUP:RetExePatch
A20OFF_PSP      dw      ?       ;     +3Dh new DOS 5 object             ;BC005;
;---------------                ;
BUFFERS_PARM1   dw     40       ;+3Fh value m of BUFFERS= m,n           ;BN007;
;---------------                ;
BUFFERS_PARM2   dw      0       ;+41h value n of BUFFERS= m,n
;---------------                ;
BootDrive       db      0       ;+43h the boot drive
;---------------                ;
DDMOVE          db      1       ;+44h 1 if we need DWORD move
                                ;     used in only one DOS place to determine
                                ;     if a 66h,MOVSW==MOVSD is possible.
                                ;     Normal 8086 DOS has a 0 here, but since
                                ;     we are guaranteed a 386 MOVSD is valid.
;---------------                ;
EXT_MEM_SIZE    dw      0       ;+45h extended memory size in K
;---------------                ;
HASHINITVAR     label   word    ;+47h
BufferQueue     label   dword   ;     DOS 5=Head of the buffer Queue
BUF_HASH_PTR    dd      ?       ;     DOS 3.4&4=buffer hash table addr
;---------------                ;
DirtyBufferCount label  word    ;+4Bh DOS 5=Count of Dirty buffers in the Que
                                ;           DOS 5 init value=0.
BUF_HASH_COUNT  dw      0       ;     DOS 3.4&4=number of Hash entries
                                ;           DOS 3.4&4 init value=1.
;---------------                ;
SC_CACHE_PTR    dd      ?       ;+4Dh secondary cache pointer
;---------------                ;
SC_CACHE_COUNT  dw      0       ;+51h secondary cache count
;---------------                ;
BuffInHMA       db      0       ;+53h DOS 5=Flag to indicate that buffs in HMA
;---------------                ;
LoMemBuff       dd      ?       ;+54h DOS 5=Ptr to intermediate buffer in
                                ;           Low mem when buffs are in HMA
;---------------                ;
UU_BUF_EMS_FIRST_PAGE db 0,0,0  ;+58h DOS 5=considers this useless space, avail
;---------------                ;
CL0FATENTRY     dw      -1      ;+5Bh DOS 5=Holds the data that is used in
                                ;           pack/unpack rts. in fat.asm if
                                ;           cluster 0 is specified.
;---------------                ;
IoStatFail      db      0       ;+5Dh DOS 5=IoStatFail has been added to
                                ;           record a fail on an I24 issued
                                ;           from IOFUNC on a status call.
;---------------                ;
ALLOCMSAVE      db      0       ;+5Eh DOS 5=temp var. used to save
                                ;           alloc method in msproc.asm
;---------------                ;
A20OFF_COUNT    db      0       ;+5Fh DOS 5=indiactes the # of int 21
                                ;           calls for which A20 is off
;---------------                ;
DOS_FLAG        db      0       ;+60h DOS 5: see DOSSYM.INC for Bit definitions
                                ;     bit 0=[ExecOpen]=This is set when an
                                ;     $open call is made from $exec. This
                                ;     is used in $open to indicate to the
                                ;     redirector that this open is being
                                ;     made by an exec call.
                                ;     bit 1=[SUPPRESS_WINA20]
                                ;     bit 2=[ExecA20Off] A20 line bug flag.
;---------------                ;
UNPACK_OFFSET   dw      0       ;+61h DOS 5=saves pointer to the start of
                                ;           unpack code in exepatch.asm
;---------------                ;
UMBFLAG         db      0       ;+63h DOS 5=bit defined in DemUmb.inc
                                ;     bit 0=[LINKSTATE]=bit 0 indicates the
                                ;       link state of the UMBs whether linked
                                ;       or not to the DOS arena chain
                                ;       1=linked, 0=not linked
                                ;     bit 4=[DOSALLOC]=This is a kernel request
                                ;       0=this is not a kernel request. If set,
                                ;       when UMBs are not in linked $alloc will
                                ;       search UMBs anyway.
                                ;     bit 5=[NOUMBS]=DOS=UMBs will RESET this
                                ;       flag. When DOS=UMBS (NOUMBS=0), the
                                ;       DOS apps will not be able to use XMS to
                                ;       get UMBs. They will have to specify
                                ;       DOS=NOUMBS (NOUMBS=1) to access UMBs
                                ;       via XMS. 0=DOS owns UMBs 1=DOS does
                                ;       not own UMBS.
                                ;     bit 6=[UMBAVAIL]=indicates whether UMBs
                                ;       are supported (ie DOS=UMB, XMS
                                ;       providing UMBs, and UBM_HEAD is valid
                                ;       1=supported 0=not supported
                                ;     bit 7=[NOLINKUMBS]=indicates whether the
                                ;       UMBs are linkable.
                                ;       0=can link, 1=can't link
;---------------                ;
SAVE_AX         dw      0       ;+64h DOS 5=temp varibale to store ax
                                ;           in msproc.asm
;---------------                ;
UMB_HEAD        dw      -1      ;+66h DOS 5=this is initialized to the
                                ;           first umb arena by BIOS sysinit.
;---------------                ;
START_ARENA     dw      -1      ;+68h DOS 5=this is the first arena from which
                                ;           DOS will start its scan for alloc.
                                ;           Seg address of arena from which to
                                ;           start allocation scan.
                                ;           DOS 5 init value=1.
;---------------                ;
                                ;+6Ah DOS 4=End of SysInitVar block
        PUBLIC  END_INTERNAL_VAL;
END_INTERNAL_VAL   LABEL  WORD  ;
;---------------                ;



;-----------------------------------------------------------------------
;IFDEF GA_MVDM
;umb_head       dw      -1      ;+47h head of UMB arena
;UmbFlag        dw      0       ;+49h UMB flag byte
;                               ;+4Ah GA=End of SYSINITVar block
;ENDIF
;-----------------------------------------------------------------------
;IFDEF DOS_340
;HASHINITVAR    label   word    ;
;BUF_HASH_PTR   dd      ?       ;+47h DOS 3.4 buffer Hash table addr
;BUF_HASH_COUNT dw      1       ;+4Bh DOS 3.4 number of Hash entries
;SC_CACHE_PTR   dd      ?       ;+4Dh secondary cache pointer
;SC_CACHE_COUNT dw      0       ;+51h secondary cache count
;BUF_EMS_MODE   db      -1      ;+53h DOS 3.4=EMS mode
;BUF_EMS_HANDLE dw      ?       ;+54h DOS 3.4=buffer EMS handle
;BUF_EMS_SEG_CNT dw     1       ;+56h DOS 3.4=EMS seg count
;BUF_EMS_PFRAME dw      ?       ;+58h DOS 3.4=EMS page frame seg address
;BUF_EMS_RESERV dw      0       ;+5Ah DOS 3.4=reserved
;BUF_EMS_MAP_BUFF db   12 dup(0);+5Ch DOS 3.4=map buffer
;                               ;+68h DOS 3.4=End of SYSINITVar block
;ENDIF
;-----------------------------------------------------------------------
;IFDEF DOS_400
;HASHINITVAR    label   word    ;
;BUF_HASH_PTR   dd      ?       ;+47h DOS 4=buffer Hash table addr
;BUF_HASH_COUNT dw      1       ;+4Bh DOS 4=number of Hash entries
;SC_CACHE_PTR   dd      ?       ;+4Dh secondary cache pointer
;SC_CACHE_COUNT dw      0       ;+51h secondary cache count
;BUF_EMS_SAFE_FLAG db   1       ;+53h DOS 4=indicates whether the page used
;                               ;           by buffers is safe or not
;BUF_EMS_LAST_PAGE db   4 dup(0);+54h DOS 4=holds the last page above 640k
;BUF_EMS_FIRST_PAGE db  4 dup(0);+58h DOS 4=holds the first page above 640K
;BUF_EMS_NPA640    db   0       ;+5Ch DOS 4=holds the number of pages above 640K
;BUF_EMS_BUFF_SEG  dw   0       ;+5Dh DOS 4=
;BUF_EMS_HANDLE    dw   ?       ;+5Fh DOS 4=buffer EMS handle
;BUF_EMS_PAGE_FRAME dw  -1      ;+61h DOS 4=EMS page frame number
;BUF_EMS_SEG_CNT   dw   1       ;+63h DOS 4=EMS seg count
;BUF_EMS_PFRAME    dw   ?       ;+65h DOS 4=EMS page frame seg address
;BUF_EMS_RESERV    dw   0       ;+67h DOS 4=reserved
;BUF_EMS_MODE      db   -1      ;+69h DOS 4=EMS mode
;                               ;+6Ah DOS 4=End of SYSINITVar block
;ENDIF
;-----------------------------------------------------------------------
;IFDEF DOS_500
;HASHINITVAR    label   word    ;
;BufferQueue    dd      ?       ;+47h DOS 5=Head of the buffer Queue
;DirtyBufferCount dw    0       ;+4Bh DOS 5=Count of Dirty buffers in the Que
;SC_CACHE_PTR   dd      ?       ;+4Dh secondary cache pointer
;SC_CACHE_COUNT dw      0       ;+51h secondary cache count
;BuffInHMA      db      0       ;+53h DOS 5=Flag to indicate that buffs in HMA
;LoMemBuff      dd      ?       ;+54h DOS 5=Ptr to intermediate buffer in
;                               ;           Low mem when buffs are in HMA
;UU_BUF_EMS_FIRST_PAGE db 0,0,0 ;+58h DOS 5=holds the first page above 640K
;CL0FATENTRY    dw      -1      ;+5Bh DOS 5=Holds the data that is used in
;                               ;           pack/unpack rts. in fat.asm if
;                               ;           cluster 0 is specified.
;IoStatFail     db      0       ;+5Dh DOS 5=IoStatFail has been added to
;                               ;           record a fail on an I24 issued
;                               ;           from IOFUNC on a status call.
;ALLOCMSAVE     db      0       ;+5Eh DOS 5=temp var. used to save AllocMethod
;                               ;           in msproc.asm
;A20OFF_COUNT   db      0       ;+5Fh DOS 5=indiactes the # of int 21 calls
;                               ;           for which A20 is off
;DOS_FLAG       db      0       ;+60h DOS 5=see DOSSYM.INC for Bit definitions
;UNPACK_OFFSET  dw      0       ;+61h DOS 5=saves pointer to the start of
;                               ;           unpack code in exepatch.asm
;UMBFLAG        db      0       ;+63h DOS 5=bit 0 indicates the link state of
;                               ;           the UMBs whether linked or not to
;                               ;           the DOS arena chain
;SAVE_AX        dw      0       ;+64h DOS 5=temp varibale to store ax in msproc
;UMB_HEAD       dw      -1      ;+66h DOS 5=this is initialized to the first
;                               ;           umb arena by BIOS sysinit.
;START_ARENA    dw      1       ;+68h DOS 5=this is the first arena from which
;                               ;           DOS will start its scan for alloc.
;                               ;+6Ah DOS 5=End of SYSINITVar block
;ENDIF
;-----------------------------------------------------------------------

V86LoL  ENDS


V86CONST SEGMENT
;
; Sharer jump table
;
PUBLIC  JShare
        EVEN
JShare  LABEL   DWORD
        DW      OFFSET V86GROUP:BadCall, 0
        DW      OFFSET V86GROUP:OKCall,  0  ;   1   MFT_enter
        DW      OFFSET V86GROUP:OKCall,  0  ;   2   MFTClose
        DW      OFFSET V86GROUP:BadCall, 0  ;   3   MFTclU
        DW      OFFSET V86GROUP:BadCall, 0  ;   4   MFTCloseP
        DW      OFFSET V86GROUP:BadCall, 0  ;   5   MFTCloN
        DW      OFFSET V86GROUP:BadCall, 0  ;   6   set_block
        DW      OFFSET V86GROUP:BadCall, 0  ;   7   clr_block
        DW      OFFSET V86GROUP:OKCall,  0  ;   8   chk_block
        DW      OFFSET V86GROUP:BadCall, 0  ;   9   MFT_get
        DW      OFFSET V86GROUP:BadCall, 0  ;   10  ShSave
        DW      OFFSET V86GROUP:BadCall, 0  ;   11  ShChk
        DW      OFFSET V86GROUP:OKCall , 0  ;   12  ShCol
        DW      OFFSET V86GROUP:BadCall, 0  ;   13  ShCloseFile
        DW      OFFSET V86GROUP:BadCall, 0  ;   14  ShSU

V86CONST    ENDS

;The MEM utility has this address hard-coded.  Therefore, if UMB_HEAD
;changes releative position to SYSINITVAR, MEM much also change.
.errnz  UMB_HEAD-SYSINITVAR-MEM_UTIL_UMB_HEAD

;The COMMAND.COM utility has uses the LoL (List-of-lists) segment at
;offset 0 to find this Dword object.  If it should move, COMMAND.COM
;will need to change too.
.errnz  offset V86LoL:pfnInt24Handler

        END
