        page    ,132
        title   MS_DATA - DATA segment for DOS

        subttl  Uninitialized data overlayed by initialization code

;********************************************************************** ;BN001;
; 12Jul91 - G.L.Fulk                                                    ;BN001;
; Increase the buffer for EXEC reading the .EXE relocation table to 2K. ;BN001;
;********************************************************************** ;BN001;
; 21Jan92 - G.L.Fulk                                                    ;BN002;
; Enable the Swappable DOS data area feature.                           ;BN002;
;********************************************************************** ;BN002;
;
; DATA Segment for DOS.
;

.xlist
include v86seg.inc
.xcref
include demcd.inc                       ;CurDirLen def
include dirent.inc                      ;{DOSINC} Dir_entry def
.cref
.list


V86SDA  SEGMENT
; Init code overlaps with data area below

;;;     ORG     0

public  $_cp20_Ms_Data
$_cp20_Ms_Data label byte

public  TIMEBUF,DEVIOBUF,OPENBUF,RenBuf,SEARCHBUF,DummyCDS
public  NAME1,NAME2,DESTSTART

TIMEBUF         db      6 dup(?);+096h Time read from clock device
DEVIOBUF        db      2 dup(?);+09Ch Buffer for I/O under file assignment

;
; The following areas are used as temp buffer in EXEC system call
;
; The following buffer must remain continguous                          ;BN001;
OPENBUF         db    128 dup(?);+09Eh buffer for name operations
RenBuf          db    128 dup(?);+11Eh buffer for rename destination
; Buffer for search calls
SEARCHBUF       db     53 dup(?);+19Eh internal search buffer
DummyCDS        label  byte     ;+1D3h
                DB     (SIZE curdir_list) dup(?)
; This area is here to allow few-large read, instead of many-small reads;BN001;
;       DB      (exec_internal_buffer_size - ($ - OpenBuf)) dup (?)     ;BN001;

;
; End of contiguous buffer
;

;
; Temporary directory entry for use by many routines.  Device directory
; entries (bogus) are built here.
;
        PUBLIC  DevFCB
DEVFCB  LABEL   BYTE                    ; Uses NAME1, NAME2, combined
; WARNING..  do not alter position of NAME1 relative to DEVFCB
; without first examining BUILD_DEVICE_ENT. Look carefully at DOS_RENAME
; as well as it is the only guy who uses NAME2 and DESTSTART.
NAME1           db     12 dup(?);+22Bh File name buffer
NAME2           db     13 dup(?);+237h
DESTSTART       dw      ?       ;+244h
                db      ((SIZE DIR_ENTRY) - ($ - DEVFCB)) DUP (?)
;
; End Temporary directory entry.
;

public  ATTRIB,EXTFCB,SATTRIB,open_access,FoundDel,Found_dev,fSplice
public  fSharing,SECCLUSPOS,TRANS,READOP,THISDRV,CLUSFAC,CLUSSPLIT
public  INSMODE,cMeta,VOLID,exit_type,CREATING,DELALL,EXITHOLD
public  user_SP,user_SS,CONTSTK,THISDPB,CLUSSAVE,CLUSSEC,PREREAD
public  FATBYT,FATBYTE,DEVPT,THISSFT,THISCDS,THISFCB,SFN,JFN,PJFN
public  WFP_START,REN_WFP,CURR_DIR_END,NEXTADD,LASTPOS,CLUSNUM
public  DIRSEC,DIRSTART,SECPOS,VALSEC,BYTSECPOS,BYTPOS,BYTCNT1,BYTCNT2
public  SECCNT,ENTFREE,ENTLAST,NXTCLUSNUM,GROWCNT,CURBUF,CONSft,SaveBX
public  SaveDS,restore_tmp,NSS,NSP,EXTOPEN_FLAG,EXTOPEN_ON
public  EXTOPEN_IO_MODE,SAVE_DI,SAVE_ES,SAVE_DX,SAVE_CX,SAVE_BX
public  SAVE_SI,SAVE_DS,HIGH_SECTOR,UU_HIGH_SECTOR_TEMP,DISK_FULL
public  TEMP_VAR,TEMP_VAR2,DrvErr,DOS34_FLAG,NO_FILTER_PATH
public  NO_FILTER_DPATH,AbsRdWr_SS,AbsRdWr_SP,UU_Callback_flag


