Source code of Windows XP (NT5)
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.

315 lines
5.6 KiB

  1. subttl emulator.inc - Emulator macros.
  2. ;***
  3. ;emulator.inc - Emulator history.
  4. ;
  5. ; Copyright (c) 1989-89, Microsoft Corporation
  6. ;
  7. ;Purpose:
  8. ; Defines macros for emulator.
  9. ;
  10. ;Revision History
  11. ;
  12. ; See emulator.hst
  13. ;
  14. ;*******************************************************************************
  15. ;*******************************************************************************
  16. ;
  17. ; EMver - defines version tag put in code segment.
  18. ;
  19. ;*******************************************************************************
  20. EMver macro
  21. db 'MSEM87',major_ver,minor_ver
  22. endm
  23. ;*******************************************************************************
  24. ;
  25. ; Define pub and glb macros to make labels public for debugging.
  26. ;
  27. ;*******************************************************************************
  28. ifdef DEBUG
  29. lab macro name
  30. public name
  31. name:
  32. endm
  33. pub macro name
  34. public name
  35. name:
  36. endm
  37. glb macro name
  38. irp nm,<name>
  39. public nm
  40. endm
  41. endm
  42. elseifdef WINDOWS ; If windows, make these public for the map file.
  43. lab macro name
  44. public name
  45. name:
  46. endm
  47. pub macro name
  48. public name
  49. name:
  50. endm
  51. glb macro name
  52. irp nm,<name>
  53. public nm
  54. endm
  55. endm
  56. else ;DEFAULT
  57. lab macro name
  58. name:
  59. endm
  60. pub macro name
  61. name:
  62. endm
  63. glb macro name
  64. endm
  65. endif ;DEFAULT
  66. ;*******************************************************************************
  67. ;
  68. ; Macros and register aliases to keep the 386/8086 versions close.
  69. ;
  70. ;*******************************************************************************
  71. ifdef i386
  72. eWORD macro nam ; 386 macros
  73. nam label dword
  74. endm
  75. nedw macro nam,contents
  76. nam dd contents
  77. endm
  78. nedd macro nam,contents
  79. nam df contents
  80. endm
  81. edw macro contents
  82. dd contents
  83. endm
  84. edd macro contents
  85. df contents
  86. endm
  87. else ; not i386
  88. eWORD macro nam ; 286 macros
  89. nam label word
  90. endm
  91. nedw macro nam,contents
  92. nam dw contents
  93. endm
  94. nedd macro nam,contents
  95. nam dd contents
  96. endm
  97. edw macro contents
  98. dw contents
  99. endm
  100. edd macro contents
  101. dd contents
  102. endm
  103. eax equ ax
  104. ecx equ cx
  105. edx equ dx
  106. ebx equ bx
  107. esp equ sp
  108. ebp equ bp
  109. esi equ si
  110. edi equ di
  111. iretd equ iret
  112. endif ;not i386
  113. ;*******************************************************************************
  114. ;
  115. ; Processor opcode byte definitions.
  116. ;
  117. ;*******************************************************************************
  118. fINT equ 0cdh
  119. fFWAIT equ 9bh
  120. fESCAPE equ 0d8h
  121. iNOP equ 90h ; byte nop
  122. fES equ 26h ; segment prefix opcodes
  123. fCS equ 2eh
  124. fSS equ 36h
  125. fDS equ 3eh
  126. bIRET equ 0cfh ; "iret"
  127. bRETF equ 0cah ; first byte of "retf 2". Followed by word operand.
  128. wNOP equ 0c08bh ; word nop. "mov ax, ax"
  129. bEscMask equ 0f8h ; masks all bits but escape
  130. bMOD equ 0c0h ; MOD bits are the two highest bits
  131. bRM equ 7h ; R/M bits are the three lowest bits.
  132. ;*******************************************************************************
  133. ;
  134. ; Define os2extrn and os2call for dual mode emulators
  135. ;
  136. ;*******************************************************************************
  137. ifdef DOS3and5
  138. os2call macro name
  139. call __&name
  140. endm
  141. os2extrn macro name
  142. extrn __&name : far
  143. endm
  144. endif ;DOS3and5
  145. ifdef DOS5only
  146. os2call macro name
  147. call name
  148. endm
  149. os2extrn macro name
  150. extrn name : far
  151. endm
  152. endif ;DOS5only
  153. ;*******************************************************************************
  154. ;
  155. ; Define ProfBegin ProfEnd macros for when profiling emulator.
  156. ;
  157. ;*******************************************************************************
  158. ProfBegin macro name
  159. ifdef PROFILE
  160. nop
  161. public EM_&name&_BEGIN
  162. EM_&name&_BEGIN label far
  163. endif
  164. endm
  165. ProfEnd macro name
  166. ifdef PROFILE
  167. public EM_&name&_END
  168. EM_&name&_END label far
  169. nop
  170. endif
  171. endm
  172. ;*******************************************************************************
  173. ;
  174. ; Define IntDOS macro for handling "int 21h" and "call DOS3CALL".
  175. ;
  176. ;*******************************************************************************
  177. IntDOS macro
  178. ifdef WINDOWSP
  179. call DOS3CALL
  180. else
  181. int 21h
  182. endif
  183. endm
  184. ;*******************************************************************************
  185. ;
  186. ; Define constants for DOS int 21h
  187. ;
  188. ;*******************************************************************************
  189. DOS_getvector equ 35H
  190. INT_GetEquipList equ 11h ; PC BIOS equipment list call.
  191. GEL_80x87 equ 2h ; Mask for Coprocessor sense switch.
  192. ;*******************************************************************************
  193. ;
  194. ; Define structures for __WinInfo(), __WinSave(), and __WinRestore().
  195. ;
  196. ;*******************************************************************************
  197. WinInfoStruct struc
  198. WI_Version dw ? ; High byte is major version.
  199. WI_SizeSaveArea dw ? ; Size of save area.
  200. WI_WinDataSeg dw ?
  201. WI_WinCodeSeg dw ?
  202. WI_Have80x87 dw ?
  203. WI_Unused dw ? ; Coprocessor type will go here.
  204. WinInfoStruct ends
  205. Size80x87Area equ 94
  206. WinSaveArea struc
  207. WSA_Save80x87 db Size80x87Area dup(?) ; Where 80x87 info will go.
  208. WSA_SaveEm db ? ; Where emulator data will go.
  209. WinSaveArea ends
  210. ;*******************************************************************************
  211. ;
  212. ; Define constants for checking "extrn __WINFLAGS:asb"
  213. ;
  214. ;*******************************************************************************
  215. WF_PMODE equ 1
  216. WF_CPU286 equ 2
  217. WF_CPU386 equ 4
  218. WF_WIN286 equ 10h
  219. WF_WIN386 equ 20h
  220. WF_80x87 equ 400h