BIOS.H
上传用户:apf998
上传日期:2021-04-18
资源大小:1k
文件大小:5k
源码类别:

Windows编程

开发平台:

DOS

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