PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page   1


=  0001                   __RASM__        EQU     1

                          ;    File              : $SUPPORT.A86$
                          ;
                          ;    Description       :
                          ;
                          ;    Original Author   : DIGITAL RESEARCH
                          ;
                          ;    Last Edited By    : $CALDERA$
                          ;
                          ;-----------------------------------------------------------------------;
                          ;    Copyright Work of Caldera, Inc. All Rights Reserved.
                          ;      
                          ;    THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL,
                          ;    PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC.
                          ;    ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES
                          ;    WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF
                          ;    THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO
                          ;    HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE
                          ;    AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE
                          ;    AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED,
                          ;    COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED,
                          ;    CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST,
                          ;    TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF
                          ;    CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT
                          ;    AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND
                          ;    CIVIL LIABILITY.
                          ;-----------------------------------------------------------------------;
                          ;
                          ;    *** Current Edit History ***
                          ;    *** End of Current Edit History ***
                          ;
                          ;    $Log$
                          ;    SUPPORT.A86 1.11 93/11/29 13:39:28
                          ;    Don't rely on DS when return_ called
                          ;    ENDLOG
                          ;
                          ;       The following Support routines are provided for both the 
                          ;       handle and FCB functions which require critical error handler
                          ;       support.
                          ;
                          ; 15 Jun 88 Modify the SYSDAT and SUPERVISOR variables to enable
                          ;           the relocation of the BDOS into high memory
                          ;  5 Jan 89 Only set PCKBD mode if we own the default console
                          ;  9 Mar 89 Support a split PCMODE and SYSDAT Segments
                          ; 22 Sep 89 LDT support routine added
                          ; 29 Jan 90 Int 2A critical section support added to dpbdos_entry
                          ;  7 Mar 90 Convert to register preserved function calls
                          ;  4 May 90 DRDOS int3x handlers removed (they are pointed to IRET
                          ;           in PCMODE_DATA by INIT.PCM)
                          ; 12 Dec 90 keep error server number inverted so local = 0, more compatible

PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page   2


                          ;
=                                 include pcmode.equ
=                         ;    File              : $PCMODE.EQU$
=                         ;
=                         ;    Description       :
=                         ;
=                         ;    Original Author   : DIGITAL RESEARCH
=                         ;
=                         ;    Last Edited By    : $CALDERA$
=                         ;
=                         ;-----------------------------------------------------------------------;
=                         ;    Copyright Work of Caldera, Inc. All Rights Reserved.
=                         ;      
=                         ;    THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL,
=                         ;    PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC.
=                         ;    ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES
=                         ;    WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF
=                         ;    THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO
=                         ;    HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE
=                         ;    AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE
=                         ;    AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED,
=                         ;    COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED,
=                         ;    CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST,
=                         ;    TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF
=                         ;    CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT
=                         ;    AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND
=                         ;    CIVIL LIABILITY.
=                         ;-----------------------------------------------------------------------;
=                         ;
=                         ;    *** Current Edit History ***
=                         ;    *** End of Current Edit History ***
=                         ;
=                         ;    $Log$
=                         ;
=                         ;    ENDLOG
=                         ;       This file contains all the general purpose definitions
=                         ;       and equates used by the PCMODE Module.
=                         ;
=
=  FFFF                   TRUE            equ     0FFFFh          ; value of TRUE
=  0000                   FALSE           equ     0               ; value of FALSE
=
=  0006                   TRUE_VERSION    equ     6
=
=  FFFF                   IDLE_DETECT     equ     TRUE            ; Check for IDLE Process's
=
=                         if IDLE_DETECT
=  0001                   IDLE_COMMAND    equ     0001h           ; Command Processor Active
=  0002                   IDLE_DOSFUNC    equ     0002h           ; DOS Function Called
=  0004                   IDLE_INT28      equ     0004h           ; INT 28 Called
=
=  4000                   IDLE_ON         equ     4000h           ; ReSet when Idle Checking Enabled
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page   3


