home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Languages / Quick C 2.0 / INCLUDE / BIOS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-05  |  4.6 KB  |  189 lines

  1. /***
  2. *bios.h - declarations for bios interface functions and supporting definitions
  3. *
  4. *    Copyright (c) 1987-1989, 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.  
  13. #ifndef NO_EXT_KEYS    /* extensions enabled */
  14.     #define _CDECL    cdecl
  15. #else    /* extensions not enabled */
  16.     #define _CDECL
  17. #endif    /* NO_EXT_KEYS */
  18.  
  19. /* manifest constants for BIOS serial communications (RS-232) support */
  20.  
  21. /* serial port services */
  22.  
  23. #define _COM_INIT        0    /* init serial port */
  24. #define _COM_SEND        1    /* send character */
  25. #define _COM_RECEIVE        2    /* receive character */
  26. #define _COM_STATUS        3    /* get serial port status */
  27.  
  28. /* serial port initializers.  One and only one constant from each of the
  29.  * following four groups - character size, stop bit, parity, and baud rate -
  30.  * must be specified in the initialization byte.
  31.  */
  32.  
  33. /* character size initializers */
  34.  
  35. #define _COM_CHR7        2    /* 7 bits characters */
  36. #define _COM_CHR8        3    /* 8 bits characters */
  37.  
  38. /* stop bit values - on or off */
  39.  
  40. #define _COM_STOP1        0    /* 1 stop bit */
  41. #define _COM_STOP2        4    /* 2 stop bits */
  42.  
  43. /*  parity initializers */
  44.  
  45. #define _COM_NOPARITY        0    /* no parity */
  46. #define _COM_ODDPARITY        8    /* odd parity */
  47. #define _COM_EVENPARITY     24    /* even parity */
  48.  
  49. /*  baud rate initializers */
  50.  
  51. #define _COM_110        0    /* 110 baud */
  52. #define _COM_150        32    /* 150 baud */
  53. #define _COM_300        64    /* 300 baud */
  54. #define _COM_600        96    /* 600 baud */
  55. #define _COM_1200        128     /* 1200 baud */
  56. #define _COM_2400        160     /* 2400 baud */
  57. #define _COM_4800        192     /* 4800 baud */
  58. #define _COM_9600        224     /* 9600 baud */
  59.  
  60.  
  61. /* manifest constants for BIOS disk support */
  62.  
  63. /* disk services */
  64.  
  65. #define _DISK_RESET        0    /* reset disk controller */
  66. #define _DISK_STATUS        1    /* get disk status */
  67. #define _DISK_READ        2    /* read disk sectors */
  68. #define _DISK_WRITE        3    /* write disk sectors */
  69. #define _DISK_VERIFY        4    /* verify disk sectors */
  70. #define _DISK_FORMAT        5    /* format disk track */
  71.  
  72. /* struct used to send/receive information to/from the BIOS disk services */
  73.  
  74. #ifndef NO_EXT_KEYS        /* extensions must be enabled */
  75.  
  76. #ifndef _DISKINFO_T_DEFINED
  77.  
  78. struct diskinfo_t {
  79.     unsigned drive;
  80.     unsigned head;
  81.     unsigned track;
  82.     unsigned sector;
  83.     unsigned nsectors;
  84.     void far *buffer;
  85.     };
  86.  
  87. #define _DISKINFO_T_DEFINED
  88.  
  89. #endif
  90.  
  91. #endif /* NO_EXT_KEYS */
  92.  
  93.  
  94. /* manifest constants for BIOS keyboard support */
  95.  
  96. /* keyboard services */
  97.  
  98. #define _KEYBRD_READ        0    /* read next character from keyboard */
  99. #define _KEYBRD_READY        1    /* check for keystroke */
  100. #define _KEYBRD_SHIFTSTATUS    2    /* get current shift key status */
  101.  
  102. /* services for enhanced keyboards */
  103.  
  104. #define _NKEYBRD_READ        0x10    /* read next character from keyboard */
  105. #define _NKEYBRD_READY        0x11    /* check for keystroke */
  106. #define _NKEYBRD_SHIFTSTATUS    0x12    /* get current shift key status */
  107.  
  108.  
  109. /* manifest constants for BIOS printer support */
  110.  
  111. /* printer services */
  112.  
  113. #define _PRINTER_WRITE        0    /* write character to printer */
  114. #define _PRINTER_INIT        1    /* intialize printer */
  115. #define _PRINTER_STATUS     2    /* get printer status */
  116.  
  117.  
  118. /* manifest constants for BIOS time of day support */
  119.  
  120. /* time of day services */
  121.  
  122. #define _TIME_GETCLOCK        0    /* get current clock count */
  123. #define _TIME_SETCLOCK        1    /* set current clock count */
  124.  
  125.  
  126. #ifndef _REGS_DEFINED
  127.  
  128. /* word registers */
  129.  
  130. struct WORDREGS {
  131.     unsigned int ax;
  132.     unsigned int bx;
  133.     unsigned int cx;
  134.     unsigned int dx;
  135.     unsigned int si;
  136.     unsigned int di;
  137.     unsigned int cflag;
  138.     };
  139.  
  140. /* byte registers */
  141.  
  142. struct BYTEREGS {
  143.     unsigned char al, ah;
  144.     unsigned char bl, bh;
  145.     unsigned char cl, ch;
  146.     unsigned char dl, dh;
  147.     };
  148.  
  149. /* general purpose registers union -
  150.  *  overlays the corresponding word and byte registers.
  151.  */
  152.  
  153. union REGS {
  154.     struct WORDREGS x;
  155.     struct BYTEREGS h;
  156.     };
  157.  
  158. /* segment registers */
  159.  
  160. struct SREGS {
  161.     unsigned int es;
  162.     unsigned int cs;
  163.     unsigned int ss;
  164.     unsigned int ds;
  165.     };
  166.  
  167. #define _REGS_DEFINED
  168.  
  169. #endif /* _REGS_DEFINED */
  170.  
  171.  
  172. /* function prototypes */
  173.  
  174. unsigned _CDECL _bios_equiplist(void);
  175. unsigned _CDECL _bios_keybrd(unsigned);
  176. unsigned _CDECL _bios_memsize(void);
  177. unsigned _CDECL _bios_printer(unsigned, unsigned, unsigned);
  178. unsigned _CDECL _bios_serialcom(unsigned, unsigned, unsigned);
  179. unsigned _CDECL _bios_timeofday(unsigned, long *);
  180. int _CDECL int86(int, union REGS *, union REGS *);
  181. int _CDECL int86x(int, union REGS *, union REGS *, struct SREGS *);
  182.  
  183. #ifndef NO_EXT_KEYS        /* extensions must be enabled */
  184.  
  185. unsigned _CDECL _bios_disk(unsigned, struct diskinfo_t *);
  186.  
  187. #endif /* NO_EXT_KEYS */
  188.  
  189.