home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 2.ddi / RTLINSRC.ZIP / ASMRULES.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.8 KB  |  89 lines

  1. /*------------------------------------------------------------------------
  2.  * filename - asmrules.h
  3.  *
  4.  *      Rules & structures useful for in-line assembler
  5.  *-----------------------------------------------------------------------*/
  6.  
  7. /*[]------------------------------------------------------------[]*/
  8. /*|                                                              |*/
  9. /*|     C/C++ Run Time Library - Version 4.0                     |*/
  10. /*|                                                              |*/
  11. /*|                                                              |*/
  12. /*|     Copyright (c) 1987, 1991 by Borland International        |*/
  13. /*|     All Rights Reserved.                                     |*/
  14. /*|                                                              |*/
  15. /*[]------------------------------------------------------------[]*/
  16.  
  17. #pragma inline
  18. #pragma warn -asm
  19.  
  20. /****
  21. #define  LPROG  (4 == sizeof (void (*) (void)))
  22. #define  LDATA  (4 == sizeof (void *))
  23. ****/
  24. #if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
  25. #define LDATA 1
  26. #else
  27. #define LDATA 0
  28. #endif
  29.  
  30. #if defined(__LARGE__) || defined(__HUGE__) || defined(__MEDIUM__)
  31. #define LPROG 1
  32. #else
  33. #define LPROG 0
  34. #endif
  35.  
  36. #define  W0(ea) (word ptr (ea))
  37. #define  W1(ea) (word ptr (ea) [2])
  38.  
  39. #define  BY0(ea) (byte ptr (ea))
  40. #define  BY1(ea) (byte ptr (ea) [1])
  41.  
  42. #define  FLOAT(ea)  (dword ptr (ea))
  43. #define  DOUBLE(ea) (qword ptr (ea))
  44. #define  LONGDOUBLE(ea) (tbyte ptr (ea))
  45.  
  46. #define _SimLocalCall_  asm     db      0E8h, 0, 0      /* call $       */
  47. /*      jmp     toLocalProc                             NEVER USE "SHORT" ! */
  48.  
  49. #define  RETNEAR asm  db   0C3h
  50.  
  51. #if LDATA
  52. #   define  LES_  LES
  53. #   define  ES_   ES:
  54. #   define  SS_   SS:
  55. #   define  DPTR_(ea)  (dword ptr (ea))
  56. #   define  dPtrSize    4
  57. #   define  pushDS_     asm     push    DS
  58. #   define  LDS_        LDS
  59. #   define  popDS_      asm     pop     DS
  60. #else
  61. #   define  LES_  mov
  62. #   define  ES_
  63. #   define  SS_
  64. #   define  DPTR_(ea)  (word ptr (ea))
  65. #   define  dPtrSize    2
  66. #   define  pushDS_
  67. #   define  LDS_        mov
  68. #   define  popDS_
  69. #endif
  70.  
  71. #if LPROG
  72. #   define  CPTR_(ea)  (dword ptr (ea))
  73. #   define  EXTPROC(x)  (far ptr (x))
  74. #   define  cPtrSize    4
  75. #else
  76. #   define  CPTR_(ea)  (word ptr (ea))
  77. #   define  EXTPROC(x)  (x)
  78. #   define  cPtrSize    2
  79. #endif
  80.  
  81. /* Use these macros inside of a function to force an si or di save/restore */
  82. #define SaveSI                  asm     __savesi equ si
  83. #define SaveDI                  asm     __savedi equ di
  84.  
  85. /* Use these macros when you want to return a value in DX:AX and
  86.    avoid a warning messages being generated.  Ex: return( MK_LONG ); */
  87. #define MK_LONG   (long)((void _seg *)(_DX) + (void near *)(_AX))
  88. #define MK_ULONG  (unsigned long)((void _seg *)(_DX) + (void near *)(_AX))
  89.