home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_11 / 2.ddi / INCLUDE.ZIP / BIOS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-13  |  3.8 KB  |  146 lines

  1. /*  bios.h
  2.  
  3.     Access to bios services.
  4.  
  5.     Copyright (c) Borland International 1987,1988,1990,1991
  6.     All Rights Reserved.
  7. */
  8.  
  9. #if !defined( __BIOS_H )
  10. #define __BIOS_H
  11.  
  12. #ifdef __DLL__
  13. #define _FAR far
  14. #else
  15. #define _FAR
  16. #endif
  17.  
  18. #if __STDC__
  19. #define _Cdecl
  20. #else
  21. #define _Cdecl  cdecl
  22. #endif
  23.  
  24. #ifndef __PAS__
  25. #define _CType _Cdecl
  26. #else
  27. #define _CType pascal
  28. #endif
  29.  
  30. /* register structure definitions for int86(), int86x() */
  31.  
  32. #ifdef __MSC
  33. #ifndef _REG_DEFS
  34. #define _REG_DEFS
  35.  
  36. struct WORDREGS {
  37.     unsigned int    ax, bx, cx, dx, si, di, cflag, flags;
  38. };
  39.  
  40. struct BYTEREGS {
  41.     unsigned char   al, ah, bl, bh, cl, ch, dl, dh;
  42. };
  43.  
  44. union   REGS    {
  45.     struct  WORDREGS x;
  46.     struct  BYTEREGS h;
  47. };
  48.  
  49. struct  SREGS   {
  50.     unsigned int    es;
  51.     unsigned int    cs;
  52.     unsigned int    ss;
  53.     unsigned int    ds;
  54. };
  55.  
  56. struct  REGPACK {
  57.     unsigned    r_ax, r_bx, r_cx, r_dx;
  58.     unsigned    r_bp, r_si, r_di, r_ds, r_es, r_flags;
  59. };
  60.  
  61. #endif    /* _REG_DEFS */
  62. #endif    /* __MSC */
  63.  
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif
  67. int _Cdecl bioscom(int __cmd, char __abyte, int __port);
  68. int _Cdecl biosdisk(int __cmd, int __drive, int __head, int __track,
  69.                     int __sector, int __nsects, void _FAR *__buffer);
  70. int _Cdecl biosequip(void);
  71. int _Cdecl bioskey(int __cmd);
  72. int _Cdecl biosmemory(void);
  73. int _Cdecl biosprint(int __cmd, int __abyte, int __port);
  74. long    _Cdecl biostime(int __cmd, long __newtime);
  75.  
  76. #ifdef __MSC
  77. int         _Cdecl int86( int __intno,
  78.                           union REGS _FAR *__inregs,
  79.                           union REGS _FAR *__outregs );
  80. int         _Cdecl int86x( int __intno,
  81.                            union REGS _FAR *__inregs,
  82.                            union REGS _FAR *__outregs,
  83.                            struct SREGS _FAR *__segregs );
  84. #endif
  85.  
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89.  
  90. #ifdef __MSC
  91.  
  92. /* cmd values for _bios_keybrd() */
  93.  
  94. #define _KEYBRD_READ        0    /* read key */
  95. #define _NKEYBRD_READ        0x10    /* read key - enhanced */
  96. #define _KEYBRD_READY        1    /* check key ready */
  97. #define _NKEYBRD_READY        0x11    /* check key ready - enhanced */
  98. #define _KEYBRD_SHIFTSTATUS    2    /* get shift status */
  99. #define _NKEYBRD_SHIFTSTATUS    0x12    /* get shift status - enhanced */
  100.  
  101.  
  102. /* cmd values for _bios_printer() */
  103.  
  104. #define _PRINTER_WRITE    0    /* send abyte to printer */
  105. #define _PRINTER_INIT    1    /* initialize printer */
  106. #define _PRINTER_STATUS    2    /* read printer status */
  107.  
  108. /* cmd values for _bios_serialcom() */
  109.  
  110. #define _COM_INIT    0    /* set communication parms to abyte */
  111. #define _COM_SEND    1    /* send abyte to port */
  112. #define _COM_RECEIVE    2    /* read character from port */
  113. #define _COM_STATUS    3    /* get status of port */
  114.  
  115. /* abyte values for _COM_INIT cmd of _bios_serialcom() */
  116.  
  117. #define _COM_CHR7    0x02    /* 7 data bits */
  118. #define _COM_CHR8    0x03    /* 8 data bits */
  119. #define _COM_STOP1    0x00    /* 1 stop bit */
  120. #define _COM_STOP2    0x04    /* 2 stop bits */
  121. #define _COM_NOPARITY    0x00    /* no parity */
  122. #define _COM_EVENPARITY    0x18    /* even parity */
  123. #define _COM_ODDPARITY    0x08    /* odd parity */
  124. #define _COM_110    0x00    /* 110 baud */
  125. #define _COM_150    0x20    /* 150 baud */
  126. #define _COM_300    0x40    /* 300 baud */
  127. #define _COM_600    0x60    /* 600 baud */
  128. #define _COM_1200    0x80    /* 1200 baud */
  129. #define _COM_2400    0xa0    /* 2400 baud */
  130. #define _COM_4800    0xc0    /* 4800 baud */
  131. #define _COM_9600    0xe0    /* 9600 baud */
  132.  
  133. /* Macros for MSC functions */
  134.  
  135. #define _bios_equiplist()    (unsigned)biosequip()
  136. #define _bios_keybrd(cmd)    (unsigned)bioskey((int)(cmd))
  137. #define _bios_memsize()        (unsigned)biosmemory()
  138. #define _bios_printer(cmd,port,data) \
  139.   (unsigned)biosprint((int)(cmd),(int)(data),(int)(port))
  140. #define _bios_serialcom(cmd,port,data) \
  141.   (unsigned)bioscom((int)(cmd),(int)(data),(int)(port))
  142.  
  143. #endif    /* __MSC */
  144.  
  145. #endif  /* __BIOS_H */
  146.