ATTRIB          db      ?       ;+24Bh storage for file attributes
EXTFCB          db      ?       ;+24Ch TRUE => extended FCB in use
SATTRIB         db      ?       ;+24Dh Storage for search attributes
open_access     db      ?       ;+24Eh access of open system call
FoundDel        db      ?       ;+24Fh true => file was deleted
Found_dev       db      ?       ;+250h true => search found a device
fSplice         db      ?       ;+251h true => do a splice in transpath
fSharing        db      ?       ;+252h TRUE => no redirection
SECCLUSPOS      db      ?       ;+253h Position of first sector within cluster
TRANS           db      ?       ;+254h
READOP          db      ?       ;+255h
THISDRV         db      ?       ;+256h
CLUSFAC         db      ?       ;+257h
CLUSSPLIT       db      ?       ;+258h
INSMODE         db      ?       ;+259h true => insert mode in buffered read
cMeta           db      ?       ;+25Ah count of meta'ed components found
VOLID           db      ?       ;+25Bh
exit_type       db      ?       ;+25Ch type of exit...

                EVEN            ;+25Dh dead byte

; WARNING - the following two items are accessed as a word
CREATING        db      ?       ;+25Eh true => creating a file
DELALL          db      ?       ;+25Fh true => deleting everything
                                ;      = 0 iff BUGBUG
                                ;      = DIRFREE iff BUGBUG

EXITHOLD        dd      ?       ;+260h Temp location for proc terminate
user_SP         dw      ?       ;+264h User SP for system call
user_SS         dw      ?       ;+266h User SS for system call
CONTSTK         dw      ?       ;+268h
THISDPB         dd      ?       ;+26Ah
CLUSSAVE        dw      ?       ;+26Eh
CLUSSEC         dd      ?       ;+270h >32mb                             AC0000
PREREAD         dw      ?       ;+274h 0 means preread; 1 means optional

FATBYT          dw      ?       ;+276h Used by ALLOCATE
FATBYTE         dw      ?       ;+278h Used by $SLEAZEFUNC
DEVPT           dd      ?       ;+27Ah
THISSFT         dd      ?       ;+27Eh Address of user SFT
THISCDS         dd      ?       ;+282h Address of current CDS
THISFCB         dd      ?       ;+286h Address of user FCB

SFN             dw      -1      ;+28Ah SystemFileNumber found for accessfile
JFN             dw      ?       ;+28Ch JobFileNumber found for accessfile
PJFN            dd      ?       ;+28Eh PointerJobFileNumber found for accessfile
WFP_START       dw      ?       ;+292h
REN_WFP         dw      ?       ;+294h
CURR_DIR_END    dw      ?       ;+296h
NEXTADD         dw      ?       ;+298h
LASTPOS         dw      ?       ;+29Ah
CLUSNUM         dw      ?       ;+29Ch
DIRSEC          dd      ?       ;+29Eh >32mb                             AC0000
DIRSTART        dw      ?       ;+2A2h
SECPOS          dd      ?       ;+2A4h >32mb Position of first sector accessed
VALSEC          dd      ?       ;+2A8h >32mb Number of valid (previously
                                ;      written) sectors

BYTSECPOS       dw      ?       ;+2ACh Position of first byte within sector
BYTPOS          db      4 dup(?);+2AEh Byte position in file of access
BYTCNT1         dw      ?       ;+2B2h No. of bytes in first sector
BYTCNT2         dw      ?       ;+2B4h No. of bytes in last sector
SECCNT          dw      ?       ;+2B6h No. of whole sectors
ENTFREE         dw      ?       ;+2B8h
ENTLAST         dw      ?       ;+2BAh
NXTCLUSNUM      dw      ?       ;+2BCh
GROWCNT         dd      ?       ;+2BEh
CURBUF          dd      ?       ;+2C2h
CONSft          dd      ?       ;+2C6h SFT of console swapped guy.
SaveBX          dw      ?       ;+2CAh
SaveDS          dw      ?       ;+2CCh
restore_tmp     dw      ?       ;+2CEh return address for restore world
NSS             dw      ?       ;+2D0h
NSP             dw      ?       ;+2D2h