=  8000                   IDLE_INIT       equ     8000h           ; ReSet when $IDLE$ Loaded and Active
=  C000                   IDLE_DISABLE    equ     IDLE_INIT + IDLE_ON 
=
=  0001                   PROC_IDLE       equ     0001            ; Process is IDLE
=  0002                   PROC_INT28      equ     0002            ; INT28 Polling Loop
=  0003                   PROC_KEYIN      equ     0003            ; Keyboard Input
=  0004                   PROC_DEVIN      equ     0004            ; Device Input Routine
=                         endif
=
=
=  00C0                   STACK_SIZE      equ     192             ; Local Stack Size (Levels)
=  0050                   MAX_PATHLEN     equ     80              ; Maximum Path length
=  000D                   MAX_FILELEN     equ     13
=
=                         ;
=                         ;       DOS process termination Codes
=                         ;
=  0000                   TERM_NORMAL     equ     0               ; Normal Termination
=  0001                   TERM_BREAK      equ     1               ; Termination by Control Break
=  0002                   TERM_ERROR      equ     2               ; Termination by Critical Error
=  0003                   TERM_RESIDENT   equ     3               ; Terminate and Stay Resident
=
=                         ;
=                         ;       Critical Error responses from the default INT 24 handler and
=                         ;       the DO_INT24 routine.
=                         ;
=  0000                   ERR_IGNORE      equ     0               ; Ignore Error
=  0001                   ERR_RETRY       equ     1               ; Retry the Operation
=  0002                   ERR_ABORT       equ     2               ; Terminate the Process
=  0003                   ERR_FAIL        equ     3               ; Fail Function
=                         ;
=  0008                   OK_FAIL         equ     0000$1000b      ; Fail is a Valid Response
=  0010                   OK_RETRY        equ     0001$0000b      ; Retry is a Valid Response
=  0020                   OK_IGNORE       equ     0010$0000b      ; Ignore is a valid Response
=  0038                   OK_RIF          equ     0011$1000b      ; All Responsese are Valid
=  0030                   OK_RI           equ     0011$0000b      ; Retry and Ignore are Valid
=  0018                   OK_RF           equ     0001$1000b      ; Retry and Fail are Valid
=                         ;
=  0040                   NO_CRIT_ERRORS  equ     0100$0000b      ; critical error shouldn't be generated
=                                                                 ; warning - must match FDOS.A86
=                         ;
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page   4


=                         eject
=                         ;       The following equates define the format in which the users registers
=                         ;       are saved on the stack. This format is also seen by an application
=                         ;       when a critical error occurs.
=                         ;
=                         CodeMacro       POP$DOS         ; Pop User Registers a la MS-DOS
=                                 db 058h ! db 05Bh       ; pop AX ! pop BX
=                                 db 059h ! db 05Ah       ; pop BX ! pop CX
=                                 db 05Eh ! db 05Fh       ; pop SI ! pop DI
=                                 db 05Dh                 ; pop BP
=                                 db 01Fh ! db 007h       ; pop DS ! pop ES
=                         EndM
=
=                         CodeMacro   PUSH$DOS    ; Push User Registers
=                                 db 006h ! db 01Eh       ; push ES ! push DS
=                                 db 055h                 ; push BP
=                                 db 057h ! db 056h       ; push DI ! push SI
=                                 db 052h ! db 051h       ; push DX ! push CX
=                                 db 053h ! db 050h       ; push BX ! push AX
=                         EndM
=
=  0000                   reg_AX          equ     word ptr .00
=  0000                   reg_AL          equ     byte ptr .00
=  0001                   reg_AH          equ     byte ptr .01
=
=  0002                   reg_BX          equ     word ptr .02
=  0002                   reg_BL          equ     byte ptr .02
=  0003                   reg_BH          equ     byte ptr .03
=
=  0004                   reg_CX          equ     word ptr .04
=  0004                   reg_CL          equ     byte ptr .04
=  0005                   reg_CH          equ     byte ptr .05
=
=  0006                   reg_DX          equ     word ptr .06
=  0006                   reg_DL          equ     byte ptr .06
=  0007                   reg_DH          equ     byte ptr .07
=
=  0008                   reg_SI          equ     word ptr .08
=  000A                   reg_DI          equ     word ptr .10
=  000C                   reg_BP          equ     word ptr .12
=
=  000E                   reg_DS          equ     word ptr .14
=  0010                   reg_ES          equ     word ptr .16
=
=  0012                   reg_IP          equ     word ptr .18
=  0014                   reg_CS          equ     word ptr .20
=  0016                   reg_FLAGS       equ     word ptr .22
=
=                         ; Processor Flags
=  0001                   CARRY_FLAG      equ     0001h           ; Carry Flag
=  0040                   ZERO_FLAG       equ     0040h           ; Zero Flag
=  0080                   SIGN_FLAG       equ     0080h           ; Sign Flag
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page   5


=  0200                   INT_FLAG        equ     0200h           ; Interrupt Flag
=  0400                   DIR_FLAG        equ     0400h           ; Direction Flag
=  0800                   OFLW_FLAG       equ     0800h           ; OverFlow Flag
=
=  0000                   DMD_ID          equ     es:byte ptr .0  ; id code ('M' or 'Z')
=  0001                   DMD_PSP         equ     es:word ptr .1  ; owner of memory block
=  0003                   DMD_LEN         equ     es:word ptr .3  ; length of memory block
=  0006                   DMD_IDLE_FLAGS  equ es:word ptr .6  ; idle flags live here
=  0008                   DMD_NAME        equ     es:byte ptr .8  ; ASCIIZ name field
=  0008                   DMD_NAME_LEN    equ     8               ;  8 Bytes long
=  004D                   IDM             equ     'M'             ; not last id code
=  005A                   IDZ             equ     'Z'             ; last id code
=
=                         PCMCODE         GROUP   PCM_HEADER, PCM_CODE, BDOS_CODE, PCM_RODATA
=                         PCMCODE         GROUP   PCM_HISTORY, PCM_ICODE, PCM_CODEND
=
=                         PCM_HEADER      CSEG    PARA
=                         PCM_CODE        CSEG    BYTE
=                         PCM_RODATA      CSEG    WORD
=                         BDOS_CODE       CSEG    WORD
=                         PCM_HISTORY     CSEG    BYTE
=                         PCM_ICODE       CSEG    BYTE
=                         PCM_CODEND      CSEG    PARA
=
=
=                         PCMDATA         GROUP   PCMODE_DATA, FDOS_DSEG, FIXED_DOS_DATA
=                         PCMDATA         GROUP   PCMODE_CODE, GLOBAL_DATA, BDOS_DATA, PCMODE_DSIZE
=
=                         PCMODE_DATA     DSEG    WORD            ; DOS Data
=                         FDOS_DSEG       DSEG    WORD COMMON     ; FDOS Parameter Block  
=0000                     fdos_data       rw      7
=                         FIXED_DOS_DATA  CSEG    WORD    'DATA'  ; Fixed DOS Data Area
=                         PCMODE_CODE     CSEG    WORD    'DATA'  ; DATA relative CODE
=                         GLOBAL_DATA     DSEG    WORD            ; GLOBAL DOS DATA (Process Independant)
=                         BDOS_DATA       DSEG    WORD            ; BDOS Data Area
=                         PCMODE_DSIZE    DSEG    PARA            ; End of DOS Data Area

