home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 14.ddi / GENINC.PAK / BIOS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  5.5 KB  |  196 lines

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