        page    80,132                  ;0
        title   MSTABLE -

;   Revision history:
;
; Local DCR/
; Tag   PTM     Who     Date        Description
;
; A000                              version 4.0  Jan. 1988
; A001  D486                        Share installation for >32mb drives
; A006  D503                        fake version for IBMCACHE
; A008  P4070                       fake version for MS WINDOWS
;               danno   16-Nov-1988 Modify for MVDM
;
;********************************************************************** ;BN001;
;  20Aug91 - G.L.Fulk                                                   ;BN001;
;  Move the hard-coded copyright notice to the DosKrnl init, and use    ;BN001;
;  the message translated into NLS language instead.                    ;BN001;
;********************************************************************** ;BN001;
;  11Jun92 - G.L.Fulk                                                   ;BN002;
;  Implement the DispatchDOS int 2Fh table.                             ;BN002;
;********************************************************************** ;BN002;

.xlist
include v86seg.inc
.xcref
include basemaca.inc
include osmaca.inc
include oldmaca.inc
include demmac.inc
include demver.inc
;include extattr.inc                           ;AN000;; for Extended Attributes
;include fastopen.inc                     ;AN000;; for Extended Attributes
include dossymc.inc
include error.inc
include syscalls.inc
.cref
.list

        AsmVars <Kanji, Debug, Redirector, ShareF>

V86TABLE        SEGMENT
TableZero       LABEL   BYTE



public  DosDseg
DosDseg dw      ?



PUBLIC MSTAB001s,MSTAB001e
MSTAB001S       label byte


; I21_MAP_E_TAB - INT 21 error mapping table
;
; This is the error code mapping table for INT 21 errors.  This table in
; conjunction with the next table defines error mappings to change one error
; code to another (usually to map a protect mode error to a compatable 3x
; error), and error codes which are "allowed" for each system call.  If the
; error code ABOUT to be returned is not "allowed" for the call, the correct
; action is to return the "real" error via Extended error, and one of the
; allowed errors on the actual call.
;
; The table is organized as follows:
;
;       byte    call            int 21 function number
;       byte    count           total bytes following this byte for this entry
;       byte    nmaps           number of mapping entries (can be 0)
;        word   from,to         mapping entries...
;       byte    nlegal          number of legal error codes (at least 1)
;        byte   legal           legal error codes...
;
; two macros are used to build the table entries:
;   E21 call,nummaps,<<map>,<mapn>>,numlegalerrors
;   E21legal <error1,error2>
;   where:
;       call = int 21 function #
;       nummaps = number of mapping entries
;       map  = <from,to>
;       numlegalerrors = number of legal error codes
;
; two macros are used instead of one because one line is too long for the
; assembler.
;
; EXAMPLE:
;       E21 Open,1,<<invalid_drive,path_not_found>>,5
;       E21legal <path_not_found,file_not_found,invalid_access,too_many_open_files,access_denied>
;
;       Generates:
;       DB      3d, 0b, 01, 000f,0003, 05, 03,02,0c,04,05
;
; There are a number of calls (for instance all of the FCB calls) for which
;   there is NO entry.  This means that NO error codes are returned on this
;   call, so set up an Extended error and leave the current error code alone.
;
; The table is terminated by a call value of 0FFh

E21     macro   call,nummap,maps,numlegal
        LOCAL size

        ;; nmap + 4 bytes per map + nlegal + 1 byte per legal
        size = 1+nummap*4 + 1+numlegal      ;; size after call,count
        IF size GE 256
            IF2
                .err
                %out E21: entry too large
            ENDIF
        ENDIF

        IF numlegal EQ 0
            IF2
                .err
                %out E21: must have at least one valid error code
            ENDIF
        ENDIF

        db      call
        db      size
        db      nummap
        IRP     map,<maps>
            IRP tmp,<map>
                dw      error_&&&tmp
            ENDM
        ENDM
        db      numlegal
endm


E21legal macro   legals

        IRP     legal,<legals>
                db      error_&&legal
        ENDM
endm


        public  I21_MAP_E_TAB