=                                 include fdos.def        
=                         ;    File              : $FDOS.DEF$
=                         ;
=                         ;    Description       :
=                         ;
=                         ;    Original Author   : DIGITAL RESEARCH
=                         ;
=                         ;    Last Edited By    : $CALDERA$
=                         ;
=                         ;-----------------------------------------------------------------------;
=                         ;    Copyright Work of Caldera, Inc. All Rights Reserved.
=                         ;      
=                         ;    THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL,
=                         ;    PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC.
=                         ;    ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page   6


=                         ;    WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF
=                         ;    THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO
=                         ;    HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE
=                         ;    AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE
=                         ;    AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED,
=                         ;    COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED,
=                         ;    CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST,
=                         ;    TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF
=                         ;    CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT
=                         ;    AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND
=                         ;    CIVIL LIABILITY.
=                         ;-----------------------------------------------------------------------;
=                         ;
=                         ;    *** Current Edit History ***
=                         ;    *** End of Current Edit History ***
=                         ;
=                         ;    $Log$
=                         ;
=                         ;    ENDLOG
=
=  0048                   FD_DISKINFO     equ     48h
=  0049                   FD_FLUSH        equ     49h
=  004A                   FD_SELECT       equ     4Ah
=  004B                   FD_EXEC         equ     4Bh
=  004C                   FD_EXIT         equ     4Ch
=  004D                   FD_FCB          equ     4Dh
=  0050                   FD_COMMIT       equ     50H
=  0051                   FD_NEW          equ     51h
=  0052                   FD_LOCK         equ     52h
=  0054                   FD_DDIO         equ     54h
=  0055                   FD_EXPAND       equ     55h
=  0058                   FD_REOPEN       equ     58h
=
=  0007                   FDOS_MAXPARM    equ     7               ; Maximum FDOS Parameter Length (WORDS)
=
=  0000                   FD_FUNC         equ     fdos_data
=
=  0002                   FD_DRIVE        equ     fdos_data + 2
=  0004                   FD_DPB          equ     dword ptr fdos_data + 4
=  0004                   FD_DPBOFF       equ     fdos_data + 4
=  0006                   FD_DPBSEG       equ     fdos_data + 6
=  0008                   FD_ADJUST       equ     fdos_data + 8
=
=  0002                   FD_NAME         equ     dword ptr fdos_data + 2
=  0002                   FD_NAMEOFF      equ     fdos_data + 2
=  0004                   FD_NAMESEG      equ     fdos_data + 4
=
=  0006                   FD_MODE         equ     fdos_data + 6
=
=  0002                   FD_HANDLE       equ     fdos_data + 2
=
=  0004                   FD_BUF          equ     dword ptr fdos_data + 4
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page   7


=  0004                   FD_BUFOFF       equ     fdos_data + 4
=  0006                   FD_BUFSEG       equ     fdos_data + 6
=
=  0008                   FD_COUNT        equ     fdos_data + 8
=
=  0004                   FD_OFFSET       equ     dword ptr fdos_data + 4
=
=  0008                   FD_METHOD       equ     fdos_data + 8
=
=  0006                   FD_FLAG         equ     fdos_data + 6
=
=  0008                   FD_ATTRIB       equ     fdos_data + 8
=
=  0004                   FD_PATH         equ     dword ptr fdos_data + 4
=  0004                   FD_PATHOFF      equ     fdos_data + 4
=  0006                   FD_PATHSEG      equ     fdos_data + 6
=
=  0002                   FD_ONAME        equ     dword ptr fdos_data + 2
=  0002                   FD_ONAMEOFF     equ     fdos_data + 2
=  0004                   FD_ONAMESEG     equ     fdos_data + 4
=
=  000A                   FD_NNAME        equ     dword ptr fdos_data + 10
=  000A                   FD_NNAMEOFF     equ     fdos_data + 10
=  000C                   FD_NNAMESEG     equ     fdos_data + 12
=
=  0004                   FD_SFLAG        equ     fdos_data + 4
=  0006                   FD_DATE         equ     fdos_data + 6
=  0008                   FD_TIME         equ     fdos_data + 8
=
=  0008                   FD_LENGTH       equ     dword ptr fdos_data + 8
=  000C                   FD_LFLAG        equ     word  ptr fdos_data + 12
=
=  0004                   FD_NEWHND       equ     fdos_data + 4
=
=  0002                   FD_FCBADR       equ     dword ptr fdos_data + 2
=  0002                   FD_FCBOFF       equ     fdos_data + 2
=  0004                   FD_FCBSEG       equ     fdos_data + 4
=
=  0006                   FD_FCBCNT       equ     fdos_data + 6
=  0008                   FD_FCBFUNC      equ     fdos_data + 8
=
=  0002                   FD_PSPSEG       equ     fdos_data + 2
=
=  0002                   FD_BPBOFF       equ     fdos_data + 2
=  0004                   FD_BPBSEG       equ     fdos_data + 4
=  0006                   FD_DDSCOFF      equ     fdos_data + 6
=  0008                   FD_DDSCSEG      equ     fdos_data + 8
=
=  0004                   FD_IOCTLFUNC    equ     fdos_data + 4
=  0006                   FD_IOCTLSTAT    equ     fdos_data + 6
=
=  0002                   FD_NUMOPEN      equ     fdos_data + 2
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page   8


