; Microsoft Compatibility - Mar 30 2006 - CE

MS_P_TERMCPM	equ	00H
MS_C_READ	equ	01H
MS_C_WRITE	equ	02H
MS_A_READ	equ	03H
MS_A_WRITE	equ	04H
MS_L_WRITE	equ	05H
MS_C_RAWIO	equ	06H
MS_C_RAWIN	equ	07H
MS_C_NOECHO	equ	08H
MS_C_WRITESTR	equ	09H
MS_C_READSTR	equ	0aH
MS_C_STAT	equ	0bH
MS_C_FLUSH	equ	0cH
MS_DRV_ALLRESET	equ	0dH
MS_DRV_SET	equ	0eH
MS_F_OPEN	equ	0fH
MS_F_CLOSE	equ	10H
MS_F_SFIRST	equ	11H
MS_F_SNEXT	equ	12H
MS_F_DELETE	equ	13H
MS_F_READ	equ	14H
MS_F_WRITE	equ	15H
MS_F_MAKE	equ	16H
MS_F_RENAME	equ	17H
MS_DRV_GET	equ	19H
MS_F_DMAOFF	equ	1aH
MS_DRV_ALLOC	equ	1bH
MS_DRV_ALLOCSPEC equ	1cH
MS_F_READRAND	equ	21H
MS_F_WRITERAND	equ	22H
MS_F_SIZE	equ	23H
MS_F_RANDREC	equ	24H
MS_S_SETINT	equ	25H
MS_P_MKPSP	equ	26H
MS_F_READBLK	equ	27H
MS_F_WRITEBLK	equ	28H
MS_F_PARSE	equ	29H
MS_T_GETDATE	equ	2aH
MS_T_SETDATE	equ	2bH
MS_T_GETTIME	equ	2cH
MS_T_SETTIME	equ	2dH
MS_F_VERIFY	equ	2eH
MS_F_DMAGET	equ	2fH
MS_S_BDOSVER	equ	30H
MS_P_TERMKEEP	equ	31H
MS_S_BREAK	equ	33H
MS_S_GETINT	equ	35H
MS_DRV_SPACE	equ	36H
MS_S_COUNTRY	equ	38H
MS_X_MKDIR	equ	39H
MS_X_RMDIR	equ	3aH
MS_X_CHDIR	equ	3bH
MS_X_CREAT	equ	3cH
MS_X_OPEN	equ	3dH
MS_X_CLOSE	equ	3eH
MS_X_READ	equ	3fH
MS_X_WRITE	equ	40H
MS_X_UNLINK	equ	41H
MS_X_LSEEK	equ	42H
MS_X_CHMOD	equ	43H
MS_X_IOCTL	equ	44H
MS_X_DUP	equ	45H
MS_X_DUP2	equ	46H
MS_X_CURDIR	equ	47H
MS_M_ALLOC	equ	48H
MS_M_FREE	equ	49H
MS_M_SETBLOCK	equ	4aH
MS_X_EXEC	equ	4bH
MS_X_EXIT	equ	4cH
MS_X_WAIT	equ	4dH
MS_X_FIRST	equ	4eH
MS_X_NEXT	equ	4fH
MS_P_SETPSP	equ	50H
MS_F_GETVERIFY	equ	54H
MS_X_RENAME	equ	56H
MS_X_DATETIME	equ	57H
MS_M_STRATEGY	equ	58h
MS_F_ERROR	equ	59H
MS_X_MKTEMP	equ	5aH
MS_X_MKNEW	equ	5bH
MS_F_LOCK	equ	5cH
MS_X_EXPAND	equ	60H
MS_P_GETPSP	equ	62H
MS_X_GETCP	equ	6601h
MS_X_SETCP	equ	6602h
MS_X_SETHC	equ	67h
MS_X_COMMIT	equ	68h

DOS_INT         equ 21h ; DOS Entry Point
;
STDIN		equ	0	; Standard Console Input Handle
STDOUT		equ	1	; Standard Console Output Handle
STDERR		equ	2	; Standard Error Output
STDAUX		equ	3	; Auxilary Device Handle
STDPRN		equ	4	; Printer Device Handle