I21_MAP_E_TAB   label   byte
    E21 International,0,<>,2
    E21legal <invalid_function,file_not_found>
    E21 MkDir,2,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>>,3
    E21legal <path_not_found,file_not_found,access_denied>
    E21 RmDir,2,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>>,4
    E21legal <current_directory,path_not_found,file_not_found,access_denied>
    E21 ChDir,2,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>>,2
    E21legal <file_not_found,path_not_found>
    E21 Creat,3,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>,<invalid_name,file_not_found>>,4
    E21legal <path_not_found,file_not_found,too_many_open_files,access_denied>
    E21 Open,4,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>,<invalid_drive,path_not_found>,<invalid_name,file_not_found>>,5
    E21legal <path_not_found,file_not_found,invalid_access,too_many_open_files,access_denied>
    E21 Close,0,<>,1
    E21legal <invalid_handle>
    E21 Read,0,<>,2
    E21legal <invalid_handle,access_denied>
    E21 Write,0,<>,2
    E21legal <invalid_handle,access_denied>
    E21 Unlink,2,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>>,3
    E21legal <path_not_found,file_not_found,access_denied>
    E21 LSeek,0,<>,2
    E21legal <invalid_handle,invalid_function>
    E21 CHMod,2,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>>,4
    E21legal <path_not_found,file_not_found,invalid_function,access_denied>
    E21 IOCtl,0,<>,5
    E21legal <invalid_drive,invalid_data,invalid_function,invalid_handle,access_denied>
    E21 XDup,0,<>, 2
    E21legal <invalid_handle,too_many_open_files>
    E21 XDup2,0,<>,2
    E21legal <invalid_handle,too_many_open_files>
    E21 Current_Dir,0,<>,1
    E21legal <invalid_drive>
    E21 Alloc,0,<>,2
    E21legal <arena_trashed,not_enough_memory>
    E21 Dealloc,0,<>,2
    E21legal <arena_trashed,invalid_block>
    E21 Setblock,0,<>,3
    E21legal <arena_trashed,invalid_block,not_enough_memory>
    E21 Exec,2,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>>,8
    E21legal <path_not_found,invalid_function,file_not_found,too_many_open_files,bad_format,bad_environment,not_enough_memory,access_denied>
    E21 Find_First,2,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>>,3
    E21legal <path_not_found,file_not_found,no_more_files>
    E21 Find_Next,2,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>>,1
    E21legal <no_more_files>
    E21 Rename,2,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>>,4
    E21legal <not_same_device,path_not_found,file_not_found,access_denied>
    E21 File_Times,0,<>,2
    E21legal <invalid_handle,invalid_function>
    E21 CreateTempFile,3,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>,<invalid_name,file_not_found>>,4
    E21legal <path_not_found,file_not_found,too_many_open_files,access_denied>
    E21 CreateNewFile,3,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>,<invalid_name,file_not_found>>,5
    E21legal <file_exists,path_not_found,file_not_found,too_many_open_files,access_denied>
    E21 LockOper,0,<>,4
    E21legal <invalid_handle,invalid_function,sharing_buffer_exceeded,lock_violation>
    E21 GetExtCntry,0,<>,2
    E21legal <invalid_function,file_not_found>
    E21 GetSetCdPg,0,<>,2
    E21legal <invalid_function,file_not_found>
    E21 Open2,2,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>>,5
    E21legal <path_not_found,file_not_found,invalid_access,too_many_open_files,access_denied>
    E21 MkDir2,2,<<meta_expansion_too_long,file_not_found>,<filename_exced_range,file_not_found>>,3
    E21legal <path_not_found,file_not_found,access_denied>
    DB  0FFh




; INT 21h Standard Functions
include i21.inc



assume cs:V86GROUP
glf_dummy proc near
DOS_CLOSE:  ;<-move to close.asm
PATHCHRCMP:
SCANPLACE:
Idle:
StrCpy:
SET_SFT_MODE:
PLACEBUF:
FREE_SFT:
BUFWRITE:
SHARE_VIOLATION:
SHARE_ERROR:
POINTCOMP:
CHECKFLUSH:
SETYEAR:
DSUM:
DEVNAME:
DSLIDE:
StrCmp:
NLS_OPEN:
NLS_LSEEK:
NLS_IOCTL:
NLS_GETEXT:
 ret
glf_dummy endp


PUBLIC FOO
FOO     LABEL WORD
        Short_addr  Leave2F
DTab    DW  OFFSET  V86GROUP:DOSTable
        PUBLIC FOO,DTAB

