        page    ,132
        title   CONST2 - More constants data

        subttl  Initialized data and data used at DOS initialization

;********************************************************************** ;BN001;
; 23Jan92 - G.L.Fulk                                                    ;BN001;
; Add a Fake SFTabl.                                                    ;BN001;
;********************************************************************** ;BN001;
; 23Jan92 - G.L.Fulk                                                    ;BN002;
; Enable the Swappable DOS data area feature.                           ;BN002;
;********************************************************************** ;BN002;
; 02Feb93 - Fulkgl                                                      ;61361;
; Default VERIFY OFF.                                                   ;61361;
;********************************************************************** ;61361;
; 11Dec93 -B.Clare (changeteam defect 75460)                            ;75460;
;          Added definition for SrvCallEntFlg. Indicates that current   ;75460;
;          DOS call was entered from SRV_CALL.  Only function 41h       ;75460;
;          ($unlink) is supported at this time.                         ;75460;
;********************************************************************** ;75460;
; 17Dec93 -ChangeTeam Defect 76092                                      ;76092;
;          Added definition for flag fLoadHigh for LOADHIGH command.    ;76092;
;********************************************************************** ;76092;
;
;Local  DCR/
;Tag    PTM(R)  Who     When
;               danno   05-Dec-1988
;                   Modified from const2.asm for MVDM
;

.xlist
include v86seg.inc
.xcref
include devsym.inc                      ;{INC} SRHead, LENNDR defs
include sf.inc                          ;SFT definitions
.cref
.list


;
; 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.
;



V86SDA  SEGMENT
        EXTRN   DEVIOBUF:byte
V86SDA  ENDS


V86CONST    SEGMENT
public  $_cp20_Const2
$_cp20_Const2 label byte

;
; Table of routines for assignable devices
;
; MSDOS allows assignment if the following standard devices:
;   stdin  (usually CON input)
;   stdout (usually CON output)
;   auxin  (usually AUX input)
;   auxout (usually AUX output)
;   stdlpt (usually PRN output)
;
; SPECIAL NOTE:
;   Status of a file is a strange idea.  We choose to handle it in this
;   manner:  If we're not at end-of-file, then we always say that we have a
;   character.  Otherwise, we return ^Z as the character and set the ZERO
;   flag.  In this manner we can support program written under the old DOS
;   (they use ^Z as EOF on devices) and programs written under the new DOS
;   (they use the ZERO flag as EOF).

; Default SFTs for boot up


;----------------------------------------------------------------------
; This is a "fake" SFT (System File Table).  Under real-DOS SFT entries
; would follow this header.  If a dirty program attempts to use any of
; the SFT entries problems are sure to occur.  The purpose for this
; fake header is the "FILES=" value is placed in the SFT size field.
; This is how some programs determine the FILES= setting.
;
        PUBLIC  sftabl
sftabl  LABEL   DWORD           ; [SYSTEM] file table
        DW      -1              ; [SYSTEM] link to next table
        DW      -1              ; [SYSTEM] link seg to next table
        DW      sf_default_number;[SYSTEM] Number of entries in table
        DB      sf_default_number DUP ( (SIZE sf_entry) DUP (0))


public  CARPOS,STARTPOS,INBUF,CONBUF,PFLAG,VERFLG,CharCo,chSwitch
public  AllocMethod,fShare,DIFFNAM,MYNAME,SrvCallEntFLG             ;75460; Added SrvCallEntFlg
public  fLoadHigh                                                   ;76092;


; the next two variables relate to the position of the logical stdout/stdin
; cursor.  They are only meaningful when stdin/stdout are assigned to the
; console.
CARPOS          db      ?           ;[SYSTEM] cursor position in stdin
STARTPOS        db      ?           ;[SYSTEM] position of cursor at beginning of buffered input call

INBUF           db      128 dup (?) ;[SYSTEM] general device input buffer
CONBUF          db      131 dup (?) ;[SYSTEM] The rest of INBUF and console buffer

