Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
3.1 KiB

  1. ; High-Level-Language Interface Macros - Version 2.0
  2. ; for Microsoft Macro Assembler 5.10
  3. ; (C) Copyright Microsoft Corporation, 1987.
  4. ; Syntax Purpose
  5. ; ------ -------
  6. ;
  7. ; setModel Sets model from text equate
  8. ;
  9. ; hProc <name [NEAR|FAR]> [,<USES reglist>] [,arg[:type] [,arg[:type]]]...
  10. ; Starts a procedure with optional stack arguments
  11. ;
  12. ; hLocal var[:type] [,var[:type]]...
  13. ; Defines local stack variables
  14. ;
  15. ; hRet Returns from the current procedure
  16. ;
  17. ; hEndp Ends the current procedure
  18. ;
  19. ; ifFP statement Assembles statement if far data
  20. ;
  21. ; FPoperand Conditionally provides ES override for data
  22. ;
  23. ; pLes register,address Conditionally loads data through ES
  24. ;
  25. ; pLds register,address Conditionally loads data through DS
  26. ;if1
  27. ; Translate command-line arguments
  28. ; Initialize procName
  29. procName equ <foo>
  30. ; Set model passed from command line
  31. setModel macro mod
  32. ifdef cLang
  33. .model mod, C
  34. lang EQU <C>
  35. elseifdef BASIC
  36. .model mod, Basic
  37. elseifdef FORTRAN
  38. .model mod, FORTRAN
  39. elseifdef Pascal
  40. .model mod, Pascal
  41. endif
  42. ; FP - supply far pointer ES overide as needed - must be inside for setModel
  43. if @Datasize
  44. FP equ <es:>
  45. else
  46. FP equ <>
  47. endif
  48. endm
  49. ; FP - supply far pointer ES overide as needed - must be outside for .MODEL
  50. ifdef @Datasize
  51. if @Datasize
  52. FP equ <es:>
  53. else
  54. FP equ <>
  55. endif
  56. endif
  57. ; Declare high level routine and parameters
  58. hProc macro funName, a,b,c,d,e,f,g,h,i,j
  59. ; LOCAL argstr
  60. ii instr <funName>,< >
  61. if ii
  62. procName subStr <funName>,1,ii
  63. nearFar subStr <funName>,ii
  64. else
  65. procName equ <funName>
  66. nearFar equ <>
  67. endif
  68. argstr equ <a>
  69. irp arg,<b,c,d,e,f,g,h,i,j>
  70. ifnb <arg>
  71. argstr catstr argstr,<, arg>
  72. else
  73. exitm
  74. endif
  75. endm
  76. defineProc %nearFar, %argstr
  77. endm
  78. defineProc Macro size,args
  79. procName proc size args
  80. endm
  81. ; Declare local stack variables
  82. hLocal macro a,b,c,d,e,f,g,h,i,j
  83. ; LOCAL argstr
  84. argstr EQU <a>
  85. irp arg,<b,c,d,e,f,g,h,i,j>
  86. ifnb <arg>
  87. argstr catstr argstr,<, arg>
  88. else
  89. exitm
  90. endif
  91. endm
  92. defineLocal %argstr
  93. endm
  94. defineLocal macro args
  95. &local args
  96. endm
  97. ; Generate high level return
  98. hRet macro
  99. ret
  100. endm
  101. ; End a high level procedure
  102. hEndp macro
  103. procName endp
  104. endm
  105. ; Execute instruction if far data
  106. ifFP macro a,b,c,d,e,f,g,h,i,j
  107. if @datasize
  108. a b c d e f g h i j
  109. endif
  110. endm
  111. ; Load 16/32 bit pointers into [ES:] reg
  112. pLes macro reg, address
  113. if @datasize
  114. les reg,address
  115. else
  116. mov reg,address
  117. endif
  118. endm
  119. ;Load 16/32 bit pointers into [DS:] reg
  120. pLds macro reg, address
  121. if @datasize
  122. lds reg,address
  123. else
  124. mov reg,address
  125. endif
  126. endm
  127. ;endif ; Pass 1 only