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