PFLAG           db      ?           ;[SYSTEM] printer echoing flag
VERFLG          db      0           ;[SYSTEM] Initialize with verify off;61361;
CharCo          db      00000011B   ;[SYSTEM] Allows statchks every 4 chars...
chSwitch        db      '/'         ;[SYSTEM] current switch character
AllocMethod     db      ?           ;[SYSTEM] how to alloc first(best)last
fShare          db      1           ;[SYSTEM] TRUE => sharing installed
DIFFNAM         db      1           ;[SYSTEM] Indicates when MYNAME has changed
MYNAME          db      16 dup (" ");[SYSTEM] My network name
fLoadHigh       db      0           ;[SYSTEM] Loadhigh flag             ;76092;

SrvCallEntFLG   db      0           ;75460   ;TRUE => Entered DOS function 41h
                                    ;75460   ;from Server Call (Function 5D00h)
;
; The following table is a list of addresses that the sharer patches to be
; PUSH AX to enable the critical sections
;
PUBLIC  CritPatch
CritPatch LABEL WORD
        EXTRN   EcritDisk: near
        EXTRN   LcritDisk: near
        EXTRN   EcritDevice: near
        EXTRN   LcritDevice: near
        dw      offset V86GROUP:EcritDisk
        dw      offset V86GROUP:LcritDisk
        dw      offset V86GROUP:EcritDevice
        dw      offset V86GROUP:LcritDevice
        dw      0

;
; WARNING!!!  COMMAND.COM gets the INT 24 handler address
; relative to INDOS using the GET_INDOS_FLAG int 21.
; Do not change the order of the follow variables.
;
        public  fHaveK09
fHaveK09 db     0
;;;     I_am    pfnInt24Handler,DWORD
        EVEN                            ; make swap area word aligned


V86CONST ENDS


V86SDA  SEGMENT

;
; WARNING!!!  PRINT and PSPRINT *REQUIRE* ErrorMode to precede INDOS.
; Also, IBM server 1.0 requires this also.
;

public  ErrorMode,INDOS,WPErr,EXTERR_LOCUS,EXTERR,EXTERR_ACTION
public  EXTERR_CLASS,EXTERRPT,DMAADD,CurrentPDB,ConC_spsave,exit_code
public  CURDRV,CNTCFLAG,CPSWFLAG,CPSWSAVE


PUBLIC  SWAP_START
SWAP_START      LABEL BYTE


ErrorMode       db      ?       ;+000h Flag for INT 24 processing
INDOS           db      0       ;+001h DOS status for interrupt processing
WPErr           db      -1      ;+002h Write protect error flag
                                ;      *WARNING* Following 4 extendeds must be in this order and packed together
EXTERR_LOCUS    db      ?       ;+003h Extended Error Locus
EXTERR          dw      0       ;+004h Extended Error code
EXTERR_ACTION   db      ?       ;+006h Extended Error Action
EXTERR_CLASS    db      ?       ;+007h Extended Error Class
EXTERRPT        dd      ?       ;+008h Extended Error pointer
DMAADD          label   dword   ;+00Ch User's disk transfer addr (disp/seg)
                dw      80h
                dw      ?
CurrentPDB      dw      ?       ;+010h Current process identifier
ConC_spsave     dw      ?       ;+012h saved SP before ^C
exit_code       dw      ?       ;+014h exit code of last proc.
CURDRV          db      ?       ;+016h Default drive (init A)
CNTCFLAG        db      0       ;+017h ^C check in dispatch disabled
CPSWFLAG        db      0       ;+018h Code Page Switching Flag  DOS 4.00
CPSWSAVE        db      0       ;+019h copy of above in case of ABORT

                EVEN
PUBLIC  Swap_Always
Swap_Always     LABEL   BYTE


public  USER_IN_AX,PROC_ID,USER_ID,FirstArena,BestArena,LastArena
public  EndMem,LASTENT,FAILERR,ALLOWED,NoSetDir,DidCTRLC,SpaceFlag
public  DAY,MONTH,YEAR,DAYCNT,WEEKDAY,CONSWAP,IDLEINT,fAborting
public  DEVCALL,CALLUNIT,CALLMED,CALLFLSH,CALLBR,CALLXAD,CALLRBYT
public  CALLVIDM,CallBPB,CALLSSEC,CALLSCNT,CALLVIDRW,CALLNEWSC


