home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / BIOS.H < prev    next >
C/C++ Source or Header  |  1997-02-14  |  5KB  |  201 lines

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