home *** CD-ROM | disk | FTP | other *** search
- /*_ dos.h Tue Sep 20 1988 Modified by: Walter Bright */
- /* Copyright (C) 1985-1988 by Northwest Software */
- /* All rights reserved */
- /* Written by Walter Bright */
-
- #ifndef DOS_H
- #define DOS_H 1
-
- /* DOS and IBM PC specific declarations */
-
- /* Register structure required for functions int86() and intdos() */
- struct WORDREGS {unsigned ax,bx,cx,dx,si,di,cflag,flags; };
- struct BYTEREGS {unsigned char al,ah,bl,bh,cl,ch,dl,dh; };
- union REGS { struct WORDREGS x; struct BYTEREGS h; };
- struct SREGS { unsigned es,cs,ss,ds; };
-
- int int86(int,union REGS *,union REGS *);
- int int86x(int,union REGS *,union REGS *,struct SREGS *);
- int intdos(union REGS *,union REGS *);
- int intdosx(union REGS *,union REGS *,struct SREGS *);
- void segread(struct SREGS *);
-
- struct FIND /* struct used by findfirst() and findnext() */
- { char reserved[21]; /* reserved by DOS */
- char attribute; /* attribute found (FA_XXXX) */
- unsigned time,date; /* file's time and date */
- unsigned long size; /* file's size */
- char name[13]; /* filename followed by 0 byte */
- };
-
- struct FIND *findfirst(char *,int),*findnext(void);
-
- /* Directory entry attributes */
- #define FA_RDONLY 0x01
- #define FA_HIDDEN 0x02
- #define FA_SYSTEM 0x04
- #define FA_LABEL 0x08
- #define FA_DIREC 0x10
- #define FA_ARCH 0x20
-
- extern unsigned _psp;
- extern unsigned char _osmajor,_osminor;
- extern volatile int _doserrno; /* MS-DOS error codes. Refer to the */
- /* ERROR RETURN TABLE in your MS-DOS */
- /* manual. */
-
- /***************************
- * Define macros to get at the segment and offset of a far pointer.
- */
-
- #define FP_SEG(fp) ((unsigned)((unsigned long)(fp) >> 16))
- #define FP_OFF(fp) ((unsigned)(fp))
-
- /* Generate a far pointer from a segment and an offset */
- #define MK_FP(seg,offset) \
- ((void far *)(((unsigned long)(seg)<<16) | (unsigned)(offset)))
-
- void far *_farptr_norm(void far *), far *_farptr_fromlong(long);
- long _farptr_tolong(void far *);
-
- /***********************************
- * Far storage allocation functions
- */
-
- void far *farmalloc(unsigned long size);
- void far *farcalloc(unsigned long numelems,unsigned long elemsize);
- void far *farrealloc(void far *oldptr,unsigned long newsize);
- int farfree(void far *ptr);
- unsigned long farcoreleft(void);
-
- /*******************************
- * File modes for open().
- */
-
- #define O_RDONLY 0
- #define O_WRONLY 1
- #define O_RDWR 2
- #define O_CREAT 0
-
- /* DOS specific functions: */
- void dos_set_verify(int), dos_set_ctrl_break(int);
- int dos_get_verify(void), dos_get_ctrl_break(void);
- long dos_getdiskfreespace(int);
- int dos_abs_disk_read(int,int,int,char *);
- int dos_abs_disk_write(int,int,int,char *);
-
- /* For inline code generation for inp(), inpw(), outp() and outpw() functions */
- unsigned char _inline_inp(unsigned);
- int _inline_inpw(unsigned);
- unsigned char _inline_outp(unsigned,char);
- int _inline_outpw(unsigned,unsigned);
-
- #define inp _inline_inp
- #define inpw _inline_inpw
- #define outp _inline_outp
- #define outpw _inline_outpw
-
- #endif /* DOS_H */
-