home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0000 - 0009 / ibm0000-0009 / ibm0003.tar / ibm0003 / C_DISK2.ZIP / DOS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-09-20  |  3.0 KB  |  99 lines

  1. /*_ dos.h   Tue Sep 20 1988   Modified by: Walter Bright */
  2. /* Copyright (C) 1985-1988 by Northwest Software    */
  3. /* All rights reserved                    */
  4. /* Written by Walter Bright                */
  5.  
  6. #ifndef DOS_H
  7. #define DOS_H    1
  8.  
  9. /* DOS and IBM PC specific declarations            */
  10.  
  11. /* Register structure required for functions int86() and intdos()    */
  12. struct WORDREGS {unsigned ax,bx,cx,dx,si,di,cflag,flags; };
  13. struct BYTEREGS {unsigned char al,ah,bl,bh,cl,ch,dl,dh; };
  14. union REGS { struct WORDREGS x; struct BYTEREGS h; };
  15. struct SREGS { unsigned es,cs,ss,ds; };
  16.  
  17. int int86(int,union REGS *,union REGS *);
  18. int int86x(int,union REGS *,union REGS *,struct SREGS *);
  19. int intdos(union REGS *,union REGS *);
  20. int intdosx(union REGS *,union REGS *,struct SREGS *);
  21. void segread(struct SREGS *);
  22.  
  23. struct FIND        /* struct used by findfirst() and findnext()    */
  24. {    char reserved[21];    /* reserved by DOS            */
  25.     char attribute;        /* attribute found (FA_XXXX)        */
  26.     unsigned time,date;    /* file's time and date            */
  27.     unsigned long size;    /* file's size                */
  28.     char name[13];        /* filename followed by 0 byte        */
  29. };
  30.  
  31. struct FIND *findfirst(char *,int),*findnext(void);
  32.  
  33. /* Directory entry attributes    */
  34. #define FA_RDONLY    0x01
  35. #define FA_HIDDEN    0x02
  36. #define FA_SYSTEM    0x04
  37. #define FA_LABEL    0x08
  38. #define FA_DIREC    0x10
  39. #define FA_ARCH        0x20
  40.  
  41. extern unsigned _psp;
  42. extern unsigned char _osmajor,_osminor;
  43. extern volatile int _doserrno;    /* MS-DOS error codes. Refer to the    */
  44.                 /* ERROR RETURN TABLE in your MS-DOS    */
  45.                 /* manual.                */
  46.  
  47. /***************************
  48.  * Define macros to get at the segment and offset of a far pointer.
  49.  */
  50.  
  51. #define FP_SEG(fp)    ((unsigned)((unsigned long)(fp) >> 16))
  52. #define FP_OFF(fp)    ((unsigned)(fp))
  53.  
  54. /* Generate a far pointer from a segment and an offset    */
  55. #define MK_FP(seg,offset) \
  56.     ((void far *)(((unsigned long)(seg)<<16) | (unsigned)(offset)))
  57.  
  58. void far *_farptr_norm(void far *), far *_farptr_fromlong(long);
  59. long _farptr_tolong(void far *);
  60.  
  61. /***********************************
  62.  * Far storage allocation functions
  63.  */
  64.  
  65. void far *farmalloc(unsigned long size);
  66. void far *farcalloc(unsigned long numelems,unsigned long elemsize);
  67. void far *farrealloc(void far *oldptr,unsigned long newsize);
  68. int farfree(void far *ptr);
  69. unsigned long farcoreleft(void);
  70.  
  71. /*******************************
  72.  * File modes for open().
  73.  */
  74.  
  75. #define O_RDONLY    0
  76. #define O_WRONLY    1
  77. #define O_RDWR        2
  78. #define O_CREAT        0
  79.  
  80. /* DOS specific functions:    */
  81. void    dos_set_verify(int),    dos_set_ctrl_break(int);
  82. int    dos_get_verify(void),    dos_get_ctrl_break(void);
  83. long    dos_getdiskfreespace(int);
  84. int    dos_abs_disk_read(int,int,int,char *);
  85. int    dos_abs_disk_write(int,int,int,char *);
  86.  
  87. /* For inline code generation for inp(), inpw(), outp() and outpw() functions */
  88. unsigned char    _inline_inp(unsigned);
  89. int        _inline_inpw(unsigned);
  90. unsigned char    _inline_outp(unsigned,char);
  91. int        _inline_outpw(unsigned,unsigned);
  92.  
  93. #define inp    _inline_inp
  94. #define inpw    _inline_inpw
  95. #define outp    _inline_outp
  96. #define outpw    _inline_outpw
  97.  
  98. #endif /* DOS_H */
  99.