bios.h
上传用户:xiaoan1112
上传日期:2013-04-11
资源大小:19621k
文件大小:4k
源码类别:

操作系统开发

开发平台:

Visual C++

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