home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c063 / 1.ddi / INCLUDE.ZIP / BIOS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-18  |  4.5 KB  |  144 lines

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