DOSTable    LABEL   WORD
        DB      (DOSTableEnd-DOSTable-1)/2
 Short_addr            DOSInstall      ;int2F.1200h 00 install check
 Short_addr            DOS_CLOSE       ;int2F.1201h 01 DOS_CLOSE
 Short_addr            RECSET          ;int2F.1202h 02 RECSET
 Short_addr            DOSGetGroup     ;int2F.1203h 03 Get DOSGROUP
 Short_addr            PATHCHRCMP      ;int2F.1204h 04 PATHCHRCMP
 Short_addr            OUTT            ;int2F.1205h 05 OUT
 Short_addr            NET_I24_ENTRY   ;int2F.1206h 06 NET_I24_ENTRY
 Short_addr            PLACEBUF        ;int2F.1207h 07 PLACEBUF
 Short_addr            FREE_SFT        ;int2F.1208h 08 FREE_SFT
 Short_addr            BUFWRITE        ;int2F.1209h 09 BUFWRITE
 Short_addr            SHARE_VIOLATION ;int2F.120Ah 10 SHARE_VIOLATION
 Short_addr            SHARE_ERROR     ;int2F.120Bh 11 SHARE_ERROR
 Short_addr            SET_SFT_MODE    ;int2F.120Ch 12 SET_SFT_MODE
 Short_addr            DATE16          ;int2F.120Dh 13 DATE16
 Short_addr            idle            ;int2F.120Eh 14 empty slot
 Short_addr            SCANPLACE       ;int2F.120Fh 15 SCANPLACE
 Short_addr            idle            ;int2F.1210h 16 empty slot
 Short_addr            StrCpy          ;int2F.1211h 17 StrCpy
 Short_addr            StrLen          ;int2F.1212h 18 StrLen
 Short_addr            Ucase           ;int2F.1213h 19 Ucase
 Short_addr            POINTCOMP       ;int2F.1214h 20 POINTCOMP
 Short_addr            CHECKFLUSH      ;int2F.1215h 21 CHECKFLUSH
 Short_addr            glf_SFFromSFN   ;int2F.1216h 22 SFFromSFN
 Short_addr            GetCDSFromDrv   ;int2F.1217h 23 GetCDSFromDrv
 Short_addr            Get_User_Stack  ;int2F.1218h 24 Get_User_Stack
 Short_addr            GetThisDrv      ;int2F.1219h 25 GetThisDrv
 Short_addr glf_dummy ;DriveFromText   ;int2F.121Ah 26 DriveFromText
 Short_addr            SETYEAR         ;int2F.121Bh 27 SETYEAR
 Short_addr            DSUM            ;int2F.121Ch 28 DSUM
 Short_addr            DSLIDE          ;int2F.121Dh 29 DSLIDE
 Short_addr            StrCmp          ;int2F.121Eh 30 StrCmp
 Short_addr            InitCDS         ;int2F.121Fh 31 initcds
 Short_addr            pJFNFromHandle  ;int2F.1220h 32 pJfnFromHandle
 Short_addr glf_dummy ;$NameTrans      ;int2F.1221h 33 $NameTrans
 Short_addr glf_dummy ;CAL_LK          ;int2F.1222h 34 CAL_LK
 Short_addr            DEVNAME         ;int2F.1223h 35 DEVNAME
 Short_addr            Idle            ;int2F.1224h 36 Idle
 Short_addr            DStrLen         ;int2F.1225h 37 DStrLen
 Short_addr            NLS_OPEN        ;int2F.1226h 38 NLS_OPEN      DOS 3.3
 Short_addr glf_dummy ;$CLOSE          ;int2F.1227h 39 $CLOSE        DOS 3.3
 Short_addr            NLS_LSEEK       ;int2F.1228h 40 NLS_LSEEK     DOS 3.3
 Short_addr glf_dummy ;$READ           ;int2F.1229h 41 $READ         DOS 3.3
 Short_addr            FastInit        ;int2F.122Ah 42 FastInit      DOS 3.4
 Short_addr            NLS_IOCTL       ;int2F.122Bh 43 NLS_IOCTL     DOS 3.3
 Short_addr glf_dummy ;GetDevList      ;int2F.122Ch 44 GetDevList    DOS 3.3
 Short_addr            NLS_GETEXT      ;int2F.122Dh 45 NLS_GETEXT    DOS 3.3
 Short_addr glf_dummy ;MSG_RETRIEVAL   ;int2F.122Eh 46 MSG_RETRIEVAL DOS 4.0
 Short_addr glf_dummy ;Fake_Version    ;int2F.122Fh 47 Fake_Version  DOS 4.0

DOSTableEnd LABEL   BYTE


; NOTE WARNING: This declaration of HEADER must be THE LAST thing in this
;       module. The reason is so that the data alignments are the same in
;       IBM-DOS and MS-DOS up through header.


        PUBLIC  HEADER
