home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / INC.PAK / BIOS.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  5KB  |  200 lines

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