diff options
Diffstat (limited to 'v4.0/src/INC/CMACROS.INC')
| -rw-r--r-- | v4.0/src/INC/CMACROS.INC | 932 |
1 files changed, 932 insertions, 0 deletions
diff --git a/v4.0/src/INC/CMACROS.INC b/v4.0/src/INC/CMACROS.INC new file mode 100644 index 0000000..d81960c --- /dev/null +++ b/v4.0/src/INC/CMACROS.INC | |||
| @@ -0,0 +1,932 @@ | |||
| 1 | comment $ | ||
| 2 | cmacros - assembly macros for interfacing to HHLs | ||
| 3 | (C)Copyright 1984, 1988 Microsoft Corporation | ||
| 4 | $ | ||
| 5 | if1 | ||
| 6 | outif MACRO name,defval,onmsg,offmsg | ||
| 7 | ifndef name | ||
| 8 | ifb <defval> | ||
| 9 | name=0 | ||
| 10 | else | ||
| 11 | name=defval | ||
| 12 | endif | ||
| 13 | endif | ||
| 14 | if name | ||
| 15 | name=1 | ||
| 16 | ifnb <onmsg> | ||
| 17 | %out ! onmsg | ||
| 18 | endif | ||
| 19 | else | ||
| 20 | ifnb <offmsg> | ||
| 21 | %out ! offmsg | ||
| 22 | endif | ||
| 23 | endif | ||
| 24 | endm | ||
| 25 | |||
| 26 | error MACRO msg | ||
| 27 | bug | ||
| 28 | %out E r r o r ----- msg | ||
| 29 | ENDM | ||
| 30 | %out cMacros Version 1.04 | ||
| 31 | outif memS,0,<Small Model> | ||
| 32 | outif memM,0,<Medium Model> | ||
| 33 | outif memL,0,<Large Model> | ||
| 34 | outif memC,0,<Compact Model> | ||
| 35 | outif memH,0,<Huge Model> | ||
| 36 | memMOD= memS + memM + memL + memC + memH | ||
| 37 | if memMOD ne 1 | ||
| 38 | if memMOD eq 0 | ||
| 39 | memS= 1 | ||
| 40 | outif memS,0,<Small Model> | ||
| 41 | else | ||
| 42 | error <Must have only 1 memory model selected> | ||
| 43 | endif | ||
| 44 | endif | ||
| 45 | sizeC= memM + memL + memH | ||
| 46 | sizeD= memL + memC + (memH*2) | ||
| 47 | outif ?DF,0,<No segments or groups will be defined> | ||
| 48 | outif ?WIN,0,<Windows Support> | ||
| 49 | outif ?PLM,0,<PLM calling convention> | ||
| 50 | endif | ||
| 51 | .XCREF | ||
| 52 | .XCREF ?N,?AX,?AH,?AL,?BX,?BH | ||
| 53 | .XCREF ?BL,?CX,?CH,?CL,?DX,?DH | ||
| 54 | .XCREF ?DL,?SI,?DI,?ES,?DS,?BP | ||
| 55 | .XCREF ?SP,?SS,?CS | ||
| 56 | .XCREF ?RSL,?CPD,?argl,?argc,?BA | ||
| 57 | .XCREF ?ACB,???,?PO | ||
| 58 | .XCREF ?PAS,?PC | ||
| 59 | .XCREF Uconcat,mPush,mPop | ||
| 60 | .XCREF ?RI,?pp,?pp1,?al1 | ||
| 61 | .XCREF ?aD,?AP,?Atal,?pd,?dd,?dd1,?ex1,?cas | ||
| 62 | .XCREF ?pg,?pg1,?aloc,?cs1,?cs2 | ||
| 63 | .XCREF ?lb1,?lblpu | ||
| 64 | .XCREF ?DF,?PLM,?WIN,?IA,?PU,?ADJ | ||
| 65 | .CREF | ||
| 66 | ?RSL = 0 | ||
| 67 | ?CPD = 0 | ||
| 68 | ?ArgL = 0 | ||
| 69 | ?ArgC = 0 | ||
| 70 | ?BA = 0 | ||
| 71 | ?ACB = 0 | ||
| 72 | ??? = 0 | ||
| 73 | ?PO = 0 | ||
| 74 | ?PAS = 0 | ||
| 75 | ?PC = 0 | ||
| 76 | ?IA = 0 | ||
| 77 | ?PU = 0 | ||
| 78 | ?ADJ = 0 | ||
| 79 | ?lblpu = 0 | ||
| 80 | ?N = 0000000000000000B | ||
| 81 | ?AX = 0000000000000011B | ||
| 82 | ?AH = 0000000000000001B | ||
| 83 | ?AL = 0000000000000010B | ||
| 84 | ?BX = 0000000000001100B | ||
| 85 | ?BH = 0000000000000100B | ||
| 86 | ?BL = 0000000000001000B | ||
| 87 | ?CX = 0000000000110000B | ||
| 88 | ?CH = 0000000000010000B | ||
| 89 | ?CL = 0000000000100000B | ||
| 90 | ?DX = 0000000011000000B | ||
| 91 | ?DH = 0000000001000000B | ||
| 92 | ?DL = 0000000010000000B | ||
| 93 | ?SI = 0000000100000000B | ||
| 94 | ?DI = 0000001000000000B | ||
| 95 | ?ES = 0000010000000000B | ||
| 96 | ?DS = 0000100000000000B | ||
| 97 | ?BP = 0001000000000000B | ||
| 98 | ?SP = 0010000000000000B | ||
| 99 | ?SS = 0100000000000000B | ||
| 100 | ?CS = 1000000000000000B | ||
| 101 | uconcat macro n1,n2,o1,o2,p1,p2 | ||
| 102 | n1&n2 o1&o2 p1&p2 | ||
| 103 | endm | ||
| 104 | mpush macro rV | ||
| 105 | irp x,<ax,bx,cx,dx,si,di,es,ds,bp,sp,ss,cs> | ||
| 106 | if rV AND ?&&x | ||
| 107 | push x | ||
| 108 | endif | ||
| 109 | endm | ||
| 110 | endm | ||
| 111 | mpop macro rV | ||
| 112 | irp x,<cs,ss,sp,bp,ds,es,di,si,dx,cx,bx,ax> | ||
| 113 | if rV AND ?&&x | ||
| 114 | pop x | ||
| 115 | endif | ||
| 116 | endm | ||
| 117 | endm | ||
| 118 | SAVE macro rL | ||
| 119 | ?RSL = 0 | ||
| 120 | ?RI ?RSL,<rL> | ||
| 121 | endm | ||
| 122 | smashes macro n,rL | ||
| 123 | .xcref | ||
| 124 | .xcref ?SM&n | ||
| 125 | .cref | ||
| 126 | ?SM&n = 0 | ||
| 127 | ?RI ?SM&n,<rL> | ||
| 128 | endm | ||
| 129 | ?RI macro n,rL | ||
| 130 | irp x,<rL> | ||
| 131 | ifdef ?&&x | ||
| 132 | n = n or ?&&x | ||
| 133 | endif | ||
| 134 | endm | ||
| 135 | endm | ||
| 136 | parmB macro nl | ||
| 137 | ?pp <&nL>,<byte>,2,1 | ||
| 138 | endm | ||
| 139 | parmW macro nl | ||
| 140 | ?pp <&nL>,<word>,2,2 | ||
| 141 | endm | ||
| 142 | parmD macro nl | ||
| 143 | ife ?PLM | ||
| 144 | irp x,<nL> | ||
| 145 | ?pp <&&x>,<DWORD>,0,4 | ||
| 146 | ?pp <Off_&&x>,<WORD>,2,2 | ||
| 147 | ?pp <Seg_&&x>,<WORD>,2,2 | ||
| 148 | endm | ||
| 149 | else | ||
| 150 | irp x,<nL> | ||
| 151 | ?pp <Seg_&&x>,<WORD>,2,2 | ||
| 152 | ?pp <Off_&&x>,<WORD>,2,2 | ||
| 153 | ?pp <&&x>,<DWORD>,0,4 | ||
| 154 | endm | ||
| 155 | endif | ||
| 156 | endm | ||
| 157 | parmQ macro nl | ||
| 158 | ?pp <&nL>,<QWORD>,8,8 | ||
| 159 | endm | ||
| 160 | parmT macro nl | ||
| 161 | ?pp <&nL>,<TBYTE>,10,10 | ||
| 162 | endm | ||
| 163 | if sizeC | ||
| 164 | parmCP macro nl | ||
| 165 | parmD <nl> | ||
| 166 | endm | ||
| 167 | else | ||
| 168 | parmCP macro nl | ||
| 169 | parmW <nl> | ||
| 170 | endm | ||
| 171 | endif | ||
| 172 | if sizeD | ||
| 173 | parmDP macro nl | ||
| 174 | parmD <nl> | ||
| 175 | endm | ||
| 176 | else | ||
| 177 | parmDP macro nl | ||
| 178 | parmW <nl> | ||
| 179 | endm | ||
| 180 | endif | ||
| 181 | ?pp macro nL,t,l,s | ||
| 182 | if ?CPD | ||
| 183 | .xcref | ||
| 184 | ife ?PLM | ||
| 185 | irp x,<nL> | ||
| 186 | ?pp1 x,<t>,%?PO,%?adj,%(?PO+?adj) | ||
| 187 | ?PO = ?PO + l | ||
| 188 | .xcref ?T&&x | ||
| 189 | ?T&&x = s | ||
| 190 | endm | ||
| 191 | else | ||
| 192 | irp x,<nL> | ||
| 193 | ?PO = ?PO + l | ||
| 194 | ?pp1 x,<t>,%?PO,%?adj,%(?PO+?adj) | ||
| 195 | .xcref ?T&&x | ||
| 196 | ?T&&x = s | ||
| 197 | endm | ||
| 198 | endif | ||
| 199 | .cref | ||
| 200 | else | ||
| 201 | %out Parm(s) "&nl" declared outside proc def. | ||
| 202 | endif | ||
| 203 | endm | ||
| 204 | ?pp1 macro n,t,o,a,b | ||
| 205 | ife ?PLM | ||
| 206 | n equ t ptr [bp+b] | ||
| 207 | else | ||
| 208 | n equ t ptr [bp+a+?PO-o] | ||
| 209 | endif | ||
| 210 | endm | ||
| 211 | localB macro nL | ||
| 212 | ?aLoc <&nL>,<BYTE ptr>,1,1,0 | ||
| 213 | endm | ||
| 214 | localW macro nL | ||
| 215 | ?aLoc <&nL>,<WORD PTR>,2,2,1 | ||
| 216 | endm | ||
| 217 | localD macro nL | ||
| 218 | irp x,<nL> | ||
| 219 | ?aLoc <Seg_&&x>,<WORD PTR>,2,2,1 | ||
| 220 | ?aLoc <Off_&&x>,<WORD PTR>,2,2,1 | ||
| 221 | ?aLoc <&&x>,<DWORD PTR>,0,4,1 | ||
| 222 | endm | ||
| 223 | endm | ||
| 224 | localQ macro nL | ||
| 225 | ?aLoc <&nL>,<QWORD PTR>,8,8,1 | ||
| 226 | endm | ||
| 227 | localT macro nL | ||
| 228 | ?aLoc <&nL>,<TBYTE PTR>,10,10,1 | ||
| 229 | endm | ||
| 230 | if sizeC | ||
| 231 | localCP macro nL | ||
| 232 | localD <nL> | ||
| 233 | endm | ||
| 234 | else | ||
| 235 | localCP macro nL | ||
| 236 | localW <nL> | ||
| 237 | endm | ||
| 238 | endif | ||
| 239 | if sizeD | ||
| 240 | localDP macro nL | ||
| 241 | localD <nL> | ||
| 242 | endm | ||
| 243 | else | ||
| 244 | localDP macro nL | ||
| 245 | localW <nL> | ||
| 246 | endm | ||
| 247 | endif | ||
| 248 | localV macro n,a | ||
| 249 | ?aLoc <&n>,,%(&a),0,1 | ||
| 250 | endm | ||
| 251 | ?aLoc macro nL,t,l,s,a | ||
| 252 | if ?CPD | ||
| 253 | .xcref | ||
| 254 | ??? = ??? + l | ||
| 255 | if a | ||
| 256 | ??? = ((??? + 1) AND 0FFFEH) | ||
| 257 | endif | ||
| 258 | irp x,<nL> | ||
| 259 | ?aL1 x,<t>,%??? | ||
| 260 | .xcref ?T&&x | ||
| 261 | ?T&&x = s | ||
| 262 | endm | ||
| 263 | .cref | ||
| 264 | else | ||
| 265 | %out Locals "&nl" declared outside procedure def. | ||
| 266 | endif | ||
| 267 | endm | ||
| 268 | ?aL1 macro n,t,o | ||
| 269 | if ?IA | ||
| 270 | n equ t [bp-?IA-o] | ||
| 271 | else | ||
| 272 | n equ t [bp-o] | ||
| 273 | endif | ||
| 274 | endm | ||
| 275 | globalB macro n,i,s | ||
| 276 | ?aD <n>,1 | ||
| 277 | ?dd n,1,<BYTE>,<DB>,<i>,<s> | ||
| 278 | endm | ||
| 279 | globalW macro n,i,s | ||
| 280 | ?aD <n>,2 | ||
| 281 | ?dd n,1,<WORD>,<DW>,<i>,<s> | ||
| 282 | endm | ||
| 283 | globalD macro n,i,s | ||
| 284 | ?aD <n>,4 | ||
| 285 | ?dd n,1,<DWORD>,<DD>,<i>,<s> | ||
| 286 | endm | ||
| 287 | globalQ macro n,i,s | ||
| 288 | ?aD <n>,8 | ||
| 289 | ?dd n,1,<QWORD>,<DQ>,<i>,<s> | ||
| 290 | endm | ||
| 291 | globalT macro n,i,s | ||
| 292 | ?aD <n>,10 | ||
| 293 | ?dd n,1,<TBYTE>,<DT>,<i>,<s> | ||
| 294 | endm | ||
| 295 | if sizeC | ||
| 296 | globalCP macro n,i,s | ||
| 297 | globalD n,<i>,<s> | ||
| 298 | endm | ||
| 299 | else | ||
| 300 | globalCP macro n,i,s | ||
| 301 | globalW n,<i>,<s> | ||
| 302 | endm | ||
| 303 | endif | ||
| 304 | if sizeD | ||
| 305 | globalDP macro n,i,s | ||
| 306 | globalD n,<i>,<s> | ||
| 307 | endm | ||
| 308 | else | ||
| 309 | globalDP macro n,i,s | ||
| 310 | globalW n,<i>,<s> | ||
| 311 | endm | ||
| 312 | endif | ||
| 313 | staticB macro n,i,s | ||
| 314 | ?aD <n>,1 | ||
| 315 | ?dd n,0,<BYTE>,<DB>,<i>,<s> | ||
| 316 | endm | ||
| 317 | staticW macro n,i,s | ||
| 318 | ?aD <n>,2 | ||
| 319 | ?dd n,0,<WORD>,<DW>,<i>,<s> | ||
| 320 | endm | ||
| 321 | staticD macro n,i,s | ||
| 322 | ?aD <n>,4 | ||
| 323 | ?dd n,0,<DWORD>,<DD>,<i>,<s> | ||
| 324 | endm | ||
| 325 | staticQ macro n,i,s | ||
| 326 | ?aD <n>,8 | ||
| 327 | ?dd n,0,<QWORD>,<DQ>,<i>,<s> | ||
| 328 | endm | ||
| 329 | staticT macro n,i,s | ||
| 330 | ?aD <n>,10 | ||
| 331 | ?dd n,0,<TBYTE>,<DT>,<i>,<s> | ||
| 332 | endm | ||
| 333 | if sizeC | ||
| 334 | staticCP macro n,i,s | ||
| 335 | staticD n,<i>,<s> | ||
| 336 | endm | ||
| 337 | else | ||
| 338 | staticCP macro n,i,s | ||
| 339 | staticW n,<i>,<s> | ||
| 340 | endm | ||
| 341 | endif | ||
| 342 | if sizeD | ||
| 343 | staticDP macro n,i,s | ||
| 344 | staticD n,<i>,<s> | ||
| 345 | endm | ||
| 346 | else | ||
| 347 | staticDP macro n,i,s | ||
| 348 | staticW n,<i>,<s> | ||
| 349 | endm | ||
| 350 | endif | ||
| 351 | ?dd macro n,p,t,d,i,s | ||
| 352 | ife ?PLM | ||
| 353 | n label t | ||
| 354 | ?dd1 _&n,p,<d>,<i>,<s> | ||
| 355 | else | ||
| 356 | ?dd1 n,p,<d>,<i>,<s> | ||
| 357 | endif | ||
| 358 | endm | ||
| 359 | ?dd1 macro n,p,d,i,s | ||
| 360 | if p | ||
| 361 | PUBLIC n | ||
| 362 | endif | ||
| 363 | ifb <s> | ||
| 364 | n d i | ||
| 365 | else | ||
| 366 | ifb <i> | ||
| 367 | n d s DUP (?) | ||
| 368 | else | ||
| 369 | n d s DUP (i) | ||
| 370 | endif | ||
| 371 | endif | ||
| 372 | endm | ||
| 373 | externB macro nL | ||
| 374 | ?ex1 <&nL>,1,<BYTE> | ||
| 375 | endm | ||
| 376 | externW macro nL | ||
| 377 | ?ex1 <&nL>,2,<WORD> | ||
| 378 | endm | ||
| 379 | externD macro nL | ||
| 380 | ?ex1 <&nL>,4,<DWORD> | ||
| 381 | endm | ||
| 382 | externQ macro nL | ||
| 383 | ?ex1 <&nL>,8,<QWORD> | ||
| 384 | endm | ||
| 385 | externT macro nL | ||
| 386 | ?ex1 <&nL>,10,<TBYTE> | ||
| 387 | endm | ||
| 388 | externNP macro nL | ||
| 389 | ?ex1 <&nL>,2,<NEAR> | ||
| 390 | endm | ||
| 391 | externFP macro nL | ||
| 392 | ?ex1 <&nL>,4,<FAR> | ||
| 393 | endm | ||
| 394 | if sizeC | ||
| 395 | externP macro nL | ||
| 396 | ?ex1 <&nL>,4,<FAR> | ||
| 397 | endm | ||
| 398 | else | ||
| 399 | externP macro nL | ||
| 400 | ?ex1 <&nL>,2,<NEAR> | ||
| 401 | endm | ||
| 402 | endif | ||
| 403 | if sizeC | ||
| 404 | externCP macro nL | ||
| 405 | ?ex1 <&nL>,4,<DWORD> | ||
| 406 | endm | ||
| 407 | else | ||
| 408 | externCP macro nL | ||
| 409 | ?ex1 <&nL>,2,<WORD> | ||
| 410 | endm | ||
| 411 | endif | ||
| 412 | if sizeD | ||
| 413 | externDP macro nL | ||
| 414 | ?ex1 <&nL>,4,<DWORD> | ||
| 415 | endm | ||
| 416 | else | ||
| 417 | externDP macro nL | ||
| 418 | ?ex1 <&nL>,2,<WORD> | ||
| 419 | endm | ||
| 420 | endif | ||
| 421 | ?ex1 macro nL,s,d | ||
| 422 | irp x,<nL> | ||
| 423 | .xcref | ||
| 424 | .xcref ?T&&x | ||
| 425 | .cref | ||
| 426 | ?T&&x = s | ||
| 427 | ife ?PLM | ||
| 428 | extrn _&&x:&d | ||
| 429 | x equ _&&x | ||
| 430 | else | ||
| 431 | extrn x:&d | ||
| 432 | endif | ||
| 433 | endm | ||
| 434 | endm | ||
| 435 | labelB macro nL | ||
| 436 | ?lb1 <&nL>,1,<BYTE> | ||
| 437 | endm | ||
| 438 | labelW macro nL | ||
| 439 | ?lb1 <&nL>,2,<WORD> | ||
| 440 | endm | ||
| 441 | labelD macro nL | ||
| 442 | ?lb1 <&nL>,4,<DWORD> | ||
| 443 | endm | ||
| 444 | labelQ macro nL | ||
| 445 | ?lb1 <&nL>,8,<QWORD> | ||
| 446 | endm | ||
| 447 | labelT macro nL | ||
| 448 | ?lb1 <&nL>,10,<TBYTE> | ||
| 449 | endm | ||
| 450 | labelNP macro nL | ||
| 451 | ?lb1 <&nL>,2,<NEAR> | ||
| 452 | endm | ||
| 453 | labelFP macro nL | ||
| 454 | ?lb1 <&nL>,4,<FAR> | ||
| 455 | endm | ||
| 456 | if sizeC | ||
| 457 | labelP macro nL | ||
| 458 | ?lb1 <&nL>,4,<FAR> | ||
| 459 | endm | ||
| 460 | else | ||
| 461 | labelP macro nL | ||
| 462 | ?lb1 <&nL>,2,<NEAR> | ||
| 463 | endm | ||
| 464 | endif | ||
| 465 | if sizeC | ||
| 466 | labelCP macro nL | ||
| 467 | ?lb1 <&nL>,4,<DWORD> | ||
| 468 | endm | ||
| 469 | else | ||
| 470 | labelCP macro nL | ||
| 471 | ?lb1 <&nL>,2,<WORD> | ||
| 472 | endm | ||
| 473 | endif | ||
| 474 | if sizeD | ||
| 475 | labelDP macro nL | ||
| 476 | ?lb1 <&nL>,4,<DWORD> | ||
| 477 | endm | ||
| 478 | else | ||
| 479 | labelDP macro nL | ||
| 480 | ?lb1 <&nL>,2,<WORD> | ||
| 481 | endm | ||
| 482 | endif | ||
| 483 | ?lb1 macro nL,s,d | ||
| 484 | ?lblpu = 0 | ||
| 485 | irp x,<nL> | ||
| 486 | ifidn <x>,<PUBLIC> | ||
| 487 | ?lblpu = 1 | ||
| 488 | else | ||
| 489 | .xcref | ||
| 490 | .xcref ?T&&x | ||
| 491 | .cref | ||
| 492 | ?T&&x = s | ||
| 493 | ife ?PLM | ||
| 494 | if ?lblpu | ||
| 495 | public _&&x | ||
| 496 | endif | ||
| 497 | _&&x label &d | ||
| 498 | x equ _&&x | ||
| 499 | else | ||
| 500 | if ?lblpu | ||
| 501 | public x | ||
| 502 | endif | ||
| 503 | x label &d | ||
| 504 | endif | ||
| 505 | endif | ||
| 506 | endm | ||
| 507 | endm | ||
| 508 | defB macro nL | ||
| 509 | ?aD <&nL>,1 | ||
| 510 | endm | ||
| 511 | defW macro nL | ||
| 512 | ?aD <&nL>,2 | ||
| 513 | endm | ||
| 514 | defD macro nL | ||
| 515 | ?aD <&nL>,4 | ||
| 516 | endm | ||
| 517 | defQ macro nL | ||
| 518 | ?aD <&nL>,8 | ||
| 519 | endm | ||
| 520 | defT macro nL | ||
| 521 | ?aD <&nL>,10 | ||
| 522 | endm | ||
| 523 | if sizeC | ||
| 524 | defCP macro nL | ||
| 525 | defD <nL> | ||
| 526 | endm | ||
| 527 | else | ||
| 528 | defCP macro nL | ||
| 529 | defW <nL> | ||
| 530 | endm | ||
| 531 | endif | ||
| 532 | if sizeD | ||
| 533 | defDP macro nL | ||
| 534 | defD <nL> | ||
| 535 | endm | ||
| 536 | else | ||
| 537 | defDP macro nL | ||
| 538 | defW <nL> | ||
| 539 | endm | ||
| 540 | endif | ||
| 541 | ?aD macro nL,s | ||
| 542 | irp x,<nL> | ||
| 543 | .xcref | ||
| 544 | .xcref ?T&&x | ||
| 545 | .cref | ||
| 546 | ?T&&x = s | ||
| 547 | endm | ||
| 548 | endm | ||
| 549 | regPtr macro n,S,O | ||
| 550 | .xcref | ||
| 551 | .xcref ?T&n,?SR&n,?OR&n | ||
| 552 | .cref | ||
| 553 | ?T&n = 0FFFFH | ||
| 554 | ?SR&n = 0 | ||
| 555 | ?RI ?SR&n,<&S> | ||
| 556 | ?OR&n = 0 | ||
| 557 | ?RI ?OR&n,<&O> | ||
| 558 | endm | ||
| 559 | arg macro aL | ||
| 560 | irp x,<aL> | ||
| 561 | ?argc = ?argc + 1 | ||
| 562 | ?Atal <x>,%?argc | ||
| 563 | endm | ||
| 564 | endm | ||
| 565 | ?Atal macro n,i | ||
| 566 | .xcref | ||
| 567 | .xcref ?ALI&i | ||
| 568 | .cref | ||
| 569 | ?ALI&i ¯o | ||
| 570 | ?AP n | ||
| 571 | &endm | ||
| 572 | endm | ||
| 573 | ?AP macro n | ||
| 574 | ?argl = ?argl + 2 | ||
| 575 | ifdef ?T&n | ||
| 576 | ife ?T&n-1 | ||
| 577 | push word ptr (n) | ||
| 578 | exitm | ||
| 579 | endif | ||
| 580 | ife ?T&n-2 | ||
| 581 | push n | ||
| 582 | exitm | ||
| 583 | endif | ||
| 584 | ife ?T&n-4 | ||
| 585 | push word ptr (n)+2 | ||
| 586 | push word ptr (n) | ||
| 587 | ?argl = ?argl + 2 | ||
| 588 | exitm | ||
| 589 | endif | ||
| 590 | ife ?T&n-8 | ||
| 591 | push word ptr (n)+6 | ||
| 592 | push word ptr (n)+4 | ||
| 593 | push word ptr (n)+2 | ||
| 594 | push word ptr (n) | ||
| 595 | ?argl = ?argl + 6 | ||
| 596 | exitm | ||
| 597 | endif | ||
| 598 | ife ?T&n-0FFFFH | ||
| 599 | mpush %(?SR&n),1 | ||
| 600 | mpush %(?OR&n),1 | ||
| 601 | ?argl = ?argl + 2 | ||
| 602 | exitm | ||
| 603 | endif | ||
| 604 | ife ?T&n | ||
| 605 | push word ptr (n) | ||
| 606 | exitm | ||
| 607 | endif | ||
| 608 | endif | ||
| 609 | push n | ||
| 610 | endm | ||
| 611 | ife ?PLM | ||
| 612 | ccall macro n,a,sleaze | ||
| 613 | ifnb <a> | ||
| 614 | Arg <a> | ||
| 615 | endif | ||
| 616 | ifdef ?SM&n | ||
| 617 | ?RSL = ?RSL AND ?SM&n | ||
| 618 | endif | ||
| 619 | mpush %?RSL | ||
| 620 | ?argl = 0 | ||
| 621 | ?ACB = ?argc | ||
| 622 | rept ?argc | ||
| 623 | uconcat <?ALI>,%?ACB | ||
| 624 | uconcat <purge>,,<?ALI>,%?ACB | ||
| 625 | ?ACB = ?ACB - 1 | ||
| 626 | endm | ||
| 627 | ife ?PLM | ||
| 628 | ifb <sleaze> | ||
| 629 | call _&n | ||
| 630 | else | ||
| 631 | call n | ||
| 632 | endif | ||
| 633 | else | ||
| 634 | call n | ||
| 635 | endif | ||
| 636 | if ?argl | ||
| 637 | add sp,?argl | ||
| 638 | endif | ||
| 639 | mpop %?RSL | ||
| 640 | ?RSL = 0 | ||
| 641 | ?argc = 0 | ||
| 642 | ?argl = 0 | ||
| 643 | endm | ||
| 644 | else | ||
| 645 | ccall macro n,a | ||
| 646 | ifnb <a> | ||
| 647 | Arg <a> | ||
| 648 | endif | ||
| 649 | ifdef ?SM&n | ||
| 650 | ?RSL = ?RSL AND ?SM&n | ||
| 651 | endif | ||
| 652 | mpush %?RSL | ||
| 653 | ?argl = 0 | ||
| 654 | ?ACB = 1 | ||
| 655 | rept ?argc | ||
| 656 | uconcat <?ALI>,%?ACB | ||
| 657 | uconcat <purge>,,<?ALI>,%?ACB | ||
| 658 | ?ACB = ?ACB + 1 | ||
| 659 | endm | ||
| 660 | ife ?PLM | ||
| 661 | call _&n | ||
| 662 | else | ||
| 663 | call n | ||
| 664 | endif | ||
| 665 | mpop %?RSL | ||
| 666 | ?RSL = 0 | ||
| 667 | ?argc = 0 | ||
| 668 | ?argl = 0 | ||
| 669 | endm | ||
| 670 | endif | ||
| 671 | cProc macro n,cl,s | ||
| 672 | ?pd n,<cl>,<s>,4 | ||
| 673 | endm | ||
| 674 | ?pd macro n,c,a,i | ||
| 675 | if ?CPD | ||
| 676 | ?UTPE | ||
| 677 | endif | ||
| 678 | ?CPD = 1 | ||
| 679 | ??? = 0 | ||
| 680 | ?argc = 0 | ||
| 681 | ?BA = 0 | ||
| 682 | ?PO = 0 | ||
| 683 | ?PU = 0 | ||
| 684 | ?IA = 0 | ||
| 685 | ?adj = i | ||
| 686 | ?PAS = 0 | ||
| 687 | ifnb <a> | ||
| 688 | ?RI ?PAS,<a> | ||
| 689 | endif | ||
| 690 | ?PC = sizeC | ||
| 691 | irp x,<c> | ||
| 692 | ifidn <x>,<FAR> | ||
| 693 | ?PC = 1 | ||
| 694 | endif | ||
| 695 | ifidn <x>,<NEAR> | ||
| 696 | ?PC = 0 | ||
| 697 | endif | ||
| 698 | ifidn <x>,<PUBLIC> | ||
| 699 | ?PU = 1 | ||
| 700 | endif | ||
| 701 | endm | ||
| 702 | if ?PC | ||
| 703 | if ?WIN | ||
| 704 | ?IA = 2 | ||
| 705 | endif | ||
| 706 | ?adj = ?adj + 2 | ||
| 707 | endif | ||
| 708 | ife ?PLM | ||
| 709 | ife ?PC | ||
| 710 | n label near | ||
| 711 | else | ||
| 712 | n label far | ||
| 713 | endif | ||
| 714 | ?pg <_&n>,%?PU,%?PC,%?PAS | ||
| 715 | else | ||
| 716 | ?pg <n>,%?PU,%?PC,%?PAS | ||
| 717 | endif | ||
| 718 | endm | ||
| 719 | ?pg macro n,p,c,a | ||
| 720 | .xcref | ||
| 721 | cBegin ¯o g | ||
| 722 | .xcref | ||
| 723 | ?pg1 <n>,c,a,%?PO | ||
| 724 | ?CPD = 0 | ||
| 725 | ?argc = 0 | ||
| 726 | ?BA = 1 | ||
| 727 | ??? = (???+1) AND 0FFFEH | ||
| 728 | if p | ||
| 729 | PUBLIC n | ||
| 730 | endif | ||
| 731 | ife c | ||
| 732 | n proc NEAR | ||
| 733 | else | ||
| 734 | n proc FAR | ||
| 735 | endif | ||
| 736 | ifidn <g>,<nogen> | ||
| 737 | if ???+?PO+a | ||
| 738 | %out <cBegin - possible invalid use of nogen> | ||
| 739 | endif | ||
| 740 | else | ||
| 741 | if ?IA | ||
| 742 | mov ax,ds | ||
| 743 | nop | ||
| 744 | inc bp | ||
| 745 | push bp | ||
| 746 | mov bp,sp | ||
| 747 | push ds | ||
| 748 | mov ds,ax | ||
| 749 | else | ||
| 750 | push bp | ||
| 751 | mov bp,sp | ||
| 752 | endif | ||
| 753 | if ??? | ||
| 754 | sub sp,??? | ||
| 755 | endif | ||
| 756 | mPush a,1 | ||
| 757 | endif | ||
| 758 | .cref | ||
| 759 | purge cBegin | ||
| 760 | &endm | ||
| 761 | ?UTPE ¯o | ||
| 762 | %out Unterminated Procedure Definition: "&n" | ||
| 763 | &endm | ||
| 764 | endm | ||
| 765 | |||
| 766 | ?pg1 macro n,c,a,o | ||
| 767 | .xcref | ||
| 768 | cEnd ¯o g | ||
| 769 | .xcref | ||
| 770 | ?BA = 0 | ||
| 771 | ifidn <g>,<nogen> | ||
| 772 | if o+a | ||
| 773 | %out <cEnd - possible invalid use of nogen> | ||
| 774 | endif | ||
| 775 | else | ||
| 776 | mPop a,1 | ||
| 777 | if ?IA | ||
| 778 | sub bp,2 | ||
| 779 | mov sp,bp | ||
| 780 | pop ds | ||
| 781 | pop bp | ||
| 782 | dec bp | ||
| 783 | else | ||
| 784 | mov sp,bp | ||
| 785 | pop bp | ||
| 786 | endif | ||
| 787 | ife ?PLM | ||
| 788 | ret | ||
| 789 | else | ||
| 790 | ret o | ||
| 791 | endif | ||
| 792 | endif | ||
| 793 | n endp | ||
| 794 | .cref | ||
| 795 | purge cEnd | ||
| 796 | &endm | ||
| 797 | .cref | ||
| 798 | endm | ||
| 799 | |||
| 800 | assumes macro s,g | ||
| 801 | local assumed | ||
| 802 | assumed = 0 | ||
| 803 | ifidn <code>,<g> | ||
| 804 | ?cas <s> | ||
| 805 | assumed = 1 | ||
| 806 | endif | ||
| 807 | ifidn <CODE>,<g> | ||
| 808 | ?cas <s> | ||
| 809 | assumed = 1 | ||
| 810 | endif | ||
| 811 | ifidn <data>,<g> | ||
| 812 | assume s&:dgroup | ||
| 813 | assumed = 1 | ||
| 814 | endif | ||
| 815 | ifidn <DATA>,<g> | ||
| 816 | assume s&:dgroup | ||
| 817 | assumed = 1 | ||
| 818 | endif | ||
| 819 | ife assumed | ||
| 820 | assume s&:&g | ||
| 821 | endif | ||
| 822 | endm | ||
| 823 | if sizeC | ||
| 824 | ?cas macro s | ||
| 825 | assume s&:_TEXT | ||
| 826 | endm | ||
| 827 | else | ||
| 828 | ?cas macro s | ||
| 829 | assume s&:IGROUP | ||
| 830 | endm | ||
| 831 | endif | ||
| 832 | createSeg macro n,ln,a,co,cl,grp | ||
| 833 | ifnb <grp> | ||
| 834 | ifidn <grp>,<IGROUP> | ||
| 835 | ife sizeC | ||
| 836 | addSeg IGROUP,n | ||
| 837 | endif | ||
| 838 | else | ||
| 839 | addSeg grp,n | ||
| 840 | endif | ||
| 841 | endif | ||
| 842 | ifnb <cl> | ||
| 843 | n segment a co '&cl' | ||
| 844 | else | ||
| 845 | n segment a co | ||
| 846 | endif | ||
| 847 | n ends | ||
| 848 | ?cs1 <n>,<ln> | ||
| 849 | endm | ||
| 850 | if1 | ||
| 851 | ASMpass=1 | ||
| 852 | else | ||
| 853 | ASMpass=2 | ||
| 854 | endif | ||
| 855 | addSeg macro grp,seg | ||
| 856 | ifndef def_&grp | ||
| 857 | def_&grp= 0 | ||
| 858 | endif | ||
| 859 | if def_&grp ne ASMpass | ||
| 860 | add_&grp ¯o s | ||
| 861 | in_&grp <seg>,s | ||
| 862 | &endm | ||
| 863 | in_&grp ¯o sl,s | ||
| 864 | ifb <s> | ||
| 865 | grp group sl | ||
| 866 | else | ||
| 867 | add_&grp ¯o ns | ||
| 868 | in_&grp <sl,s>,ns | ||
| 869 | &endm | ||
| 870 | endif | ||
| 871 | &endm | ||
| 872 | def_&grp=ASMpass | ||
| 873 | else | ||
| 874 | add_&grp seg | ||
| 875 | endif | ||
| 876 | endm | ||
| 877 | defGrp macro nam | ||
| 878 | addSeg nam | ||
| 879 | endm | ||
| 880 | ?cs1 macro n,ln | ||
| 881 | begin&ln ¯o | ||
| 882 | ?cs2 <n> | ||
| 883 | n segment | ||
| 884 | &endm | ||
| 885 | endm | ||
| 886 | |||
| 887 | ?cs2 macro n | ||
| 888 | sEnd ¯o | ||
| 889 | n ends | ||
| 890 | &endm | ||
| 891 | endm | ||
| 892 | |||
| 893 | sBegin macro ln | ||
| 894 | begin&ln | ||
| 895 | endm | ||
| 896 | |||
| 897 | ife ?DF | ||
| 898 | createSeg _TEXT,code,byte,public,CODE,IGROUP | ||
| 899 | createSeg _DATA,data,word,public,DATA,DGROUP | ||
| 900 | if ?WIN | ||
| 901 | ife sizeC | ||
| 902 | createSeg _INITTEXT,initcode,byte,public,CODE,IGROUP | ||
| 903 | createSeg _INITDATA,initdata,word,public,DATA,DGROUP | ||
| 904 | endif | ||
| 905 | endif | ||
| 906 | ife sizeC | ||
| 907 | defGrp IGROUP | ||
| 908 | endif | ||
| 909 | defGrp DGROUP | ||
| 910 | if sizeC | ||
| 911 | codeOFFSET equ OFFSET _TEXT: | ||
| 912 | else | ||
| 913 | codeOFFSET equ OFFSET IGROUP: | ||
| 914 | endif | ||
| 915 | dataOFFSET equ OFFSET DGROUP: | ||
| 916 | endif | ||
| 917 | |||
| 918 | errnz macro x | ||
| 919 | if2 | ||
| 920 | if x | ||
| 921 | errnz1 <x>,%(x) | ||
| 922 | endif | ||
| 923 | endif | ||
| 924 | endm | ||
| 925 | |||
| 926 | errnz1 macro x1,x2 | ||
| 927 | = *ERRNZ* x1 = x2 | ||
| 928 | endm | ||
| 929 | |||
| 930 | errn$ macro l,x | ||
| 931 | errnz <OFFSET $ - OFFSET l x> | ||
| 932 | endm | ||