; Error return values

ED_FUNCTION	equ	-01		; invalid function number
ED_FILE		equ	-02		; file not found
ED_PATH		equ	-03		; path not found
ED_HANDLE	equ	-04		; too many open files
ED_ACCESS	equ	-05		; file access denied
ED_H_MATCH	equ	-06		; invalid handle number
ED_DMD		equ	-07		; memory descriptor destroyed
ED_MEMORY	equ	-08		; insufficient memory
ED_BLOCK	equ	-09		; invalid memory block addr
ED_ENVIRON	equ	-10		; invalid environment
ED_FORMAT	equ	-11		; invalid format
ED_ACC_CODE	equ	-12		; invalid access code
ED_DATA		equ	-13		; invalid data
ED_DRIVE	equ	-15		; invalid drive specified
ED_DIR		equ	-16		; can't remove current dir
ED_DEVICE	equ	-17		; not same device
ED_ROOM		equ	-18		; no more files

ED_PROTECT	equ	-19		; disk write protected
ED_BADUNIT	equ	-20		; invalid drive specified
ED_NOTREADY	equ	-21		; drive doesn't respond
ED_BADCMD	equ	-22		; invalid command to driver
ED_BADDATA	equ	-23		; data CRC error
ED_BADRHLEN	equ	-24		; (shouldn't happen)
ED_BADSEEK	equ	-25		; can't seek to track
ED_BADMEDIA	equ	-26		; unrecognizable medium
ED_RNF		equ	-27		; record/sector not found
ED_NOPAPER	equ	-28		; printer error
ED_WRFAIL	equ	-29		; write failed
ED_RDFAIL	equ	-30		; read failed
ED_GENFAIL	equ	-31		; anything failed
ED_SHAREFAIL	equ	-32		; sharing conflict
ED_LOCKFAIL	equ	-33		; locking conflict
ED_DISKCHG	equ	-34		; invalid disk change
ED_NOFCBS	equ	-35		; FCB table exhausted
ED_NOLOCKS	equ	-36		; lock list items exhausted
ED_NET		equ	-50		; Network Request Not Supported

ED_NETACCESS	equ	-65		; file access denied

ED_NETPWD	equ	-73		; Server Password Error
ED_NETVER	equ	-74		; Incorrect Server version
ED_NETREQ	equ	-75		; No Local Network Resources
ED_NETTIME	equ	-76		; Network Time Out Error
ED_NETCOMM	equ	-77		; Network Communications Error
ED_NETSRVR	equ	-78		; No Server Network Resources 
ED_NETLOG	equ	-79		; Server Not Logged In

ED_EXISTS	equ	-80		; file already exists
ED_MAKE		equ	-82		; Cannot Make (Files ??)
ED_FAIL		equ	-83		; FAIL code returned from INT 24
ED_STRUCT	equ	-84		; Out of Structures
ED_ASSIGN	equ	-85		; Already Assigned
ED_PASSWORD	equ	-86		; Invalid Password
ED_PARAM	equ	-87		; Invalid Parameter
ED_NETWRITE	equ	-88		; Network write fault
ED_NETFUNC	equ	-89		; Function not supported on network
ED_COMPONENT	equ	-90		; system component not installed
ED_LASTERROR	equ	-90		; Last Error Number Used


CLASS_RESOURCE	equ	1	; Out of Resource
CLASS_TEMP	equ	2	; Temporary Situation
CLASS_AUTHOR	equ	3	; Authorization Error
CLASS_INTERNAL	equ	4	; Internal System Software Error
CLASS_HARDWARE	equ	5	; Hardware Failure
CLASS_SYSTEM	equ	6	; Serious System Failure
CLASS_APPLIC	equ	7	; Application Program Error
CLASS_LOST	equ	8	; File/Item Not Found
CLASS_FORMAT	equ	9	; File/Item Illegal Format 
CLASS_LOCKED	equ	10	; File/Item Locked
CLASS_MEDIA	equ	11	; Media Failure
CLASS_EXISTS	equ	12	; Item Already Exists
CLASS_UNKNOWN	equ	13	; Unknown Classification

ACT_RETRY	equ	1	; Retry a few times then prompt user
ACT_DELAY	equ	2	; Delay then as ACT_RETRY
ACT_USER	equ	3	; Prompt user to re-enter data
ACT_ABORT	equ	4	; Clean Up then ABORT the process
ACT_TERM	equ	5	; Terminate immeadiately NO CLEAN UP
ACT_IGNORE	equ	6	; Ignore the Error
ACT_URETRY	equ	7	; Retry the error after user intervention

LOC_UNKNOWN	equ	1	; Unknown error location
LOC_BLOCK	equ	2	; Block Device Failure
LOC_NET		equ	3	; Network Failure
LOC_CHAR	equ	4	; Related to Serial/Character devices
LOC_MEMORY	equ	5	; Failure related to Memory 

TRUE	   	equ	0FFFFh		; value of TRUE
FALSE	   	equ	0		; value of FALSE

TRUE_VERSION	equ	6

IDLE_DETECT	equ	TRUE		; Check for IDLE Process's

IF (IDLE_DETECT)
        IDLE_COMMAND    equ     0001h           ; Command Processor Active
        IDLE_DOSFUNC    equ     0002h           ; DOS Function Called
        IDLE_INT28      equ     0004h           ; INT 28 Called

        IDLE_ON         equ     4000h           ; ReSet when Idle Checking Enabled
        IDLE_INIT       equ     8000h           ; ReSet when $IDLE$ Loaded and Active
        IDLE_DISABLE    equ     IDLE_INIT + IDLE_ON 

        PROC_IDLE       equ     0001            ; Process is IDLE
        PROC_INT28      equ     0002            ; INT28 Polling Loop
        PROC_KEYIN      equ     0003            ; Keyboard Input
        PROC_DEVIN      equ     0004            ; Device Input Routine
ENDIF


STACK_SIZE	equ	192		; Local Stack Size (Levels)
MAX_PATHLEN	equ	80		; Maximum Path length
MAX_FILELEN	equ	13

;
;	DOS process termination Codes
;
TERM_NORMAL	equ	0		; Normal Termination
TERM_BREAK	equ	1		; Termination by Control Break
TERM_ERROR	equ	2		; Termination by Critical Error
TERM_RESIDENT	equ	3		; Terminate and Stay Resident

;
;	Critical Error responses from the default INT 24 handler and
;	the DO_INT24 routine.
;
ERR_IGNORE	equ	0		; Ignore Error
ERR_RETRY	equ	1		; Retry the Operation
ERR_ABORT	equ	2		; Terminate the Process
ERR_FAIL	equ	3		; Fail Function
;
OK_FAIL		equ	0000$1000b	; Fail is a Valid Response
OK_RETRY	equ	0001$0000b	; Retry is a Valid Response
OK_IGNORE	equ	0010$0000b	; Ignore is a valid Response
OK_RIF		equ	0011$1000b	; All Responsese are Valid
OK_RI		equ	0011$0000b	; Retry and Ignore are Valid
OK_RF		equ	0001$1000b	; Retry and Fail are Valid
;
NO_CRIT_ERRORS	equ	0100$0000b	; critical error shouldn't be generated
					; warning - must match FDOS.A86
; 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.
;
POPDOS  Macro                   ; 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

PUSHDOS Macro   ; 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

; Processor Flags
CARRY_FLAG	equ	0001h		; Carry Flag
ZERO_FLAG	equ	0040h		; Zero Flag
SIGN_FLAG	equ	0080h		; Sign Flag
INT_FLAG	equ	0200h		; Interrupt Flag
DIR_FLAG	equ	0400h		; Direction Flag
OFLW_FLAG	equ	0800h		; OverFlow Flag

IDM             equ     'M'		; not last id code
IDZ             equ     'Z'		; last id code