USER_IN_AX      dw      ?       ;+01Ah User INPUT AX value (used for
                                ;      extended error type stuff.  NOTE:
                                ;      does not have Correct value on
                                ;      1-12, OEM, Get/Set CurrentPDB,
                                ;      GetExtendedError system calls
PROC_ID         dw      0       ;+01Ch PID for sharing (0 = local)
USER_ID         dw      0       ;+01Eh Machine for sharing (0 = local)
FirstArena      dw      ?       ;+020h first free block found
BestArena       dw      ?       ;+022h best free block found
LastArena       dw      ?       ;+024h last free block found
EndMem          dw      ?       ;+026h End of memory used in DOSINIT
LASTENT         dw      ?       ;+028h Last entry for directory search

FAILERR         db      0       ;+02Ah NZ if user did FAIL on I 24
ALLOWED         db      0       ;+02Bh Allowed I 24 answers (see allowed_)
NoSetDir        db      ?       ;+02Ch true -> do not set directory
DidCTRLC        db      ?       ;+02Dh true -> we did a ^C exit
SpaceFlag       db      ?       ;+02Eh true -> embedded spaces are allowed in FCB

                EVEN            ;+02Fh dead byte
                                ;      *Warning!  The following 5 items are
                                ;         accessed as a WORD in TIME.ASM
DAY             db      0       ;+030h Day of month
MONTH           db      0       ;+031h Month of year
YEAR            dw      0       ;+032h Year (with century)
DAYCNT          dw      -1      ;+034h Day count from beginning of year
WEEKDAY         db      0       ;+036h Day of week

CONSWAP         db      ?       ;+037h TRUE => console was swapped during device read
IDLEINT         db      1       ;+038h TRUE => idle int is allowed
fAborting       db      0       ;+039h TRUE => abort in progress

                                ;      Combination of all device call parameters
DEVCALL         SRHEAD  <>      ;+03Ah basic header for disk packet

CALLUNIT        LABEL   BYTE    ;+047h unit number for disk
CALLFLSH        LABEL   WORD    ;
CALLMED         db      ?       ;      media byte

CALLBR          LABEL   DWORD   ;+048h
CALLXAD         LABEL   DWORD   ;
CALLRBYT        db      ?       ;

CALLVIDM        LABEL   DWORD   ;+049h
                db      3 DUP(?);

CALLBPB         LABEL   DWORD   ;+04Ch
CALLSCNT        dw      ?       ;

CALLSSEC        dw      ?       ;+04Eh

CALLVIDRW       dd      ?       ;+050h

CALLNEWSC       dd      ?       ;+054h starting sector for >32mb

; End of largest possible request packet (note, however, that it is
; currently only used for INIT requests in v86init.asm;  all other references
; are currently ifdef'ed out -JTP)


public  CALLDEVAD,IOCall,IORCHR,IOMED,IOXAD,IOSCNT,IOSSEC,IOFLSH


CALLDEVAD       dd      ?       ;+058h stash for device entry point


; Same as above for I/O calls   ;
                                ;
IOCALL          SRHEAD  <>      ;+05Ch

IOFLSH          LABEL   WORD    ;+069h
IORCHR          LABEL   BYTE    ;
IOMED           db      ?       ;

IOXAD           dd      ?       ;+06Ah

IOSCNT          dw      ?       ;+06Eh

IOSSEC          dw      ?       ;+070h

; Call struct for DSKSTATCHK
public  DSKSTCALL,DSKSTCOM,DSKSTST,DSKCHRET,DSKSTCNT,CreatePDB
public  Lock_Buffer,UserNum,OEMNum

DSKSTCALL       db      LENNDR,0;+072h
DSKSTCOM        db      5       ;+074h use DOS value, not OS2 value here
DSKSTST         dw      ?       ;+075h
                db      8 DUP(0);+077h
DSKCHRET        db      ?       ;+07Fh
    dw offset V86GROUP:DEVIOBUF ;+80h
                dw      ?       ;+082h DOS segment set at Init
DSKSTCNT        dw      1       ;+084h
                dw      0       ;+086h

CreatePDB       db      ?       ;+088h flag for creating a process

Lock_Buffer     DD      ?       ;+089h DOS Lock Buffer for Ext Lock, position
                DD      ?       ;+08Dh length

                EVEN            ;+091h dead byte

USERNUM         DW      ?       ;+092h 24 bit user number
                DB      ?       ;+094h
OEMNUM          DB      0       ;+095h 8 bit OEM number

                                ;+096h

V86SDA  ENDS

        END
