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.

1230 lines
17 KiB

  1. comment $
  2. cmacros - assembly macros for interfacing to hhls
  3. (C)Copyright Microsoft Corp. 1984-1988
  4. $
  5. .xcref
  6. .xcref ??_out
  7. ??_out macro t
  8. ifndef ?QUIET
  9. %out t
  10. endif
  11. endm
  12. outif macro name,defval,onmsg,offmsg
  13. ifndef name
  14. ifb <defval>
  15. name=0
  16. else
  17. name=defval
  18. endif
  19. endif
  20. if name
  21. name=1
  22. ifnb <onmsg>
  23. ??_out <! onmsg>
  24. endif
  25. else
  26. ifnb <offmsg>
  27. ??_out <! offmsg>
  28. endif
  29. endif
  30. endm
  31. .xcref ??error
  32. ??error macro msg
  33. e r r o r ----- msg
  34. .err
  35. endm
  36. .xcref ASMpass
  37. .xcref memS,memM,memL,memC,memH,memMOD,sizec,sized
  38. if1
  39. ASMpass=1
  40. ifdef ?SMALL
  41. memS=1
  42. endif
  43. ifdef ?MEDIUM
  44. memM=1
  45. endif
  46. ifdef ?COMPACT
  47. memC=1
  48. endif
  49. ifdef ?LARGE
  50. memL=1
  51. endif
  52. ifdef ?HUGE
  53. memH=1
  54. endif
  55. ??_out <cMacros Version 5.20 - Copyright (c) Microsoft Corp. 1984-1988>
  56. outif memS,0,<Small model>
  57. outif memM,0,<Medium model>
  58. outif memL,0,<Large model>
  59. outif memC,0,<Compact model>
  60. outif memH,0,<Huge model>
  61. memMOD= memS + memM + memL + memC + memH
  62. if memMOD ne 1
  63. if memMOD eq 0
  64. memS = 1
  65. else
  66. ??error <more than 1 memory model selected>
  67. endif
  68. endif
  69. sizec= memM + memL + memH
  70. sized= memL + memC + (memH*2)
  71. outif ?DF,0,<No segments or groups will be defined>
  72. outif ?TF,0,<Epilog sequences assume valid SP>
  73. outif ?WIN,1,<Windows support>
  74. if ?WIN eq 1
  75. outif ?PLM,1,<>
  76. else
  77. outif ?PLM,1,<PL/M calling convention>
  78. endif
  79. ifndef ?NODATA
  80. ?nodata1=0
  81. else
  82. ?nodata1=1
  83. ??_out <! NODATA module>
  84. endif
  85. ifndef ?CHKSTK
  86. ?chkstk1=0
  87. else
  88. ?chkstk1=1
  89. ifdef ?CHKSTKPROC
  90. ??_out <! Private stack checking enabled>
  91. else
  92. ??_out <! Stack checking enabled>
  93. endif
  94. endif
  95. ifndef DOS5
  96. ?DOS5=0
  97. else
  98. ?DOS5=1
  99. ??_out <! DOS5 module>
  100. endif
  101. ifdef ?PROFILE
  102. ??_out <! Native profiling enabled>
  103. endif
  104. else
  105. ASMpass=2
  106. endif
  107. .xcref ?n,?ax,?eax,?bx,?ebx
  108. .xcref ?cx,?ecx,?dx,?edx
  109. .xcref ?si,?esi,?di,?edi,?es,?ds,?fs
  110. .xcref ?gs
  111. .xcref ?rsl,?cpd,?argl,?argc,?ba
  112. .xcref ?acb,???,?po
  113. .xcref ?pas,?pc
  114. .xcref uconcat,mpush,mpop
  115. .xcref ?ri,?pp,?pp1,?al1
  116. .xcref ?ad,?ap,?atal,?dd,?dd1,?dd2
  117. .xcref ?pg,?pg1,?aloc,?cs1,?cs2
  118. .xcref ?DF,?TF,?ff,?PLM,?WIN,?ia,?pu,?adj
  119. .xcref ?uf,?rp,?nx,?nd,?nodata1,?chkstk1,?DOS5
  120. .xcref ?wfp,arg,cCall,cProc,assumes,?cs3,?cs2,?cs1
  121. .xcref defgrp,addseg,createSeg
  122. .xcref save,outif,errnz,errn$,errnz1
  123. .xcref ?PLMPrevParm,?gcc
  124. .xcref ?cCall1,?pcc
  125. ?rsl = 0
  126. ?cpd = 0
  127. ?argl = 0
  128. ?argc = 0
  129. ?ba = 0
  130. ?acb = 0
  131. ??? = 0
  132. ?po = 0
  133. ?pas = 0
  134. ?pc = 0
  135. ?ia = 0
  136. ?pu = 0
  137. ?adj = 0
  138. ?rp = 0
  139. ?uf = 0
  140. ?nd = 0
  141. ?nx = 0
  142. ?wfp = 0
  143. ?ff = 0
  144. ?dd2 = 0
  145. ?cCall1 = 0
  146. ?pcc = 0
  147. ?PLMPrevParm = 0
  148. .xcref ?casen
  149. if1
  150. ?casen = 0
  151. endif
  152. ?n = 0000000000000000b
  153. ?ax = 0000000000000001b
  154. ?eax = 0000000000000010b
  155. ?bx = 0000000000000100b
  156. ?ebx = 0000000000001000b
  157. ?cx = 0000000000010000b
  158. ?ecx = 0000000000100000b
  159. ?dx = 0000000001000000b
  160. ?edx = 0000000010000000b
  161. ?si = 0000000100000000b
  162. ?esi = 0000001000000000b
  163. ?di = 0000010000000000b
  164. ?edi = 0000100000000000b
  165. ?ds = 0001000000000000b
  166. ?es = 0010000000000000b
  167. ?fs = 0100000000000000b
  168. ?gs = 1000000000000000b
  169. .cref
  170. uconcat macro a,b,c,d,e,f,g
  171. a&b c&d e&f&g
  172. endm
  173. mpush macro r
  174. irp x,<ax,eax,bx,ebx,cx,ecx,dx,edx,si,esi,di,edi,ds,es,fs,gs>
  175. if (r and ?&&x)
  176. push x
  177. endif
  178. endm
  179. endm
  180. mpop macro r
  181. irp x,<gs,fs,es,ds,edi,di,esi,si,edx,dx,ecx,cx,ebx,bx,eax,ax>
  182. if (r and ?&&x)
  183. pop x
  184. endif
  185. endm
  186. endm
  187. save macro r
  188. ?rsl=0
  189. ?ri ?rsl,<r>
  190. endm
  191. ?ri macro n,r
  192. irp x,<r>
  193. .ERRNDEF ?&&x
  194. n=n or ?&&x
  195. endm
  196. endm
  197. .xcref
  198. .xcref parmB,parmW,parmD,parmQ,parmT,parmCP,parmDP
  199. .cref
  200. parmB macro n
  201. ?pp <n>,<byte>,2,1
  202. endm
  203. parmW macro n
  204. ?pp <n>,<word>,2,2
  205. endm
  206. parmD macro n
  207. ife ?PLM
  208. irp x,<n>
  209. ?pp <&&x>,<dword>,0,4
  210. ?pp <off_&&x>,<word>,2,2
  211. ?pp <seg_&&x>,<word>,2,2
  212. endm
  213. else
  214. irp x,<n>
  215. ?pp <seg_&&x>,<word>,2,2
  216. ?pp <off_&&x>,<word>,2,2
  217. ?pp <&&x>,<dword>,0,4
  218. endm
  219. endif
  220. endm
  221. parmQ macro n
  222. ?pp <n>,<qword>,8,8
  223. endm
  224. parmT macro n
  225. ?pp <n>,<tbyte>,10,10
  226. endm
  227. if sizec
  228. parmCP macro n
  229. parmD <n>
  230. endm
  231. else
  232. parmCP macro n
  233. parmW <n>
  234. endm
  235. endif
  236. if sized
  237. parmDP macro n
  238. parmD <n>
  239. endm
  240. else
  241. parmDP macro n
  242. parmW <n>
  243. endm
  244. endif
  245. ?pp macro n,t,l,s
  246. if ?cpd
  247. .xcref
  248. irp x,<n>
  249. .xcref ?t&&x
  250. ?t&&x=s
  251. ife ?PLM
  252. ?pp1 x,<t>,,,%(?po+?adj)
  253. ?po=?po+l
  254. else
  255. ?PLMPrevParm=?PLMPrevParm+1
  256. ?po=?po+l
  257. ?pp1 x,<t>,%?po,%?adj,,%?PLMPrevParm,%(?PLMPrevParm-1)
  258. endif
  259. endm
  260. .cref
  261. else
  262. ??error <parm(s) "&n" declared outside proc def>
  263. endif
  264. endm
  265. ?pp1 macro n,t,o,a,b,cpc,ppc
  266. ife ?PLM
  267. n equ (t ptr [bp+b])
  268. else
  269. .xcref
  270. .xcref ?PLMParm&cpc
  271. .cref
  272. ?PLMParm&cpc &macro po
  273. uconcat <n>,,<equ>,,<(t ptr [bp+>,%(a+po-o),<])>
  274. ?PLMParm&ppc po
  275. purge ?PLMParm&cpc
  276. &endm
  277. endif
  278. endm
  279. ifndef ?NOPARMR
  280. .xcref
  281. .xcref ?pr,parmR
  282. .cref
  283. parmR macro n,r,r2
  284. ?pr n,r,r2,%?rp,%(?ia+2)
  285. endm
  286. ?pr macro n,r,r2,i,o
  287. .xcref
  288. ifnb <r2>
  289. parmR seg_&n,r
  290. parmR off_&n,r2
  291. n equ (dword ptr [bp-o-2])
  292. .xcref ?t&n
  293. ?t&n=4
  294. else
  295. .xcref ?rp&i
  296. ?rp&i=0
  297. ifdef ?&r
  298. ?rp&i=?&r
  299. endif
  300. if ??? or (?cpd eq 0) or (?rp&i eq 0)
  301. ??error <invalid parmR encountered: &n,&r>
  302. exitm
  303. endif
  304. n equ (word ptr [bp-o])
  305. ?t&n=2
  306. irp x,<bh,ch,dh,bl,cl,dl,ah,al>
  307. if ?&&x eq ?&r
  308. n equ (byte ptr [bp-o])
  309. ?t&n=1
  310. exitm
  311. endif
  312. endm
  313. ?ia=?ia+2
  314. ?rp=?rp+1
  315. endif
  316. .cref
  317. endm
  318. endif
  319. .xcref
  320. .xcref localB,localW,localD,localQ,localT,localCP,localDP,localV
  321. .cref
  322. localB macro n
  323. ?aloc <n>,<byte ptr>,1,1,0
  324. endm
  325. localW macro n
  326. ?aloc <n>,<word ptr>,2,2,1
  327. endm
  328. localD macro n
  329. irp x,<n>
  330. ?aloc <seg_&&x>,<word ptr>,2,2,1
  331. ?aloc <off_&&x>,<word ptr>,2,2,1
  332. ?aloc <&&x>,<dword ptr>,0,4,1
  333. endm
  334. endm
  335. localQ macro n
  336. ?aloc <n>,<qword ptr>,8,8,1
  337. endm
  338. localT macro n
  339. ?aloc <n>,<tbyte ptr>,10,10,1
  340. endm
  341. if sizec
  342. localCP macro n
  343. localD <n>
  344. endm
  345. else
  346. localCP macro n
  347. localW <n>
  348. endm
  349. endif
  350. if sized
  351. localDP macro n
  352. localD <n>
  353. endm
  354. else
  355. localDP macro n
  356. localW <n>
  357. endm
  358. endif
  359. localV macro n,a
  360. ?aloc <n>,,%(a),0,1
  361. endm
  362. ?aloc macro n,t,l,s,a
  363. if ?cpd
  364. .xcref
  365. irp x,<n>
  366. ???=???+l
  367. if a
  368. ???=((??? + 1) and 0fffeh)
  369. endif
  370. ?al1 x,<t>,%(???+?ia)
  371. .xcref ?t&&x
  372. ?t&&x=s
  373. endm
  374. .cref
  375. else
  376. ??error <locals "&n" declared outside procedure def>
  377. endif
  378. endm
  379. ?al1 macro n,t,o
  380. n equ (t [bp-o])
  381. endm
  382. ?gcc macro s,i,cc
  383. s = i
  384. ifnb <cc>
  385. ifidn <cc>,<C>
  386. s=0
  387. endif
  388. ifidn <cc>,<PLM>
  389. s=1
  390. endif
  391. ifidn <cc>,<PASCAL>
  392. s=1
  393. endif
  394. endif
  395. endm
  396. ifndef ?NOGLOBAL
  397. .xcref
  398. .xcref globalB,globalW,globalD,globalQ,globalT,globalCP,globalDP
  399. .cref
  400. globalB macro n,i,s,c
  401. ?ad <n>,1
  402. ?dd n,1,<byte>,<db>,<i>,<s>,<c>
  403. endm
  404. globalW macro n,i,s,c
  405. ?ad <n>,2
  406. ?dd n,1,<word>,<dw>,<i>,<s>,<c>
  407. endm
  408. globalD macro n,i,s,c
  409. ?ad <n>,4
  410. ?dd n,1,<dword>,<dd>,<i>,<s>,<c>
  411. off_&n equ n
  412. seg_&n equ n[2]
  413. endm
  414. globalQ macro n,i,s,c
  415. ?ad <n>,8
  416. ?dd n,1,<qword>,<dq>,<i>,<s>,<c>
  417. endm
  418. globalT macro n,i,s,c
  419. ?ad <n>,10
  420. ?dd n,1,<tbyte>,<dt>,<i>,<s>,<c>
  421. endm
  422. if sizec
  423. globalCP macro n,i,s,c
  424. globalD n,<i>,<s>,<c>
  425. endm
  426. else
  427. globalCP macro n,i,s,c
  428. globalW n,<i>,<s>,<c>
  429. endm
  430. endif
  431. if sized
  432. globalDP macro n,i,s,c
  433. globalD n,<i>,<s>,<c>
  434. endm
  435. else
  436. globalDP macro n,i,s,c
  437. globalW n,<i>,<s>,<c>
  438. endm
  439. endif
  440. endif
  441. ifndef ?NOSTATIC
  442. .xcref
  443. .xcref staticB,staticW,staticD,staticQ,staticT,staticCP,staticDP
  444. .cref
  445. staticB macro n,i,s
  446. ?ad <n>,1
  447. ?dd n,0,<byte>,<db>,<i>,<s>,<PLM>
  448. endm
  449. staticW macro n,i,s
  450. ?ad <n>,2
  451. ?dd n,0,<word>,<dw>,<i>,<s>,<PLM>
  452. endm
  453. staticD macro n,i,s
  454. ?ad <n>,4
  455. ?dd n,0,<dword>,<dd>,<i>,<s>,<PLM>
  456. endm
  457. staticQ macro n,i,s
  458. ?ad <n>,8
  459. ?dd n,0,<qword>,<dq>,<i>,<s>,<PLM>
  460. endm
  461. staticT macro n,i,s
  462. ?ad <n>,10
  463. ?dd n,0,<tbyte>,<dt>,<i>,<s>,<PLM>
  464. endm
  465. if sizec
  466. staticCP macro n,i,s
  467. staticD n,<i>,<s>
  468. endm
  469. else
  470. staticCP macro n,i,s
  471. staticW n,<i>,<s>
  472. endm
  473. endif
  474. if sized
  475. staticDP macro n,i,s
  476. staticD n,<i>,<s>
  477. endm
  478. else
  479. staticDP macro n,i,s
  480. staticW n,<i>,<s>
  481. endm
  482. endif
  483. endif
  484. ?dd macro n,p,t,d,i,s,c
  485. ?gcc ?dd2,%?PLM,<c>
  486. ife ?dd2
  487. n label t
  488. ?dd1 _&n,p,<d>,<i>,<s>
  489. else
  490. ?dd1 n,p,<d>,<i>,<s>
  491. endif
  492. endm
  493. ?dd1 macro n,p,d,i,s
  494. if p
  495. public n
  496. endif
  497. ifb <s>
  498. n d i
  499. else
  500. ifb <i>
  501. n d s dup (?)
  502. else
  503. n d s dup (i)
  504. endif
  505. endif
  506. endm
  507. ifndef ?NOEXTERN
  508. .xcref
  509. .xcref ?ex1,?ex2,externB,externW,externD,externQ,externT
  510. .xcref externNP,externFP,externP,externCP,externDP,externA
  511. .cref
  512. ?ex2 = 0
  513. externA macro n,c
  514. ?ex1 <n>,40h,<abs>,<c>,<>
  515. endm
  516. externB macro n,c
  517. ?ex1 <n>,1,<byte>,<c>,<>
  518. endm
  519. externW macro n,c
  520. ?ex1 <n>,2,<word>,<c>,<>
  521. endm
  522. externD macro n,c
  523. ?ex1 <n>,4,<dword>,<c>,<>
  524. endm
  525. externQ macro n,c
  526. ?ex1 <n>,8,<qword>,<c>,<>
  527. endm
  528. externT macro n,c
  529. ?ex1 <n>,10,<tbyte>,<c>,<>
  530. endm
  531. externNP macro n,c
  532. ?ex1 <n>,2,<near>,<c>,<cc>
  533. endm
  534. externFP macro n,c
  535. ?ex1 <n>,4,<far>,<c>,<cc>
  536. endm
  537. if sizec
  538. externP macro n,c
  539. ?ex1 <n>,4,<far>,<c>,<cc>
  540. endm
  541. else
  542. externP macro n,c
  543. ?ex1 <n>,2,<near>,<c>,<cc>
  544. endm
  545. endif
  546. if sizec
  547. externCP macro n,c
  548. ?ex1 <n>,4,<dword>,<c>,<>
  549. endm
  550. else
  551. externCP macro n,c
  552. ?ex1 <n>,2,<word>,<c>,<>
  553. endm
  554. endif
  555. if sized
  556. externDP macro n,c
  557. ?ex1 <n>,4,<dword>,<c>,<>
  558. endm
  559. else
  560. externDP macro n,c
  561. ?ex1 <n>,2,<word>,<c>,<>
  562. endm
  563. endif
  564. ?ex1 macro n,s,d,c,scv
  565. ?gcc ?ex2,%?PLM,<c>
  566. irp x,<n>
  567. .xcref
  568. .xcref ?t&&x
  569. .cref
  570. ?t&&x=s
  571. ife ?ex2
  572. extrn _&&x:&d
  573. x equ _&&x
  574. else
  575. extrn x:&d
  576. endif
  577. ifidn <scv>,<cc>
  578. .xcref
  579. .xcref ?CC&&x
  580. .cref
  581. ?CC&&x=?ex2
  582. endif
  583. endm
  584. endm
  585. endif
  586. ifndef ?NOLABEL
  587. .xcref
  588. .xcref ?lb1,?lblpu,?lb2
  589. .xcref labelB,labelW,labelD,labelQ,labelT
  590. .xcref labelNP,labelFP,labelP,labelCP,labelDP
  591. .cref
  592. ?lblpu = 0
  593. ?lb2 = 0
  594. labelB macro n,c
  595. ?lb1 <n>,1,<byte>,<c>
  596. endm
  597. labelW macro n,c
  598. ?lb1 <n>,2,<word>,<c>
  599. endm
  600. labelD macro n,c
  601. ?lb1 <n>,4,<dword>,<c>
  602. endm
  603. labelQ macro n,c
  604. ?lb1 <n>,8,<qword>,<c>
  605. endm
  606. labelT macro n,c
  607. ?lb1 <n>,10,<tbyte>,<c>
  608. endm
  609. labelNP macro n,c
  610. ?lb1 <n>,2,<near>,<c>
  611. endm
  612. labelFP macro n,c
  613. ?lb1 <n>,4,<far>,<c>
  614. endm
  615. if sizec
  616. labelP macro n,c
  617. ?lb1 <n>,4,<far>,<c>
  618. endm
  619. else
  620. labelP macro n,c
  621. ?lb1 <n>,2,<near>,<c>
  622. endm
  623. endif
  624. if sizec
  625. labelCP macro n,c
  626. ?lb1 <n>,4,<dword>,<c>
  627. endm
  628. else
  629. labelCP macro n,c
  630. ?lb1 <n>,2,<word>,<c>
  631. endm
  632. endif
  633. if sized
  634. labelDP macro n,c
  635. ?lb1 <n>,4,<dword>,<c>
  636. endm
  637. else
  638. labelDP macro n,c
  639. ?lb1 <n>,2,<word>,<c>
  640. endm
  641. endif
  642. ?lb1 macro n,s,d,c
  643. ?gcc ?lb2,%?PLM,<c>
  644. ?lblpu=0
  645. irp x,<n>
  646. ifidn <x>,<PUBLIC>
  647. ?lblpu=1
  648. else
  649. .xcref
  650. .xcref ?t&&x
  651. .cref
  652. ?t&&x=s
  653. ife ?lb2
  654. if ?lblpu
  655. public _&&x
  656. endif
  657. _&&x label &d
  658. x equ _&&x
  659. else
  660. if ?lblpu
  661. public x
  662. endif
  663. x label &d
  664. endif
  665. endif
  666. endm
  667. endm
  668. endif
  669. ifndef ?NODEF
  670. .xcref
  671. .xcref defB,defW,defD,defQ,defT,defCP,defDP
  672. .cref
  673. defB macro n
  674. ?ad <n>,1
  675. endm
  676. defW macro n
  677. ?ad <n>,2
  678. endm
  679. defD macro n
  680. ?ad <n>,4
  681. endm
  682. defQ macro n
  683. ?ad <n>,8
  684. endm
  685. defT macro n
  686. ?ad <n>,10
  687. endm
  688. if sizec
  689. defCP macro n
  690. defD <n>
  691. endm
  692. else
  693. defCP macro n
  694. defW <n>
  695. endm
  696. endif
  697. if sized
  698. defDP macro n
  699. defD <n>
  700. endm
  701. else
  702. defDP macro n
  703. defW <n>
  704. endm
  705. endif
  706. endif
  707. ?ad macro n,s
  708. irp x,<n>
  709. .xcref
  710. .xcref ?t&&x
  711. .cref
  712. ?t&&x=s
  713. endm
  714. endm
  715. ifndef ?NOPTR
  716. .xcref
  717. .xcref regPtr,farPtr
  718. .cref
  719. regPtr macro n,s,o
  720. farPtr n,s,o
  721. endm
  722. farPtr macro n,s,o
  723. .xcref
  724. .xcref ?t&n
  725. .cref
  726. n &macro
  727. push s
  728. push o
  729. &endm
  730. ?t&n=80h
  731. endm
  732. endif
  733. arg macro a
  734. irp x,<a>
  735. ?argc=?argc+1
  736. ?atal <x>,%?argc
  737. endm
  738. endm
  739. ?atal macro n,i
  740. .xcref
  741. .xcref ?ali&i
  742. .cref
  743. ?ali&i &macro
  744. ?ap n
  745. &endm
  746. endm
  747. ?ap macro n
  748. ?argl=?argl+2
  749. ifdef ?t&n
  750. ife ?t&n-1
  751. push word ptr (n)
  752. exitm
  753. endif
  754. ife ?t&n-2
  755. push n
  756. exitm
  757. endif
  758. ife ?t&n-4
  759. push word ptr (n)[2]
  760. push word ptr (n)
  761. ?argl=?argl+2
  762. exitm
  763. endif
  764. ife ?t&n-8
  765. push word ptr (n)[6]
  766. push word ptr (n)[4]
  767. push word ptr (n)[2]
  768. push word ptr (n)
  769. ?argl=?argl+6
  770. exitm
  771. endif
  772. if ?t&n and 80h
  773. n
  774. ?argl=?argl+2
  775. exitm
  776. endif
  777. ife ?t&n
  778. push word ptr (n)
  779. exitm
  780. endif
  781. endif
  782. push n
  783. endm
  784. cCall macro n,a,c
  785. ifnb <a>
  786. arg <a>
  787. endif
  788. mpush %?rsl
  789. ifdef ?CC&n
  790. ?cCall1=?CC&n
  791. else
  792. ?cCall1=?PLM
  793. endif
  794. ifnb <c>
  795. ?gcc ?cCall1,%?cCall1,<c>
  796. endif
  797. ?argl=0
  798. ife ?cCall1
  799. ?acb=?argc
  800. else
  801. ?acb=1
  802. endif
  803. rept ?argc
  804. uconcat <?ali>,%?acb
  805. uconcat <purge>,,<?ali>,%?acb
  806. ife ?cCall1
  807. ?acb=?acb-1
  808. else
  809. ?acb=?acb+1
  810. endif
  811. endm
  812. call n
  813. if ((?cCall1 eq 0) and (?argl ne 0))
  814. add sp,?argl
  815. endif
  816. mpop %?rsl
  817. ?rsl=0
  818. ?argc= 0
  819. ?argl= 0
  820. endm
  821. cProc macro n,cf,a
  822. if ?cpd
  823. ?utpe
  824. endif
  825. ?cpd=1
  826. ???=0
  827. ?argc=0
  828. ?ba=0
  829. ?po=0
  830. ?pu=0
  831. ?ia=0
  832. ?adj=4
  833. ?rp=0
  834. ?uf=0
  835. ?wfp=?WIN
  836. ?ff=0
  837. ?pas=0
  838. ?pcc=?PLM
  839. ifnb <a>
  840. ?ri ?pas,<a>
  841. endif
  842. ?pc=sizec
  843. ?nd=?nodata1
  844. ?nx=0
  845. irp x,<cf>
  846. ifidn <x>,<FAR>
  847. ?pc=1
  848. endif
  849. ifidn <x>,<NEAR>
  850. ?pc=0
  851. endif
  852. ifidn <x>,<PUBLIC>
  853. ?pu=1
  854. endif
  855. ifidn <x>,<SMALL>
  856. ?uf=1
  857. endif
  858. ifidn <x>,<DATA>
  859. ?nd=0
  860. endif
  861. ifidn <x>,<NODATA>
  862. ?nd=1
  863. endif
  864. ifidn <x>,<ATOMIC>
  865. ?nx=1
  866. endif
  867. ifidn <x>,<C>
  868. ?pcc=0
  869. endif
  870. ifidn <x>,<PLM>
  871. ?pcc=1
  872. endif
  873. ifidn <x>,<PASCAL>
  874. ?pcc=1
  875. endif
  876. ifidn <x>,<WIN>
  877. ?wfp=1
  878. endif
  879. ifidn <x>,<NONWIN>
  880. ?wfp=0
  881. endif
  882. endm
  883. if ?pcc
  884. ?PLMPrevParm=0
  885. .xcref
  886. .xcref ?PLMParm0
  887. .cref
  888. ?PLMParm0 &macro
  889. purge ?PLMParm0
  890. &endm
  891. endif
  892. .xcref
  893. .xcref ?CC&n
  894. .cref
  895. ?CC&n=?pcc
  896. if (?nx eq 1) and (?nd eq 0)
  897. ?nx = 0
  898. ??error <ATOMIC specified without NODATA - ATOMIC ignored>
  899. endif
  900. if ?pc
  901. if ?wfp
  902. ife ?nx
  903. ?ia=2
  904. ?pas = ?pas and (not ?ds)
  905. endif
  906. endif
  907. ?adj=?adj+2
  908. else
  909. ?wfp=0
  910. endif
  911. if ?uf
  912. ?pas = ?pas and (not (?si+?di))
  913. endif
  914. ife ?pcc
  915. ?pg <_&n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
  916. else
  917. ?pg <n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
  918. endif
  919. endm
  920. ?pg macro n,p,c,a,w,nnu,cc
  921. .xcref
  922. if ?uf
  923. if ?nd
  924. ??error <NODATA encountered in &n - user frame ignored>
  925. ?uf=0
  926. endif
  927. endif
  928. .xcref cBegin
  929. cBegin &macro g
  930. .xcref
  931. if cc
  932. uconcat <?PLMParm>,%?PLMPrevParm,%?po
  933. endif
  934. if ?uf
  935. if ?rp
  936. ??error <parmR encountered in &n - user frame ignored>
  937. ?uf=0
  938. endif
  939. endif
  940. ?pg1 <n>,c,a,%?po,w,%?uf,%?nd,%?rp,cc
  941. ?cpd=0
  942. ?argc=0
  943. ?ba=1
  944. ???=(???+1) and 0fffeh
  945. if p
  946. public n
  947. endif
  948. ife c
  949. n proc near
  950. else
  951. n proc far
  952. endif
  953. ife cc
  954. nnu equ n
  955. endif
  956. ifidn <g>,<nogen>
  957. if ???+?po+a+?rp
  958. ??_out <cBegin - possible invalid use of nogen>
  959. endif
  960. else
  961. if ?uf
  962. ?mf c,%???,%?po
  963. mpush a
  964. else
  965. if w
  966. ife ?nd
  967. mov ax,ds
  968. nop
  969. endif
  970. ife ?nx
  971. ife ?DOS5
  972. inc bp
  973. endif
  974. push bp
  975. mov bp,sp
  976. push ds
  977. else
  978. if ?ff+???+?po+?rp
  979. push bp
  980. mov bp,sp
  981. endif
  982. endif
  983. ife ?nd
  984. mov ds,ax
  985. endif
  986. else
  987. if ?ff+???+?po+?rp
  988. push bp
  989. mov bp,sp
  990. endif
  991. endif
  992. if ?rp
  993. ?uf=0
  994. rept ?rp
  995. uconcat mpush,,?rp,%?uf
  996. ?uf=?uf+1
  997. endm
  998. endif
  999. if ???
  1000. if ?chkstk1
  1001. ifdef ?CHKSTKPROC
  1002. ?CHKSTKPROC %???
  1003. else
  1004. mov ax,???
  1005. ife cc
  1006. call _chkstk
  1007. else
  1008. call chkstk
  1009. endif
  1010. endif
  1011. else
  1012. sub sp,???
  1013. endif
  1014. endif
  1015. mpush a
  1016. endif
  1017. ifdef ?PROFILE
  1018. if c
  1019. call StartNMeas
  1020. endif
  1021. endif
  1022. endif
  1023. .cref
  1024. purge cBegin
  1025. &endm
  1026. .xcref ?utpe
  1027. ?utpe &macro
  1028. ??error <unterminated procedure definition: "&n">
  1029. &endm
  1030. .cref
  1031. endm
  1032. ?pg1 macro n,c,a,o,w,f,d,r,cc
  1033. .xcref
  1034. .xcref cEnd
  1035. cEnd &macro g
  1036. .xcref
  1037. ?ba=0
  1038. ifidn <g>,<nogen>
  1039. if o+a+r
  1040. ??_out <cEnd - possible invalid use of nogen>
  1041. endif
  1042. else
  1043. ifdef ?PROFILE
  1044. if c
  1045. call StopNMeas
  1046. endif
  1047. endif
  1048. mpop a
  1049. if f
  1050. db 0c3h
  1051. else
  1052. if w
  1053. ife ?nx
  1054. if (?TF eq 0) or (???+?rp)
  1055. lea sp,-2[bp]
  1056. endif
  1057. pop ds
  1058. pop bp
  1059. ife ?DOS5
  1060. dec bp
  1061. endif
  1062. else
  1063. if (?TF eq 0) or (???+?rp)
  1064. mov sp,bp
  1065. endif
  1066. if ???+?po+?rp
  1067. pop bp
  1068. endif
  1069. endif
  1070. else
  1071. if ?ff+???+?po+?rp
  1072. if (?TF eq 0) or (???+?rp)
  1073. mov sp,bp
  1074. endif
  1075. pop bp
  1076. endif
  1077. endif
  1078. ife cc
  1079. ret
  1080. else
  1081. ret o
  1082. endif
  1083. endif
  1084. endif
  1085. n endp
  1086. .cref
  1087. purge cEnd
  1088. &endm
  1089. .cref
  1090. endm
  1091. assumes macro s,ln
  1092. ifndef ln&_assumes
  1093. assume s:ln
  1094. else
  1095. ln&_assumes s
  1096. endif
  1097. endm
  1098. createSeg macro n,ln,a,co,cl,grp
  1099. ifnb <grp>
  1100. addseg grp,n
  1101. else
  1102. ln&OFFSET equ offset n:
  1103. ln&BASE equ n
  1104. ?cs3 <ln>,<n>
  1105. endif
  1106. ifnb <cl>
  1107. n segment a co '&cl'
  1108. else
  1109. n segment a co
  1110. endif
  1111. n ends
  1112. ?cs1 <ln>,<n>
  1113. endm
  1114. addseg macro grp,seg
  1115. .xcref
  1116. .xcref grp&_def
  1117. .cref
  1118. ifndef grp&_def
  1119. grp&_def=0
  1120. endif
  1121. if grp&_def ne ASMpass
  1122. .xcref
  1123. .xcref grp&_add
  1124. .cref
  1125. grp&_add &macro s
  1126. grp&_in <seg>,s
  1127. &endm
  1128. .xcref
  1129. .xcref grp&_in
  1130. .cref
  1131. grp&_in &macro sl,s
  1132. ifb <s>
  1133. grp group sl
  1134. else
  1135. grp&_add &macro ns
  1136. grp&_in <sl,s>,ns
  1137. &endm
  1138. endif
  1139. &endm
  1140. grp&_def=ASMpass
  1141. else
  1142. grp&_add seg
  1143. endif
  1144. endm
  1145. defgrp macro grp,ln
  1146. addseg grp
  1147. ifnb <ln>
  1148. irp x,<ln>
  1149. ?cs3 <&x>,<grp>
  1150. x&&OFFSET equ offset grp:
  1151. x&&BASE equ grp
  1152. endm
  1153. endif
  1154. endm
  1155. ?cs1 macro ln,n
  1156. .xcref
  1157. .xcref ln&_sbegin
  1158. .cref
  1159. ln&_sbegin &macro
  1160. .xcref
  1161. .xcref ?mf
  1162. .cref
  1163. ?mf &&macro c,l,p
  1164. if c
  1165. extrn n&_FARFRAME:near
  1166. call n&_FARFRAME
  1167. else
  1168. extrn n&_NEARFRAME:near
  1169. call n&_NEARFRAME
  1170. endif
  1171. db l shr 1
  1172. db p shr 1
  1173. &&endm
  1174. ?cs2 <ln>,<n>
  1175. n segment
  1176. &endm
  1177. endm
  1178. ?cs2 macro ln,n
  1179. .xcref
  1180. .xcref sEnd
  1181. .cref
  1182. sEnd &macro
  1183. n ends
  1184. purge ?mf
  1185. purge sEnd
  1186. &endm
  1187. endm
  1188. ?cs3 macro ln,n
  1189. .xcref
  1190. .xcref ln&_assumes
  1191. .cref
  1192. ln&_assumes &macro s
  1193. assume s:&n
  1194. &endm
  1195. endm
  1196. .xcref
  1197. .xcref sBegin
  1198. .cref
  1199. sBegin macro ln
  1200. ln&_sbegin
  1201. endm
  1202. ife ?DF
  1203. createSeg _TEXT,Code,word,public,CODE
  1204. ife ?nodata1
  1205. createSeg _DATA,Data,word,public,DATA,DGROUP
  1206. defgrp DGROUP,Data
  1207. endif
  1208. if ?chkstk1
  1209. ifndef ?CHKSTKPROC
  1210. externp <chkstk>
  1211. endif
  1212. endif
  1213. endif
  1214. errnz macro x
  1215. if2
  1216. if x
  1217. errnz1 <x>,%(x)
  1218. endif
  1219. endif
  1220. endm
  1221. errnz1 macro x1,x2
  1222. = *errnz* x1 = x2
  1223. .err
  1224. endm
  1225. errn$ macro l,x
  1226. errnz <offset $ - offset l x>
  1227. endm
  1228. ifdef ?PROFILE
  1229. externFP <StartNMeas,StopNMeas>
  1230. endif