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.

360 lines
5.0 KiB

  1. ;
  2. ; SYSTEM MACROS
  3. ;
  4. ; DISPLAY TEXT ON SCREEN
  5. ;
  6. DISP MACRO TEXT,SEGM
  7. IFNB <SEGM>
  8. IFDIF <SEGM>,<DS>
  9. PUSH DS
  10. MOV AX,SEGM
  11. MOV DS,AX
  12. ENDIF
  13. ENDIF
  14. IFNB <TEXT>
  15. LEA DX,TEXT
  16. ENDIF
  17. DOS DSTR
  18. IFNB <SEGM>
  19. IFDIF <SEGM>,<DS>
  20. POP DS
  21. ENDIF
  22. ENDIF
  23. ENDM
  24. ;
  25. DMSG MACRO MSG
  26. IFNB <MSG>
  27. LEA DX,MSG
  28. ENDIF
  29. DISP
  30. ENDM
  31. ;
  32. DCHAR MACRO CHAR
  33. PUSH DX
  34. IFNB <CHAR>
  35. MOV DL,CHAR ; SET CHARACTER
  36. ELSE
  37. MOV DL,AL
  38. ENDIF
  39. DOS DO
  40. POP DX
  41. ENDM
  42. ;
  43. ; CLEAR SCREEN
  44. ;
  45. CLEAR MACRO
  46. MOV CX,00H*256+00H ; ROW=00, COL=00
  47. MOV DX,24H*256+79H ; ROW=24, COL=79
  48. MOV BH,07H ; NORMAL ATTRIBUTE
  49. MOV AX,06H*256+00H ; CLEAR WHOLE SCREEN
  50. INT 10H
  51. ENDM
  52. ;
  53. POS MACRO ROW,COL,PAGE
  54. IFNB <ROW>
  55. MOV DX,ROW*256+COL ; SET ROW AND COLUMN
  56. ENDIF
  57. IFNB <PAGE>
  58. MOV BH,PAGE ; SET PAGE
  59. ELSE
  60. MOV BH,0
  61. ENDIF
  62. MOV AH,02H ; POSTIION CURSOR
  63. INT 10H
  64. ENDM
  65. ;
  66. DEFMSG MACRO ID,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10
  67. IFNB <ID>
  68. ID LABEL BYTE ; DEFINE ESSAGE
  69. ENDIF
  70. IFNB <T1>
  71. DB T1
  72. ENDIF
  73. IFNB <T2>
  74. DB T2
  75. ENDIF
  76. IFNB <T3>
  77. DB T3
  78. ENDIF
  79. IFNB <T4>
  80. DB T4
  81. ENDIF
  82. IFNB <T5>
  83. DB T5
  84. ENDIF
  85. IFNB <T6>
  86. DB T6
  87. ENDIF
  88. IFNB <T7>
  89. DB T7
  90. ENDIF
  91. IFNB <T8>
  92. DB T8
  93. ENDIF
  94. IFNB <T9>
  95. DB T9
  96. ENDIF
  97. IFNB <T10>
  98. DB T10
  99. ENDIF
  100. DB '$'
  101. ENDM
  102. ;
  103. MOVE MACRO TO,LEN,FROM
  104. IFNB <TO>
  105. LEA DI,TO ; SET DESTINATION
  106. ENDIF
  107. IFNB <LEN>
  108. MOV CX,LEN ; SET LENGTH
  109. ENDIF
  110. IFNB <FROM>
  111. LEA SI,FROM ; SET SOURCE
  112. ENDIF
  113. REP MOVS BYTE PTR[DI],BYTE PTR[SI]
  114. ENDM
  115. MOVEZ MACRO TO,FROM
  116. IFNB <TO>
  117. LEA DI,TO ; SET DESTINATION
  118. ENDIF
  119. IFNB <FROM>
  120. LEA SI,FROM ; SET SOURCE
  121. ENDIF
  122. CALL MOVZ$
  123. ENDM
  124. ;
  125. SCAN MACRO TO,LEN,VALUE,TYPE
  126. IFNB <TO>
  127. LEA DI,TO ; SET DESTINATION
  128. ENDIF
  129. IFNB <LEN>
  130. MOV CX,LEN ; SET LENGTH
  131. ENDIF
  132. IFNB <VALUE>
  133. MOV AL,VALUE ; SET SOURCE
  134. ENDIF
  135. IFB <TYPE>
  136. REPZ SCASB
  137. ENDIF
  138. IFIDN <TYPE>,<EQ>
  139. REPZ SCASB
  140. ENDIF
  141. IFIDN <TYPE>,<Z>
  142. REPZ SCASB
  143. ENDIF
  144. IFIDN <TYPE>,<NE>
  145. REPNZ SCASB
  146. ENDIF
  147. IFIDN <TYPE>,<NZ>
  148. REPNZ SCASB
  149. ENDIF
  150. ENDM
  151. ;
  152. FILL MACRO TO,LEN,VALUE
  153. PUSH DI
  154. PUSH CX
  155. IFNB <TO>
  156. LEA DI,TO ; SET DESTINATION
  157. ENDIF
  158. IFNB <LEN>
  159. MOV CX,LEN ; SET LENGTH
  160. ENDIF
  161. IFNB <VALUE>
  162. MOV AL,VALUE ; SET SOURCE
  163. ENDIF
  164. REP STOS BYTE PTR[DI]
  165. POP CX
  166. POP DI
  167. ENDM
  168. ;
  169. COMP MACRO TO,LEN,FROM
  170. IFNB <TO>
  171. LEA DI,TO ; SET DESTINATION
  172. ENDIF
  173. IFNB <LEN>
  174. MOV CX,LEN ; SET LENGTH
  175. ENDIF
  176. IFNB <FROM>
  177. LEA SI,FROM ; SET SOURCE
  178. ENDIF
  179. REPE CMPS BYTE PTR[DI],BYTE PTR[SI]
  180. ENDM
  181. COMPZ MACRO TO,FROM
  182. IFNB <TO>
  183. LEA DI,TO ; SET DESTINATION
  184. ENDIF
  185. IFNB <FROM>
  186. LEA SI,FROM ; SET SOURCE
  187. ENDIF
  188. CALL CMPZ$
  189. ENDM
  190. ;
  191. XCHGS MACRO O1,O2
  192. PUSH O1
  193. PUSH O2
  194. POP O1
  195. POP O2
  196. ENDM
  197. ;
  198. JUMP MACRO COND,TARGET
  199. LOCAL LAB
  200. IFB <COND>
  201. JMP TARGET
  202. ENDIF
  203. IFIDN <COND>,<A>
  204. JNA LAB
  205. JMP TARGET
  206. LAB:
  207. ENDIF
  208. IFIDN <COND>,<NBE>
  209. JBE LAB
  210. JMP TARGET
  211. LAB:
  212. ENDIF
  213. IFIDN <COND>,<AE>
  214. JNAE LAB
  215. JMP TARGET
  216. LAB:
  217. ENDIF
  218. IFIDN <COND>,<NB>
  219. JB LAB
  220. JMP TARGET
  221. LAB:
  222. ENDIF
  223. IFIDN <COND>,<B>
  224. JNB LAB
  225. JMP TARGET
  226. LAB:
  227. ENDIF
  228. IFIDN <COND>,<NAE>
  229. JAE LAB
  230. JMP TARGET
  231. LAB:
  232. ENDIF
  233. IFIDN <COND>,<C>
  234. JNC LAB
  235. JMP TARGET
  236. LAB:
  237. ENDIF
  238. IFIDN <COND>,<BE>
  239. JNBE LAB
  240. JMP TARGET
  241. LAB:
  242. ENDIF
  243. IFIDN <COND>,<NA>
  244. JA LAB
  245. JMP TARGET
  246. LAB:
  247. ENDIF
  248. IFIDN <COND>,<CXZ>
  249. OR CX,CX
  250. JNZ LAB
  251. JMP TARGET
  252. LAB:
  253. ENDIF
  254. IFIDN <COND>,<E>
  255. JNE LAB
  256. JMP TARGET
  257. LAB:
  258. ENDIF
  259. IFIDN <COND>,<Z>
  260. JNZ LAB
  261. JMP TARGET
  262. LAB:
  263. ENDIF
  264. IFIDN <COND>,<G>
  265. JNG LAB
  266. JMP TARGET
  267. LAB:
  268. ENDIF
  269. IFIDN <COND>,<NLE>
  270. JLE LAB
  271. JMP TARGET
  272. LAB:
  273. ENDIF
  274. IFIDN <COND>,<GE>
  275. JNGE LAB
  276. JMP TARGET
  277. LAB:
  278. ENDIF
  279. IFIDN <COND>,<NL>
  280. JL LAB
  281. JMP TARGET
  282. LAB:
  283. ENDIF
  284. IFIDN <COND>,<L>
  285. JNL LAB
  286. JMP TARGET
  287. LAB:
  288. ENDIF
  289. IFIDN <COND>,<NGE>
  290. JGE LAB
  291. JMP TARGET
  292. LAB:
  293. ENDIF
  294. IFIDN <COND>,<LE>
  295. JNLE LAB
  296. JMP TARGET
  297. LAB:
  298. ENDIF
  299. IFIDN <COND>,<NG>
  300. JG LAB
  301. JMP TARGET
  302. LAB:
  303. ENDIF
  304. IFIDN <COND>,<NC>
  305. JC LAB
  306. JMP TARGET
  307. LAB:
  308. ENDIF
  309. IFIDN <COND>,<NE>
  310. JE LAB
  311. JMP TARGET
  312. LAB:
  313. ENDIF
  314. IFIDN <COND>,<NZ>
  315. JZ LAB
  316. JMP TARGET
  317. LAB:
  318. ENDIF
  319. IFIDN <COND>,<NO>
  320. JO LAB
  321. JMP TARGET
  322. LAB:
  323. ENDIF
  324. IFIDN <COND>,<NP>
  325. JP LAB
  326. JMP TARGET
  327. LAB:
  328. ENDIF
  329. IFIDN <COND>,<PO>
  330. JPE LAB
  331. JMP TARGET
  332. LAB:
  333. ENDIF
  334. IFIDN <COND>,<NS>
  335. JS LAB
  336. JMP TARGET
  337. LAB:
  338. ENDIF
  339. IFIDN <COND>,<O>
  340. JNO LAB
  341. JMP TARGET
  342. LAB:
  343. ENDIF
  344. IFIDN <COND>,<P>
  345. JNP LAB
  346. JMP TARGET
  347. LAB:
  348. ENDIF
  349. IFIDN <COND>,<PE>
  350. JPO LAB
  351. JMP TARGET
  352. LAB:
  353. ENDIF
  354. IFIDN <COND>,<S>
  355. JNS LAB
  356. JMP TARGET
  357. LAB:
  358. ENDIF
  359. ENDM
  360. ;
  361.