=
=  0002                   FD_DDIO_DRV_OP  equ     fdos_data + 2
=  0004                   FD_DDIO_NSECTORS equ    fdos_data + 4
=  0006                   FD_DDIO_STARTLOW equ    fdos_data + 6
=  0008                   FD_DDIO_STARTHIGH equ   fdos_data + 8
=  000A                   FD_DDIO_DMAOFF  equ     fdos_data + 10
=  000C                   FD_DDIO_DMASEG  equ     fdos_data + 12
=

=                                 include i:mserror.equ
=                         ;    File              : $MSERROR.EQU$
=                         ;
=                         ;    Description       :
=                         ;
=                         ;    Original Author   : DIGITAL RESEARCH
=                         ;
=                         ;    Last Edited By    : $CALDERA$
=                         ;
=                         ;-----------------------------------------------------------------------;
=                         ;    Copyright Work of Caldera, Inc. All Rights Reserved.
=                         ;      
=                         ;    THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL,
=                         ;    PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC.
=                         ;    ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES
=                         ;    WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF
=                         ;    THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO
=                         ;    HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE
=                         ;    AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE
=                         ;    AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED,
=                         ;    COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED,
=                         ;    CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST,
=                         ;    TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF
=                         ;    CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT
=                         ;    AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND
=                         ;    CIVIL LIABILITY.
=                         ;-----------------------------------------------------------------------;
=                         ;
=                         ;    *** Current Edit History ***
=                         ;    *** End of Current Edit History ***
=                         ;
=                         ;    $Log$
=                         ;
=                         ;    ENDLOG
=
=  FFFF                   ED_FUNCTION     equ     -01             ; invalid function number
=  FFFE                   ED_FILE         equ     -02             ; file not found
=  FFFD                   ED_PATH         equ     -03             ; path not found
=  FFFC                   ED_HANDLE       equ     -04             ; too many open files
=  FFFB                   ED_ACCESS       equ     -05             ; file access denied
=  FFFA                   ED_H_MATCH      equ     -06             ; invalid handle number
=  FFF9                   ED_DMD          equ     -07             ; memory descriptor destroyed
=  FFF8                   ED_MEMORY       equ     -08             ; insufficient memory
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page   9


