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.

2663 lines
34 KiB

  1. IFNDEF MASM6
  2. comment $
  3. cmacros - assembly macros for interfacing to hlls
  4. (C)Copyright Microsoft Corp. 1984-1994
  5. $
  6. .xcref
  7. .xcref ??_out
  8. ??_out macro t
  9. ifndef ?QUIET
  10. %out t
  11. endif
  12. endm
  13. outif macro name,defval,onmsg,offmsg
  14. ifndef name
  15. ifb <defval>
  16. name=0
  17. else
  18. name=defval
  19. endif
  20. endif
  21. if name
  22. name=1
  23. ifnb <onmsg>
  24. ??_out <! onmsg>
  25. endif
  26. else
  27. ifnb <offmsg>
  28. ??_out <! offmsg>
  29. endif
  30. endif
  31. endm
  32. .xcref ??error
  33. ??error macro msg
  34. e r r o r ----- msg
  35. .err
  36. endm
  37. .xcref ASMpass
  38. .xcref memS,memM,memL,memC,memH,memMOD,sizec,sized
  39. if1
  40. ASMpass=1
  41. ifdef ?SMALL
  42. memS=1
  43. endif
  44. ifdef ?MEDIUM
  45. memM=1
  46. endif
  47. ifdef ?COMPACT
  48. memC=1
  49. endif
  50. ifdef ?LARGE
  51. memL=1
  52. endif
  53. ifdef ?HUGE
  54. memH=1
  55. endif
  56. ??_out <cMacros Version 5.20 - Copyright (c) Microsoft Corp. 1984-1988>
  57. outif memS,0,<Small model>
  58. outif memM,0,<Medium model>
  59. outif memL,0,<Large model>
  60. outif memC,0,<Compact model>
  61. outif memH,0,<Huge model>
  62. memMOD= memS + memM + memL + memC + memH
  63. if memMOD ne 1
  64. if memMOD eq 0
  65. memS = 1
  66. else
  67. ??error <more than 1 memory model selected>
  68. endif
  69. endif
  70. sizec= memM + memL + memH
  71. sized= memL + memC + (memH*2)
  72. outif ?DF,0,<No segments or groups will be defined>
  73. outif ?TF,0,<Epilog sequences assume valid SP>
  74. outif ?WIN,1,<Windows support>
  75. ifdef PMODE
  76. ?pmd=1
  77. ??_out <! 286 protect mode>
  78. else
  79. ?pmd=0
  80. endif
  81. ifdef ?386regs
  82. if ?386regs
  83. ??_out <! 386 registers enabled>
  84. endif
  85. else
  86. ?386regs=0
  87. endif
  88. if ?WIN eq 1
  89. outif ?PLM,1,<>
  90. else
  91. outif ?PLM,1,<Pascal calling convention>
  92. endif
  93. ifndef ?NODATA
  94. ?nodata1=0
  95. else
  96. ?nodata1=1
  97. ??_out <! NODATA module>
  98. endif
  99. ifndef ?CHKSTK
  100. ?chkstk1=0
  101. else
  102. ?chkstk1=1
  103. ifdef ?CHKSTKPROC
  104. ??_out <! Private stack checking enabled>
  105. else
  106. ??_out <! Stack checking enabled>
  107. endif
  108. endif
  109. ifndef DOS5
  110. ?DOS5=0
  111. else
  112. ?DOS5=1
  113. ??_out <! DOS5 module>
  114. endif
  115. ifdef ?PROFILE
  116. ??_out <! Native profiling enabled>
  117. endif
  118. else
  119. ASMpass=2
  120. endif
  121. ifdef ?pmd
  122. .286p
  123. endif
  124. if ?386regs
  125. .xcref ?n,?ax,?eax,?bx,?ebx
  126. .xcref ?cx,?ecx,?dx,?edx
  127. .xcref ?si,?esi,?di,?edi,?es,?ds,?fs
  128. .xcref ?gs
  129. else
  130. .xcref ?n,?ax,?ah,?al,?bx,?bh
  131. .xcref ?bl,?cx,?ch,?cl,?dx,?dh
  132. .xcref ?dl,?si,?di,?es,?ds,?bp
  133. .xcref ?sp,?ss,?cs
  134. endif
  135. .xcref ?rsl,?cpd,?argl,?argc,?ba
  136. .xcref ?acb,???,?po
  137. .xcref ?pas,?pc
  138. .xcref uconcat,mpush,mpop
  139. .xcref ?ri,?pp,?pp1,?al1
  140. .xcref ?ad,?ap,?atal,?dd,?dd1,?dd2
  141. .xcref ?pg,?pg1,?aloc,?cs1,?cs2
  142. .xcref ?DF,?TF,?ff,?PLM,?WIN,?ia,?pu,?adj
  143. .xcref ?uf,?rp,?nx,?nd,?nodata1,?chkstk1,?DOS5,?pmd,?lds,?exp
  144. .xcref ?wfp,arg,cCall,cProc,assumes,?cs3,?cs2,?cs1
  145. .xcref defgrp,addseg,createSeg
  146. .xcref save,outif,errnz,errn$,errnz1
  147. .xcref ?PLMPrevParm,?gcc
  148. .xcref ?cCall1,?pcc
  149. ?rsl = 0
  150. ?cpd = 0
  151. ?argl = 0
  152. ?argc = 0
  153. ?ba = 0
  154. ?acb = 0
  155. ??? = 0
  156. ?po = 0
  157. ?pas = 0
  158. ?pc = 0
  159. ?ia = 0
  160. ?pu = 0
  161. ?adj = 0
  162. ?rp = 0
  163. ?uf = 0
  164. ?nd = 0
  165. ?nx = 0
  166. ?wfp = 0
  167. ?lds = 0
  168. ?exp = 0
  169. ?ff = 0
  170. ?dd2 = 0
  171. ?cCall1 = 0
  172. ?pcc = 0
  173. ?PLMPrevParm = 0
  174. .xcref ?casen
  175. if1
  176. ?casen = 0
  177. endif
  178. if ?386regs
  179. ?n = 0000000000000000b
  180. ?ax = 0000000000000001b
  181. ?eax = 0000000000000010b
  182. ?bx = 0000000000000100b
  183. ?ebx = 0000000000001000b
  184. ?cx = 0000000000010000b
  185. ?ecx = 0000000000100000b
  186. ?dx = 0000000001000000b
  187. ?edx = 0000000010000000b
  188. ?si = 0000000100000000b
  189. ?esi = 0000001000000000b
  190. ?di = 0000010000000000b
  191. ?edi = 0000100000000000b
  192. ?ds = 0001000000000000b
  193. ?es = 0010000000000000b
  194. ?fs = 0100000000000000b
  195. ?gs = 1000000000000000b
  196. else
  197. ?n = 0000000000000000b
  198. ?ax = 0000000000000011b
  199. ?ah = 0000000000000001b
  200. ?al = 0000000000000010b
  201. ?bx = 0000000000001100b
  202. ?bh = 0000000000000100b
  203. ?bl = 0000000000001000b
  204. ?cx = 0000000000110000b
  205. ?ch = 0000000000010000b
  206. ?cl = 0000000000100000b
  207. ?dx = 0000000011000000b
  208. ?dh = 0000000001000000b
  209. ?dl = 0000000010000000b
  210. ?si = 0000000100000000b
  211. ?di = 0000001000000000b
  212. ?es = 0000010000000000b
  213. ?ds = 0000100000000000b
  214. ?bp = 0001000000000000b
  215. ?sp = 0010000000000000b
  216. ?ss = 0100000000000000b
  217. ?cs = 1000000000000000b
  218. endif
  219. .cref
  220. uconcat macro a,b,c,d,e,f,g
  221. a&b c&d e&f&g
  222. endm
  223. if ?386regs
  224. mpush macro r
  225. irp x,<ax,eax,bx,ebx,cx,ecx,dx,edx,si,esi,di,edi,ds,es,fs,gs>
  226. if (r and ?&&x)
  227. push x
  228. endif
  229. endm
  230. endm
  231. else
  232. mpush macro r
  233. irp x,<ax,bx,cx,dx,si,di,es,ds,bp,sp,ss,cs>
  234. if (r and ?&&x)
  235. push x
  236. endif
  237. endm
  238. endm
  239. endif
  240. if ?386regs
  241. mpop macro r
  242. irp x,<gs,fs,es,ds,edi,di,esi,si,edx,dx,ecx,cx,ebx,bx,eax,ax>
  243. if (r and ?&&x)
  244. pop x
  245. endif
  246. endm
  247. endm
  248. else
  249. mpop macro r
  250. irp x,<cs,ss,sp,bp,ds,es,di,si,dx,cx,bx,ax>
  251. if (r and ?&&x)
  252. pop x
  253. endif
  254. endm
  255. endm
  256. endif
  257. save macro r
  258. ?rsl=0
  259. ?ri ?rsl,<r>
  260. endm
  261. ?ri macro n,r
  262. irp x,<r>
  263. .ERRNDEF ?&&x
  264. n=n or ?&&x
  265. endm
  266. endm
  267. .xcref
  268. .xcref parmB,parmW,parmD,parmQ,parmT,parmCP,parmDP
  269. .cref
  270. parmB macro n
  271. ?pp <n>,<byte>,2,1
  272. endm
  273. parmW macro n
  274. ?pp <n>,<word>,2,2
  275. endm
  276. parmD macro n
  277. ife ?PLM
  278. irp x,<n>
  279. ?pp <&&x>,<dword>,0,4
  280. ?pp <off_&&x>,<word>,2,2
  281. ?pp <seg_&&x>,<word>,2,2
  282. endm
  283. else
  284. irp x,<n>
  285. ?pp <seg_&&x>,<word>,2,2
  286. ?pp <off_&&x>,<word>,2,2
  287. ?pp <&&x>,<dword>,0,4
  288. endm
  289. endif
  290. endm
  291. parmQ macro n
  292. ?pp <n>,<qword>,8,8
  293. endm
  294. parmT macro n
  295. ?pp <n>,<tbyte>,10,10
  296. endm
  297. if sizec
  298. parmCP macro n
  299. parmD <n>
  300. endm
  301. else
  302. parmCP macro n
  303. parmW <n>
  304. endm
  305. endif
  306. if sized
  307. parmDP macro n
  308. parmD <n>
  309. endm
  310. else
  311. parmDP macro n
  312. parmW <n>
  313. endm
  314. endif
  315. ?pp macro n,t,l,s
  316. if ?cpd
  317. .xcref
  318. irp x,<n>
  319. .xcref ?t&&x
  320. ?t&&x=s
  321. ife ?PLM
  322. ?pp1 x,<t>,,,%(?po+?adj)
  323. ?po=?po+l
  324. else
  325. ?PLMPrevParm=?PLMPrevParm+1
  326. ?po=?po+l
  327. ?pp1 x,<t>,%?po,%?adj,,%?PLMPrevParm,%(?PLMPrevParm-1)
  328. endif
  329. endm
  330. .cref
  331. else
  332. ??error <parm(s) "&n" declared outside proc def>
  333. endif
  334. endm
  335. ?pp1 macro n,t,o,a,b,cpc,ppc
  336. ife ?PLM
  337. n equ (t ptr [bp+b])
  338. else
  339. .xcref
  340. .xcref ?PLMParm&cpc
  341. .cref
  342. ?PLMParm&cpc &macro po
  343. uconcat <n>,,<equ>,,<(t ptr [bp+>,%(a+po-o),<])>
  344. ?PLMParm&ppc po
  345. purge ?PLMParm&cpc
  346. &endm
  347. endif
  348. endm
  349. ifndef ?NOPARMR
  350. if ?pmd
  351. parmR macro n,r,r2
  352. ??error <Sorry: ParmR can't be used with PMODE=1>
  353. endm
  354. else
  355. .xcref
  356. .xcref ?pr,parmR
  357. .cref
  358. parmR macro n,r,r2
  359. ?pr n,r,r2,%?rp,%(?ia+2)
  360. endm
  361. ?pr macro n,r,r2,i,o
  362. .xcref
  363. ifnb <r2>
  364. parmR seg_&n,r
  365. parmR off_&n,r2
  366. n equ (dword ptr [bp-o-2])
  367. .xcref ?t&n
  368. ?t&n=4
  369. else
  370. .xcref ?rp&i
  371. ?rp&i=0
  372. ifdef ?&r
  373. ?rp&i=?&r
  374. endif
  375. if ??? or (?cpd eq 0) or (?rp&i eq 0)
  376. ??error <invalid parmR encountered: &n,&r>
  377. exitm
  378. endif
  379. n equ (word ptr [bp-o])
  380. ?t&n=2
  381. irp x,<bh,ch,dh,bl,cl,dl,ah,al>
  382. if ?&&x eq ?&r
  383. n equ (byte ptr [bp-o])
  384. ?t&n=1
  385. exitm
  386. endif
  387. endm
  388. ?ia=?ia+2
  389. ?rp=?rp+1
  390. endif
  391. .cref
  392. endm
  393. endif
  394. endif
  395. .xcref
  396. .xcref localB,localW,localD,localQ,localT,localCP,localDP,localV
  397. .cref
  398. localB macro n
  399. ?aloc <n>,<byte ptr>,1,1,0
  400. endm
  401. localW macro n
  402. ?aloc <n>,<word ptr>,2,2,1
  403. endm
  404. localD macro n
  405. irp x,<n>
  406. ?aloc <seg_&&x>,<word ptr>,2,2,1
  407. ?aloc <off_&&x>,<word ptr>,2,2,1
  408. ?aloc <&&x>,<dword ptr>,0,4,1
  409. endm
  410. endm
  411. localQ macro n
  412. ?aloc <n>,<qword ptr>,8,8,1
  413. endm
  414. localT macro n
  415. ?aloc <n>,<tbyte ptr>,10,10,1
  416. endm
  417. if sizec
  418. localCP macro n
  419. localD <n>
  420. endm
  421. else
  422. localCP macro n
  423. localW <n>
  424. endm
  425. endif
  426. if sized
  427. localDP macro n
  428. localD <n>
  429. endm
  430. else
  431. localDP macro n
  432. localW <n>
  433. endm
  434. endif
  435. localV macro n,a
  436. ?aloc <n>,,%(a),0,1
  437. endm
  438. ?aloc macro n,t,l,s,a
  439. if ?cpd
  440. .xcref
  441. irp x,<n>
  442. ???=???+l
  443. if a
  444. ???=((??? + 1) and 0fffeh)
  445. endif
  446. ?al1 x,<t>,%(???+?ia)
  447. .xcref ?t&&x
  448. ?t&&x=s
  449. endm
  450. .cref
  451. else
  452. ??error <locals "&n" declared outside procedure def>
  453. endif
  454. endm
  455. ?al1 macro n,t,o
  456. n equ (t [bp-o])
  457. endm
  458. ?gcc macro s,i,cc
  459. s = i
  460. ifnb <cc>
  461. ifidn <cc>,<C>
  462. s=0
  463. endif
  464. ifidn <cc>,<PLM>
  465. s=1
  466. endif
  467. ifidn <cc>,<PASCAL>
  468. s=1
  469. endif
  470. endif
  471. endm
  472. ifndef ?NOGLOBAL
  473. .xcref
  474. .xcref globalB,globalW,globalD,globalQ,globalT,globalCP,globalDP
  475. .cref
  476. globalB macro n,i,s,c
  477. ?ad <n>,1
  478. ?dd n,1,<byte>,<db>,<i>,<s>,<c>
  479. endm
  480. globalW macro n,i,s,c
  481. ?ad <n>,2
  482. ?dd n,1,<word>,<dw>,<i>,<s>,<c>
  483. endm
  484. globalD macro n,i,s,c
  485. ?ad <n>,4
  486. ?dd n,1,<dword>,<dd>,<i>,<s>,<c>
  487. off_&n equ n
  488. seg_&n equ n[2]
  489. endm
  490. globalQ macro n,i,s,c
  491. ?ad <n>,8
  492. ?dd n,1,<qword>,<dq>,<i>,<s>,<c>
  493. endm
  494. globalT macro n,i,s,c
  495. ?ad <n>,10
  496. ?dd n,1,<tbyte>,<dt>,<i>,<s>,<c>
  497. endm
  498. if sizec
  499. globalCP macro n,i,s,c
  500. globalD n,<i>,<s>,<c>
  501. endm
  502. else
  503. globalCP macro n,i,s,c
  504. globalW n,<i>,<s>,<c>
  505. endm
  506. endif
  507. if sized
  508. globalDP macro n,i,s,c
  509. globalD n,<i>,<s>,<c>
  510. endm
  511. else
  512. globalDP macro n,i,s,c
  513. globalW n,<i>,<s>,<c>
  514. endm
  515. endif
  516. endif
  517. ifndef ?NOSTATIC
  518. .xcref
  519. .xcref staticB,staticW,staticD,staticQ,staticT,staticCP,staticDP
  520. .cref
  521. staticB macro n,i,s
  522. ?ad <n>,1
  523. ?dd n,0,<byte>,<db>,<i>,<s>,<PLM>
  524. endm
  525. staticW macro n,i,s
  526. ?ad <n>,2
  527. ?dd n,0,<word>,<dw>,<i>,<s>,<PLM>
  528. endm
  529. staticD macro n,i,s
  530. ?ad <n>,4
  531. ?dd n,0,<dword>,<dd>,<i>,<s>,<PLM>
  532. endm
  533. staticQ macro n,i,s
  534. ?ad <n>,8
  535. ?dd n,0,<qword>,<dq>,<i>,<s>,<PLM>
  536. endm
  537. staticT macro n,i,s
  538. ?ad <n>,10
  539. ?dd n,0,<tbyte>,<dt>,<i>,<s>,<PLM>
  540. endm
  541. if sizec
  542. staticCP macro n,i,s
  543. staticD n,<i>,<s>
  544. endm
  545. else
  546. staticCP macro n,i,s
  547. staticW n,<i>,<s>
  548. endm
  549. endif
  550. if sized
  551. staticDP macro n,i,s
  552. staticD n,<i>,<s>
  553. endm
  554. else
  555. staticDP macro n,i,s
  556. staticW n,<i>,<s>
  557. endm
  558. endif
  559. endif
  560. ?dd macro n,p,t,d,i,s,c
  561. ?gcc ?dd2,%?PLM,<c>
  562. ife ?dd2
  563. n label t
  564. ?dd1 _&n,p,<d>,<i>,<s>
  565. else
  566. ?dd1 n,p,<d>,<i>,<s>
  567. endif
  568. endm
  569. ?dd1 macro n,p,d,i,s
  570. if p
  571. public n
  572. endif
  573. ifb <s>
  574. n d i
  575. else
  576. ifb <i>
  577. n d s dup (?)
  578. else
  579. n d s dup (i)
  580. endif
  581. endif
  582. endm
  583. ifndef ?NOEXTERN
  584. .xcref
  585. .xcref ?ex1,?ex2,externB,externW,externD,externQ,externT
  586. .xcref externNP,externFP,externP,externCP,externDP,externA
  587. .cref
  588. ?ex2 = 0
  589. externA macro n,c
  590. ?ex1 <n>,40h,<abs>,<c>,<>
  591. endm
  592. externB macro n,c
  593. ?ex1 <n>,1,<byte>,<c>,<>
  594. endm
  595. externW macro n,c
  596. ?ex1 <n>,2,<word>,<c>,<>
  597. endm
  598. externD macro n,c
  599. ?ex1 <n>,4,<dword>,<c>,<>
  600. endm
  601. externQ macro n,c
  602. ?ex1 <n>,8,<qword>,<c>,<>
  603. endm
  604. externT macro n,c
  605. ?ex1 <n>,10,<tbyte>,<c>,<>
  606. endm
  607. externNP macro n,c
  608. ?ex1 <n>,2,<near>,<c>,<cc>
  609. endm
  610. externFP macro n,c
  611. ?ex1 <n>,4,<far>,<c>,<cc>
  612. endm
  613. if sizec
  614. externP macro n,c
  615. ?ex1 <n>,4,<far>,<c>,<cc>
  616. endm
  617. else
  618. externP macro n,c
  619. ?ex1 <n>,2,<near>,<c>,<cc>
  620. endm
  621. endif
  622. if sizec
  623. externCP macro n,c
  624. ?ex1 <n>,4,<dword>,<c>,<>
  625. endm
  626. else
  627. externCP macro n,c
  628. ?ex1 <n>,2,<word>,<c>,<>
  629. endm
  630. endif
  631. if sized
  632. externDP macro n,c
  633. ?ex1 <n>,4,<dword>,<c>,<>
  634. endm
  635. else
  636. externDP macro n,c
  637. ?ex1 <n>,2,<word>,<c>,<>
  638. endm
  639. endif
  640. ?ex1 macro n,s,d,c,scv
  641. ?gcc ?ex2,%?PLM,<c>
  642. irp x,<n>
  643. .xcref
  644. .xcref ?t&&x
  645. .cref
  646. ?t&&x=s
  647. ife ?ex2
  648. extrn _&&x:&d
  649. x equ _&&x
  650. else
  651. extrn x:&d
  652. endif
  653. ifidn <scv>,<cc>
  654. .xcref
  655. .xcref ?CC&&x
  656. .cref
  657. ?CC&&x=?ex2
  658. endif
  659. endm
  660. endm
  661. endif
  662. ifndef ?NOLABEL
  663. .xcref
  664. .xcref ?lb1,?lblpu,?lb2
  665. .xcref labelB,labelW,labelD,labelQ,labelT
  666. .xcref labelNP,labelFP,labelP,labelCP,labelDP
  667. .cref
  668. ?lblpu = 0
  669. ?lb2 = 0
  670. labelB macro n,c
  671. ?lb1 <n>,1,<byte>,<c>
  672. endm
  673. labelW macro n,c
  674. ?lb1 <n>,2,<word>,<c>
  675. endm
  676. labelD macro n,c
  677. ?lb1 <n>,4,<dword>,<c>
  678. endm
  679. labelQ macro n,c
  680. ?lb1 <n>,8,<qword>,<c>
  681. endm
  682. labelT macro n,c
  683. ?lb1 <n>,10,<tbyte>,<c>
  684. endm
  685. labelNP macro n,c
  686. ?lb1 <n>,2,<near>,<c>
  687. endm
  688. labelFP macro n,c
  689. ?lb1 <n>,4,<far>,<c>
  690. endm
  691. if sizec
  692. labelP macro n,c
  693. ?lb1 <n>,4,<far>,<c>
  694. endm
  695. else
  696. labelP macro n,c
  697. ?lb1 <n>,2,<near>,<c>
  698. endm
  699. endif
  700. if sizec
  701. labelCP macro n,c
  702. ?lb1 <n>,4,<dword>,<c>
  703. endm
  704. else
  705. labelCP macro n,c
  706. ?lb1 <n>,2,<word>,<c>
  707. endm
  708. endif
  709. if sized
  710. labelDP macro n,c
  711. ?lb1 <n>,4,<dword>,<c>
  712. endm
  713. else
  714. labelDP macro n,c
  715. ?lb1 <n>,2,<word>,<c>
  716. endm
  717. endif
  718. ?lb1 macro n,s,d,c
  719. ?gcc ?lb2,%?PLM,<c>
  720. ?lblpu=0
  721. irp x,<n>
  722. ifidn <x>,<PUBLIC>
  723. ?lblpu=1
  724. else
  725. .xcref
  726. .xcref ?t&&x
  727. .cref
  728. ?t&&x=s
  729. ife ?lb2
  730. if ?lblpu
  731. public _&&x
  732. endif
  733. _&&x label &d
  734. x equ _&&x
  735. else
  736. if ?lblpu
  737. public x
  738. endif
  739. x label &d
  740. endif
  741. endif
  742. endm
  743. endm
  744. endif
  745. ifndef ?NODEF
  746. .xcref
  747. .xcref defB,defW,defD,defQ,defT,defCP,defDP
  748. .cref
  749. defB macro n
  750. ?ad <n>,1
  751. endm
  752. defW macro n
  753. ?ad <n>,2
  754. endm
  755. defD macro n
  756. ?ad <n>,4
  757. endm
  758. defQ macro n
  759. ?ad <n>,8
  760. endm
  761. defT macro n
  762. ?ad <n>,10
  763. endm
  764. if sizec
  765. defCP macro n
  766. defD <n>
  767. endm
  768. else
  769. defCP macro n
  770. defW <n>
  771. endm
  772. endif
  773. if sized
  774. defDP macro n
  775. defD <n>
  776. endm
  777. else
  778. defDP macro n
  779. defW <n>
  780. endm
  781. endif
  782. endif
  783. ?ad macro n,s
  784. irp x,<n>
  785. .xcref
  786. .xcref ?t&&x
  787. .cref
  788. ?t&&x=s
  789. endm
  790. endm
  791. ifndef ?NOPTR
  792. .xcref
  793. .xcref regPtr,farPtr
  794. .cref
  795. regPtr macro n,s,o
  796. farPtr n,s,o
  797. endm
  798. farPtr macro n,s,o
  799. .xcref
  800. .xcref ?t&n
  801. .cref
  802. n &macro
  803. push s
  804. push o
  805. &endm
  806. ?t&n=80h
  807. endm
  808. endif
  809. arg macro a
  810. irp x,<a>
  811. ?argc=?argc+1
  812. ?atal <x>,%?argc
  813. endm
  814. endm
  815. ?atal macro n,i
  816. .xcref
  817. .xcref ?ali&i
  818. .cref
  819. ?ali&i &macro
  820. ?ap n
  821. &endm
  822. endm
  823. ?ap macro n
  824. ?argl=?argl+2
  825. ifdef ?t&n
  826. ife ?t&n-1
  827. push word ptr (n)
  828. exitm
  829. endif
  830. ife ?t&n-2
  831. push n
  832. exitm
  833. endif
  834. ife ?t&n-4
  835. push word ptr (n)[2]
  836. push word ptr (n)
  837. ?argl=?argl+2
  838. exitm
  839. endif
  840. ife ?t&n-8
  841. push word ptr (n)[6]
  842. push word ptr (n)[4]
  843. push word ptr (n)[2]
  844. push word ptr (n)
  845. ?argl=?argl+6
  846. exitm
  847. endif
  848. if ?t&n and 80h
  849. n
  850. ?argl=?argl+2
  851. exitm
  852. endif
  853. ife ?t&n
  854. push word ptr (n)
  855. exitm
  856. endif
  857. endif
  858. push n
  859. endm
  860. cCall macro n,a,c
  861. ifnb <a>
  862. arg <a>
  863. endif
  864. mpush %?rsl
  865. ifdef ?CC&n
  866. ?cCall1=?CC&n
  867. else
  868. ?cCall1=?PLM
  869. endif
  870. ifnb <c>
  871. ?gcc ?cCall1,%?cCall1,<c>
  872. endif
  873. ?argl=0
  874. ife ?cCall1
  875. ?acb=?argc
  876. else
  877. ?acb=1
  878. endif
  879. rept ?argc
  880. uconcat <?ali>,%?acb
  881. uconcat <purge>,,<?ali>,%?acb
  882. ife ?cCall1
  883. ?acb=?acb-1
  884. else
  885. ?acb=?acb+1
  886. endif
  887. endm
  888. call n
  889. if ((?cCall1 eq 0) and (?argl ne 0))
  890. add sp,?argl
  891. endif
  892. mpop %?rsl
  893. ?rsl=0
  894. ?argc= 0
  895. ?argl= 0
  896. endm
  897. cProc macro n,cf,a
  898. if ?cpd
  899. ?utpe
  900. endif
  901. ?cpd=1
  902. ???=0
  903. ?argc=0
  904. ?ba=0
  905. ?po=0
  906. ?pu=0
  907. ?ia=0
  908. ?adj=4
  909. ?rp=0
  910. ?uf=0
  911. ?wfp=?WIN
  912. ?ff=0
  913. ?pas=0
  914. ?pcc=?PLM
  915. ?lds=0
  916. ?exp=0
  917. ifnb <a>
  918. ?ri ?pas,<a>
  919. endif
  920. ?pc=sizec
  921. ?nd=?nodata1
  922. ?nx=0
  923. irp x,<cf>
  924. ifidn <x>,<FAR>
  925. ?pc=1
  926. endif
  927. ifidn <x>,<NEAR>
  928. ?pc=0
  929. endif
  930. ifidn <x>,<PUBLIC>
  931. ?pu=1
  932. endif
  933. ifidn <x>,<SMALL>
  934. ?uf=1
  935. endif
  936. ifidn <x>,<DATA>
  937. ?nd=0
  938. endif
  939. ifidn <x>,<NODATA>
  940. ?nd=1
  941. endif
  942. ifidn <x>,<ATOMIC>
  943. ?nx=1
  944. endif
  945. ifidn <x>,<C>
  946. ?pcc=0
  947. endif
  948. ifidn <x>,<PLM>
  949. ?pcc=1
  950. endif
  951. ifidn <x>,<PASCAL>
  952. ?pcc=1
  953. endif
  954. ifidn <x>,<WIN>
  955. ?wfp=1
  956. endif
  957. ifidn <x>,<NONWIN>
  958. ?wfp=0
  959. endif
  960. ifidn <x>,<LOADDS>
  961. ?lds=1
  962. endif
  963. ifidn <x>,<EXPORTED>
  964. ?exp=1
  965. endif
  966. endm
  967. if ?pcc
  968. ?PLMPrevParm=0
  969. .xcref
  970. .xcref ?PLMParm0
  971. .cref
  972. ?PLMParm0 &macro
  973. purge ?PLMParm0
  974. &endm
  975. endif
  976. .xcref
  977. .xcref ?CC&n
  978. .cref
  979. ?CC&n=?pcc
  980. if (?nx eq 1) and (?nd eq 0)
  981. ?nx = 0
  982. ??error <ATOMIC specified without NODATA - ATOMIC ignored>
  983. endif
  984. if ?pc
  985. if ?wfp+?exp+?lds
  986. ife ?nx
  987. ife ?pmd
  988. ?ia=2
  989. endif
  990. ?pas = ?pas and (not ?ds)
  991. endif
  992. endif
  993. ?adj=?adj+2
  994. else
  995. ?wfp=0
  996. endif
  997. ife ?386regs
  998. ?pas = ?pas and (not (?sp+?cs+?ss))
  999. endif
  1000. if ?uf
  1001. if ?386regs
  1002. ?pas = ?pas and (not (?si+?di))
  1003. else
  1004. ?pas = ?pas and (not (?bp+?si+?di))
  1005. endif
  1006. endif
  1007. ife ?pcc
  1008. ?pg <_&n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
  1009. else
  1010. ?pg <n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
  1011. endif
  1012. endm
  1013. ?pg macro n,p,c,a,w,nnu,cc
  1014. .xcref
  1015. if ?uf
  1016. if ?nd
  1017. ??error <NODATA encountered in &n - user frame ignored>
  1018. ?uf=0
  1019. endif
  1020. endif
  1021. .xcref cBegin
  1022. cBegin &macro g
  1023. .xcref
  1024. if cc
  1025. uconcat <?PLMParm>,%?PLMPrevParm,%?po
  1026. endif
  1027. if ?uf
  1028. if ?rp
  1029. ??error <parmR encountered in &n - user frame ignored>
  1030. ?uf=0
  1031. endif
  1032. endif
  1033. ?pg1 <n>,c,a,%?po,w,%?uf,%?nd,%?rp,cc
  1034. ?cpd=0
  1035. ?argc=0
  1036. ?ba=1
  1037. ???=(???+1) and 0fffeh
  1038. if p
  1039. public n
  1040. endif
  1041. ife c
  1042. n proc near
  1043. else
  1044. n proc far
  1045. endif
  1046. ife cc
  1047. nnu equ n
  1048. endif
  1049. ifidn <g>,<nogen>
  1050. if ???+?po+a+?rp
  1051. ??_out <cBegin - possible invalid use of nogen>
  1052. endif
  1053. else
  1054. if ?uf
  1055. ?mf c,%???,%?po
  1056. mpush a
  1057. else
  1058. if w+?exp+?lds
  1059. if ?pmd
  1060. ife ?nd
  1061. if ?lds
  1062. mov ax,_DATA
  1063. else
  1064. if ?exp
  1065. mov ax,ds
  1066. nop
  1067. endif
  1068. endif
  1069. endif
  1070. ife ?nx
  1071. if ???+?po
  1072. if ?chkstk1
  1073. push bp
  1074. mov bp,sp
  1075. else
  1076. if ???
  1077. enter ???,0
  1078. else
  1079. push bp
  1080. mov bp,sp
  1081. endif
  1082. endif
  1083. endif
  1084. push ds
  1085. if ?lds+?exp
  1086. mov ds,ax
  1087. endif
  1088. else
  1089. if ?ff+???+?po+?rp
  1090. push bp
  1091. mov bp,sp
  1092. endif
  1093. endif
  1094. else
  1095. ife ?nd
  1096. mov ax,ds
  1097. nop
  1098. endif
  1099. ife ?nx
  1100. ife ?DOS5
  1101. inc bp
  1102. endif
  1103. push bp
  1104. mov bp,sp
  1105. push ds
  1106. else
  1107. if ?ff+???+?po+?rp
  1108. push bp
  1109. mov bp,sp
  1110. endif
  1111. endif
  1112. ife ?nd
  1113. mov ds,ax
  1114. endif
  1115. endif
  1116. else
  1117. if ?pmd
  1118. if ?exp
  1119. mov ax,ds
  1120. nop
  1121. else
  1122. if ?lds
  1123. mov ax,_DATA
  1124. endif
  1125. endif
  1126. if ?ff+???+?po+?rp
  1127. if ?chkstk1
  1128. push bp
  1129. mov bp,sp
  1130. else
  1131. if ???
  1132. enter ???,0
  1133. else
  1134. push bp
  1135. mov bp,sp
  1136. endif
  1137. endif
  1138. endif
  1139. if ?exp+?lds
  1140. push ds
  1141. mov ds,ax
  1142. endif
  1143. else
  1144. if ?ff+???+?po+?rp
  1145. push bp
  1146. mov bp,sp
  1147. endif
  1148. endif
  1149. endif
  1150. if ?rp
  1151. ?uf=0
  1152. rept ?rp
  1153. uconcat mpush,,?rp,%?uf
  1154. ?uf=?uf+1
  1155. endm
  1156. endif
  1157. if ???
  1158. if ?chkstk1
  1159. ifdef ?CHKSTKPROC
  1160. ?CHKSTKPROC %???
  1161. else
  1162. mov ax,???
  1163. ife cc
  1164. call _chkstk
  1165. else
  1166. call chkstk
  1167. endif
  1168. endif
  1169. else
  1170. ife ?pmd
  1171. sub sp,???
  1172. endif
  1173. endif
  1174. endif
  1175. mpush a
  1176. endif
  1177. ifdef ?PROFILE
  1178. if c
  1179. call StartNMeas
  1180. endif
  1181. endif
  1182. endif
  1183. .cref
  1184. purge cBegin
  1185. &endm
  1186. .xcref ?utpe
  1187. ?utpe &macro
  1188. ??error <unterminated procedure definition: "&n">
  1189. &endm
  1190. .cref
  1191. endm
  1192. ?pg1 macro n,c,a,o,w,f,d,r,cc
  1193. .xcref
  1194. .xcref cEnd
  1195. cEnd &macro g
  1196. .xcref
  1197. ?ba=0
  1198. ifidn <g>,<nogen>
  1199. if o+a+r
  1200. ??_out <cEnd - possible invalid use of nogen>
  1201. endif
  1202. else
  1203. ifdef ?PROFILE
  1204. if c
  1205. call StopNMeas
  1206. endif
  1207. endif
  1208. mpop a
  1209. if f
  1210. db 0c3h
  1211. else
  1212. if w+?exp+?lds
  1213. if ?pmd
  1214. ife ?nx
  1215. pop ds
  1216. endif
  1217. ife ?nx
  1218. if ?chkstk1+???+?po
  1219. leave
  1220. endif
  1221. else
  1222. if ?ff+???+?po+?rp
  1223. leave
  1224. endif
  1225. endif
  1226. else
  1227. ife ?nx
  1228. if (?TF eq 0) or (???+?rp)
  1229. lea sp,-2[bp]
  1230. endif
  1231. pop ds
  1232. pop bp
  1233. ife ?DOS5
  1234. dec bp
  1235. endif
  1236. else
  1237. if (?TF eq 0) or (???+?rp)
  1238. mov sp,bp
  1239. endif
  1240. if ???+?po+?rp
  1241. pop bp
  1242. endif
  1243. endif
  1244. endif
  1245. else
  1246. if ?pmd
  1247. if ?ff+???+?po+?rp
  1248. leave
  1249. endif
  1250. else
  1251. if ?ff+???+?po+?rp
  1252. if (?TF eq 0) or (???+?rp)
  1253. mov sp,bp
  1254. endif
  1255. pop bp
  1256. endif
  1257. endif
  1258. endif
  1259. ife cc
  1260. ret
  1261. else
  1262. ret o
  1263. endif
  1264. endif
  1265. endif
  1266. n endp
  1267. .cref
  1268. purge cEnd
  1269. &endm
  1270. .cref
  1271. endm
  1272. assumes macro s,ln
  1273. ifndef ln&_assumes
  1274. assume s:ln
  1275. else
  1276. ln&_assumes s
  1277. endif
  1278. endm
  1279. createSeg macro n,ln,a,co,cl,grp
  1280. ifnb <grp>
  1281. addseg grp,n
  1282. else
  1283. ln&OFFSET equ offset n:
  1284. ln&BASE equ n
  1285. ?cs3 <ln>,<n>
  1286. endif
  1287. ifnb <cl>
  1288. n segment a co '&cl'
  1289. else
  1290. n segment a co
  1291. endif
  1292. n ends
  1293. ?cs1 <ln>,<n>
  1294. endm
  1295. addseg macro grp,seg
  1296. .xcref
  1297. .xcref grp&_def
  1298. .cref
  1299. ifndef grp&_def
  1300. grp&_def=0
  1301. endif
  1302. if grp&_def ne ASMpass
  1303. .xcref
  1304. .xcref grp&_add
  1305. .cref
  1306. grp&_add &macro s
  1307. grp&_in <seg>,s
  1308. &endm
  1309. .xcref
  1310. .xcref grp&_in
  1311. .cref
  1312. grp&_in &macro sl,s
  1313. ifb <s>
  1314. grp group sl
  1315. else
  1316. grp&_add &macro ns
  1317. grp&_in <sl,s>,ns
  1318. &endm
  1319. endif
  1320. &endm
  1321. grp&_def=ASMpass
  1322. else
  1323. grp&_add seg
  1324. endif
  1325. endm
  1326. defgrp macro grp,ln
  1327. addseg grp
  1328. ifnb <ln>
  1329. irp x,<ln>
  1330. ?cs3 <&x>,<grp>
  1331. x&&OFFSET equ offset grp:
  1332. x&&BASE equ grp
  1333. endm
  1334. endif
  1335. endm
  1336. ?cs1 macro ln,n
  1337. .xcref
  1338. .xcref ln&_sbegin
  1339. .cref
  1340. ln&_sbegin &macro
  1341. .xcref
  1342. .xcref ?mf
  1343. .cref
  1344. ?mf &&macro c,l,p
  1345. if c
  1346. extrn n&_FARFRAME:near
  1347. call n&_FARFRAME
  1348. else
  1349. extrn n&_NEARFRAME:near
  1350. call n&_NEARFRAME
  1351. endif
  1352. db l shr 1
  1353. db p shr 1
  1354. &&endm
  1355. ?cs2 <ln>,<n>
  1356. n segment
  1357. &endm
  1358. endm
  1359. ?cs2 macro ln,n
  1360. .xcref
  1361. .xcref sEnd
  1362. .cref
  1363. sEnd &macro
  1364. n ends
  1365. purge ?mf
  1366. purge sEnd
  1367. &endm
  1368. endm
  1369. ?cs3 macro ln,n
  1370. .xcref
  1371. .xcref ln&_assumes
  1372. .cref
  1373. ln&_assumes &macro s
  1374. assume s:&n
  1375. &endm
  1376. endm
  1377. .xcref
  1378. .xcref sBegin
  1379. .cref
  1380. sBegin macro ln
  1381. ln&_sbegin
  1382. endm
  1383. ife ?DF
  1384. createSeg _TEXT,Code,word,public,CODE
  1385. ife ?nodata1
  1386. createSeg _DATA,Data,word,public,DATA,DGROUP
  1387. defgrp DGROUP,Data
  1388. endif
  1389. if ?chkstk1
  1390. ifndef ?CHKSTKPROC
  1391. externp <chkstk>
  1392. endif
  1393. endif
  1394. endif
  1395. errnz macro x
  1396. if2
  1397. if x
  1398. errnz1 <x>,%(x)
  1399. endif
  1400. endif
  1401. endm
  1402. errnz1 macro x1,x2
  1403. = *errnz* x1 = x2
  1404. .err
  1405. endm
  1406. errn$ macro l,x
  1407. errnz <offset $ - offset l x>
  1408. endm
  1409. ifdef ?PROFILE
  1410. externFP <StartNMeas,StopNMeas>
  1411. endif
  1412. ELSE ;MASM6
  1413. comment $
  1414. cmacros - assembly macros for interfacing to hhls
  1415. (C)Copyright Microsoft Corp. 1984-1994
  1416. $
  1417. .xcref
  1418. ??CM_Paste macro arg1:req, arg2:req
  1419. exitm <arg1&arg2>
  1420. endm
  1421. .xcref ??_out
  1422. ??_out macro t
  1423. ifndef ?QUIET
  1424. %out t
  1425. endif
  1426. endm
  1427. outif macro name,defval,onmsg,offmsg
  1428. ifndef name
  1429. ifb <defval>
  1430. name=0
  1431. else
  1432. name=defval
  1433. endif
  1434. endif
  1435. if name
  1436. name=1
  1437. ifnb <onmsg>
  1438. ??_out <! onmsg>
  1439. endif
  1440. else
  1441. ifnb <offmsg>
  1442. ??_out <! offmsg>
  1443. endif
  1444. endif
  1445. endm
  1446. .xcref ??error
  1447. ??error macro msg
  1448. %out e r r o r ----- msg
  1449. .err e r r o r ----- msg
  1450. endm
  1451. .xcref ASMpass
  1452. .xcref memS,memM,memL,memC,memH,memMOD,sizec,sized
  1453. ASMpass=1
  1454. ifdef ?SMALL
  1455. memS=1
  1456. endif
  1457. ifdef ?MEDIUM
  1458. memM=1
  1459. endif
  1460. ifdef ?COMPACT
  1461. memC=1
  1462. endif
  1463. ifdef ?LARGE
  1464. memL=1
  1465. endif
  1466. ifdef ?HUGE
  1467. memH=1
  1468. endif
  1469. ??_out <cMacros Version 5.30 - Copyright (c) Microsoft Corp. 1984-1991>
  1470. outif memS,0,<Small Model>
  1471. outif memM,0,<Medium Model>
  1472. outif memL,0,<Large Model>
  1473. outif memC,0,<Compact Model>
  1474. outif memH,0,<Huge Model>
  1475. memMOD= memS + memM + memL + memC + memH
  1476. if memMOD ne 1
  1477. if memMOD eq 0
  1478. memS = 1
  1479. outif memS,0,<Small Model>
  1480. else
  1481. ??error <more than 1 memory model selected>
  1482. endif
  1483. endif
  1484. sizec= memM + memL + memH
  1485. sized= memL + memC + (memH*2)
  1486. outif ?DF,0,<No segments or groups will be defined>
  1487. outif ?TF,0,<Epilog sequences assume valid SP>
  1488. outif ?WIN,1,<Windows support>
  1489. if ?WIN eq 1
  1490. outif ?PLM,1,<>
  1491. else
  1492. outif ?PLM,1,<PL/M calling convention>
  1493. endif
  1494. ifndef ?NODATA
  1495. ?nodata1=0
  1496. else
  1497. ?nodata1=1
  1498. ??_out <! NODATA module>
  1499. endif
  1500. ifndef ?CHKSTK
  1501. ?chkstk1=0
  1502. else
  1503. ?chkstk1=1
  1504. ifdef ?CHKSTKPROC
  1505. ??_out <! Private stack checking enabled>
  1506. else
  1507. ??_out <! Stack checking enabled>
  1508. endif
  1509. endif
  1510. ifndef DOS5
  1511. ?DOS5=0
  1512. else
  1513. ?DOS5=1
  1514. ??_out <! DOS5 module>
  1515. endif
  1516. ifdef ?PROFILE
  1517. ??_out <! Native profiling enabled>
  1518. endif
  1519. .xcref ?n,?ax,?ah,?al,?bx,?bh
  1520. .xcref ?bl,?cx,?ch,?cl,?dx,?dh
  1521. .xcref ?dl,?si,?di,?es,?ds,?bp
  1522. .xcref ?sp,?ss,?cs
  1523. .xcref ?rsl,?cpd,?argl,?argc,?ba
  1524. .xcref ?acb,???,?po
  1525. .xcref ?pas,?pc
  1526. .xcref uconcat,mpush,mpop
  1527. .xcref ?ri,?pp,?pp1,?al1
  1528. .xcref ?ad,?ap,?atal,?dd,?dd1,?dd2
  1529. .xcref ?pg,?pg1,?aloc,?cs1,?cs2
  1530. .xcref ?DF,?TF,?ff,?PLM,?WIN,?ia,?pu,?adj
  1531. .xcref ?uf,?rp,?nx,?nd,?nodata1,?chkstk1,?DOS5
  1532. .xcref ?wfp,arg,cCall,cProc,assumes,?cs3,?cs2,?cs1
  1533. .xcref defgrp,addseg,createSeg
  1534. .xcref save,outif,errnz,errn$,errnz1
  1535. .xcref ?PLMPrevParm,?gcc
  1536. .xcref ?cCall1,?pcc
  1537. ?rsl = 0
  1538. ?cpd = 0
  1539. ?argl = 0
  1540. ?argc = 0
  1541. ?ba = 0
  1542. ?acb = 0
  1543. ??? = 0
  1544. ?po = 0
  1545. ?pas = 0
  1546. ?pc = 0
  1547. ?ia = 0
  1548. ?pu = 0
  1549. ?adj = 0
  1550. ?rp = 0
  1551. ?uf = 0
  1552. ?nd = 0
  1553. ?nx = 0
  1554. ?wfp = 0
  1555. ?ff = 0
  1556. ?dd2 = 0
  1557. ?cCall1 = 0
  1558. ?pcc = ?PLM
  1559. ?PLMPrevParm = 0
  1560. .xcref ?casen
  1561. if1
  1562. ?casen = 0
  1563. endif
  1564. ?n = 0000000000000000b
  1565. ?ax = 0000000000000011b
  1566. ?ah = 0000000000000001b
  1567. ?al = 0000000000000010b
  1568. ?bx = 0000000000001100b
  1569. ?bh = 0000000000000100b
  1570. ?bl = 0000000000001000b
  1571. ?cx = 0000000000110000b
  1572. ?ch = 0000000000010000b
  1573. ?cl = 0000000000100000b
  1574. ?dx = 0000000011000000b
  1575. ?dh = 0000000001000000b
  1576. ?dl = 0000000010000000b
  1577. ?si = 0000000100000000b
  1578. ?di = 0000001000000000b
  1579. ?es = 0000010000000000b
  1580. ?ds = 0000100000000000b
  1581. ?bp = 0001000000000000b
  1582. ?sp = 0010000000000000b
  1583. ?ss = 0100000000000000b
  1584. ?cs = 1000000000000000b
  1585. .cref
  1586. uconcat macro a,b,c,d,e,f,g
  1587. a&b c&d e&f&g
  1588. endm
  1589. mpush macro r
  1590. irp x,<ax,bx,cx,dx,si,di,es,ds,bp,sp,ss,cs>
  1591. if (r and ??CM_Paste(?,x))
  1592. push x
  1593. endif
  1594. endm
  1595. endm
  1596. mpop macro r
  1597. irp x,<cs,ss,sp,bp,ds,es,di,si,dx,cx,bx,ax>
  1598. if (r and ??CM_Paste(?,x))
  1599. pop x
  1600. endif
  1601. endm
  1602. endm
  1603. save macro r
  1604. ?rsl=0
  1605. ?ri ?rsl,<r>
  1606. endm
  1607. ?ri macro n,r
  1608. irp x,<r>
  1609. ifdef ??CM_Paste(?,x)
  1610. n=n or ??CM_Paste(?,x)
  1611. endif
  1612. endm
  1613. endm
  1614. .xcref
  1615. .xcref parmB,parmW,parmD,parmQ,parmT,parmCP,parmDP,parmH
  1616. .cref
  1617. parmB macro n
  1618. ?pp <n>,<byte>,2,1
  1619. endm
  1620. parmW macro n
  1621. ?pp <n>,<word>,2,2
  1622. endm
  1623. parmD macro n
  1624. ife ?pcc
  1625. irp x,<n>
  1626. ?pp <&&x>,<dword>,0,4
  1627. ?pp <off_&&x>,<word>,2,2
  1628. ?pp <seg_&&x>,<word>,2,2
  1629. endm
  1630. else
  1631. irp x,<n>
  1632. ?pp <seg_&&x>,<word>,2,2
  1633. ?pp <off_&&x>,<word>,2,2
  1634. ?pp <&&x>,<dword>,0,4
  1635. endm
  1636. endif
  1637. endm
  1638. parmH macro n
  1639. ?pp <n>,<word>,4,2
  1640. endm
  1641. parmQ macro n
  1642. ?pp <n>,<qword>,8,8
  1643. endm
  1644. parmT macro n
  1645. ?pp <n>,<tbyte>,10,10
  1646. endm
  1647. if sizec
  1648. parmCP macro n
  1649. parmD <n>
  1650. endm
  1651. else
  1652. parmCP macro n
  1653. parmW <n>
  1654. endm
  1655. endif
  1656. if sized
  1657. parmDP macro n
  1658. parmD <n>
  1659. endm
  1660. else
  1661. parmDP macro n
  1662. parmW <n>
  1663. endm
  1664. endif
  1665. ?pp macro n,t,l,s
  1666. if ?cpd
  1667. .xcref
  1668. irp x,<n>
  1669. .xcref ??CM_Paste(?t_,x)
  1670. ??CM_Paste(?t_,x)=s
  1671. ife ?pcc
  1672. ?pp1 x,<t>,,,%(?po+?adj)
  1673. ?po=?po+l
  1674. else
  1675. ?PLMPrevParm=?PLMPrevParm+1
  1676. ?po=?po+l
  1677. ?pp1 x,<t>,%?po,%?adj,,%?PLMPrevParm,%(?PLMPrevParm-1)
  1678. endif
  1679. endm
  1680. .cref
  1681. else
  1682. ??error <parm(s) "&n" declared outside proc def>
  1683. endif
  1684. endm
  1685. ?pp1 macro n,t,o,a,b,cpc,ppc
  1686. ife ?pcc
  1687. n equ (t ptr [bp][+b])
  1688. else
  1689. .xcref
  1690. .xcref ?PLMParm&cpc
  1691. .cref
  1692. ?PLMParm&cpc macro po
  1693. uconcat <n>,,<equ>,,<(t ptr [bp][+>,%(a+po-o),<])>
  1694. ?PLMParm&ppc po
  1695. purge ?PLMParm&cpc
  1696. endm
  1697. endif
  1698. endm
  1699. ifndef ?NOPARMR
  1700. .xcref
  1701. .xcref ?pr,parmR
  1702. .cref
  1703. parmR macro n,r,r2
  1704. ?pr n,r,r2,%?rp,%(?ia+2)
  1705. endm
  1706. ?pr macro n,r,r2,i,o
  1707. .xcref
  1708. ifnb <r2>
  1709. parmR seg_&n,r
  1710. parmR off_&n,r2
  1711. n equ (dword ptr [bp][-o-2])
  1712. .xcref ?t_&n
  1713. ?t_&n=4
  1714. else
  1715. .xcref ?rp&i
  1716. ?rp&i=0
  1717. ifdef ?&r
  1718. ?rp&i=?&r
  1719. endif
  1720. if ??? or (?cpd eq 0) or (?rp&i eq 0)
  1721. ??error <invalid parmR encountered: &n,&r>
  1722. exitm
  1723. endif
  1724. n equ (word ptr [bp][-o])
  1725. .xcref ?t_&n
  1726. ?t_&n=2
  1727. irp x,<bh,ch,dh,bl,cl,dl,ah,al>
  1728. if ??CM_Paste(?,x) eq ??CM_Paste(?,r)
  1729. n equ (byte ptr [bp][-o])
  1730. ??CM_Paste(?t_,n)=1
  1731. exitm
  1732. endif
  1733. endm
  1734. ?ia=?ia+2
  1735. ?rp=?rp+1
  1736. endif
  1737. .cref
  1738. endm
  1739. endif
  1740. .xcref
  1741. .xcref localB,localW,localD,localQ,localT,localCP,localDP,localV
  1742. .cref
  1743. localB macro n
  1744. ?aloc <n>,<byte ptr>,1,1,0
  1745. endm
  1746. localW macro n
  1747. ?aloc <n>,<word ptr>,2,2,1
  1748. endm
  1749. localD macro n
  1750. irp x,<n>
  1751. ?aloc <%??CM_Paste(seg_,x)>,<word ptr>,2,2,1
  1752. ?aloc <%??CM_Paste(off_,x)>,<word ptr>,2,2,1
  1753. ?aloc <&&x>,<dword ptr>,0,4,1
  1754. endm
  1755. endm
  1756. localQ macro n
  1757. ?aloc <n>,<qword ptr>,8,8,1
  1758. endm
  1759. localT macro n
  1760. ?aloc <n>,<tbyte ptr>,10,10,1
  1761. endm
  1762. if sizec
  1763. localCP macro n
  1764. localD <n>
  1765. endm
  1766. else
  1767. localCP macro n
  1768. localW <n>
  1769. endm
  1770. endif
  1771. if sized
  1772. localDP macro n
  1773. localD <n>
  1774. endm
  1775. else
  1776. localDP macro n
  1777. localW <n>
  1778. endm
  1779. endif
  1780. localV macro n,a
  1781. ?aloc <n>,,%(a),0,1
  1782. endm
  1783. ?aloc macro n,t,l,s,a
  1784. if ?cpd
  1785. .xcref
  1786. irp x,<n>
  1787. ???=???+l
  1788. if a
  1789. ???=((??? + 1) and 0fffeh)
  1790. endif
  1791. ?al1 x,<t>,%(???+?ia)
  1792. .xcref ??CM_Paste(?t_,x)
  1793. ??CM_Paste(?t_,x)=s
  1794. endm
  1795. .cref
  1796. else
  1797. ??error <locals "&n" declared outside procedure def>
  1798. endif
  1799. endm
  1800. ?al1 macro n,t,o
  1801. n equ (t [bp][-o])
  1802. endm
  1803. ?gcc macro s,i,cc
  1804. s = i
  1805. ifnb <cc>
  1806. ifidn <cc>,<C>
  1807. s=0
  1808. endif
  1809. ifidn <cc>,<PLM>
  1810. s=1
  1811. endif
  1812. ifidn <cc>,<PASCAL>
  1813. s=1
  1814. endif
  1815. endif
  1816. endm
  1817. ifndef ?NOGLOBAL
  1818. .xcref
  1819. .xcref globalB,globalW,globalD,globalQ,globalT,globalCP,globalDP
  1820. .cref
  1821. globalB macro n,i,s,c
  1822. ?ad <n>,1
  1823. ?dd n,1,<byte>,<db>,<i>,<s>,<c>
  1824. endm
  1825. globalW macro n,i,s,c
  1826. ?ad <n>,2
  1827. ?dd n,1,<word>,<dw>,<i>,<s>,<c>
  1828. endm
  1829. globalD macro n,i,s,c
  1830. ?ad <n>,4
  1831. ?dd n,1,<dword>,<dd>,<i>,<s>,<c>
  1832. off_&n equ word ptr n[0]
  1833. seg_&n equ word ptr n[2]
  1834. endm
  1835. globalQ macro n,i,s,c
  1836. ?ad <n>,8
  1837. ?dd n,1,<qword>,<dq>,<i>,<s>,<c>
  1838. endm
  1839. globalT macro n,i,s,c
  1840. ?ad <n>,10
  1841. ?dd n,1,<tbyte>,<dt>,<i>,<s>,<c>
  1842. endm
  1843. if sizec
  1844. globalCP macro n,i,s,c
  1845. globalD n,<i>,<s>,<c>
  1846. endm
  1847. else
  1848. globalCP macro n,i,s,c
  1849. globalW n,<i>,<s>,<c>
  1850. endm
  1851. endif
  1852. if sized
  1853. globalDP macro n,i,s,c
  1854. globalD n,<i>,<s>,<c>
  1855. endm
  1856. else
  1857. globalDP macro n,i,s,c
  1858. globalW n,<i>,<s>,<c>
  1859. endm
  1860. endif
  1861. endif
  1862. ifndef ?NOSTATIC
  1863. .xcref
  1864. .xcref staticB,staticW,staticD,staticQ,staticT,staticCP,staticDP
  1865. .cref
  1866. staticB macro n,i,s
  1867. ?ad <n>,1
  1868. ?dd n,0,<byte>,<db>,<i>,<s>,<PLM>
  1869. endm
  1870. staticW macro n,i,s
  1871. ?ad <n>,2
  1872. ?dd n,0,<word>,<dw>,<i>,<s>,<PLM>
  1873. endm
  1874. staticD macro n,i,s
  1875. ?ad <n>,4
  1876. ?dd n,0,<dword>,<dd>,<i>,<s>,<PLM>
  1877. endm
  1878. staticQ macro n,i,s
  1879. ?ad <n>,8
  1880. ?dd n,0,<qword>,<dq>,<i>,<s>,<PLM>
  1881. endm
  1882. staticT macro n,i,s
  1883. ?ad <n>,10
  1884. ?dd n,0,<tbyte>,<dt>,<i>,<s>,<PLM>
  1885. endm
  1886. if sizec
  1887. staticCP macro n,i,s
  1888. staticD n,<i>,<s>
  1889. endm
  1890. else
  1891. staticCP macro n,i,s
  1892. staticW n,<i>,<s>
  1893. endm
  1894. endif
  1895. if sized
  1896. staticDP macro n,i,s
  1897. staticD n,<i>,<s>
  1898. endm
  1899. else
  1900. staticDP macro n,i,s
  1901. staticW n,<i>,<s>
  1902. endm
  1903. endif
  1904. endif
  1905. ?dd macro n,p,t,d,i,s,c
  1906. ?gcc ?dd2,%?PLM,<c>
  1907. ife ?dd2
  1908. n label t
  1909. ?dd1 _&n,p,<d>,<i>,<s>
  1910. else
  1911. ?dd1 n,p,<d>,<i>,<s>
  1912. endif
  1913. endm
  1914. ?dd1 macro n,p,d,i,s
  1915. if p
  1916. public n
  1917. endif
  1918. ifb <s>
  1919. n d i
  1920. else
  1921. ifb <i>
  1922. n d s dup (?)
  1923. else
  1924. n d s dup (i)
  1925. endif
  1926. endif
  1927. endm
  1928. ifndef ?NOEXTERN
  1929. .xcref
  1930. .xcref ?ex1,?ex2,externB,externW,externD,externQ,externT
  1931. .xcref externNP,externFP,externP,externCP,externDP,externA
  1932. .cref
  1933. ?ex2 = 0
  1934. externA macro n,c
  1935. ?ex1 <n>,40h,<abs>,<c>,<>
  1936. endm
  1937. externB macro n,c
  1938. ?ex1 <n>,1,<byte>,<c>,<>
  1939. endm
  1940. externW macro n,c
  1941. ?ex1 <n>,2,<word>,<c>,<>
  1942. endm
  1943. externD macro n,c
  1944. ?ex1 <n>,4,<dword>,<c>,<>
  1945. endm
  1946. externQ macro n,c
  1947. ?ex1 <n>,8,<qword>,<c>,<>
  1948. endm
  1949. externT macro n,c
  1950. ?ex1 <n>,10,<tbyte>,<c>,<>
  1951. endm
  1952. externNP macro n,c
  1953. ?ex1 <n>,2,<near>,<c>,<cc>
  1954. endm
  1955. externFP macro n,c
  1956. ?ex1 <n>,4,<far>,<c>,<cc>
  1957. endm
  1958. if sizec
  1959. externP macro n,c
  1960. ?ex1 <n>,4,<far>,<c>,<cc>
  1961. endm
  1962. else
  1963. externP macro n,c
  1964. ?ex1 <n>,2,<near>,<c>,<cc>
  1965. endm
  1966. endif
  1967. if sizec
  1968. externCP macro n,c
  1969. ?ex1 <n>,4,<dword>,<c>,<>
  1970. endm
  1971. else
  1972. externCP macro n,c
  1973. ?ex1 <n>,2,<word>,<c>,<>
  1974. endm
  1975. endif
  1976. if sized
  1977. externDP macro n,c
  1978. ?ex1 <n>,4,<dword>,<c>,<>
  1979. endm
  1980. else
  1981. externDP macro n,c
  1982. ?ex1 <n>,2,<word>,<c>,<>
  1983. endm
  1984. endif
  1985. ?ex1 macro n,s,d,c,scv
  1986. ?gcc ?ex2,%?PLM,<c>
  1987. irp x,<n>
  1988. .xcref
  1989. .xcref ??CM_Paste(?t_,x)
  1990. .cref
  1991. ??CM_Paste(?t_,x)=s
  1992. ife ?ex2
  1993. extrn ??CM_Paste(_,x):&d
  1994. x equ ??CM_Paste(_,x)
  1995. else
  1996. extrn x:&d
  1997. endif
  1998. ifidn <scv>,<cc>
  1999. .xcref
  2000. .xcref ??CM_Paste(?CC,x)
  2001. .cref
  2002. ??CM_Paste(?CC,x)=?ex2
  2003. endif
  2004. endm
  2005. endm
  2006. endif
  2007. ifndef ?NOLABEL
  2008. .xcref
  2009. .xcref ?lb1,?lblpu,?lb2
  2010. .xcref labelB,labelW,labelD,labelQ,labelT
  2011. .xcref labelNP,labelFP,labelP,labelCP,labelDP
  2012. .cref
  2013. ?lblpu = 0
  2014. ?lb2 = 0
  2015. labelB macro n,c
  2016. ?lb1 <n>,1,<byte>,<c>
  2017. endm
  2018. labelW macro n,c
  2019. ?lb1 <n>,2,<word>,<c>
  2020. endm
  2021. labelD macro n,c
  2022. ?lb1 <n>,4,<dword>,<c>
  2023. endm
  2024. labelQ macro n,c
  2025. ?lb1 <n>,8,<qword>,<c>
  2026. endm
  2027. labelT macro n,c
  2028. ?lb1 <n>,10,<tbyte>,<c>
  2029. endm
  2030. labelNP macro n,c
  2031. ?lb1 <n>,2,<near>,<c>
  2032. endm
  2033. labelFP macro n,c
  2034. ?lb1 <n>,4,<far>,<c>
  2035. endm
  2036. if sizec
  2037. labelP macro n,c
  2038. ?lb1 <n>,4,<far>,<c>
  2039. endm
  2040. else
  2041. labelP macro n,c
  2042. ?lb1 <n>,2,<near>,<c>
  2043. endm
  2044. endif
  2045. if sizec
  2046. labelCP macro n,c
  2047. ?lb1 <n>,4,<dword>,<c>
  2048. endm
  2049. else
  2050. labelCP macro n,c
  2051. ?lb1 <n>,2,<word>,<c>
  2052. endm
  2053. endif
  2054. if sized
  2055. labelDP macro n,c
  2056. ?lb1 <n>,4,<dword>,<c>
  2057. endm
  2058. else
  2059. labelDP macro n,c
  2060. ?lb1 <n>,2,<word>,<c>
  2061. endm
  2062. endif
  2063. ?lb1 macro n,s,d,c
  2064. ?gcc ?lb2,%?PLM,<c>
  2065. ?lblpu=0
  2066. irp x,<n>
  2067. ifidn <x>,<PUBLIC>
  2068. ?lblpu=1
  2069. else
  2070. .xcref
  2071. .xcref ??CM_Paste(?t_,x)
  2072. .cref
  2073. ??CM_Paste(?t_,x)=s
  2074. ife ?lb2
  2075. if ?lblpu
  2076. public ??CM_Paste(_,x)
  2077. endif
  2078. ??CM_Paste(_,x) label &d
  2079. x equ ??CM_Paste(_,x)
  2080. else
  2081. if ?lblpu
  2082. public x
  2083. endif
  2084. x label &d
  2085. endif
  2086. endif
  2087. endm
  2088. endm
  2089. endif
  2090. ifndef ?NODEF
  2091. .xcref
  2092. .xcref defB,defW,defD,defQ,defT,defCP,defDP
  2093. .cref
  2094. defB macro n
  2095. ?ad <n>,1
  2096. endm
  2097. defW macro n
  2098. ?ad <n>,2
  2099. endm
  2100. defD macro n
  2101. ?ad <n>,4
  2102. endm
  2103. defQ macro n
  2104. ?ad <n>,8
  2105. endm
  2106. defT macro n
  2107. ?ad <n>,10
  2108. endm
  2109. if sizec
  2110. defCP macro n
  2111. defD <n>
  2112. endm
  2113. else
  2114. defCP macro n
  2115. defW <n>
  2116. endm
  2117. endif
  2118. if sized
  2119. defDP macro n
  2120. defD <n>
  2121. endm
  2122. else
  2123. defDP macro n
  2124. defW <n>
  2125. endm
  2126. endif
  2127. endif
  2128. ?ad macro n,s
  2129. irp x,<n>
  2130. .xcref
  2131. .xcref ??CM_Paste(?t_,x)
  2132. .cref
  2133. ??CM_Paste(?t_,x)=s
  2134. endm
  2135. endm
  2136. ifndef ?NOPTR
  2137. .xcref
  2138. .xcref regPtr,farPtr
  2139. .cref
  2140. regPtr macro n,s,o
  2141. farPtr n,s,o
  2142. endm
  2143. farPtr macro n,s,o
  2144. .xcref
  2145. .xcref ?t_&n
  2146. .cref
  2147. n macro
  2148. push s
  2149. push o
  2150. endm
  2151. ?t_&n=80h
  2152. endm
  2153. endif
  2154. arg macro a
  2155. irp x,<a>
  2156. ?argc=?argc+1
  2157. ?atal <x>,%?argc
  2158. endm
  2159. endm
  2160. ?atal macro n,i
  2161. .xcref
  2162. .xcref ?ali&i
  2163. .cref
  2164. ?ali&i macro
  2165. ?ap <n>
  2166. endm
  2167. endm
  2168. ?ap macro n
  2169. ?argl=?argl+2
  2170. ifdef ?t_&n
  2171. ife ?t_&n-1
  2172. push word ptr (n)
  2173. exitm
  2174. endif
  2175. ife ?t_&n-2
  2176. push n
  2177. exitm
  2178. endif
  2179. ife ?t_&n-4
  2180. push word ptr (n)[2]
  2181. push word ptr (n)
  2182. ?argl=?argl+2
  2183. exitm
  2184. endif
  2185. ife ?t_&n-8
  2186. push word ptr (n)[6]
  2187. push word ptr (n)[4]
  2188. push word ptr (n)[2]
  2189. push word ptr (n)
  2190. ?argl=?argl+6
  2191. exitm
  2192. endif
  2193. if ?t_&n and 80h
  2194. n
  2195. ?argl=?argl+2
  2196. exitm
  2197. endif
  2198. ife ?t_&n
  2199. push word ptr (n)
  2200. exitm
  2201. endif
  2202. endif
  2203. push n
  2204. endm
  2205. cCall macro n,a,c
  2206. ifnb <a>
  2207. arg <a>
  2208. endif
  2209. mpush %?rsl
  2210. ifdef ?CC&n
  2211. ?cCall1=?CC&n
  2212. else
  2213. ?cCall1=?PLM
  2214. endif
  2215. ifnb <c>
  2216. ?gcc ?cCall1,%?cCall1,<c>
  2217. endif
  2218. ?argl=0
  2219. ife ?cCall1
  2220. ?acb=?argc
  2221. else
  2222. ?acb=1
  2223. endif
  2224. rept ?argc
  2225. uconcat <?ali>,%?acb
  2226. uconcat <purge>,,<?ali>,%?acb
  2227. ife ?cCall1
  2228. ?acb=?acb-1
  2229. else
  2230. ?acb=?acb+1
  2231. endif
  2232. endm
  2233. call n
  2234. if ((?cCall1 eq 0) and (?argl ne 0))
  2235. add sp,?argl
  2236. endif
  2237. mpop %?rsl
  2238. ?rsl=0
  2239. ?argc= 0
  2240. ?argl= 0
  2241. endm
  2242. cProc macro n,cf,a
  2243. if ?cpd
  2244. ?utpe
  2245. endif
  2246. ?cpd=1
  2247. ???=0
  2248. ?argc=0
  2249. ?ba=0
  2250. ?po=0
  2251. ?pu=0
  2252. ?ia=0
  2253. ?adj=4
  2254. ?rp=0
  2255. ?uf=0
  2256. ?wfp=?WIN
  2257. ?ff=0
  2258. ?pas=0
  2259. ?pcc=?PLM
  2260. ifnb <a>
  2261. ?ri ?pas,<a>
  2262. endif
  2263. ?pc=sizec
  2264. ?nd=?nodata1
  2265. ?nx=0
  2266. irp x,<cf>
  2267. ifidn <x>,<FAR>
  2268. ?pc=1
  2269. endif
  2270. ifidn <x>,<NEAR>
  2271. ?pc=0
  2272. endif
  2273. ifidn <x>,<PUBLIC>
  2274. ?pu=1
  2275. endif
  2276. ifidn <x>,<SMALL>
  2277. ?uf=1
  2278. endif
  2279. ifidn <x>,<DATA>
  2280. ?nd=0
  2281. endif
  2282. ifidn <x>,<NODATA>
  2283. ?nd=1
  2284. endif
  2285. ifidn <x>,<ATOMIC>
  2286. ?nx=1
  2287. endif
  2288. ifidn <x>,<C>
  2289. ?pcc=0
  2290. endif
  2291. ifidn <x>,<PLM>
  2292. ?pcc=1
  2293. endif
  2294. ifidn <x>,<PASCAL>
  2295. ?pcc=1
  2296. endif
  2297. ifidn <x>,<WIN>
  2298. ?wfp=1
  2299. endif
  2300. ifidn <x>,<NONWIN>
  2301. ?wfp=0
  2302. endif
  2303. endm
  2304. if ?pcc
  2305. ?PLMPrevParm=0
  2306. .xcref
  2307. .xcref ?PLMParm0
  2308. .cref
  2309. ?PLMParm0 macro arg
  2310. purge ?PLMParm0
  2311. endm
  2312. endif
  2313. .xcref
  2314. .xcref ?CC&n
  2315. .cref
  2316. ?CC&n=?pcc
  2317. if (?nx eq 1) and (?nd eq 0)
  2318. ?nx = 0
  2319. ??error <ATOMIC specified without NODATA - ATOMIC ignored>
  2320. endif
  2321. if ?pc
  2322. if ?wfp
  2323. ife ?nx
  2324. ?ia=2
  2325. ?pas = ?pas and (not ?ds)
  2326. endif
  2327. endif
  2328. ?adj=?adj+2
  2329. else
  2330. ?wfp=0
  2331. endif
  2332. ?pas = ?pas and (not (?sp+?cs+?ss))
  2333. if ?uf
  2334. ?pas = ?pas and (not (?bp+?si+?di))
  2335. endif
  2336. ife ?pcc
  2337. ?pg <_&n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
  2338. else
  2339. ?pg <n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
  2340. endif
  2341. endm
  2342. ?pg macro n,p,c,a,w,nnu,cc
  2343. .xcref
  2344. if ?uf
  2345. if ?nd
  2346. ??error <NODATA encountered in &n - user frame ignored>
  2347. ?uf=0
  2348. endif
  2349. endif
  2350. .xcref cBegin
  2351. cBegin macro g
  2352. .xcref
  2353. if cc
  2354. uconcat <?PLMParm>,%?PLMPrevParm,%?po
  2355. endif
  2356. if ?uf
  2357. if ?rp
  2358. ??error <parmR encountered in &n - user frame ignored>
  2359. ?uf=0
  2360. endif
  2361. endif
  2362. ?pg1 <n>,c,a,%?po,w,%?uf,%?nd,%?rp,cc
  2363. ?cpd=0
  2364. ?argc=0
  2365. ?ba=1
  2366. ???=(???+1) and 0fffeh
  2367. if p
  2368. public n
  2369. endif
  2370. ife c
  2371. n proc near
  2372. else
  2373. n proc far
  2374. endif
  2375. ife cc
  2376. nnu equ n
  2377. endif
  2378. ifidn <g>,<nogen>
  2379. if ???+?po+a+?rp
  2380. ??_out <cBegin - possible invalid use of nogen>
  2381. endif
  2382. else
  2383. if ?uf
  2384. ?mf c,%???,%?po
  2385. mpush a
  2386. else
  2387. if w
  2388. ife ?nd
  2389. mov ax,ds
  2390. nop
  2391. endif
  2392. ife ?nx
  2393. ife ?DOS5
  2394. inc bp
  2395. endif
  2396. push bp
  2397. mov bp,sp
  2398. push ds
  2399. else
  2400. if ?ff+???+?po+?rp
  2401. push bp
  2402. mov bp,sp
  2403. endif
  2404. endif
  2405. ife ?nd
  2406. mov ds,ax
  2407. endif
  2408. else
  2409. if ?ff+???+?po+?rp
  2410. push bp
  2411. mov bp,sp
  2412. endif
  2413. endif
  2414. if ?rp
  2415. ?uf=0
  2416. rept ?rp
  2417. uconcat mpush,,?rp,%?uf
  2418. ?uf=?uf+1
  2419. endm
  2420. endif
  2421. if ???
  2422. if ?chkstk1
  2423. ifdef ?CHKSTKPROC
  2424. ?CHKSTKPROC %???
  2425. else
  2426. mov ax,???
  2427. ife cc
  2428. call _chkstk
  2429. else
  2430. call chkstk
  2431. endif
  2432. endif
  2433. else
  2434. sub sp,???
  2435. endif
  2436. endif
  2437. mpush a
  2438. endif
  2439. ifdef ?PROFILE
  2440. if c
  2441. call StartNMeas
  2442. endif
  2443. endif
  2444. endif
  2445. .cref
  2446. purge cBegin
  2447. endm
  2448. .xcref ?utpe
  2449. ?utpe macro
  2450. ??error <unterminated procedure definition: "&n">
  2451. endm
  2452. .cref
  2453. endm
  2454. ?pg1 macro n,c,a,o,w,f,d,r,cc
  2455. .xcref
  2456. .xcref cEnd
  2457. cEnd macro g
  2458. .xcref
  2459. ?ba=0
  2460. ifidn <g>,<nogen>
  2461. if o+a+r
  2462. ??_out <cEnd - possible invalid use of nogen>
  2463. endif
  2464. else
  2465. ifdef ?PROFILE
  2466. if c
  2467. call StopNMeas
  2468. endif
  2469. endif
  2470. mpop a
  2471. if f
  2472. db 0c3h
  2473. else
  2474. if w
  2475. ife ?nx
  2476. if (?TF eq 0) or (???+?rp)
  2477. lea sp,(-2)[bp]
  2478. endif
  2479. pop ds
  2480. pop bp
  2481. ife ?DOS5
  2482. dec bp
  2483. endif
  2484. else
  2485. if (?TF eq 0) or (???+?rp)
  2486. mov sp,bp
  2487. endif
  2488. if ???+?po+?rp
  2489. pop bp
  2490. endif
  2491. endif
  2492. else
  2493. if ?ff+???+?po+?rp
  2494. if (?TF eq 0) or (???+?rp)
  2495. mov sp,bp
  2496. endif
  2497. pop bp
  2498. endif
  2499. endif
  2500. ife cc
  2501. ret
  2502. else
  2503. ret o
  2504. endif
  2505. endif
  2506. endif
  2507. n endp
  2508. .cref
  2509. purge cEnd
  2510. endm
  2511. .cref
  2512. endm
  2513. assumes macro s,ln
  2514. ifdef MS_STARTUP
  2515. ifidn <code>,<ln>
  2516. assume s&:_TEXT
  2517. exitm
  2518. elseifidn <CODE>,<ln>
  2519. assume s&:_TEXT
  2520. exitm
  2521. elseifidn <data>,<ln>
  2522. assume s&:dgroup
  2523. exitm
  2524. elseifidn <DATA>,<ln>
  2525. assume s&:dgroup
  2526. exitm
  2527. endif
  2528. endif
  2529. ifndef ln&_assumes
  2530. assume s:ln
  2531. else
  2532. ln&_assumes s
  2533. endif
  2534. endm
  2535. createSeg macro n,ln,a,co,cl,grp
  2536. ifnb <cl>
  2537. n segment a co '&cl'
  2538. else
  2539. n segment a co
  2540. endif
  2541. n ends
  2542. ?cs1 <ln>,<n>
  2543. ifnb <grp>
  2544. grp group n
  2545. ?cs3 <ln>,<grp>
  2546. ln&OFFSET equ <offset grp:>
  2547. ln&BASE equ <grp>
  2548. else
  2549. ?cs3 <ln>,<n>
  2550. ln&OFFSET equ <offset>
  2551. ln&BASE equ <n>
  2552. endif
  2553. endm
  2554. addseg macro grp,seg
  2555. .xcref
  2556. .xcref grp&_add
  2557. .cref
  2558. grp&_add macro s
  2559. grp&_in <seg>,s
  2560. endm
  2561. .xcref
  2562. .xcref grp&_in
  2563. .cref
  2564. grp&_in macro sl,s
  2565. ifb <s>
  2566. grp group sl
  2567. else
  2568. grp&_add macro ns
  2569. grp&_in <sl,s>,ns
  2570. endm
  2571. endif
  2572. endm
  2573. endm
  2574. defgrp macro grp,ln
  2575. endm
  2576. ?cs1 macro ln,n
  2577. .xcref
  2578. .xcref ln&_sbegin
  2579. .cref
  2580. ln&_sbegin macro
  2581. ?cs2 <ln>,<n>
  2582. n segment
  2583. .xcref
  2584. .xcref ?mf
  2585. .cref
  2586. ?mf macro c,l,p
  2587. if c
  2588. extrn n&_FARFRAME:near
  2589. call n&_FARFRAME
  2590. else
  2591. extrn n&_NEARFRAME:near
  2592. call n&_NEARFRAME
  2593. endif
  2594. db l shr 1
  2595. db p shr 1
  2596. endm
  2597. endm
  2598. endm
  2599. ?cs2 macro ln,n
  2600. .xcref
  2601. .xcref sEnd
  2602. .cref
  2603. sEnd macro arg
  2604. n ends
  2605. purge ?mf
  2606. purge sEnd
  2607. endm
  2608. endm
  2609. ?cs3 macro ln,n
  2610. .xcref
  2611. .xcref ln&_assumes
  2612. .cref
  2613. ln&_assumes macro s
  2614. assume s:&n
  2615. endm
  2616. endm
  2617. .xcref
  2618. .xcref sBegin
  2619. .cref
  2620. sBegin macro ln
  2621. ln&_sbegin
  2622. endm
  2623. ife ?DF
  2624. createSeg _TEXT,Code,word,public,CODE
  2625. ife ?nodata1
  2626. createSeg _DATA,Data,word,public,DATA,DGROUP
  2627. defgrp DGROUP,Data
  2628. endif
  2629. if ?chkstk1
  2630. ifndef ?CHKSTKPROC
  2631. externp <chkstk>
  2632. endif
  2633. endif
  2634. endif
  2635. errnz macro x
  2636. ifnb <x>
  2637. .errnz (x),<x>
  2638. endif
  2639. endm
  2640. errnz1 macro x1,x2
  2641. = *errnz* x1 = x2
  2642. .err
  2643. endm
  2644. errn$ macro l,x
  2645. errnz <offset $ - offset l x>
  2646. endm
  2647. ifdef ?PROFILE
  2648. externFP <StartNMeas,StopNMeas>
  2649. endif
  2650. callcrt MACRO funcname
  2651. ifdef _QC2
  2652. call funcname
  2653. else
  2654. if sizeC
  2655. push cs
  2656. call near ptr (funcname)
  2657. else
  2658. call funcname
  2659. endif
  2660. endif
  2661. ENDM
  2662. .cref
  2663. ENDIF ;MASM6