home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / Bios.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-16  |  3.7 KB  |  157 lines

  1. /* Copyright (C) 1986-2001 by Digital Mars. $Revision: 1.1.1.1 $ */
  2. #if __SC__ || __RCC__
  3. #pragma once
  4. #endif
  5.  
  6. #ifndef __BIOS_H
  7. #define __BIOS_H 1
  8.  
  9. #ifndef __NT__
  10. #if __cplusplus
  11. extern "C" {
  12. #endif
  13.  
  14. #define _KEYBRD_READ        0
  15. #define _KEYBRD_READY       1
  16. #define _KEYBRD_SHIFTSTATUS 2
  17. #define _NKEYBRD_READ       0x10
  18. #define _NKEYBRD_READY      0x11
  19. #define _NKEYBRD_SHIFTSTATUS 0x12
  20.  
  21. #ifndef _WINDOWS
  22. unsigned short __cdecl _bios_keybrd(unsigned);
  23. unsigned short __cdecl bioskey(int);
  24. #endif
  25.  
  26. #if M_UNIX || M_XENIX
  27.  
  28. void __cdecl _bios_keybrd_close(void);
  29. int __cdecl _bios_keybrd_open(void);
  30.  
  31. #else /* M_UNIX || M_XENIX */
  32.  
  33. #pragma pack(1)
  34. struct diskinfo_t {
  35.     unsigned drive;
  36.     unsigned head;
  37.     unsigned track;
  38.     unsigned sector;
  39.     unsigned nsectors;
  40.     void __far *buffer;
  41.     };
  42. #define _diskinfo_t diskinfo_t
  43.  
  44. #pragma pack()
  45.  
  46. #define _COM_INIT       0
  47. #define _COM_SEND       1
  48. #define _COM_RECEIVE    2
  49. #define _COM_STATUS     3
  50. #define _COM_CHR7       2
  51. #define _COM_CHR8       3
  52. #define _COM_STOP1      0
  53. #define _COM_STOP2      4
  54. #define _COM_NOPARITY   0
  55. #define _COM_ODDPARITY  8
  56. #define _COM_EVENPARITY 24
  57. #define _COM_110        0
  58. #define _COM_150        32
  59. #define _COM_300        64
  60. #define _COM_600        96
  61. #define _COM_1200       128
  62. #define _COM_2400       160
  63. #define _COM_4800       192
  64. #define _COM_9600       224
  65. #define _DISK_RESET     0
  66. #define _DISK_STATUS    1
  67. #define _DISK_READ      2
  68. #define _DISK_WRITE     3
  69. #define _DISK_VERIFY    4
  70. #define _DISK_FORMAT    5
  71. #define _PRINTER_WRITE  0
  72. #define _PRINTER_INIT   1
  73. #define _PRINTER_STATUS 2
  74. #define _TIME_GETCLOCK  0
  75. #define _TIME_SETCLOCK  1
  76.  
  77. unsigned __cdecl _bios_equiplist(void);
  78. unsigned __cdecl _bios_memsize(void);
  79. #ifndef _WINDOWS
  80. unsigned __cdecl _bios_printer(unsigned, unsigned, unsigned);
  81. #define biosprint(cmd,abyte,port) _bios_printer(cmd,port,abyte)
  82. unsigned __cdecl _bios_serialcom(unsigned, unsigned, unsigned);
  83. #define bioscom _bios_serialcom
  84. #endif
  85. unsigned __cdecl _bios_timeofday(unsigned, long *);
  86. long __cdecl biostime(int , long);
  87. #ifndef DOS386
  88. unsigned __cdecl _bios_disk(unsigned, struct diskinfo_t *);
  89. int __cdecl biosdisk(int, int, int, int, int, int, void *);
  90. #endif /* DOS386 */
  91.  
  92. #define biosmemory() _bios_memsize()
  93. #define biosequip() _bios_equiplist()
  94. #endif /* M_UNIX || M_XENIX */
  95.  
  96. #ifndef __REGS_DEFINED
  97. #define __REGS_DEFINED
  98. #ifndef __NT__
  99.  
  100. #if __INTSIZE == 4
  101.  
  102. #pragma pack(1)
  103. struct _DWORDREGS
  104. {       unsigned eax,ebx,ecx,edx,esi,edi,cflag,flags;
  105. };
  106. #define DWORDREGS _DWORDREGS
  107.  
  108. struct _WORDREGS
  109. {       unsigned short  ax,eaxmsw,bx,ebxmsw,cx,ecxmsw,dx,edxmsw,
  110.             si,esimsw,di,edimsw;
  111.     unsigned cflag,flags;
  112. };
  113. #define WORDREGS _WORDREGS
  114.  
  115. struct _BYTEREGS
  116. {       unsigned char al,ah,ax2,ax3,bl,bh,bx2,bx3,
  117.               cl,ch,cx2,cx3,dl,dh,dx2,dx3;
  118. };
  119. #define BYTEREGS _BYTEREGS
  120.  
  121. union _REGS { struct _DWORDREGS e; struct _WORDREGS x; struct _BYTEREGS h; };
  122. #define REGS _REGS
  123.  
  124. struct _SREGS { unsigned short es,cs,ss,ds,fs,gs; };
  125. #define SREGS _SREGS
  126.  
  127. #pragma pack()
  128. #else /* __INTSIZE == 4 */
  129.  
  130. #pragma pack(1)
  131. struct WORDREGS { unsigned ax,bx,cx,dx,si,di,cflag,flags; };
  132. struct BYTEREGS {unsigned char al,ah,bl,bh,cl,ch,dl,dh; };
  133. union REGS { struct WORDREGS x; struct BYTEREGS h; };
  134. struct SREGS { unsigned es,cs,ss,ds; };
  135. #pragma pack()
  136. #define _REGS REGS
  137. #define _SREGS SREGS
  138. #define _WORDREGS WORDREGS
  139. #define _BYTEREGS BYTEREGS
  140.  
  141. #endif /* __INTSIZE == 4 */
  142. #endif /* __NT__ */
  143. #endif /* __REGS_DEFINED */
  144.  
  145. int __cdecl int86(int,union REGS *,union REGS *);
  146. int __cdecl int86x(int,union REGS *,union REGS *,struct SREGS *);
  147. #define _int86 int86
  148. #define _int86x int86x
  149.  
  150. #if __cplusplus
  151. }
  152. #endif
  153.  
  154. #endif /* __NT__ */
  155.  
  156. #endif
  157.