EXTOPEN_FLAG    dw      0       ;+2D4h extended open input flag
EXTOPEN_ON      db      0       ;+2D6h extended open conditional flag
EXTOPEN_IO_MODE dw      0       ;+2D7h extended open io mode
SAVE_DI         dw      ?       ;+2D9h extended open saved DI
SAVE_ES         dw      ?       ;+2DBh extended open saved ES
SAVE_DX         dw      ?       ;+2DDh extended open saved DX
SAVE_CX         dw      ?       ;+2DFh extended open saved CX
SAVE_BX         dw      ?       ;+2E1h extended open saved BX
SAVE_SI         dw      ?       ;+2E3h extended open saved SI
SAVE_DS         dw      ?       ;+2E5h extended open saved DS

;       HIGH_SECTOR is a hack to allow passing 32-bit sector numbers where
;       we used to just pass 16 bits in a register.  Now High_SECTOR holds
;       the high 16, the low 16 are still in the register.

HIGH_SECTOR     dw      0       ;+2E7h >32mb higher sector #

UU_HIGH_SECTOR_TEMP dw  0       ;+2E9h >32mb high sector #

DISK_FULL       db      ?       ;+2EBh >32mb indicating disk full when 1
TEMP_VAR        dw      ?       ;+2ECh temporary variable for everyone
TEMP_VAR2       dw      ?       ;+2EEh temporary variable 2 for everyone
DrvErr          db      ?       ;+2F0h used to save drive error
DOS34_FLAG      dw      0       ;+2F1h common flag for DOS 3.4
NO_FILTER_PATH  dd      ?       ;+2F3h pointer to orignal path
NO_FILTER_DPATH dd      ?       ;+2F7h pointer to orignal path of destination

AbsRdWr_SS      dw      ?       ;+2FBh INT 25/26 user stack segment
AbsRdWr_SP      dw      ?       ;+2FDh INT 25/26 user stack offset
UU_Callback_flag db     0       ;+2FFh Unused


; make those pushes fast!!!
EVEN
StackSize   =   180h                    ; gross but effective

;
; WARNING!!!! DskStack may grow into AUXSTACK due to interrupt service.
; This is NO problem as long as AUXSTACK comes immediately before DSKSTACK
;

                PUBLIC  RENAMEDMA,AuxStack,DskStack,IOStack
RENAMEDMA       LABEL   BYTE    ;+300h See DOS_RENAME
                DB      StackSize DUP (?)
AuxStack        LABEL   BYTE    ;+480h
                DB      StackSize DUP (?)
DskStack        LABEL   BYTE    ;+600h
                DB      StackSize DUP (?)
IOStack         LABEL   BYTE    ;+780h

; patch space for Boca folks.
; Say What????!!! This does NOT go into the swappable area!
; NOTE: We include the decl of ibmpatch in ms-dos even though it is not needed.
;       This allows the REDIRector to work on either IBM or MS-DOS.

                PUBLIC  IBMPATCH,Printer_flag,VOLCHNG_FLAG,VIRTUAL_OPEN
                PUBLIC  FSeek_drive,FSeek_firclus,FSeek_logclus
                PUBLIC  FSeek_logsave,TEMP_DOSLOC

IBMPATCH        label   byte
PRINTER_FLAG    db      0       ;+780h status of PRINT utility
VOLCHNG_FLAG    db      0       ;+781h true if volume label created
VIRTUAL_OPEN    db      0       ;+782h non-zero if we opened a virtual file

; Following 4 variables moved to MSDATA.asm from MSTABLE.asm (P4986)

FSeek_drive     db      ?       ;+783h fastseek drive #
FSeek_firclus   dw      ?       ;+784h fastseek first cluster #
FSeek_logclus   dw      ?       ;+786h fastseek logical cluster #
FSeek_logsave   dw      ?       ;+788h fastseek returned log clus #
TEMP_DOSLOC     dw      -1      ;+78Ah stores the temporary location
                                ;      of dos at SYSINIT time.



SWAP_END    LABEL   BYTE        ;+78Ch
PUBLIC  SWAP_END

V86SDA  ENDS
        END