=  FFF7                   ED_BLOCK        equ     -09             ; invalid memory block addr
=  FFF6                   ED_ENVIRON      equ     -10             ; invalid environment
=  FFF5                   ED_FORMAT       equ     -11             ; invalid format
=  FFF4                   ED_ACC_CODE     equ     -12             ; invalid access code
=  FFF3                   ED_DATA         equ     -13             ; invalid data
=  FFF1                   ED_DRIVE        equ     -15             ; invalid drive specified
=  FFF0                   ED_DIR          equ     -16             ; can't remove current dir
=  FFEF                   ED_DEVICE       equ     -17             ; not same device
=  FFEE                   ED_ROOM         equ     -18             ; no more files
=
=  FFED                   ED_PROTECT      equ     -19             ; disk write protected
=  FFEC                   ED_BADUNIT      equ     -20             ; invalid drive specified
=  FFEB                   ED_NOTREADY     equ     -21             ; drive doesn't respond
=  FFEA                   ED_BADCMD       equ     -22             ; invalid command to driver
=  FFE9                   ED_BADDATA      equ     -23             ; data CRC error
=  FFE8                   ED_BADRHLEN     equ     -24             ; (shouldn't happen)
=  FFE7                   ED_BADSEEK      equ     -25             ; can't seek to track
=  FFE6                   ED_BADMEDIA     equ     -26             ; unrecognizable medium
=  FFE5                   ED_RNF          equ     -27             ; record/sector not found
=  FFE4                   ED_NOPAPER      equ     -28             ; printer error
=  FFE3                   ED_WRFAIL       equ     -29             ; write failed
=  FFE2                   ED_RDFAIL       equ     -30             ; read failed
=  FFE1                   ED_GENFAIL      equ     -31             ; anything failed
=  FFE0                   ED_SHAREFAIL    equ     -32             ; sharing conflict
=  FFDF                   ED_LOCKFAIL     equ     -33             ; locking conflict
=  FFDE                   ED_DISKCHG      equ     -34             ; invalid disk change
=  FFDD                   ED_NOFCBS       equ     -35             ; FCB table exhausted
=  FFDC                   ED_NOLOCKS      equ     -36             ; lock list items exhausted
=  FFCE                   ED_NET          equ     -50             ; Network Request Not Supported
=
=  FFBF                   ED_NETACCESS    equ     -65             ; file access denied
=
=  FFB7                   ED_NETPWD       equ     -73             ; Server Password Error
=  FFB6                   ED_NETVER       equ     -74             ; Incorrect Server version
=  FFB5                   ED_NETREQ       equ     -75             ; No Local Network Resources
=  FFB4                   ED_NETTIME      equ     -76             ; Network Time Out Error
=  FFB3                   ED_NETCOMM      equ     -77             ; Network Communications Error
=  FFB2                   ED_NETSRVR      equ     -78             ; No Server Network Resources 
=  FFB1                   ED_NETLOG       equ     -79             ; Server Not Logged In
=
=  FFB0                   ED_EXISTS       equ     -80             ; file already exists
=  FFAE                   ED_MAKE         equ     -82             ; Cannot Make (Files ??)
=  FFAD                   ED_FAIL         equ     -83             ; FAIL code returned from INT 24
=  FFAC                   ED_STRUCT       equ     -84             ; Out of Structures
=  FFAB                   ED_ASSIGN       equ     -85             ; Already Assigned
=  FFAA                   ED_PASSWORD     equ     -86             ; Invalid Password
=  FFA9                   ED_PARAM        equ     -87             ; Invalid Parameter
=  FFA8                   ED_NETWRITE     equ     -88             ; Network write fault
=  FFA7                   ED_NETFUNC      equ     -89             ; Function not supported on network
=  FFA6                   ED_COMPONENT    equ     -90             ; system component not installed
=  FFA6                   ED_LASTERROR    equ     -90             ; Last Error Number Used
=
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page  10


=
=  0001                   CLASS_RESOURCE  equ     1       ; Out of Resource
=  0002                   CLASS_TEMP      equ     2       ; Temporary Situation
=  0003                   CLASS_AUTHOR    equ     3       ; Authorization Error
=  0004                   CLASS_INTERNAL  equ     4       ; Internal System Software Error
=  0005                   CLASS_HARDWARE  equ     5       ; Hardware Failure
=  0006                   CLASS_SYSTEM    equ     6       ; Serious System Failure
=  0007                   CLASS_APPLIC    equ     7       ; Application Program Error
=  0008                   CLASS_LOST      equ     8       ; File/Item Not Found
=  0009                   CLASS_FORMAT    equ     9       ; File/Item Illegal Format 
=  000A                   CLASS_LOCKED    equ     10      ; File/Item Locked
=  000B                   CLASS_MEDIA     equ     11      ; Media Failure
=  000C                   CLASS_EXISTS    equ     12      ; Item Already Exists
=  000D                   CLASS_UNKNOWN   equ     13      ; Unknown Classification
=
=  0001                   ACT_RETRY       equ     1       ; Retry a few times then prompt user
=  0002                   ACT_DELAY       equ     2       ; Delay then as ACT_RETRY
=  0003                   ACT_USER        equ     3       ; Prompt user to re-enter data
=  0004                   ACT_ABORT       equ     4       ; Clean Up then ABORT the process
=  0005                   ACT_TERM        equ     5       ; Terminate immeadiately NO CLEAN UP
=  0006                   ACT_IGNORE      equ     6       ; Ignore the Error
=  0007                   ACT_URETRY      equ     7       ; Retry the error after user intervention
=
=  0001                   LOC_UNKNOWN     equ     1       ; Unknown error location
=  0002                   LOC_BLOCK       equ     2       ; Block Device Failure
=  0003                   LOC_NET         equ     3       ; Network Failure
=  0004                   LOC_CHAR        equ     4       ; Related to Serial/Character devices
=  0005                   LOC_MEMORY      equ     5       ; Failure related to Memory 

=                                 include i:doshndl.def
=                         ;    File              : $DOSHNDL.DEF$
=                         ;
=                         ;    Description       :
=                         ;
=                         ;    Original Author   : DIGITAL RESEARCH
=                         ;
=                         ;    Last Edited By    : $CALDERA$
=                         ;
=                         ;-----------------------------------------------------------------------;
=                         ;    Copyright Work of Caldera, Inc. All Rights Reserved.
=                         ;      
=                         ;    THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL,
=                         ;    PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC.
=                         ;    ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES
=                         ;    WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF
=                         ;    THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO
=                         ;    HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE
=                         ;    AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE
=                         ;    AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED,
=                         ;    COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED,
=                         ;    CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST,
=                         ;    TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page  11


=                         ;    CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT
=                         ;    AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND
=                         ;    CIVIL LIABILITY.
=                         ;-----------------------------------------------------------------------;
=                         ;
=                         ;    *** Current Edit History ***
=                         ;    *** End of Current Edit History ***
=                         ;
=                         ;    $Log$
=                         ;
=                         ;    ENDLOG
=
=  0000                   DCNTRL_DSADD    equ dword ptr 0000h  
=  0000                   DCNTRL_DSOFF    equ  word ptr 0000h  
=  0002                   DCNTRL_DSSEG    equ  word ptr 0002h  
=  0004                   DCNTRL_COUNT    equ  word ptr 0004h  
=  0006                   DCNTRL_LEN      equ     6
=
=  0000                   DHNDL_COUNT     equ     word ptr 00h            ; 00 - Usage Count
=  0002                   DHNDL_MODE      equ     word ptr 02h            ; 02 - File Mode
=
=  8000                   DHM_FCB         equ     8000h                   ; marks as FCB
=  4000                   DHM_COMMIT      equ     4000h                   ; auto-commit file
=  2000                   DHM_NOCRIT      equ     2000h                   ; no critical errors
=  0080                   DHM_LOCAL       equ     10000000b               ; file is not inherited
=  0070                   DHM_SHAREMSK    equ     01110000b               ; sharing bits
=  0000                   DHM_COMPAT      equ     00000000b
=  0010                   DHM_DENY_ALL    equ     00010000b               ; exclusive - deny all
=  0020                   DHM_DENY_WRITE  equ     00100000b
=  0030                   DHM_DENY_READ   equ     00110000b
=  0040                   DHM_DENY_NONE   equ     01000000b
=  000F                   DHM_RWMSK       equ     00001111b               ; read write bits
=  0002                   DHM_RW          equ     00000010b               ; file opened read/write
=  0001                   DHM_WO          equ     00000001b               ; file opened write only
=  0000                   DHM_RO          equ     00000000b               ; file opened read only
=
=                         ;
=                         ;       01h to 03h To be Determined
=                         ;
=  0004                   DHNDL_DATRB     equ     byte ptr 04h            ; Disk attribute byte
=  0005                   DHNDL_ATTR      equ     byte ptr 05h            ; Attribute Byte
=  0005                   DHNDL_WATTR     equ     word ptr 05h            ; Attribute Word
=
=  8000                   DHAT_REMOTE     equ     8000h                   ; set if file remote
=  4000                   DHAT_TIMEOK     equ     4000h                   ; set if timestamp up to date
=  1000                   DHAT_LOCAL      equ     1000h                   ; file is not inherited
=  0800                   DHAT_NETPRN     equ     0800h                   ; device is networked printer
=  0080                   DHAT_DEV        equ     0080h                   ; device/file bit
=  0040                   DHAT_READY      equ     0040h                   ; ready/not ready bit
=  0040                   DHAT_CLEAN      equ     0040h                   ; this bit CLEAR if dirty
=  0020                   DHAT_BIN        equ     0020h                   ; raw/cooked bit
=  001F                   DHAT_DRVMSK     equ     001Fh                   ; drive in bottom bits
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page  12


=  0008                   DHAT_CLK        equ     0008h                   ; -reserved-
=  0004                   DHAT_NUL        equ     0004h                   ; handle is null device
=  0002                   DHAT_COT        equ     0002h                   ; handle is console output device
=  0001                   DHAT_CIN        equ     0001h                   ; handle is console input device
=
=  0007                   DHNDL_DEVPTR    equ     dword ptr 07h           ; 07 - pointer to device
=  0007                   DHNDL_DEVOFF    equ     word ptr 07h            ; 07 - offset of device
=  0009                   DHNDL_DEVSEG    equ     word ptr 09h            ; 09 - segment of device
=  000B                   DHNDL_BLK1      equ     word ptr 0Bh            ; 0B - first cluster in file
=  000D                   DHNDL_TIME      equ     word ptr 0Dh            ; 0D - file time stamp
=  000F                   DHNDL_DATE      equ     word ptr 0Fh            ; 0F - file date stamp
=  0011                   DHNDL_SIZE      equ     dword ptr 11h           ; 11 - file length
=  0011                   DHNDL_SIZELO    equ     word ptr 11h
=  0013                   DHNDL_SIZEHI    equ     word ptr 13h
=  0015                   DHNDL_POS       equ     dword ptr 15h           ; 15 - current file position
=  0015                   DHNDL_POSLO     equ     word ptr 15h
=  0017                   DHNDL_POSHI     equ     word ptr 17h
=  0019                   DHNDL_IDX       equ     word ptr 19h            ; 19 - relative cluster within file of last 
                          read
=  001B                   DHNDL_DBLK      equ     word ptr 1Bh            ; 1B - cluster # of dir entry
=  001E                   DHNDL_DCNTHI    equ     byte ptr 1Eh            ; 1E - dir offset # within cluster
=  001F                   DHNDL_DCNTLO    equ     byte ptr 1Fh            ; 1F - dir offset # within cluster
=  0020                   DHNDL_NAME      equ     byte ptr 20h            ; 20 - File/Device Name
=  0028                   DHNDL_EXT       equ     byte ptr 28h            ; 28 - File extension
=  002B                   DHNDL_SFT       equ     dword ptr 2Bh           ; 2B - pointer to previous SFT
=  002F                   DHNDL_UID       equ     word ptr 2Fh            ; 2F - Owning Machine ID
=  0031                   DHNDL_PSP       equ     word ptr 31h            ; 31 - Owning PSP
=  0033                   DHNDL_SHARE     equ     word ptr 33h            ; 33 - Offset of sharing record
=  0035                   DHNDL_BLK       equ     word ptr 35h            ; 35 - absolute cluster of last read
=                                                                         ; 37 - dword reserved for IFS
=  003B                   DHNDL_LEN       equ     3Bh
=
=                         ; With DOS 3 structures _DBLK is a 16 bit
=
=
=                         ; Logical Drive Table format
=  0000                   LDT_NAME        equ     byte ptr 00h            ; 00 - Ascii Name field
=  0043                   LDT_FLAGS       equ     word ptr 43h            ; 43 - Flag field
=  0045                   LDT_PDT         equ     dword ptr 45h           ; 45 - PDT for this drive
=  0049                   LDT_BLK         equ     word ptr 49h            ; 49 - directory sector 
=  004B                   LDT_ROOT    equ word ptr 4bh        ; 4B - virtual block root
=  004D                   LDT_DRV     equ byte ptr 4dh        ; 4D - physical drive 
=  004F                   LDT_ROOTLEN     equ     word ptr 4fh            ; 4F - Length of root portion
=  0058                   LDT_LEN         equ     58h
=
=  8000                   LFLG_NETWRKD    equ     8000h
=  4000                   LFLG_PHYSICAL   equ     4000h
=  2000                   LFLG_JOINED     equ     2000h
=  1000                   LFLG_SUBST      equ     1000h


PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page  13


                          eject
                          PCM_CODE        CSEG    BYTE
                                  extrn   error_exit:near         ; Standard Error Exit Routine
                                  extrn   fcberror_exit:near      ; Special FCB function Error Exit
                                  extrn   fdos_entry:near
                                  extrn   get_dseg:near

PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page  14


                          eject
                          ;
                          ;       STRLEN determines the length of the string passed in DS:SI
                          ;       and returns the byte length in CX.
                          ;
                                  Public  strlen
                          strlen:
 0000 0657                        push es ! push di
 0002 1E07                        push ds ! pop es
 0004 8BFE                        mov     di,si
 0006 B9FFFF                      mov     cx,0FFFFh
 0009 2AC0                        sub     al,al
 000B F2AE                        repnz   scasb   
 000D 5F07                        pop di ! pop es
 000F F7D1                        not     cx
 0011 49                          dec     cx
 0012 C3                          ret

PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page  15


                          eject
                          ;
                          ;       This routine sets the address to be returned to by the 
                          ;       FDOS when an error has occured and the RETRY request has been
                          ;       made. The set_retry routine should be used as follows:-
                          ;
                          ;       mov     al,Valid Error Responses
                          ;       call    set_retry
                          ;       Init All FDOS Parameters
                          ;       call    fdos_crit
                          ;
                          ; NB. For register model return with AX = dos_AL extended to 16 bit

                                  Public  set_retry_RF
                          set_retry_RF:
 0013 B018                        mov     al,OK_RF                ; Valid to RETRY or FAIL
                          ;       jmp     set_retry               ; (the most common case)

                                  Public  set_retry
                          set_retry:
 0015 A20000       E              mov     valid_flg,al            ; Save Valid Error Reponses
 0018 8F060000     E              pop     retry_off               ; Save the Routine Address
 001C 89260000     E              mov     retry_sp,sp             ; and the Stack Pointer
 0020 8AC4                        mov     al,ah                   ; get function number
 0022 32E4                        xor     ah,ah                   ; make it a word
 0024 A30000       R              mov     FD_FUNC,ax              ; save it for the FDOS
 0027 1E                          push    ds
 0028 53                          push    bx
 0029 C51E0000     E              lds     bx,int21regs_ptr        ; point to users registers
 002D 816716FEFF                  and     reg_FLAGS[bx],not CARRY_FLAG
 0032 8A07                        mov     al,reg_AL[bx]           ; clear CY assuming we will succeed
 0034 5B                          pop     bx                      ;  and reload AL with entry value
 0035 1F                          pop     ds
 0036 FF260000     E              jmp     retry_off

                          ;
                          ;       The FDOS routine executes the CCP/M FDOS function using the 
                          ;       static FDOS parameter block defined in the Data Segment.
                          ;
                                  Public  fdos_crit
                          fdos_crit:
 003A E84400         0081         call    fdos_nocrit
 003D 3DA6FF                      cmp     ax,ED_LASTERROR         ; Compare against last error code
 0040 731E           0060          jnb    fdos_error              ; if NOT below then is ERROR CODE
 0042 0BC0                        or      ax,ax                   ; Reset the Carry Flag and Return
 0044 C3                          ret

                                  Public  fdos_ax_crit
                          fdos_ax_crit:
 0045 E83900         0081         call    fdos_nocrit
 0048 3DA6FF                      cmp     ax,ED_LASTERROR         ; Compare against last error code
 004B 7313           0060          jnb    fdos_error              ; if NOT below then is ERROR CODE
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page  16


 004D 0BC0                        or      ax,ax                   ; Reset the Carry Flag and Return
                          ;       jmp     return_AX_CLC           ; Save the Return Code

                                  Public  return_AX_CLC
                          return_AX_CLC:
                          ;-------------
                          ; On Entry:
                          ;       AX to be returned to caller in AX
                          ; On Exit:
                          ;       ES:DI trashed
                          ;
 004F 1E57                        push ds ! push di
 0051 36C53E0000   E              lds     di,ss:int21regs_ptr
 0056 8905                        mov     reg_AX[di],ax           ; return AX to caller
 0058 816516FEFF                  and     reg_FLAGS[di],not CARRY_FLAG
 005D 5F1F                        pop di ! pop ds
 005F C3                          ret


                          fdos_error:                             ; Process the Error
 0060 3B260000     E              cmp     sp,retry_sp             ; Is the user expecting use to 
 0064 7503           0069          jnz    fdos_e10                ; return or use the default handler
 0066 E90000       E              jmp     error_exit              ; If CALLed then return with the error
                          fdos_e10:                               ; to the calling routine.
 0069 F9                          stc
 006A C3                          ret

                                  Public  fcbfdos_crit
                          fcbfdos_crit:
 006B E81300         0081         call    fdos_nocrit
 006E 3DA6FF                      cmp     ax,ED_LASTERROR         ; Compare against last error code
 0071 7303           0076          jnb    fcbfdos_error           ; if NOT below then is ERROR CODE
 0073 0BC0                        or      ax,ax                   ; Reset the Carry Flag and Return
 0075 C3                          ret

                          fcbfdos_error:                          ; Process the Error
 0076 3B260000     E              cmp     sp,retry_sp             ; Is the user expecting use to 
 007A 7503           007F          jnz    fcbfdos_e10             ; return or use the default handler
 007C E90000       E              jmp     fcberror_exit           ; If CALLed then return with the error
                          fcbfdos_e10:                            ; to the calling routine.
 007F F9                          stc
 0080 C3                          ret

                                  Public  fdos_nocrit
                          fdos_nocrit:
 0081 BA0000       R              mov     dx,offset fdos_data     ; point to fdos parameter block
 0084 1E06                        push ds ! push es
 0086 565755                      push si ! push di ! push bp
 0089 E80000       E              call    fdos_entry              ; BDOS module entry point
 008C 0BC0                        or      ax,ax                   ; Set the Flags
 008E 5D5F5E                      pop  bp ! pop  di ! pop  si
 0091 071F                        pop es ! pop  ds
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page  17


 0093 C3                          ret


                                  Public  reload_ES
                          reload_ES:
                          ; On Entry:
                          ;       None
                          ; On Exit:
                          ;       ES = callers ES
                          ;       All regs preserved
                          ;
 0094 53                          push    bx
 0095 36C41E0000   E              les     bx,ss:int21regs_ptr
 009A 268E4710                    mov     es,es:reg_ES[bx]        ; reload with callers ES
 009E 5B                          pop     bx
 009F C3                          ret

                                  
                                  Public  return_BX
                          return_BX:
                          ;---------
                          ; On Entry:
                          ;       BX to be returned to caller in BX
                          ; On Exit:
                          ;       All regs preserved
                          ;
 00A0 1E53                        push ds ! push bx
 00A2 36C5360000   E              lds     si,ss:int21regs_ptr
 00A7 895C02                      mov     reg_BX[si],bx           ; return BX to caller
 00AA 5B1F                        pop bx ! pop ds
 00AC C3                          ret

                                  Public  return_CX
                          return_CX:
                          ;---------
                          ; On Entry:
                          ;       CX to be returned to caller in CX
                          ; On Exit:
                          ;       All regs preserved
                          ;
 00AD 1E53                        push ds ! push bx
 00AF 36C51E0000   E              lds     bx,ss:int21regs_ptr
 00B4 894F04                      mov     reg_CX[bx],cx           ; return CX to caller
 00B7 5B1F                        pop bx ! pop ds
 00B9 C3                          ret

                                  Public  return_DX
                          return_DX:
                          ;---------
                          ; On Entry:
                          ;       DX to be returned to caller in DX
                          ; On Exit:
PC-DOS RASM-86 1.4a  Source: SUPPORT.A86                                                                     Page  18


                          ;       All regs preserved
                          ;
 00BA 1E53                        push ds ! push bx
 00BC 36C51E0000   E              lds     bx,ss:int21regs_ptr
 00C1 895706                      mov     reg_DX[bx],dx           ; return DX to caller
 00C4 5B1F                        pop bx ! pop ds
 00C6 C3                          ret

                          PCMODE_DATA     DSEG    WORD


                                  extrn   current_psp:word
                                  extrn   DBCS_tbl:word           ; double byte character set table
                                  extrn   int21regs_ptr:dword
                                  extrn   retry_off:word
                                  extrn   retry_sp:word
                                  extrn   valid_flg:byte


                                  end


End of assembly.  Number of errors:   0.  Use factor: 16%
RD


                                  extrn   current_psp:word
       