home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s038 / 10.ddi / 017.LIF / BIOS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-02  |  5.3 KB  |  132 lines

  1. /* bios.h - BIOS functions
  2.  * $Version: 1.1 $
  3.  * Copyright 1990,91 Intel Corporation, ALL RIGHTS RESERVED.
  4.  */
  5.  
  6. #ifndef _biosh
  7. #define _biosh
  8.  
  9. #pragma fixedparams("_bios_disk",    "_bios_equiplist", "_bios_keybrd")
  10. #pragma fixedparams("_bios_memsize", "_bios_printer",   "_bios_serialcom") 
  11. #pragma fixedparams("_bios_timeofday")
  12.  
  13. /* BIOS COM port configuration constants */
  14. #define _COM_INIT       0x00            /* Initialize the com port           */
  15. #define _COM_SEND       0x01            /* Send a byte to the com port       */
  16. #define _COM_RECEIVE    0x02            /* Get a byte from the com port      */
  17. #define _COM_STATUS     0x03            /* Get status from the com port      */
  18.  
  19. #define _COM_110        0x00            /* Baud rate: 110                    */
  20. #define _COM_150        0x20            /* Baud rate: 150                    */
  21. #define _COM_300        0x40            /* Baud rate: 300                    */
  22. #define _COM_600        0x60            /* Baud rate: 600                    */
  23. #define _COM_1200       0x80            /* Baud rate: 1200                   */
  24. #define _COM_2400       0xA0            /* Baud rate: 2400                   */
  25. #define _COM_4800       0xC0            /* Baud rate: 4800                   */
  26. #define _COM_9600       0xE0            /* Baud rate: 9600                   */
  27.  
  28. #define _COM_CHR7       0x02            /* Seven data bits per character     */
  29. #define _COM_CHR8       0x03            /* Eight data bits per character     */
  30.  
  31. #define _COM_NOPARITY   0x00            /* No parity check                   */
  32. #define _COM_ODDPARITY  0x08            /* Check for odd parity              */
  33. #define _COM_EVENPARITY 0x18            /* Check for even parity             */
  34.  
  35. #define _COM_STOP1      0x00            /* One stop bit                      */
  36. #define _COM_STOP2      0x04            /* Two stop bits                     */
  37.  
  38. /* BIOS disk operations */
  39. #define _DISK_RESET     0x00            /* Reset the disk controller         */
  40. #define _DISK_STATUS    0x01            /* Get status from the disk          */
  41. #define _DISK_READ      0x02            /* Read sectors from the disk        */
  42. #define _DISK_WRITE     0x03            /* Write sectors to the disk         */
  43. #define _DISK_VERIFY    0x04            /* Verify disk sectors               */
  44. #define _DISK_FORMAT    0x05            /* Format a disk track               */
  45.  
  46. #ifndef _FAR
  47. #define _FAR
  48. #define _HUGE
  49. #define _NEAR
  50. #endif
  51.  
  52. /* BIOS disk structure */
  53. #ifndef _diskinfo_t
  54. #pragma align (diskinfo_t)
  55. struct diskinfo_t {
  56.    unsigned short drive;
  57.    unsigned short head;
  58.    unsigned short track;
  59.    unsigned short sector;
  60.    unsigned short nsectors;
  61.    void _FAR     *buffer;
  62. };
  63. #define _diskinfo_t
  64. #define _DISKINFO_T_DEFINED
  65. #endif  /* _diskinfo_t */
  66.  
  67. /* BIOS keyboard operations */
  68. #define _KEYBRD_READ            0x00    /* Get next character from keyboard  */
  69. #define _KEYBRD_READY           0x01    /* See if a keystroke is ready       */
  70. #define _KEYBRD_SHIFTSTATUS     0x02    /* Get status of shift key           */
  71.  
  72. /* BIOS enhanced keyboards operations */
  73. #define _NKEYBRD_READ           0x10    /* Get next character from keyboard  */
  74. #define _NKEYBRD_READY          0x11    /* See if a keystroke is ready       */
  75. #define _NKEYBRD_SHIFTSTATUS    0x12    /* Get status of Shift key           */
  76.  
  77. /* BIOS printer operations */
  78. #define _PRINTER_WRITE          0x00    /* Write characters to the printer   */
  79. #define _PRINTER_INIT           0x01    /* Initialize the printer            */
  80. #define _PRINTER_STATUS         0x02    /* Get status from the printer       */
  81.  
  82. /* BIOS clock operations */
  83. #define _TIME_GETCLOCK          0x00    /* Get the clock counter             */
  84. #define _TIME_SETCLOCK          0x01    /* Set the clock counter             */
  85.  
  86. /* Registers union - overlay the DWORD, WORD, and BYTE register
  87.  * structures into the same memory area.  Declaration of "eax" and "ax"
  88.  * entries the same (unsigned) for ease of porting code using "ax". Also,
  89.  * note the optional 16-bit implementation of 'x' field.
  90.  */
  91. #ifndef _regs
  92. #pragma align (DWORDREGS)
  93. #pragma align (WORDREGS)
  94. #pragma align (BYTEREGS)
  95. union REGS {
  96.   struct DWORDREGS {unsigned  eax, ebx, ecx, edx, esi,
  97.                               edi, cflag, eflags, ebp;} w;
  98.  
  99.   struct WORDREGS  {unsigned  ax, bx, cx, dx, si,
  100.                               di, cflag, flags, bp;} x;
  101.  
  102. #if _ARCHITECTURE_ == 386 ||  _ARCHITECTURE_ == 486
  103.  
  104.   struct BYTEREGS  {unsigned  al:8, ah:8, :16, bl:8, bh:8, :16,
  105.                               cl:8, ch:8, :16, dl:8, dh:8, :16;} h;
  106. #else
  107.   struct BYTEREGS  {unsigned  al:8, ah:8, bl:8, bh:8,
  108.                               cl:8, ch:8, dl:8, dh:8;} h;
  109. #endif
  110.  
  111. };
  112.  
  113. /* Selector/Segment register structure */
  114. #pragma align (SREGS)
  115. struct SREGS {unsigned short es, cs, ss, ds, fs, gs;};
  116.  
  117. #define _regs
  118. #endif  /* _regs */
  119.  
  120. /*
  121.  * Function prototypes
  122.  */
  123. unsigned int _bios_disk(unsigned, struct diskinfo_t *);
  124. unsigned int _bios_equiplist(void);
  125. unsigned int _bios_keybrd(unsigned);
  126. unsigned int _bios_memsize(void);
  127. unsigned int _bios_printer(unsigned, unsigned, unsigned);
  128. unsigned int _bios_serialcom(unsigned, unsigned, unsigned);
  129. unsigned int _bios_timeofday(unsigned, long *);
  130.  
  131. #endif /* _biosh */
  132.