home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / PROCWRKB.ZIP / BENCH1.ZIP / WIN / DOS / PREGS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-07  |  3.3 KB  |  125 lines

  1. /* ==( dos/pregs.h )== */
  2.  
  3. /* ----------------------------------------------- */
  4. /* Pro-C - Copyright (C) 1988, 1989 Vestronix Inc. */
  5. /* Modification to this source is not supported    */
  6. /* by Vestronix Inc.                               */
  7. /*            All Rights Reserved                  */
  8. /* ----------------------------------------------- */
  9. /* Written   Geo  26-Aug-88                        */
  10. /* Modified  Geo  25-Oct-89  See comments below    */
  11. /* ----------------------------------------------- */
  12. /* %W%  (%H% %T%) */
  13.  
  14. /*
  15.  *  Modifications
  16.  *
  17.  *  25-Oct-89  Geo - 1.32 Merge
  18.  *
  19.  *
  20. */
  21.  
  22. /*
  23.  * Simple defines to allow TurboC's
  24.  * pseudo variables to be used instead
  25.  * of the slower int86
  26.  *
  27.  * Warning - Know what you are doing !
  28.  * The pseudo registers need to be copied
  29.  * to real variables after the interrut call
  30.  * as they are not guarranted
  31.  *
  32.  * V2.0 TurboC and MSC 5.1 only supported for segment extras
  33. */
  34.  
  35. # undef __TURBOC__
  36.  
  37. # ifdef __TURBOC__
  38. /* Storage requirements */
  39. #  define RegStorage
  40. #  define SegStorage
  41. /* word registers */
  42. #  define Regs_ax _AX
  43. #  define Regs_bx _BX
  44. #  define Regs_cx _CX
  45. #  define Regs_dx _DX
  46. #  define Regs_si _SI
  47. #  define Regs_di _DI
  48. /* byte registers */
  49. #  define Regs_al _AL
  50. #  define Regs_ah _AH
  51. #  define Regs_bl _BL
  52. #  define Regs_bh _BH
  53. #  define Regs_cl _CL
  54. #  define Regs_ch _CH
  55. #  define Regs_dl _DL
  56. #  define Regs_dh _DH
  57. /* Segment registers */
  58. #  define Segs_es _ES
  59. #  define Segs_cs _CS
  60. #  define Segs_ss _SS
  61. #  define Segs_ds _DS
  62. /* Carry flag register (Not all CC have this) */
  63. #  define Regs_cf (_FLAGS & 1)
  64. /* Interrupt calls */
  65.     /* Default segments */
  66. #  define CallInt(n) __int__(n)
  67. #  define Video() CallInt(0x10)
  68. #  define Floppy() CallInt(0x13)
  69. #  define Keyboard() CallInt(0x16)
  70. #  define Bios() CallInt(0x21)
  71. #  define Mouse() CallInt(0x33)
  72.  
  73.     /* Defined segments */
  74. #  define Videox() CallInt(0x10)
  75. #  define Floppyx() CallInt(0x13)
  76. #  define Keyboardx() CallInt(0x16)
  77. #  define Biosx() CallInt(0x21)
  78. #  define Mousex() CallInt(0x33)
  79.  
  80. # else /* MSC etc */
  81.  
  82. /* Storage requirements */
  83. #  define RegStorage union REGS regs
  84. #  define SegStorage struct SREGS sregs
  85. /* word registers */
  86. #  define Regs_ax regs.x.ax
  87. #  define Regs_bx regs.x.bx
  88. #  define Regs_cx regs.x.cx
  89. #  define Regs_dx regs.x.dx
  90. #  define Regs_si regs.x.si
  91. #  define Regs_di regs.x.dx
  92. /* byte registers */
  93. #  define Regs_al regs.h.al
  94. #  define Regs_ah regs.h.ah
  95. #  define Regs_bl regs.h.bl
  96. #  define Regs_bh regs.h.bh
  97. #  define Regs_cl regs.h.cl
  98. #  define Regs_ch regs.h.ch
  99. #  define Regs_dl regs.h.dl
  100. #  define Regs_dh regs.h.dh
  101. /* Segment registers */
  102. #  define Segs_es sregs.es
  103. #  define Segs_cs sregs.cs
  104. #  define Segs_ss sregs.ss
  105. #  define Segs_ds sregs.ds
  106. /* Carry flag register (Not all CC have this) */
  107. #  define Regs_cf regs.x.cflag
  108. /* Interrupt calls */
  109.     /* Default segments */
  110. #  define CallInt(n) int86(n, ®s, ®s)
  111. #  define Video() CallInt(0x10)
  112. #  define Floppy() CallInt(0x13)
  113. #  define Keyboard() CallInt(0x16)
  114. #  define Bios() CallInt(0x21)
  115. #  define Mouse() CallInt(0x33)
  116.  
  117.     /* Defined segments */
  118. #  define CallIntx(n) int86x(n, ®s, ®s, &sregs)
  119. #  define Videox() CallIntx(0x10)
  120. #  define Floppyx() CallIntx(0x13)
  121. #  define Keyboardx() CallIntx(0x16)
  122. #  define Biosx() CallIntx(0x21)
  123. #  define Mousex() CallInt(0x33)
  124. # endif
  125.