home *** CD-ROM | disk | FTP | other *** search
/ Zodiac Super OZ / MEDIADEPOT.ISO / FILES / 16 / FREEDOS.ZIP / FD_A4PRE.ZIP / SOURCE / MSGLIB.ZIP / freedos / src / include / regproto.h < prev   
Text File  |  1995-04-20  |  2KB  |  88 lines

  1. /* Enables the usage of the fast register pseudo vars for non-TURBO
  2.    compilers. That means the port Turbo -> non-Turbo is OK.
  3.    Back not, because the union holds the registers independed on
  4.    real registers.
  5. */
  6.  
  7. #ifndef __REGPROTO_H
  8. #define __REGPROTO_H
  9.  
  10. #ifdef __TURBOC__
  11. #define USEREGS
  12.  
  13. #else
  14.  
  15. #ifdef _MICROC_
  16. #define USEREGS
  17. #define _AH ((unsigned)_AX_ >> 8)
  18. #define _AL ((unsigned)_AX_ & 0xf)
  19. #define _BH ((unsigned)_BX_ >> 8)
  20. #define _BL ((unsigned)_BX_ & 0xf)
  21. #define _CH ((unsigned)_CX_ >> 8)
  22. #define _CL ((unsigned)_CX_ >> 8)
  23. #define _DH ((unsigned)_DX_ & 0xf)
  24. #define _DL ((unsigned)_DX_ >> 8)
  25. #define _AX _AX_
  26. #define _BX _BX_
  27. #define _CX _CX_
  28. #define _DX _DX_
  29. #define _SI _SI_
  30. #define _DI _DI_
  31. #define geninterrupt(n)  int86(n)
  32.  
  33. #else
  34. #define USEREGS  union REGS reg ; struct SREGS sreg ;
  35. #define _AH reg.h.ah
  36. #define _AL reg.h.al
  37. #define _BH reg.h.bh
  38. #define _BL reg.h.bl
  39. #define _CH reg.h.ch
  40. #define _CL reg.h.cl
  41. #define _DH reg.h.dh
  42. #define _DL reg.h.dl
  43. #define _AX reg.x.ax
  44. #define _BX reg.x.bx
  45. #define _CX reg.x.cx
  46. #define _DX reg.x.dx
  47. #define _SI reg.x.si
  48. #define _DI reg.x.di
  49. #define _DS sreg.ds
  50. #define _ES sreg.es
  51. #define _SS sreg.ss
  52. #define geninterrupt(n)  int86x(n,®,®,&sreg)
  53.  
  54. #endif _MICROC_
  55. #endif __TURBOC__
  56. /*
  57.    int getkey()
  58.    {
  59.       USEREGS
  60.  
  61.       _AH = 0x10 ;
  62.       geninterrupt(0x16) ;
  63.       return _AX ;
  64.    }
  65. */
  66.  
  67. #ifdef _MICROC_
  68. #define label(a) a:            /* label inside of asm {} */
  69. #define asmName(a,b) b[bp]        /* variable name not available, use offset */
  70. #define FP_SEG(a) get_ds()    /* only tiny/small available */
  71. #define FP_OFF(a) (a)
  72. #else
  73. #define label(a) } a: asm {
  74. #define asmName(a,b) a
  75.  
  76. #if defined(__POWERC) || (defined(__TURBOC__) && !defined(__BORLANDC__))
  77. #define FAR far
  78. #else
  79. #define FAR _far
  80. #endif
  81.  
  82. #ifndef MK_FP
  83. #define MK_FP(seg,off) ((void FAR *)(((long)(seg) << 16)|(unsigned)(off)))
  84. #endif
  85. #endif
  86.  
  87. #endif
  88.