home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK4 / INCLUDE / BIOS.H$ / BIOS
Encoding:
Text File  |  1991-11-06  |  5.6 KB  |  243 lines

  1. /***
  2. *bios.h - declarations for bios interface functions and supporting definitions
  3. *
  4. *    Copyright (c) 1987-1992, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *    This file declares the constants, structures, and functions
  8. *    used for accessing and using various BIOS interfaces.
  9. *
  10. ****/
  11.  
  12. #ifndef _INC_BIOS
  13.  
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17.  
  18. #if (_MSC_VER <= 600)
  19. #define __cdecl     _cdecl
  20. #define __far       _far
  21. #endif
  22.  
  23.  
  24. /* manifest constants for BIOS serial communications (RS-232) support */
  25.  
  26. /* serial port services */
  27.  
  28. #define _COM_INIT    0    /* init serial port */
  29. #define _COM_SEND    1    /* send character */
  30. #define _COM_RECEIVE    2    /* receive character */
  31. #define _COM_STATUS    3    /* get serial port status */
  32.  
  33. /* serial port initializers.  One and only one constant from each of the
  34.  * following four groups - character size, stop bit, parity, and baud rate -
  35.  * must be specified in the initialization byte.
  36.  */
  37.  
  38. /* character size initializers */
  39.  
  40. #define _COM_CHR7    2    /* 7 bits characters */
  41. #define _COM_CHR8    3    /* 8 bits characters */
  42.  
  43. /* stop bit values - on or off */
  44.  
  45. #define _COM_STOP1    0    /* 1 stop bit */
  46. #define _COM_STOP2    4    /* 2 stop bits */
  47.  
  48. /*  parity initializers */
  49.  
  50. #define _COM_NOPARITY    0    /* no parity */
  51. #define _COM_ODDPARITY    8    /* odd parity */
  52. #define _COM_EVENPARITY 24    /* even parity */
  53.  
  54. /*  baud rate initializers */
  55.  
  56. #define _COM_110    0    /* 110 baud */
  57. #define _COM_150    32    /* 150 baud */
  58. #define _COM_300    64    /* 300 baud */
  59. #define _COM_600    96    /* 600 baud */
  60. #define _COM_1200    128    /* 1200 baud */
  61. #define _COM_2400    160    /* 2400 baud */
  62. #define _COM_4800    192    /* 4800 baud */
  63. #define _COM_9600    224    /* 9600 baud */
  64.  
  65.  
  66. /* manifest constants for BIOS disk support */
  67.  
  68. /* disk services */
  69.  
  70. #define _DISK_RESET    0    /* reset disk controller */
  71. #define _DISK_STATUS    1    /* get disk status */
  72. #define _DISK_READ    2    /* read disk sectors */
  73. #define _DISK_WRITE    3    /* write disk sectors */
  74. #define _DISK_VERIFY    4    /* verify disk sectors */
  75. #define _DISK_FORMAT    5    /* format disk track */
  76.  
  77. /* struct used to send/receive information to/from the BIOS disk services */
  78.  
  79. #ifndef _DISKINFO_T_DEFINED
  80. #pragma pack(2)
  81.  
  82. struct _diskinfo_t {
  83.     unsigned drive;
  84.     unsigned head;
  85.     unsigned track;
  86.     unsigned sector;
  87.     unsigned nsectors;
  88.     void __far *buffer;
  89.     };
  90.  
  91. #ifndef __STDC__
  92. /* Non-ANSI name for compatibility */
  93. #define diskinfo_t _diskinfo_t
  94. #endif
  95.  
  96. #pragma pack()
  97. #define _DISKINFO_T_DEFINED
  98. #endif
  99.  
  100.  
  101. /* manifest constants for BIOS keyboard support */
  102.  
  103. /* keyboard services */
  104.  
  105. #define _KEYBRD_READ        0    /* read next character from keyboard */
  106. #define _KEYBRD_READY        1    /* check for keystroke */
  107. #define _KEYBRD_SHIFTSTATUS    2    /* get current shift key status */
  108.  
  109. /* services for enhanced keyboards */
  110.  
  111. #define _NKEYBRD_READ        0x10    /* read next character from keyboard */
  112. #define _NKEYBRD_READY        0x11    /* check for keystroke */
  113. #define _NKEYBRD_SHIFTSTATUS    0x12    /* get current shift key status */
  114.  
  115.  
  116. /* manifest constants for BIOS printer support */
  117.  
  118. /* printer services */
  119.  
  120. #define _PRINTER_WRITE    0    /* write character to printer */
  121. #define _PRINTER_INIT    1    /* intialize printer */
  122. #define _PRINTER_STATUS 2    /* get printer status */
  123.  
  124.  
  125. /* manifest constants for BIOS time of day support */
  126.  
  127. /* time of day services */
  128.  
  129. #define _TIME_GETCLOCK    0    /* get current clock count */
  130. #define _TIME_SETCLOCK    1    /* set current clock count */
  131.  
  132.  
  133. #ifndef _REGS_DEFINED
  134.  
  135. /* word registers */
  136.  
  137. struct _WORDREGS {
  138.     unsigned int ax;
  139.     unsigned int bx;
  140.     unsigned int cx;
  141.     unsigned int dx;
  142.     unsigned int si;
  143.     unsigned int di;
  144.     unsigned int cflag;
  145.     };
  146.  
  147. /* byte registers */
  148.  
  149. struct _BYTEREGS {
  150.     unsigned char al, ah;
  151.     unsigned char bl, bh;
  152.     unsigned char cl, ch;
  153.     unsigned char dl, dh;
  154.     };
  155.  
  156. /* general purpose registers union -
  157.  *  overlays the corresponding word and byte registers.
  158.  */
  159.  
  160. union _REGS {
  161.     struct _WORDREGS x;
  162.     struct _BYTEREGS h;
  163.     };
  164.  
  165. /* segment registers */
  166.  
  167. struct _SREGS {
  168.     unsigned int es;
  169.     unsigned int cs;
  170.     unsigned int ss;
  171.     unsigned int ds;
  172.     };
  173.  
  174. #ifndef __STDC__
  175. /* Non-ANSI names for compatibility */
  176.  
  177. struct WORDREGS {
  178.     unsigned int ax;
  179.     unsigned int bx;
  180.     unsigned int cx;
  181.     unsigned int dx;
  182.     unsigned int si;
  183.     unsigned int di;
  184.     unsigned int cflag;
  185.     };
  186.  
  187. struct BYTEREGS {
  188.     unsigned char al, ah;
  189.     unsigned char bl, bh;
  190.     unsigned char cl, ch;
  191.     unsigned char dl, dh;
  192.     };
  193.  
  194. union REGS {
  195.     struct WORDREGS x;
  196.     struct BYTEREGS h;
  197.     };
  198.  
  199. struct SREGS {
  200.     unsigned int es;
  201.     unsigned int cs;
  202.     unsigned int ss;
  203.     unsigned int ds;
  204.     };
  205.  
  206. #endif    /* __STDC__ */
  207.  
  208. #define _REGS_DEFINED
  209. #endif /* _REGS_DEFINED */
  210.  
  211.  
  212. /* function prototypes */
  213.  
  214. #ifndef _WINDOWS
  215. unsigned __cdecl _bios_disk(unsigned, struct _diskinfo_t *);
  216. #endif
  217. unsigned __cdecl _bios_equiplist(void);
  218. #ifndef _WINDOWS
  219. unsigned __cdecl _bios_keybrd(unsigned);
  220. #endif
  221. unsigned __cdecl _bios_memsize(void);
  222. #ifndef _WINDOWS
  223. unsigned __cdecl _bios_printer(unsigned, unsigned, unsigned);
  224. unsigned __cdecl _bios_serialcom(unsigned, unsigned, unsigned);
  225. #endif
  226. unsigned __cdecl _bios_timeofday(unsigned, long *);
  227. int __cdecl _int86(int, union _REGS *, union _REGS *);
  228. int __cdecl _int86x(int, union _REGS *, union _REGS *, struct _SREGS *);
  229.  
  230. #ifndef __STDC__
  231. /* Non-ANSI names for compatibility */
  232. int __cdecl int86(int, union REGS *, union REGS *);
  233. int __cdecl int86x(int, union REGS *, union REGS *, struct SREGS *);
  234. #endif
  235.  
  236.  
  237. #ifdef __cplusplus
  238. }
  239. #endif
  240.  
  241. #define _INC_BIOS
  242. #endif    /* _INC_BIOS */
  243.