home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / BIOS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-18  |  5.1 KB  |  195 lines

  1. /*  bios.h
  2.  
  3.     Access to bios services.
  4.  
  5. */
  6.  
  7. /* $Copyright: 1987$ */
  8. /* $Revision:   8.1  $ */
  9.  
  10. #if !defined(__BIOS_H)
  11. #define __BIOS_H
  12.  
  13.  
  14. #if !defined(___DEFS_H)
  15. #include <_defs.h>
  16. #endif
  17.  
  18.  
  19. #if !defined(RC_INVOKED)
  20.  
  21. #if defined(__STDC__)
  22. #pragma warn -nak
  23. #endif
  24.  
  25. #endif  /* !RC_INVOKED */
  26.  
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31.  
  32.  
  33. #if !defined(_Windows)
  34.  
  35. /* diskinfo_t structure for _bios_disk() */
  36.  
  37. struct diskinfo_t
  38. {
  39.     unsigned drive, head, track, sector, nsectors;
  40.     void __far *buffer;
  41. };
  42.  
  43. /* cmd values for _bios_disk() */
  44.  
  45. #define _DISK_RESET     0   /* controller hard reset */
  46. #define _DISK_STATUS    1   /* status of last operation */
  47. #define _DISK_READ      2   /* read sectors */
  48. #define _DISK_WRITE     3   /* write sectors */
  49. #define _DISK_VERIFY    4   /* verify sectors */
  50. #define _DISK_FORMAT    5   /* format track */
  51.  
  52. unsigned _RTLENTRY _bios_disk(unsigned __cmd, struct diskinfo_t _FAR *__dinfo);
  53. int      _RTLENTRY biosdisk(int __cmd, int __drive, int __head, int __track,
  54.                             int __sector, int __nsects, void _FAR *__buffer);
  55. #endif  /* !_Windows */
  56.  
  57.  
  58. #if !defined(_Windows) || defined(__DPMI16__) || defined(__DPMI32__)
  59.  
  60. /* cmd values for _bios_keybrd() */
  61.  
  62. #define _KEYBRD_READ            0       /* read key */
  63. #define _NKEYBRD_READ           0x10    /* read key - enhanced */
  64. #define _KEYBRD_READY           1       /* check key ready */
  65. #define _NKEYBRD_READY          0x11    /* check key ready - enhanced */
  66. #define _KEYBRD_SHIFTSTATUS     2       /* get shift status */
  67. #define _NKEYBRD_SHIFTSTATUS    0x12    /* get shift status - enhanced */
  68.  
  69. /* cmd values for _bios_printer() */
  70.  
  71. #define _PRINTER_WRITE  0       /* send a byte to printer */
  72. #define _PRINTER_INIT   1       /* initialize printer */
  73. #define _PRINTER_STATUS 2       /* read printer status */
  74.  
  75. /* cmd values for _bios_serialcom() */
  76.  
  77. #define _COM_INIT       0       /* set communication parms to a byte */
  78. #define _COM_SEND       1       /* send a byte to port */
  79. #define _COM_RECEIVE    2       /* read character from port */
  80. #define _COM_STATUS     3       /* get status of port */
  81.  
  82. /* byte values for _COM_INIT cmd of _bios_serialcom() */
  83.  
  84. #define _COM_CHR7       0x02    /* 7 data bits */
  85. #define _COM_CHR8       0x03    /* 8 data bits */
  86. #define _COM_STOP1      0x00    /* 1 stop bit */
  87. #define _COM_STOP2      0x04    /* 2 stop bits */
  88. #define _COM_NOPARITY   0x00    /* no parity */
  89. #define _COM_EVENPARITY 0x18    /* even parity */
  90. #define _COM_ODDPARITY  0x08    /* odd parity */
  91. #define _COM_110        0x00    /* 110 baud */
  92. #define _COM_150        0x20    /* 150 baud */
  93. #define _COM_300        0x40    /* 300 baud */
  94. #define _COM_600        0x60    /* 600 baud */
  95. #define _COM_1200       0x80    /* 1200 baud */
  96. #define _COM_2400       0xa0    /* 2400 baud */
  97. #define _COM_4800       0xc0    /* 4800 baud */
  98. #define _COM_9600       0xe0    /* 9600 baud */
  99.  
  100. unsigned _RTLENTRY _bios_keybrd(unsigned __cmd);
  101. unsigned _RTLENTRY _bios_printer(unsigned __cmd, unsigned __port, unsigned __abyte);
  102. unsigned _RTLENTRY _bios_serialcom(unsigned __cmd, unsigned __port, unsigned __abyte);
  103.  
  104. int      _RTLENTRY bioscom(int __cmd, char __abyte, int __port);
  105. int      _RTLENTRY bioskey(int __cmd);
  106. int      _RTLENTRY biosprint(int __cmd, int __abyte, int __port);
  107.  
  108. #endif  /* !_Windows || __DPMI16__ || __DPMI32__ */
  109.  
  110.  
  111. #if !defined(__WIN32__) || defined(__DPMI32__)
  112.  
  113. /* cmd values for _bios_timeofday() */
  114.  
  115. #define _TIME_GETCLOCK  0   /* get clock count */
  116. #define _TIME_SETCLOCK  1   /* set clock count */
  117.  
  118. /* Constants for biostime() */
  119. #define _BIOS_CLOCKS_PER_SEC 18.2
  120. #define _BIOS_CLK_TCK        _BIOS_CLOCKS_PER_SEC
  121.  
  122. /* register structure definitions for int86(), int86x() */
  123.  
  124. #ifndef _REG_DEFS
  125. #define _REG_DEFS
  126.  
  127. struct WORDREGS
  128. {
  129.     unsigned int    ax, bx, cx, dx, si, di, cflag, flags;
  130. };
  131.  
  132.  
  133. struct BYTEREGS
  134. {
  135.     unsigned char   al, ah, bl, bh, cl, ch, dl, dh;
  136. };
  137.  
  138. union  REGS
  139. {
  140.     struct  WORDREGS x;
  141.     struct  BYTEREGS h;
  142. };
  143.  
  144. struct  SREGS
  145. {
  146.     unsigned int    es;
  147.     unsigned int    cs;
  148.     unsigned int    ss;
  149.     unsigned int    ds;
  150. };
  151.  
  152. struct  REGPACK
  153. {
  154.     unsigned    r_ax, r_bx, r_cx, r_dx;
  155.     unsigned    r_bp, r_si, r_di, r_ds, r_es, r_flags;
  156. };
  157.  
  158. #endif /* _REG_DEFS */
  159.  
  160. unsigned _RTLENTRY _bios_equiplist(void);
  161. unsigned _RTLENTRY _bios_memsize(void);
  162. unsigned _RTLENTRY _bios_timeofday(unsigned __cmd, long _FAR *__timeval);
  163.  
  164. int      _RTLENTRY biosequip(void);
  165. int      _RTLENTRY biosmemory(void);
  166. long     _RTLENTRY biostime(int __cmd, long __newtime);
  167.  
  168. int      _RTLENTRY int86(int __intno,
  169.                          union REGS _FAR *__inregs,
  170.                          union REGS _FAR *__outregs );
  171. int      _RTLENTRY int86x(int __intno,
  172.                           union  REGS  _FAR *__inregs,
  173.                           union  REGS  _FAR *__outregs,
  174.                           struct SREGS _FAR *__segregs );
  175.  
  176. #endif  /* !__WIN32__ || __DPMI32__ */
  177.  
  178.  
  179. #ifdef __cplusplus
  180. }
  181. #endif
  182.  
  183.  
  184. #if !defined(RC_INVOKED)
  185.  
  186. #if defined(__STDC__)
  187. #pragma warn .nak
  188. #endif
  189.  
  190. #endif  /* !RC_INVOKED */
  191.  
  192.  
  193. #endif  /* __BIOS_H */
  194.  
  195.