Header  LABEL   BYTE
        IF      DEBUG
        DB      13,10,"Debugging DOS version "
        DB      MAJOR_VERSION + "0"
        DB      "."
        DB      (MINOR_VERSION / 10) + "0"
        DB      (MINOR_VERSION MOD 10) + "0"
        DB      13,10,"$"
ENDIF

MSTAB001E       label byte


; Following 4 variables moved to MSDATA.asm  (P4986)
;     I_am     FSeek_drive,BYTE         ;AN000; fastseek drive #
;     I_am     FSeek_firclus,WORD       ;AN000; fastseek first cluster #
;     I_am     FSeek_logclus,WORD       ;AN000; fastseek logical cluster #
;     I_am     FSeek_logsave,WORD       ;AN000; fastseek returned log clus #



      I_am     XA_CONDITION,BYTE,<0>     ; for Extended Attributes              ;AN000;
;     I_am     XA_ES,WORD                ; for extended find                    ;AN000;
;     I_am     XA_BP,WORD                ; for extended find                    ;AN000;
;     I_am     XA_handle,WORD            ; for get/set EA                       ;AN000;
      I_am     XA_type,BYTE              ; for get/set EA                       ;AN000;
;     I_am     XA_device,BYTE            ; for get/set EA                       ;AN000;
      I_am     XA_from,BYTE              ; for get/set EA                       ;AN000;
;     I_am     XA_VAR,WORD               ; for get/set EA                       ;AN000;
;     I_am     XA_TEMP,WORD              ; for get/set EA                       ;AN000;
;     I_am     XA_TEMP2,WORD             ; for get/set EA                       ;AN000;
;

;     I_am     MAX_EA_SIZE,WORD,<29>     ; max EA list size                     ;AN000;
;     I_am     MAX_EANAME_SIZE,WORD,<20> ; max EA name list size                ;AN000;
;     I_am     XA_COUNT,WORD,<2>         ; number of EA entries                 ;AN000;


;     PUBLIC   XA_TABLE                       ; for get/set EA                  ;AN000;
;
;XA_TABLE       label  byte                                                      ;AN000;
;              db EAISBINARY                                       ;Code Page   ;AN000;
;              dw EASYSTEM                                                      ;AN000;
;              db 0,2                                                           ;AN000;
;              dw 2                                                             ;AN000;
;              db 'CP'                                                          ;AN000;
;
;              db EAISBINARY                                       ;File Type   ;AN000;
;              dw EASYSTEM                                                      ;AN000;
;              db 0,8                                                           ;AN000;
;              dw 1                                                             ;AN000;
;              db 'FILETYPE'                                                    ;AN000;
;

;         PUBLIC XA_PACKET                                                            ;AN000;
;XA_PACKET        label byte                                                           ;AN000;
;IF  DBCS                                                                             ;AN000;
;                dw   18                                                              ;AN000;
;                db   18 dup(0)                                                       ;AN000;
;         PUBLIC DBCS_PACKET                                                          ;AN000;
;DBCS_PACKET      label byte                                                           ;AN000;
;                db   5 dup(0)
;ELSE
;                dw   2, 0                       ; get/set device code page           ;AN000;
;ENDIF
        I_am    CurHashEntry,DWORD               ; current hash buffer entry          ;AN000;
;;      I_am    ACT_PAGE,WORD,<-1>               ;BL ; active EMS page                       ;AN000;


        I_am    IFS_DRIVER_ERR,WORD,<0>          ; driver error for IFS               ;AN000;

          PUBLIC SWAP_AREA_TABLE                                                      ;AN000;
SWAP_AREA_TABLE  label byte                                                           ;AN000;
        I_am    NUM_SWAP_AREA,WORD,<2>           ; number of swap areas               ;AN000;
        I_am    SWAP_IN_DOS,DWORD                ; swap in dos area                   ;AN000;
        I_am    SWAP_IN_DOS_LEN,WORD             ; swap in dos area length            ;AN000;
        I_am    SWAP_ALWAYS_AREA,DWORD           ; swap always area                   ;AN000;
        I_am    SWAP_ALWAYS_AREA_LEN,WORD        ; swap always area length            ;AN000;
        I_am    IFSFUNC_SWAP_IN_DOS,DWORD        ; ifsfunc swap in dos area           ;AN000;
        I_am    IFSFUNC_SWAP_IN_DOS_LEN,WORD     ; ifsfunc swap in dos area length    ;AN000;

        I_am    SWAP_AREA_LEN,WORD               ; swap area length                   ;AN000;

V86TABLE    ENDS

        END
