home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v2.zip / DDKX86 / DBCSDD / INC / CMACROS.INC < prev    next >
Text File  |  1995-04-14  |  25KB  |  1,747 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  4. ;
  5. ;    The following IBM OS/2 WARP source code is provided to you solely for
  6. ;    the purpose of assisting you in your development of OS/2 WARP device
  7. ;    drivers. You may use this code in accordance with the IBM License
  8. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  9. ;    Copyright statement may not be removed.;
  10. ;*****************************************************************************/
  11. ;       SCCSID = @(#)cmacros.inc    6.1 90/11/16
  12. comment $
  13. cmacros - assembly macros for interfacing to hhls
  14. (C)Copyright Microsoft Corp. 1984-1990
  15. $
  16. .xcref
  17. .xcref ??_out
  18. ??_out macro t
  19. ifndef ?QUIET
  20. %out t
  21. endif
  22. endm
  23. outif macro name,defval,onmsg,offmsg
  24. ifndef name
  25. ifb <defval>
  26. name=0
  27. else
  28. name=defval
  29. endif
  30. endif
  31. if name
  32. name=1
  33. ifnb <onmsg>
  34. ??_out <! onmsg>
  35. endif
  36. else
  37. ifnb <offmsg>
  38. ??_out <! offmsg>
  39. endif
  40. endif
  41. endm
  42. .xcref ??error
  43. ??error macro msg
  44. %out e r r o r ----- msg
  45. .err e r r o r ----- msg
  46. endm
  47. .xcref ??error2
  48. ??error2 macro msg
  49. if2
  50. %out e r r o r ----- msg
  51. .err e r r o r ----- msg
  52. endif
  53. endm
  54. .xcref ?sps,?ps,?rps
  55. ?ps=0
  56. ?sps macro
  57. ?ps=@Cpu
  58. endm
  59. ?rps macro
  60. if ?ps and 80h
  61. if ?ps and 08h
  62. .386P
  63. else
  64. if ?ps and 04h
  65. .286P
  66. else
  67. ??error2 <Internal error -- illegal CpuMode>
  68. endif
  69. endif
  70. else
  71. if ?ps and 08h
  72. .386
  73. else
  74. if ?ps and 04h
  75. .286
  76. else
  77. if ?ps and 02h
  78. .186
  79. else
  80. if ?ps and 01h
  81. .8086
  82. else
  83. ??error2 <Internal error -- illegal CpuMode>
  84. endif
  85. endif
  86. endif
  87. endif
  88. endif
  89. if ?ps and 800h
  90. .387
  91. else
  92. if ?ps and 400h
  93. .287
  94. else
  95. if ?ps and 100h
  96. .8087
  97. else
  98. ??error2 <Internal error -- illegal CpuMode>
  99. endif
  100. endif
  101. endif
  102. endm
  103. .xcref ASMpass
  104. .xcref memS,memM,memL,memC,memH,memMOD,sizec,sized
  105. if1
  106. ASMpass=1
  107. ifdef ?SMALL
  108. memS=1
  109. endif
  110. ifdef ?MEDIUM
  111. memM=1
  112. endif
  113. ifdef ?COMPACT
  114. memC=1
  115. endif
  116. ifdef ?LARGE
  117. memL=1
  118. endif
  119. ifdef ?HUGE
  120. memH=1
  121. endif
  122. ??_out <cMacros Version 3.08 - 01/15/90>
  123. ??_out <Copyright (C) Microsoft Corp. 1984-1990. All rights reserved.>
  124. outif memS,0,<Small Model>
  125. outif memM,0,<Medium model>
  126. outif memL,0,<Large Model>
  127. outif memC,0,<Compact Model>
  128. outif memH,0,<Huge Model>
  129. memMOD= memS + memM + memL + memC + memH
  130. if memMOD ne 1
  131. if memMOD eq 0
  132. memS = 1
  133. outif memS,0,<Small model>
  134. else
  135. ??error <must have only 1 memory model selected>
  136. endif
  137. endif
  138. sizec= memM + memL + memH
  139. sized= memL + memC + (memH*2)
  140. outif ?DF,0,<No segments or groups will be defined>
  141. outif ?TF,0,<Epilog sequences assume valid SP>
  142. outif ?WIN,1,<Windows support>
  143. outif ?PLM,1,<PL/M calling convention>
  144. ifndef ?NODATA
  145. ?nodata1=0
  146. else
  147. ?nodata1=1
  148. ??_out <! NODATA module>
  149. endif
  150. ifndef ?CHKSTK
  151. ?chkstk1=0
  152. else
  153. ?chkstk1=1
  154. ifdef ?CHKSTKPROC
  155. ??_out <! Private stack checking enabled>
  156. else
  157. ??_out <! Stack checking enabled>
  158. endif
  159. endif
  160. ifndef DOS5
  161. ?DOS5=0
  162. else
  163. ?DOS5=1
  164. ??_out <! DOS5 module>
  165. endif
  166. ifdef ?PROFILE
  167. ??_out <! Native profiling enabled>
  168. endif
  169. ifdef ATTRPROF
  170. ??_out <! Attributed profiling enabled>
  171. ?aprof1=1
  172. else
  173. ?aprof1=0
  174. endif
  175. ifndef ?NO_BP
  176. ?no_bp1=0
  177. else
  178. ?no_bp1=1
  179. ??_out <! NO_BP is default>
  180. endif
  181. ifndef ?REG32
  182. ?bigreg=0
  183. else
  184. ?bigreg=1
  185. ??_out <! 32-bit registers recognized.>
  186. endif
  187. ifndef ?ENTER
  188. ?enter1=0
  189. else
  190. ?enter1=1
  191. ??_out <! ENTER/LEAVE module>
  192. endif
  193. ifdef ?USE32
  194. ?u32=1
  195. .xcref ?u32
  196. endif
  197. ifdef ?USE16
  198. ?u32=0
  199. .xcref ?u32
  200. endif
  201. else
  202. ASMpass=2
  203. endif
  204. .xcref ?n,?ax,?ah,?al,?bx,?bh
  205. .xcref ?bl,?cx,?ch,?cl,?dx,?dh
  206. .xcref ?dl,?si,?di,?es,?ds,?bp
  207. .xcref ?sp,?ss,?cs
  208. .xcref ?n,?AX,?AH,?AL,?BX,?BH
  209. .xcref ?BL,?CX,?CH,?CL,?DX,?DH
  210. .xcref ?DL,?SI,?DI,?ES,?DS,?BP
  211. .xcref ?SP,?SS,?CS
  212. if ?bigreg
  213. .xcref ?eax,?ebx,?ecx,?edx,?esi,?edi
  214. .xcref ?ebp,?esp,?fs,?gs
  215. .xcref ?EAX,?EBX,?ECX,?EDX,?ESI,?EDI
  216. .xcref ?EBP,?ESP,?FS,?GS
  217. endif
  218. .xcref ?rsl,?cpd,?argl,?argc,?ba
  219. .xcref ?acb,???,?po
  220. .xcref ?pas,?pc
  221. .xcref uconcat,mpush,mpop
  222. .xcref ?ri,?pp,?pp1,?al1
  223. .xcref ?ad,?ap,?atal,?dd,?dd1,?dd2
  224. .xcref ?pg,?pg1,?aloc,?cs1,?cs2
  225. .xcref ?DF,?TF,?ff,?PLM,?WIN,?ia,?pu,?adj
  226. .xcref ?uf,?rp,?nx,?nd,?nodata1,?chkstk1,?aprof1,?aprof2,?DOS5
  227. .xcref ?wfp,arg,cCall,cProc,assumes,?cs3,?cs2,?cs1
  228. .xcref defgrp,addseg,createSeg
  229. .xcref save,outif,errnz,errn$,errnz1
  230. .xcref ?PLMPrevParm,?gcc
  231. .xcref ?cCall1,?pcc,?no_bp1,?no_bp2,?bigreg,?enter1
  232. .xcref ?cbe,?pcbe
  233. ?rsl = 0
  234. ?cpd = 0
  235. ?argl = 0
  236. ?argc = 0
  237. ?ba = 0
  238. ?acb = 0
  239. ??? = 0
  240. ?po = 0
  241. ?pas = 0
  242. ?pc = 0
  243. ?ia = 0
  244. ?pu = 0
  245. ?adj = 0
  246. ?rp = 0
  247. ?uf = 0
  248. ?nd = 0
  249. ?ent = 0
  250. ?nx = 0
  251. ?wfp = 0
  252. ?ff = 0
  253. ?dd2 = 0
  254. ?cCall1 = 0
  255. ?pcc = ?PLM
  256. ?PLMPrevParm = 0
  257. ?no_bp2 = ?no_bp1
  258. ?cbe = 0
  259. ?aprof2 = 0
  260. .xcref ?casen
  261. if1
  262. ?casen = 0
  263. endif
  264. ?n = 0000000000000000b
  265. ?ax = 0000000000000011b
  266. ?ah = 0000000000000001b
  267. ?al = 0000000000000010b
  268. ?bx = 0000000000001100b
  269. ?bh = 0000000000000100b
  270. ?bl = 0000000000001000b
  271. ?cx = 0000000000110000b
  272. ?ch = 0000000000010000b
  273. ?cl = 0000000000100000b
  274. ?dx = 0000000011000000b
  275. ?dh = 0000000001000000b
  276. ?dl = 0000000010000000b
  277. ?si = 0000000100000000b
  278. ?di = 0000001000000000b
  279. ?es = 0000010000000000b
  280. ?ds = 0000100000000000b
  281. ?bp = 0001000000000000b
  282. ?sp = 0010000000000000b
  283. ?ss = 0100000000000000b
  284. ?cs = 1000000000000000b
  285. if ?bigreg
  286. ?sps
  287. .386p
  288. ?eax = 10000000000000000b
  289. ?ebx = 100000000000000000b
  290. ?ecx = 1000000000000000000b
  291. ?edx = 10000000000000000000b
  292. ?esi = 100000000000000000000b
  293. ?edi = 1000000000000000000000b
  294. ?ebp = 10000000000000000000000b
  295. ?esp = 100000000000000000000000b
  296. ?fs = 1000000000000000000000000b
  297. ?gs = 10000000000000000000000000b
  298. ?rps
  299. endif
  300. ?AX = 0000000000000011b
  301. ?AH = 0000000000000001b
  302. ?AL = 0000000000000010b
  303. ?BX = 0000000000001100b
  304. ?BH = 0000000000000100b
  305. ?BL = 0000000000001000b
  306. ?CX = 0000000000110000b
  307. ?CH = 0000000000010000b
  308. ?CL = 0000000000100000b
  309. ?DX = 0000000011000000b
  310. ?DH = 0000000001000000b
  311. ?DL = 0000000010000000b
  312. ?SI = 0000000100000000b
  313. ?DI = 0000001000000000b
  314. ?ES = 0000010000000000b
  315. ?DS = 0000100000000000b
  316. ?BP = 0001000000000000b
  317. ?SP = 0010000000000000b
  318. ?SS = 0100000000000000b
  319. ?CS = 1000000000000000b
  320. if ?bigreg
  321. ?sps
  322. .386p
  323. ?EAX = 10000000000000000b
  324. ?EBX = 100000000000000000b
  325. ?ECX = 1000000000000000000b
  326. ?EDX = 10000000000000000000b
  327. ?ESI = 100000000000000000000b
  328. ?EDI = 1000000000000000000000b
  329. ?EBP = 10000000000000000000000b
  330. ?ESP = 100000000000000000000000b
  331. ?FS = 1000000000000000000000000b
  332. ?GS = 10000000000000000000000000b
  333. ?rps
  334. endif
  335. .cref
  336. uconcat macro a,b,c,d,e,f,g
  337. a&b c&d e&f&g
  338. endm
  339. mpush macro r
  340. if ?bigreg
  341. ?sps
  342. .386p
  343. irp x,<ax,bx,cx,dx,si,di,bp,sp>
  344. if (r and ?e&&x)
  345.     push    e&&x
  346. else
  347. if (r and ?&&x)
  348.     push    x
  349. endif
  350. endif
  351. endm
  352. irp x,<es,ds,ss,cs,fs,gs>
  353. if (r and ?&&x)
  354.     push    x
  355. endif
  356. endm
  357. ?rps
  358. else
  359. irp x,<ax,bx,cx,dx,si,di,es,ds,bp,sp,ss,cs>
  360. if (r and ?&&x)
  361.     push    x
  362. endif
  363. endm
  364. endif
  365. endm
  366. mpop macro r
  367. if ?bigreg
  368. ?sps
  369. .386p
  370. irp x,<gs,fs,cs,ss,ds,es>
  371. if (r and ?&&x)
  372.     pop    x
  373. endif
  374. endm
  375. irp x,<sp,bp,di,si,dx,cx,bx,ax>
  376. if (r and ?e&&x)
  377.     pop    e&&x
  378. else
  379. if (r and ?&&x)
  380.     pop    x
  381. endif
  382. endif
  383. endm
  384. ?rps
  385. else
  386. irp x,<cs,ss,sp,bp,ds,es,di,si,dx,cx,bx,ax>
  387. if (r and ?&&x)
  388.     pop    x
  389. endif
  390. endm
  391. endif
  392. endm
  393. save macro r
  394. ?rsl=0
  395. ?ri ?rsl,<r>
  396. endm
  397. ?ri macro n,r
  398. irp x,<r>
  399. ifdef ?&&x
  400. n=n or ?&&x
  401. else
  402. ??error2 <unknown register x>
  403. .err
  404. endif
  405. endm
  406. endm
  407. .xcref
  408. .xcref parmB,parmW,parmD,parmQ,parmT,parmCP,parmDP,parmH
  409. .cref
  410. parmB macro n
  411. ?pp <n>,<byte>,2,1
  412. endm
  413. parmW macro n
  414. ?pp <n>,<word>,2,2
  415. endm
  416. parmD macro n
  417. ife ?pcc
  418. irp x,<n>
  419. ?pp <&&x>,<dword>,0,4
  420. ?pp <off_&&x>,<word>,2,2
  421. ?pp <seg_&&x>,<word>,2,2
  422. endm
  423. else
  424. irp x,<n>
  425. ?pp <seg_&&x>,<word>,2,2
  426. ?pp <off_&&x>,<word>,2,2
  427. ?pp <&&x>,<dword>,0,4
  428. endm
  429. endif
  430. endm
  431. parmH macro n
  432. ?pp <n>,<word>,4,2
  433. endm
  434. parmQ macro n
  435. ?pp <n>,<qword>,8,8
  436. endm
  437. parmT macro n
  438. ?pp <n>,<tbyte>,10,10
  439. endm
  440. if sizec
  441. parmCP macro n
  442. parmD <n>
  443. endm
  444. else
  445. parmCP macro n
  446. parmW <n>
  447. endm
  448. endif
  449. if sized
  450. parmDP macro n
  451. parmD <n>
  452. endm
  453. else
  454. parmDP macro n
  455. parmW <n>
  456. endm
  457. endif
  458. ?pp macro n,t,l,s
  459. if ?cpd
  460. .xcref
  461. irp x,<n>
  462. .xcref ?t_&&x
  463. ?t_&&x=s
  464. ife ?pcc
  465. ?pp1 x,<t>,,,%(?po+?adj)
  466. ?po=?po+l
  467. else
  468. ?PLMPrevParm=?PLMPrevParm+1
  469. ?po=?po+l
  470. ?pp1 x,<t>,%?po,%?adj,,%?PLMPrevParm,%(?PLMPrevParm-1)
  471. endif
  472. endm
  473. .cref
  474. else
  475. ??error2 <parm(s) "&n" declared outside proc def>
  476. endif
  477. endm
  478. ?pp1 macro n,t,o,a,b,cpc,ppc
  479. ife ?pcc
  480. if ?no_bp2
  481. n equ (t ptr [+b])
  482. else
  483. n equ (t ptr [bp][+b])
  484. endif
  485. else
  486. .xcref
  487. .xcref ?PLMParm&cpc
  488. .cref
  489. if ?no_bp2
  490. ?PLMParm&cpc ¯o po
  491. uconcat <n>,,<equ>,,<(t ptr [+>,%(a+po-o),<])>
  492. ?PLMParm&ppc po
  493. purge ?PLMParm&cpc
  494. &endm
  495. else
  496. ?PLMParm&cpc ¯o po
  497. uconcat <n>,,<equ>,,<(t ptr [bp][+>,%(a+po-o),<])>
  498. ?PLMParm&ppc po
  499. purge ?PLMParm&cpc
  500. &endm
  501. endif
  502. endif
  503. endm
  504. ifndef ?NOPARMR
  505. .xcref
  506. .xcref ?pr,parmR
  507. .cref
  508. parmR macro n,r,r2
  509. ?pr n,r,r2,%?rp,%(?ia+2)
  510. endm
  511. ?pr macro n,r,r2,i,o
  512. .xcref
  513. ifnb <r2>
  514. parmR seg_&n,r
  515. parmR off_&n,r2
  516. if ?no_bp2
  517. n equ (dword ptr [-o-2])
  518. else
  519. n equ (dword ptr [bp][-o-2])
  520. endif
  521. .xcref ?t_&n
  522. ?t_&n=4
  523. else
  524. .xcref ?rp&i
  525. ?rp&i=0
  526. ifdef ?&r
  527. ?rp&i=?&r
  528. endif
  529. if ??? or (?cpd eq 0) or (?rp&i eq 0)
  530. ??error2 <invalid parmR encountered: &n,&r>
  531. exitm
  532. endif
  533. if ?no_bp2
  534. n equ (word ptr [-o])
  535. else
  536. n equ (word ptr [bp][-o])
  537. endif
  538. .xcref ?t_&n
  539. ?t_&n=2
  540. irp x,<bh,ch,dh,bl,cl,dl,ah,al>
  541. if ?&&x eq ?&r
  542. if ?no_bp2
  543. n equ (byte ptr [-o])
  544. else
  545. n equ (byte ptr [bp][-o])
  546. endif
  547. ?t_&n=1
  548. exitm
  549. endif
  550. endm
  551. ?ia=?ia+2
  552. ?rp=?rp+1
  553. endif
  554. .cref
  555. endm
  556. endif
  557. .xcref
  558. .xcref localB,localW,localD,localQ,localT,localCP,localDP,localV
  559. .cref
  560. localB macro n
  561. ?aloc <n>,<byte ptr>,1,1,0
  562. endm
  563. localW macro n
  564. ?aloc <n>,<word ptr>,2,2,1
  565. endm
  566. localD macro n
  567. irp x,<n>
  568. ?aloc <seg_&&x>,<word ptr>,2,2,1
  569. ?aloc <off_&&x>,<word ptr>,2,2,1
  570. ?aloc <&&x>,<dword ptr>,0,4,1
  571. endm
  572. endm
  573. localQ macro n
  574. ?aloc <n>,<qword ptr>,8,8,1
  575. endm
  576. localT macro n
  577. ?aloc <n>,<tbyte ptr>,10,10,1
  578. endm
  579. if sizec
  580. localCP macro n
  581. localD <n>
  582. endm
  583. else
  584. localCP macro n
  585. localW <n>
  586. endm
  587. endif
  588. if sized
  589. localDP macro n
  590. localD <n>
  591. endm
  592. else
  593. localDP macro n
  594. localW <n>
  595. endm
  596. endif
  597. localV macro n,a
  598. ?aloc <n>,,%(a),0,1
  599. endm
  600. ?aloc macro n,t,l,s,a
  601. if ?cpd
  602. .xcref
  603. irp x,<n>
  604. ???=???+l
  605. if a
  606. ???=((??? + 1) and 0fffeh)
  607. endif
  608. ?al1 x,<t>,%(???+?ia)
  609. .xcref ?t_&&x
  610. ?t_&&x=s
  611. endm
  612. .cref
  613. else
  614. ??error2 <locals "&n" declared outside procedure def>
  615. endif
  616. endm
  617. ?al1 macro n,t,o
  618. if ?no_bp2
  619. n equ (t [-o])
  620. else
  621. n equ (t [bp][-o])
  622. endif
  623. endm
  624. ?gcc macro s,i,cc
  625. s = i
  626. ifnb <cc>
  627. ifidn <cc>,<C>
  628. s=0
  629. endif
  630. ifidn <cc>,<PLM>
  631. s=1
  632. endif
  633. ifidn <cc>,<PASCAL>
  634. s=1
  635. endif
  636. endif
  637. endm
  638. ifndef ?NOGLOBAL
  639. .xcref
  640. .xcref globalB,globalW,globalD,globalQ,globalT,globalCP,globalDP
  641. .cref
  642. globalB macro n,i,s,c
  643. ?ad <n>,1
  644. ?dd n,1,<byte>,<db>,<i>,<s>,<c>
  645. endm
  646. globalW macro n,i,s,c
  647. ?ad <n>,2
  648. ?dd n,1,<word>,<dw>,<i>,<s>,<c>
  649. endm
  650. globalD macro n,i,s,c
  651. ?ad <n>,4
  652. ?dd n,1,<dword>,<dd>,<i>,<s>,<c>
  653. off_&n equ word ptr n[0]
  654. seg_&n equ word ptr n[2]
  655. endm
  656. globalQ macro n,i,s,c
  657. ?ad <n>,8
  658. ?dd n,1,<qword>,<dq>,<i>,<s>,<c>
  659. endm
  660. globalT macro n,i,s,c
  661. ?ad <n>,10
  662. ?dd n,1,<tbyte>,<dt>,<i>,<s>,<c>
  663. endm
  664. if sizec
  665. globalCP macro n,i,s,c
  666. globalD n,<i>,<s>,<c>
  667. endm
  668. else
  669. globalCP macro n,i,s,c
  670. globalW n,<i>,<s>,<c>
  671. endm
  672. endif
  673. if sized
  674. globalDP macro n,i,s,c
  675. globalD n,<i>,<s>,<c>
  676. endm
  677. else
  678. globalDP macro n,i,s,c
  679. globalW n,<i>,<s>,<c>
  680. endm
  681. endif
  682. endif
  683. ifndef ?NOSTATIC
  684. .xcref
  685. .xcref staticB,staticW,staticD,staticQ,staticT,staticCP,staticDP
  686. .cref
  687. staticB macro n,i,s
  688. ?ad <n>,1
  689. ?dd n,0,<byte>,<db>,<i>,<s>,<PLM>
  690. endm
  691. staticW macro n,i,s
  692. ?ad <n>,2
  693. ?dd n,0,<word>,<dw>,<i>,<s>,<PLM>
  694. endm
  695. staticD macro n,i,s
  696. ?ad <n>,4
  697. ?dd n,0,<dword>,<dd>,<i>,<s>,<PLM>
  698. endm
  699. staticQ macro n,i,s
  700. ?ad <n>,8
  701. ?dd n,0,<qword>,<dq>,<i>,<s>,<PLM>
  702. endm
  703. staticT macro n,i,s
  704. ?ad <n>,10
  705. ?dd n,0,<tbyte>,<dt>,<i>,<s>,<PLM>
  706. endm
  707. if sizec
  708. staticCP macro n,i,s
  709. staticD n,<i>,<s>
  710. endm
  711. else
  712. staticCP macro n,i,s
  713. staticW n,<i>,<s>
  714. endm
  715. endif
  716. if sized
  717. staticDP macro n,i,s
  718. staticD n,<i>,<s>
  719. endm
  720. else
  721. staticDP macro n,i,s
  722. staticW n,<i>,<s>
  723. endm
  724. endif
  725. endif
  726. ?dd macro n,p,t,d,i,s,c
  727. ?gcc ?dd2,%?PLM,<c>
  728. ife ?dd2
  729. n label t
  730. ?dd1 _&n,p,<d>,<i>,<s>
  731. else
  732. ?dd1 n,p,<d>,<i>,<s>
  733. endif
  734. endm
  735. ?dd1 macro n,p,d,i,s
  736. if p
  737. public n
  738. endif
  739. ifb <s>
  740. n d i
  741. else
  742. ifb <i>
  743. n d s dup (?)
  744. else
  745. n d s dup (i)
  746. endif
  747. endif
  748. endm
  749. ifndef ?NOEXTERN
  750. .xcref
  751. .xcref ?ex1,?ex2,externB,externW,externD,externQ,externT
  752. .xcref externNP,externFP,externP,externCP,externDP,externA
  753. .cref
  754. ?ex2 = 0
  755. externA macro n,c
  756. ?ex1 <n>,40h,<abs>,<c>,<>
  757. endm
  758. externB macro n,c
  759. ?ex1 <n>,1,<byte>,<c>,<>
  760. endm
  761. externW macro n,c
  762. ?ex1 <n>,2,<word>,<c>,<>
  763. endm
  764. externD macro n,c
  765. ?ex1 <n>,4,<dword>,<c>,<>
  766. endm
  767. externQ macro n,c
  768. ?ex1 <n>,8,<qword>,<c>,<>
  769. endm
  770. externT macro n,c
  771. ?ex1 <n>,10,<tbyte>,<c>,<>
  772. endm
  773. externNP macro n,c
  774. ?ex1 <n>,2,<near>,<c>,<cc>
  775. endm
  776. externFP macro n,c
  777. ?ex1 <n>,4,<far>,<c>,<cc>
  778. endm
  779. if sizec
  780. externP macro n,c
  781. ?ex1 <n>,4,<far>,<c>,<cc>
  782. endm
  783. else
  784. externP macro n,c
  785. ?ex1 <n>,2,<near>,<c>,<cc>
  786. endm
  787. endif
  788. if sizec
  789. externCP macro n,c
  790. ?ex1 <n>,4,<dword>,<c>,<>
  791. endm
  792. else
  793. externCP macro n,c
  794. ?ex1 <n>,2,<word>,<c>,<>
  795. endm
  796. endif
  797. if sized
  798. externDP macro n,c
  799. ?ex1 <n>,4,<dword>,<c>,<>
  800. endm
  801. else
  802. externDP macro n,c
  803. ?ex1 <n>,2,<word>,<c>,<>
  804. endm
  805. endif
  806. ?ex1 macro n,s,d,c,scv
  807. ?gcc ?ex2,%?PLM,<c>
  808. irp x,<n>
  809. .xcref
  810. .xcref ?t_&&x
  811. .cref
  812. ?t_&&x=s
  813. ife ?ex2
  814. extrn _&&x:&d
  815. x equ _&&x
  816. else
  817. extrn x:&d
  818. endif
  819. ifidn <scv>,<cc>
  820. .xcref
  821. .xcref ?CC&&x
  822. .cref
  823. ?CC&&x=?ex2
  824. endif
  825. endm
  826. endm
  827. endif
  828. ifndef ?NOLABEL
  829. .xcref
  830. .xcref ?lb1,?lblpu,?lb2
  831. .xcref labelB,labelW,labelD,labelQ,labelT
  832. .xcref labelNP,labelFP,labelP,labelCP,labelDP
  833. .cref
  834. ?lblpu = 0
  835. ?lb2 = 0
  836. labelB macro n,c
  837. ?lb1 <n>,1,<byte>,<c>
  838. endm
  839. labelW macro n,c
  840. ?lb1 <n>,2,<word>,<c>
  841. endm
  842. labelD macro n,c
  843. ?lb1 <n>,4,<dword>,<c>
  844. endm
  845. labelQ macro n,c
  846. ?lb1 <n>,8,<qword>,<c>
  847. endm
  848. labelT macro n,c
  849. ?lb1 <n>,10,<tbyte>,<c>
  850. endm
  851. labelNP macro n,c
  852. ?lb1 <n>,2,<near>,<c>
  853. endm
  854. labelFP macro n,c
  855. ?lb1 <n>,4,<far>,<c>
  856. endm
  857. if sizec
  858. labelP macro n,c
  859. ?lb1 <n>,4,<far>,<c>
  860. endm
  861. else
  862. labelP macro n,c
  863. ?lb1 <n>,2,<near>,<c>
  864. endm
  865. endif
  866. if sizec
  867. labelCP macro n,c
  868. ?lb1 <n>,4,<dword>,<c>
  869. endm
  870. else
  871. labelCP macro n,c
  872. ?lb1 <n>,2,<word>,<c>
  873. endm
  874. endif
  875. if sized
  876. labelDP macro n,c
  877. ?lb1 <n>,4,<dword>,<c>
  878. endm
  879. else
  880. labelDP macro n,c
  881. ?lb1 <n>,2,<word>,<c>
  882. endm
  883. endif
  884. ?lb1 macro n,s,d,c
  885. ?gcc ?lb2,%?PLM,<c>
  886. ?lblpu=0
  887. irp x,<n>
  888. ifidn <x>,<PUBLIC>
  889. ?lblpu=1
  890. else
  891. .xcref
  892. .xcref ?t_&&x
  893. .cref
  894. ?t_&&x=s
  895. ife ?lb2
  896. if ?lblpu
  897. public _&&x
  898. endif
  899. _&&x label &d
  900. x equ _&&x
  901. else
  902. if ?lblpu
  903. public x
  904. endif
  905. x label &d
  906. endif
  907. endif
  908. endm
  909. endm
  910. endif
  911. ifndef ?NODEF
  912. .xcref
  913. .xcref defB,defW,defD,defQ,defT,defCP,defDP
  914. .cref
  915. defB macro n
  916. ?ad <n>,1
  917. endm
  918. defW macro n
  919. ?ad <n>,2
  920. endm
  921. defD macro n
  922. ?ad <n>,4
  923. endm
  924. defQ macro n
  925. ?ad <n>,8
  926. endm
  927. defT macro n
  928. ?ad <n>,10
  929. endm
  930. if sizec
  931. defCP macro n
  932. defD <n>
  933. endm
  934. else
  935. defCP macro n
  936. defW <n>
  937. endm
  938. endif
  939. if sized
  940. defDP macro n
  941. defD <n>
  942. endm
  943. else
  944. defDP macro n
  945. defW <n>
  946. endm
  947. endif
  948. endif
  949. ?ad macro n,s
  950. irp x,<n>
  951. .xcref
  952. .xcref ?t_&&x
  953. .cref
  954. ?t_&&x=s
  955. endm
  956. endm
  957. ifndef ?NOPTR
  958. .xcref
  959. .xcref regPtr,farPtr
  960. .cref
  961. regPtr macro n,s,o
  962. farPtr n,s,o
  963. endm
  964. farPtr macro n,s,o
  965. .xcref
  966. .xcref ?t_&n
  967. .cref
  968. n ¯o
  969.     push    s
  970.     push    o
  971. &endm
  972. ?t_&n=80h
  973. endm
  974. endif
  975. arg macro a
  976. irp x,<a>
  977. ?argc=?argc+1
  978. ?atal <x>,%?argc
  979. endm
  980. endm
  981. ?atal macro n,i
  982. .xcref
  983. .xcref ?ali&i
  984. .cref
  985. ?ali&i ¯o
  986. ?ap <n>
  987. &endm
  988. endm
  989. ?ap macro n
  990. ?argl=?argl+2
  991. ifdef ?t_&n
  992. ife ?t_&n-1
  993.     push    word ptr (n)
  994. exitm
  995. endif
  996. ife ?t_&n-2
  997.     push    n
  998. exitm
  999. endif
  1000. ife ?t_&n-4
  1001. if ?bigreg
  1002. ?sps
  1003. .386p
  1004.     push    dword ptr (n)
  1005. ?rps
  1006. else
  1007.     push    word ptr (n)[2]
  1008.     push    word ptr (n)
  1009. endif
  1010. ?argl=?argl+2
  1011. exitm
  1012. endif
  1013. ife ?t_&n-8
  1014. if ?bigreg
  1015. ?sps
  1016. .386p
  1017.     push    dword ptr (n)[4]
  1018.     push    dword ptr (n)
  1019. ?rps
  1020. else
  1021.     push    word ptr (n)[6]
  1022.     push    word ptr (n)[4]
  1023.     push    word ptr (n)[2]
  1024.     push    word ptr (n)
  1025. endif
  1026. ?argl=?argl+6
  1027. exitm
  1028. endif
  1029. if ?t_&n and 80h
  1030. n
  1031. ?argl=?argl+2
  1032. exitm
  1033. endif
  1034. ife ?t_&n
  1035.     push    word ptr (n)
  1036. exitm
  1037. endif
  1038. endif
  1039.     push    n
  1040. endm
  1041. cCall macro n,a,c
  1042. ifnb <a>
  1043. arg <a>
  1044. endif
  1045. mpush %?rsl
  1046. ifdef ?CC&n
  1047. ?cCall1=?CC&n
  1048. else
  1049. ?cCall1=?PLM
  1050. endif
  1051. ifnb <c>
  1052. ?gcc ?cCall1,%?cCall1,<c>
  1053. endif
  1054. ?argl=0
  1055. ife ?cCall1
  1056. ?acb=?argc
  1057. else
  1058. ?acb=1
  1059. endif
  1060. rept ?argc
  1061. uconcat <?ali>,%?acb
  1062. uconcat <purge>,,<?ali>,%?acb
  1063. ife ?cCall1
  1064. ?acb=?acb-1
  1065. else
  1066. ?acb=?acb+1
  1067. endif
  1068. endm
  1069.     call    n
  1070. if ((?cCall1 eq 0) and (?argl ne 0))
  1071.     add    sp,?argl
  1072. endif
  1073. mpop %?rsl
  1074. ?rsl=0
  1075. ?argc= 0
  1076. ?argl= 0
  1077. endm
  1078. cProc macro n,cf,a
  1079. if ?cpd
  1080. ?utpe
  1081. endif
  1082. ?cpd=1
  1083. ???=0
  1084. ?argc=0
  1085. ?ba=0
  1086. ?po=0
  1087. ?pu=0
  1088. ?ia=0
  1089. ?adj=4
  1090. ?rp=0
  1091. ?uf=0
  1092. ?wfp=?WIN
  1093. ?ff=0
  1094. ?pas=0
  1095. ?pcc=?PLM
  1096. ?no_bp2=?no_bp1
  1097. ?aprof2=?aprof1
  1098. ifnb <a>
  1099. ?ri ?pas,<a>
  1100. endif
  1101. ?pc=sizec
  1102. ?nd=?nodata1
  1103. ?ent=?enter1
  1104. ?nx=0
  1105. irp x,<cf>
  1106. ifdef ??_cproc_&&x
  1107. ??_cproc_&&x
  1108. else
  1109. ??error2 <e r r o r - unknown keyword x>
  1110. .err
  1111. endif
  1112. endm
  1113. if ?pcc
  1114. ?PLMPrevParm=0
  1115. .xcref
  1116. .xcref ?PLMParm0
  1117. .cref
  1118. ?PLMParm0 ¯o
  1119. purge ?PLMParm0
  1120. &endm
  1121. endif
  1122. .xcref
  1123. .xcref ?CC&n
  1124. .cref
  1125. ?CC&n=?pcc
  1126. if (?nx eq 1) and (?nd eq 0)
  1127. ?nx = 0
  1128. ??error2 <ATOMIC specified without NODATA - ATOMIC ignored>
  1129. endif
  1130. if ?ent
  1131. if ?wfp
  1132. ?ent = 0
  1133. ??error2 <ENTER specified without NONWIN - ENTER ignored>
  1134. endif
  1135. if ?uf
  1136. ?ent = 0
  1137. ??error2 <ENTER specified with user frame - ENTER ignored>
  1138. endif
  1139. if ?chkstk1
  1140. ?ent = 0
  1141. ??error2 <ENTER specified with stack checking - ENTER ignored>
  1142. endif
  1143. endif
  1144. if ?pc
  1145. if ?wfp
  1146. ife ?nx
  1147. ?ia=2
  1148. ?pas = ?pas and (not ?ds)
  1149. endif
  1150. endif
  1151. ?adj=?adj+2
  1152. else
  1153. ?wfp=0
  1154. endif
  1155. ?pas = ?pas and (not (?sp+?cs+?ss))
  1156. if ?bigreg
  1157. ?pas = ?pas and (not (?esp))
  1158. endif
  1159. if ?uf
  1160. ?pas = ?pas and (not (?bp+?si+?di))
  1161. if ?bigreg
  1162. ?pas = ?pas and (not (?ebp+?esi+?edi))
  1163. endif
  1164. endif
  1165. ife ?pcc
  1166. ?pg <_&n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
  1167. else
  1168. ?pg <n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
  1169. endif
  1170. endm
  1171. ?pg macro n,p,c,a,w,nnu,cc
  1172. .xcref
  1173. if ?uf
  1174. if ?nd
  1175. ??error2 <NODATA encountered in &n - user frame ignored>
  1176. ?uf=0
  1177. endif
  1178. endif
  1179. .xcref cBegin
  1180. cBegin ¯o g
  1181. .xcref
  1182. if cc
  1183. uconcat <?PLMParm>,%?PLMPrevParm,%?po
  1184. endif
  1185. if ?rp
  1186. if ?uf
  1187. ??error2 <parmR encountered in &n - user frame ignored>
  1188. ?uf=0
  1189. endif
  1190. if ?ent
  1191. ??error2 <parmR encountered in &n - ENTER ignored>
  1192. ?ent=0
  1193. endif
  1194. endif
  1195. ?pg1 <n>,c,a,%?po,w,%?uf,%?nd,%?rp,cc,<nnu>,%???
  1196. ?cpd=0
  1197. ?argc=0
  1198. ?ba=1
  1199. ???=(???+1) and 0fffeh
  1200. if p
  1201. public n
  1202. endif
  1203. ife c
  1204. n proc near
  1205. else
  1206. n proc far
  1207. endif
  1208. ife cc
  1209. nnu equ n
  1210. endif
  1211. ?cbe = 0
  1212. ifnb <g>
  1213. ?pcbe <g>,<nnu>,<cBegin>
  1214. endif
  1215. if ?cbe eq 1
  1216. if ???+a+?rp
  1217. if2
  1218. ??_out <cBegin - possibly invalid use of nogen>
  1219. endif
  1220. endif
  1221. else
  1222. if ?uf
  1223. ?mf c,%???,%?po
  1224. mpush a
  1225. else
  1226. ife ?cbe
  1227. if w
  1228. ife ?nd
  1229. ife ?DOS5
  1230.     mov    ax,ds
  1231.     nop
  1232. else
  1233.     mov    ax,DataBASE
  1234. endif
  1235. endif
  1236. if ?aprof2
  1237.     call    AProfCall
  1238. endif
  1239. ife ?nx
  1240. ife ?DOS5
  1241.     inc    bp
  1242. endif
  1243.     push    bp
  1244.     mov    bp,sp
  1245.     push    ds
  1246. else
  1247. if ?ff+???+?po+?rp
  1248.     push    bp
  1249.     mov    bp,sp
  1250. endif
  1251. endif
  1252. ife ?nd
  1253.     mov    ds,ax
  1254. endif
  1255. else
  1256. if ?aprof2
  1257.     call    AProfCall
  1258. endif
  1259. if ?ff+???+?po+?rp
  1260. ife ?ent
  1261.     push    bp
  1262.     mov    bp,sp
  1263. endif
  1264. endif
  1265. endif
  1266. if ?rp
  1267. ?uf=0
  1268. rept ?rp
  1269. uconcat mpush,,?rp,%?uf
  1270. ?uf=?uf+1
  1271. endm
  1272. endif
  1273. ife ?ent
  1274. if ???
  1275. if ?chkstk1
  1276. ifdef ?CHKSTKPROC
  1277. ?CHKSTKPROC %???
  1278. else
  1279.     mov    ax,???
  1280. ife cc
  1281.     call    _chkstk
  1282. else
  1283.     call    chkstk
  1284. endif
  1285. endif
  1286. else
  1287.     sub    sp,???
  1288. endif
  1289. endif
  1290. else
  1291. if ???
  1292. enter ???,0
  1293. else
  1294. push bp
  1295. mov bp,sp
  1296. endif
  1297. endif
  1298. else
  1299. if ?aprof2
  1300.     call    AProfRet
  1301.     call    AProfCall
  1302. endif
  1303. if ?rp
  1304. ??error2 <cBegin - parmRs encountered with partial frame>
  1305. else
  1306. if ???
  1307.     lea    sp,[bp][-???-?ia]
  1308. endif
  1309. endif
  1310. endif
  1311. mpush a
  1312. endif
  1313. ifdef ?PROFILE
  1314. if c
  1315.     call    StartNMeas
  1316. endif
  1317. endif
  1318. endif
  1319. .cref
  1320. purge cBegin
  1321. &endm
  1322. .xcref ?utpe
  1323. ?utpe ¯o
  1324. ??error2 <unterminated procedure definition: "&n">
  1325. &endm
  1326. .cref
  1327. endm
  1328. ?pg1 macro n,c,a,o,w,f,d,r,cc,nnu,lc
  1329. .xcref
  1330. .xcref cEnd
  1331. parm_bytes_&nnu = o
  1332. cEnd ¯o g
  1333. .xcref
  1334. ?ba=0
  1335. ?cbe = 0
  1336. ifnb <g>
  1337. ?pcbe <g>,<nnu>,<cEnd>
  1338. endif
  1339. if ?cbe eq 1
  1340. if a+r+lc
  1341. if2
  1342. ??_out <cEnd - possibly invalid use of nogen>
  1343. endif
  1344. endif
  1345. else
  1346. ifdef ?PROFILE
  1347. if c
  1348. call StopNMeas
  1349. endif
  1350. endif
  1351. mpop a
  1352. if f
  1353.     db    0c3h
  1354. else
  1355. if w
  1356. ife ?nx
  1357. if (?TF eq 0) or (???+r)
  1358.     lea    sp,-2[bp]
  1359. endif
  1360.     pop    ds
  1361.     pop    bp
  1362. ife ?DOS5
  1363.     dec    bp
  1364. endif
  1365. else
  1366. if (?TF eq 0) or (???+r)
  1367.     if    ???+?po+r
  1368. if ?ent
  1369. leave
  1370. else
  1371. mov sp,bp
  1372. pop bp
  1373. endif
  1374. else
  1375. mov sp,bp
  1376. endif
  1377. else
  1378. if ???+?po+r
  1379. pop bp
  1380. endif
  1381. endif
  1382. endif
  1383. else
  1384. if ?ff+???+?po+r
  1385. if (?TF eq 0) or (???+r)
  1386.     if    ?ent
  1387. leave
  1388. else
  1389. mov sp,bp
  1390. pop bp
  1391. endif
  1392. else
  1393. pop bp
  1394. endif
  1395. endif
  1396. endif
  1397. if ?aprof2
  1398.     call    AProfRet
  1399. endif
  1400. if ?cbe ne 4
  1401. ife cc
  1402.     ret
  1403. else
  1404.     ret    o
  1405. endif
  1406. endif
  1407. endif
  1408. endif
  1409. if ?cbe ne 4
  1410. n endp
  1411. .cref
  1412. purge cEnd
  1413. else
  1414. .cref
  1415. endif
  1416. &endm
  1417. .cref
  1418. endm
  1419. .xcref
  1420. .xcref cleanframe
  1421. cleanframe macro
  1422. cEnd <??cleanframe??>
  1423. endm
  1424. .cref
  1425. .xcref
  1426. .xcref ??_cproc_FAR,??_cproc_NEAR,??_cproc_PUBLIC,??_cproc_SMALL
  1427. .xcref ??_cproc_DATA,??_cproc_NODATA,??_cproc_ATOMIC,??_cproc_C
  1428. .xcref ??_cproc_PLM,??_cproc_PASCAL,??_cproc_WIN,??_cproc_NONWIN
  1429. .xcref ??_cproc_NO_BP,??_cproc_BP,??_cproc_ENTER,??_cproc_NOENTER
  1430. .xcref ??_cproc_NO_ATTRPROF,??_cproc_ATTRPROF
  1431. .xcref ??_cproc_far,??_cproc_near,??_cproc_public,??_cproc_small
  1432. .xcref ??_cproc_data,??_cproc_nodata,??_cproc_atomic,??_cproc_c
  1433. .xcref ??_cproc_plm,??_cproc_pascal,??_cproc_win,??_cproc_nonwin
  1434. .xcref ??_cproc_no_bp,??_cproc_bp,??_cproc_enter,??_cproc_noenter
  1435. .xcref ??_cproc_no_attrprof,??_cproc_attrprof
  1436. .cref
  1437. ??_cproc_FAR macro
  1438. ?pc=1
  1439. endm
  1440. ??_cproc_NEAR macro
  1441. ?pc=0
  1442. endm
  1443. ??_cproc_PUBLIC macro
  1444. ?pu=1
  1445. endm
  1446. ??_cproc_SMALL macro
  1447. ?uf=1
  1448. endm
  1449. ??_cproc_DATA macro
  1450. ?nd=0
  1451. endm
  1452. ??_cproc_NODATA macro
  1453. ?nd=1
  1454. endm
  1455. ??_cproc_ENTER macro
  1456. ?ent=1
  1457. endm
  1458. ??_cproc_NOENTER macro
  1459. ?ent=0
  1460. endm
  1461. ??_cproc_ATOMIC macro
  1462. ?nx=1
  1463. endm
  1464. ??_cproc_C macro
  1465. ?pcc=0
  1466. endm
  1467. ??_cproc_PLM macro
  1468. ?pcc=1
  1469. endm
  1470. ??_cproc_PASCAL macro
  1471. ?pcc=1
  1472. endm
  1473. ??_cproc_WIN macro
  1474. ?wfp=1
  1475. endm
  1476. ??_cproc_NONWIN macro
  1477. ?wfp=0
  1478. endm
  1479. ??_cproc_NO_BP macro
  1480. ?no_bp2=1
  1481. endm
  1482. ??_cproc_BP macro
  1483. ?no_bp2=0
  1484. endm
  1485. ??_cproc_NO_ATTRPROF macro
  1486. ?aprof2=0
  1487. endm
  1488. ??_cproc_ATTRPROF macro
  1489. ?aprof2=1
  1490. endm
  1491. ??_cproc_far macro
  1492. ?pc=1
  1493. endm
  1494. ??_cproc_near macro
  1495. ?pc=0
  1496. endm
  1497. ??_cproc_public macro
  1498. ?pu=1
  1499. endm
  1500. ??_cproc_small macro
  1501. ?uf=1
  1502. endm
  1503. ??_cproc_data macro
  1504. ?nd=0
  1505. endm
  1506. ??_cproc_nodata macro
  1507. ?nd=1
  1508. endm
  1509. ??_cproc_enter macro
  1510. ?ent=1
  1511. endm
  1512. ??_cproc_noenter macro
  1513. ?ent=0
  1514. endm
  1515. ??_cproc_atomic macro
  1516. ?nx=1
  1517. endm
  1518. ??_cproc_c macro
  1519. ?pcc=0
  1520. endm
  1521. ??_cproc_plm macro
  1522. ?pcc=1
  1523. endm
  1524. ??_cproc_pascal macro
  1525. ?pcc=1
  1526. endm
  1527. ??_cproc_win macro
  1528. ?wfp=1
  1529. endm
  1530. ??_cproc_nonwin macro
  1531. ?wfp=0
  1532. endm
  1533. ??_cproc_no_bp macro
  1534. ?no_bp2=1
  1535. endm
  1536. ??_cproc_bp macro
  1537. ?no_bp2=0
  1538. endm
  1539. ??_cproc_no_attrprof macro
  1540. ?aprof2=0
  1541. endm
  1542. ??_cproc_attrprof macro
  1543. ?aprof2=1
  1544. endm
  1545. ?pcbe macro g,nnu,mt
  1546. ifidn <g>,<NOGEN>
  1547. ?cbe = 1
  1548. else
  1549. ifidn <g>,<nogen>
  1550. ?cbe = 1
  1551. else
  1552. ifidn <mt>,<cBegin>
  1553. ifidn <g>,<PARTIAL>
  1554. ?cbe = 2
  1555. else
  1556. ifidn <g>,<partial>
  1557. ?cbe = 2
  1558. else
  1559. ifdif <g>,<nnu>
  1560. ??error2 <mt - unknown keyword g>
  1561. endif
  1562. endif
  1563. endif
  1564. else
  1565. ifidn <g>,<??cleanframe??>
  1566. ?cbe = 4
  1567. else
  1568. ifdif <g>,<nnu>
  1569. ??error2 <mt - unknown keyword g>
  1570. endif
  1571. endif
  1572. endif
  1573. endif
  1574. endif
  1575. endm
  1576. assumes macro s,ln
  1577. ifndef ln&_assumes
  1578. assume s:ln
  1579. else
  1580. ln&_assumes s
  1581. endif
  1582. endm
  1583. createSeg macro n,ln,a,co,cl,grp,u
  1584. ifnb <u>
  1585. ifnb <cl>
  1586. n segment a co u '&cl'
  1587. else
  1588. n segment a co u
  1589. endif
  1590. else
  1591. ifdef ?u32
  1592. if ?u32
  1593. ?sps
  1594. .386p
  1595. ifnb <cl>
  1596. n segment a co use32 '&cl'
  1597. else
  1598. n segment a co use32
  1599. endif
  1600. ?rps
  1601. else
  1602. ifnb <cl>
  1603. n segment a co use16 '&cl'
  1604. else
  1605. n segment a co use16
  1606. endif
  1607. endif
  1608. else
  1609. ifnb <cl>
  1610. n segment a co '&cl'
  1611. else
  1612. n segment a co
  1613. endif
  1614. endif
  1615. endif
  1616. n ends
  1617. ifnb <grp>
  1618. addseg grp,n
  1619. else
  1620. ln&OFFSET equ offset n:
  1621. ln&BASE equ n
  1622. ?cs3 <ln>,<n>
  1623. endif
  1624. ?cs1 <ln>,<n>
  1625. endm
  1626. addseg macro grp,seg
  1627. .xcref
  1628. .xcref grp&_def
  1629. .cref
  1630. ifndef grp&_def
  1631. grp&_def=0
  1632. endif
  1633. if grp&_def ne ASMpass
  1634. .xcref
  1635. .xcref grp&_add
  1636. .cref
  1637. grp&_add ¯o s
  1638. grp&_in <seg>,s
  1639. &endm
  1640. .xcref
  1641. .xcref grp&_in
  1642. .cref
  1643. grp&_in ¯o sl,s
  1644. ifb <s>
  1645. grp group sl
  1646. else
  1647. grp&_add ¯o ns
  1648. grp&_in <sl,s>,ns
  1649. &endm
  1650. endif
  1651. &endm
  1652. grp&_def=ASMpass
  1653. else
  1654. grp&_add seg
  1655. endif
  1656. endm
  1657. defgrp macro grp,ln
  1658. addseg grp
  1659. ifnb <ln>
  1660. irp x,<ln>
  1661. ?cs3 <&x>,<grp>
  1662. x&&OFFSET equ offset grp:
  1663. x&&BASE equ grp
  1664. endm
  1665. endif
  1666. endm
  1667. ?cs1 macro ln,n
  1668. .xcref
  1669. .xcref ln&_sbegin
  1670. .cref
  1671. ln&_sbegin ¯o
  1672. .xcref
  1673. .xcref ?mf
  1674. .cref
  1675. ?curseg equ <&ln>
  1676. ?mf &¯o c,l,p
  1677. if c
  1678.     extrn    n&_FARFRAME:near
  1679.     call    n&_FARFRAME
  1680. else
  1681.     extrn    n&_NEARFRAME:near
  1682.     call    n&_NEARFRAME
  1683. endif
  1684.     db    l shr 1
  1685.     db    p shr 1
  1686. &&endm
  1687. ?cs2 <ln>,<n>
  1688. n segment
  1689. &endm
  1690. endm
  1691. ?cs2 macro ln,n
  1692. .xcref
  1693. .xcref sEnd
  1694. .cref
  1695. sEnd ¯o
  1696. n ends
  1697. purge ?mf
  1698. purge sEnd
  1699. &endm
  1700. endm
  1701. ?cs3 macro ln,n
  1702. .xcref
  1703. .xcref ln&_assumes
  1704. .cref
  1705. ln&_assumes ¯o s
  1706. assume s:&n
  1707. &endm
  1708. endm
  1709. .xcref
  1710. .xcref sBegin
  1711. .cref
  1712. sBegin macro ln
  1713. ln&_sbegin
  1714. endm
  1715. ife ?DF
  1716. createSeg _TEXT,Code,word,public,CODE
  1717. ife ?nodata1
  1718. createSeg _DATA,Data,word,public,DATA,DGROUP
  1719. defgrp DGROUP,Data
  1720. endif
  1721. if ?chkstk1
  1722. ifndef ?CHKSTKPROC
  1723. externp <chkstk>
  1724. endif
  1725. endif
  1726. endif
  1727. errnz macro x
  1728. if2
  1729. if x
  1730. errnz1 <x>,%(x)
  1731. endif
  1732. endif
  1733. endm
  1734. errnz1 macro x1,x2
  1735. = *errnz* x1 = x2
  1736. .err
  1737. endm
  1738. errn$ macro l,x
  1739. errnz <offset $ - offset l x>
  1740. endm
  1741. ifdef ?PROFILE
  1742. externFP <StartNMeas,StopNMeas>
  1743. endif
  1744. if ?aprof1
  1745. externFP <AProfCall,AProfRet>,<PLM>
  1746. endif
  1747.