home *** CD-ROM | disk | FTP | other *** search
/ Datatid 1999 #6 / Datatid_1999-06.iso / internet / Tango352Promo / P.SQL / PTKPKG.1 / XMACRO.MAC < prev   
Encoding:
Text File  |  1989-12-18  |  16.8 KB  |  755 lines

  1. .SFCOND
  2. ;.XLIST
  3. ;
  4. ;    Currently, this file does not support large DATA model.
  5. ;
  6. ;    Changes must be made to some parts in order to accomodate
  7. ;    this model.
  8. ;
  9.  
  10. INCLUDE FAR.FLG
  11. ;
  12. ;    The FAR.FLG file contains conditional flags which determine how
  13. ;    the assembly module should be compiled.  These flags are expected
  14. ;    to be in upper case.  If you plan to use the '/mx' or '/ml' switch
  15. ;    when assembling your file, they MUST be in upper case.
  16. ;
  17.  
  18. TRUE    EQU    1
  19. FALSE    EQU    0
  20. NULL    EQU    0FFFFH
  21.  
  22. IFNDEF    DOSENV
  23.     DOSENV    EQU    TRUE
  24. ENDIF
  25.  
  26. IFNDEF    FARPROC
  27.     FARPROC EQU    FALSE
  28. ENDIF
  29.  
  30. IFNDEF    MSC
  31.     MSC    EQU    FALSE
  32. ENDIF
  33.  
  34. IFNDEF    FARDATA
  35.     FARDATA EQU    FALSE
  36. ENDIF
  37.  
  38. IFNDEF    VAP
  39.     VAP    EQU    FALSE
  40. ENDIF
  41.  
  42. IFNDEF    OPSYSHERE
  43.     OPSYSHERE    EQU    FALSE
  44. ENDIF
  45.  
  46. IFNDEF    SYSCALLS
  47.     SYSCALLS    EQU    FALSE
  48. ENDIF
  49. if1
  50. outif    MACRO    name,defval,onmsg,offmsg
  51.         ifndef    name
  52.                 ifb    <defval>
  53.                         name=0
  54.                 else
  55.                         name=defval
  56.                 endif
  57.         endif
  58.         if    name
  59.                 name=1
  60.                 ifnb    <onmsg>
  61.                         %out    !    onmsg
  62.                 endif
  63.         else
  64.                 ifnb    <offmsg>
  65.                         %out    !    offmsg
  66.                 endif
  67.         endif
  68. endm
  69.  
  70. outif    DOSENV,1,<DOS Environment>,<OS/2 Environment>
  71. outif    FARPROC,1,<Large code>,<Small code>
  72. outif    FARDATA,1,<Large data>,<Small data>
  73. outif    MSC,1,<Microsoft calling conventions>,<Non-Microsoft calling conventions>
  74. outif    VAP,1,<VAP environment>,<Non-VAP environment>
  75. endif
  76.  
  77. ; if not compiling for the DOS environment
  78. ;    (In other words --- compiling for OS/2)
  79. ; we can assume we will be in protected mode (286 or 386)
  80.  
  81. IFE    DOSENV
  82. .286P
  83. ENDIF
  84.  
  85. ;
  86. ;    Set up the address (from BP saved) where
  87. ;    the first parameter is.
  88. ;
  89. IF    FARPROC
  90. parms    equ    12
  91. ELSE
  92. parms    equ    10
  93. ENDIF
  94.  
  95. ;
  96. ;    The following equates assume that each parameter is
  97. ;    a word (2 bytes).  If you are sending parameters that
  98. ;    are not 2 bytes (far pointers) you must adjust the
  99. ;    location accessed.
  100. ;
  101. ;    You can define some additional equates which access
  102. ;    double word addresses on the stack.
  103. ;
  104. parm1    equ    parms
  105. parm2    equ    parm1 + 2
  106. parm3    equ    parm2 + 2
  107. parm4    equ    parm3 + 2
  108. parm5    equ    parm4 + 2
  109. parm6    equ    parm5 + 2
  110. parm7    equ    parm6 + 2
  111.  
  112. ;
  113. ;    Macro Name : DataGroup
  114. ;
  115. ;    Parameters : None
  116. ;
  117. ;    Define the default data segment for the
  118. ;    module being assembled.
  119. ;
  120. ;    Lattice   uses DATA
  121. ;    MicroSoft uses _DATA
  122. ;
  123. DataGroup MACRO
  124. IF    MSC
  125. _DATA    segment word public 'DATA'
  126. ELSE
  127. DATA    segment word public 'DATA'
  128. ENDIF
  129. ENDM
  130.  
  131. ;
  132. ;    Macro Name : EndData
  133. ;
  134. ;    Parameters : None
  135. ;
  136. ;    Define the end of the default data segment
  137. ;
  138. ;    Lattice   uses DATA
  139. ;    MicroSoft uses _DATA
  140. ;
  141. EndData MACRO
  142. IF    MSC
  143. _DATA    ends
  144. ELSE
  145. DATA    ends
  146. ENDIF
  147. ENDM
  148.  
  149. gVar    MACRO    VARNAME,VARSIZE,INITVAL
  150. IF    MSC
  151.     public        _&VARNAME
  152.     _&VARNAME    VARSIZE INITVAL
  153.     VARNAME     equ    _&VARNAME
  154. ELSE
  155.     public        VARNAME
  156.     VARNAME     VARSIZE INITVAL
  157. ENDIF
  158. ENDM
  159.  
  160. ;
  161. ;    Macro Name : globalB    mWord,lWord,initval
  162. ;
  163. ;    Parameters : mByte   = complete variable name
  164. ;             lByte   = 8 character name for variable
  165. ;             initval = initial value
  166. ;
  167. ;    Definition : Define a public 1 BYTE variable with the
  168. ;             initial value of initval
  169. ;
  170. ;             Lattice only allows 8 character variable names
  171. ;             so lByte will be used as the external name.
  172. ;
  173. ;             MicroSoft accepts more a complete name so
  174. ;             mByte will be used.
  175. ;
  176. ;             You should access the variable in your assembly file
  177. ;             as mByte, not as lByte
  178. ;
  179. globalB MACRO    mByte,lByte,initval
  180.     gVar    mByte,db,initval
  181. ENDM
  182.  
  183. ;
  184. ;    Macro Name : globalW    mWord,lWord,initval
  185. ;
  186. ;    Parameters : mWord   = complete variable name
  187. ;             lWord   = 8 character name for variable
  188. ;             initval = initial value
  189. ;
  190. ;    Definition : Define a public 2 BYTE WORD variable with the
  191. ;             initial value of initval
  192. ;
  193. ;             Lattice only allows 8 character variable names
  194. ;             so lWord will be used as the external name.
  195. ;
  196. ;             MicroSoft accepts more a complete name so
  197. ;             mWord will be used.
  198. ;
  199. ;             You should access the variable in your assembly file
  200. ;             as mWord, not as lWord
  201. ;
  202. globalW MACRO    mWord,lWord,initval
  203.     gVar    mWord,dw,initval
  204. ENDM
  205.  
  206. ;
  207. ;    Macro Name : globalD    mWord,lWord,initval
  208. ;
  209. ;    Parameters : mWord   = complete variable name
  210. ;             lWord   = 8 character name for variable
  211. ;             initval = initial value
  212. ;
  213. ;    Definition : Define a public 4 BYTE WORD variable with the
  214. ;             initial value of initval
  215. ;
  216. ;             Lattice only allows 8 character variable names
  217. ;             so lWord will be used as the external name.
  218. ;
  219. ;             MicroSoft accepts more a complete name so
  220. ;             mWord will be used.
  221. ;
  222. ;             You should access the variable in your assembly file
  223. ;             as mWord, not as lWord
  224. ;
  225. globalD MACRO    mWord,lWord,initval
  226.     gVar    mWord,dd,initval
  227. ENDM
  228.  
  229. ;
  230. ;    Macro Name : globalQ    mWord,lWord,initval
  231. ;
  232. ;    Parameters : mWord   = complete variable name
  233. ;             lWord   = 8 character name for variable
  234. ;             initval = initial value
  235. ;
  236. ;    Definition : Define a public 8 BYTE WORD variable with the
  237. ;             initial value of initval
  238. ;
  239. ;             Lattice only allows 8 character variable names
  240. ;             so lWord will be used as the external name.
  241. ;
  242. ;             MicroSoft accepts more a complete name so
  243. ;             mWord will be used.
  244. ;
  245. ;             You should access the variable in your assembly file
  246. ;             as mWord, not as lWord
  247. ;
  248. globalQ MACRO    mWord,lWord,initval
  249.     gVar    mWord,dq,initval
  250. ENDM
  251.  
  252. xVar    MACRO    VARNAME,VARSIZE
  253. IF    MSC
  254.     extrn    _&VARNAME&:&VARSIZE
  255.     VARNAME EQU    _&VARNAME
  256. ELSE
  257.     extrn    VARNAME&:&VARSIZE
  258. ENDIF
  259. ENDM
  260.  
  261. ;
  262. ;    Macro Name : extB    extvar,extvar8
  263. ;
  264. ;    Parameters : extvar  = complete variable name
  265. ;             extvar8 = 8 character name for variable
  266. ;
  267. ;    Definition : Define an external 1 BYTE variable
  268. ;
  269. ;             Lattice only allows 8 character variable names
  270. ;             so extvar8 will be used as the external name.
  271. ;
  272. ;             MicroSoft accepts more a complete name so
  273. ;             extvar will be used.
  274. ;
  275. ;             You should access the variable in your assembly file
  276. ;             as extvar, not as extvar8
  277. ;
  278. extB    MACRO    extvar,extvar8
  279.     xVar    extvar,byte
  280. ENDM
  281.  
  282. ;
  283. ;    Macro Name : extW    extvar,extvar8
  284. ;
  285. ;    Parameters : extvar  = complete variable name
  286. ;             extvar8 = 8 character name for variable
  287. ;
  288. ;    Definition : Define an external 2 BYTE WORD variable
  289. ;
  290. ;             Lattice only allows 8 character variable names
  291. ;             so extvar8 will be used as the external name.
  292. ;
  293. ;             MicroSoft accepts more a complete name so
  294. ;             extvar will be used.
  295. ;
  296. ;             You should access the variable in your assembly file
  297. ;             as extvar, not as extvar8
  298. ;
  299. extW    MACRO    extvar,extvar8
  300.     xVar    extvar,word
  301. ENDM
  302.  
  303. ;
  304. ;    Macro Name : extD    extvar,extvar8
  305. ;
  306. ;    Parameters : extvar  = complete variable name
  307. ;             extvar8 = 8 character name for variable
  308. ;
  309. ;    Definition : Define an external 4 BYTE WORD variable
  310. ;
  311. ;             Lattice only allows 8 character variable names
  312. ;             so extvar8 will be used as the external name.
  313. ;
  314. ;             MicroSoft accepts more a complete name so
  315. ;             extvar will be used.
  316. ;
  317. ;             You should access the variable in your assembly file
  318. ;             as extvar, not as extvar8
  319. ;
  320. extD    MACRO    extvar,extvar8
  321.     xVar    extvar,dword
  322. ENDM
  323.  
  324. ;
  325. ;    Macro Name : extQ    extvar,extvar8
  326. ;
  327. ;    Parameters : extvar  = complete variable name
  328. ;             extvar8 = 8 character name for variable
  329. ;
  330. ;    Definition : Define an external 8 BYTE WORD variable
  331. ;
  332. ;             Lattice only allows 8 character variable names
  333. ;             so extvar8 will be used as the external name.
  334. ;
  335. ;             MicroSoft accepts more a complete name so
  336. ;             extvar will be used.
  337. ;
  338. ;             You should access the variable in your assembly file
  339. ;             as extvar, not as extvar8
  340. ;
  341. extQ    MACRO    extvar,extvar8
  342.     xVar    extvar,qword
  343. ENDM
  344.  
  345. ;
  346. ;    Macro Name : globalBuff mBuff,lBuff,type,length,initval
  347. ;
  348. ;    Parameters : mBuff   = complete variable name
  349. ;             lBuff   = 8 character name for variable
  350. ;             type    = DB,DW,DQ, etc.
  351. ;             length  = number of repetitions of the initial value
  352. ;             initval = inital value for each element of the buffer
  353. ;
  354. ;    Definition : Define a global buffer of data
  355. ;
  356. ;             The actual size of the buffer will be
  357. ;
  358. ;            length * sizeof(type)
  359. ;
  360. ;             Lattice only allows 8 character variable names
  361. ;             so lBuff will be used as the global name.
  362. ;
  363. ;             MicroSoft accepts more a complete name so mBuff
  364. ;             will be used.
  365. ;
  366. ;             You should access the variable in your assembly file
  367. ;             as mBuff, not as lBuff
  368. ;
  369. globalBuff    MACRO    mBuff,lBuff,type,length,initval
  370. IF    MSC
  371.     public    _&mBuff
  372.     _&mBuff type    length dup (initval)
  373.     mBuff    equ    _&mBuff
  374. ELSE
  375.     public    mBuff
  376.     mBuff    type    length dup (initval)
  377. ENDIF
  378. ENDM
  379.  
  380. ;
  381. ;    Macro Name    : SUBFN FNAME,FNAME8
  382. ;
  383. ;    Parameters    : FNAME  = Function Name (Microsoft)
  384. ;              FNAME8 = 8 Character Function Name (Lattice)
  385. ;
  386. ;    Definition    : Define a function which is global (public).
  387. ;              The macro does not save any registers, it
  388. ;              just defines the function as public
  389. ;
  390. ;              Use FNAME in you module when accessing the function.
  391. ;              this Name is used by Microsoft, and will be
  392. ;              preceded by an underscore in the object file.
  393. ;
  394. SUBFN    MACRO    FNAME,FNAME8
  395. IF    MSC
  396.     public    _&FNAME
  397. ELSE
  398.     public    FNAME
  399. ENDIF
  400.  
  401. IF    FARPROC
  402.     IF    MSC
  403.         _&FNAME proc    far
  404.         FNAME    equ    _&FNAME
  405.     ELSE
  406.         FNAME    proc    far
  407.     ENDIF
  408. ELSE
  409.     IF    MSC
  410.         _&FNAME proc    near
  411.         FNAME    equ    _&FNAME
  412.     ELSE
  413.         FNAME    proc    near
  414.     ENDIF
  415. ENDIF
  416. ENDM
  417.  
  418. ;
  419. ;    Macro Name    : STARTFN    FNAME,FNAME8
  420. ;
  421. ;    Parameters    : FNAME  = Function Name (Microsoft)
  422. ;              FNAME8 = 8 Character Function Name (Lattice)
  423. ;
  424. ;    Definition    : Define a function which is global (public).
  425. ;              The macro saves the BP, ES, SI, DI registers, in
  426. ;              that order, and then sets the BP register to
  427. ;              point to the current stack address.  It also
  428. ;              defines the function as public
  429. ;
  430. ;              Use FNAME in you module when accessing the function.
  431. ;              this Name is used by Microsoft, and will be
  432. ;              preceded by an underscore in the object file.
  433. ;
  434. STARTFN MACRO    FNAME,FNAME8
  435.     SUBFN    FNAME,FNAME8
  436.     push    bp            ;save caller's base pointer
  437.     push    es            ;and Extra segment register
  438.     push    si
  439.     push    di
  440.     mov    bp,sp            ;and set up our base pointer
  441. ENDM
  442.  
  443. ;
  444. ;    Macro Name    : TERMFN
  445. ;
  446. ;    Parameters    : None
  447. ;
  448. ;    Definition    : Restore all the registers that were saved on the
  449. ;              invocation of STARTFN.  The macro does not end
  450. ;              the definition of the function, it justs returns
  451. ;              from the function.
  452. ;
  453. TERMFN    MACRO
  454.     mov    sp,bp
  455.     pop    di
  456.     pop    si
  457.     pop    es
  458.     pop    bp
  459.     ret
  460. ENDM
  461.  
  462. ;
  463. ;    Macro Name    : ENDSUBFN    FNAME,FNAME8
  464. ;
  465. ;    Parameters    : FNAME  = Function Name (Microsoft)
  466. ;              FNAME8 = 8 Character Function Name (Lattice)
  467. ;
  468. ;    Definition    : End the definition of a function.  The macro
  469. ;              just defines the end of a function, it does not
  470. ;              restore any registers that may have been saved.
  471. ;
  472. ;              If you used SUBFN to define the function, then
  473. ;              use ENDSUBFN to end it.
  474. ;
  475. ;              If you used STARTFN to define the function, then
  476. ;              use ENDFN to end it.
  477. ;
  478. ;              Use FNAME in your module when calling the function.
  479. ;              this Name is used by Microsoft, and will be
  480. ;              preceded by an underscore in the object file.
  481. ;
  482. ENDSUBFN    MACRO    FNAME,FNAME8
  483. IF    MSC
  484.     _&FNAME endp
  485. ELSE
  486.     FNAME    endp
  487. ENDIF
  488. ENDM
  489.  
  490. ;
  491. ;    Macro Name    : ENDFN FNAME,FNAME8
  492. ;
  493. ;    Parameters    : FNAME  = Function Name (Microsoft)
  494. ;              FNAME8 = 8 Character Function Name (Lattice)
  495. ;
  496. ;    Definition    : End the definition of a function.  The macro
  497. ;              defines the end of a function, and restores
  498. ;              the registers that were saved by the macro STARTFN.
  499. ;
  500. ;              If you used SUBFN to define the function, then
  501. ;              use ENDSUBFN to end it.
  502. ;
  503. ;              If you used STARTFN to define the function, then
  504. ;              use ENDFN to end it.
  505. ;
  506. ;              Use FNAME in your module when calling the function.
  507. ;              this Name is used by Microsoft, and will be
  508. ;              preceded by an underscore in the object file.
  509. ;
  510. ENDFN    MACRO    FNAME,FNAME8
  511.     TERMFN
  512.     ENDSUBFN    FNAME,FNAME8
  513. ENDM
  514.  
  515. ;
  516. ;    Macro Name    : EXTPROC    PROCNAME,PNAME8
  517. ;
  518. ;    Parameters    : PROCNAME = Function Name (Microsoft)
  519. ;              PNAME8   = 8 Character Function Name (Lattice)
  520. ;
  521. ;    Definition    : Define a function as external
  522. ;
  523. EXTPROC MACRO    PROCNAME,PNAME8
  524. IF    FARPROC
  525.     IF    MSC
  526.         EXTRN    _&PROCNAME:far
  527.         PROCNAME    equ    _&PROCNAME
  528.     ELSE
  529.         EXTRN    PROCNAME:far
  530.     ENDIF
  531. ELSE
  532.     IF    MSC
  533.         EXTRN    _&PROCNAME:near
  534.         PROCNAME    equ    _&PROCNAME
  535.     ELSE
  536.         EXTRN    PROCNAME:near
  537.     ENDIF
  538. ENDIF
  539. ENDM
  540.  
  541. ;
  542. ;    Macro Name    : STARTCODE    FILENAME
  543. ;
  544. ;    Parameters    : FILENAME = Name of function module
  545. ;
  546. ;    Definition    : Define the name of a function module, and also
  547. ;              defines the code segment.
  548. ;
  549. ;              Microsoft:
  550. ;                The code segment is FILENAME_TEXT (if medium
  551. ;                model, _TEXT if small) and is placed on a
  552. ;                word boundary, is defined as public and class
  553. ;                CODE.
  554. ;
  555. ;              Lattice:
  556. ;                The code segment is FILENAME_CODE (if medium
  557. ;                model, prog if small) and is placed on a
  558. ;                word boundary, is defined as public and class
  559. ;                CODE.
  560. ;
  561. STARTCODE    MACRO    FILENAME
  562. IF    VAP
  563.     _TEXT    segment word    public    'CODE'
  564. ELSE
  565.     IF    FARPROC
  566.         IF    MSC
  567.             _TEXT    segment word public 'CODE'
  568.         ELSE
  569.             _CODE    segment word public 'CODE'
  570.         ENDIF
  571.     ELSE
  572.         IF    MSC
  573.             _TEXT    segment word public 'CODE'
  574.         ELSE
  575.             prog    segment word public 'PROG'
  576.         ENDIF
  577.     ENDIF
  578. ENDIF
  579. ENDM
  580.  
  581. ;
  582. ;    Macro Name    : ENDCODE    FILENAME
  583. ;
  584. ;    Parameters    : FILENAME = Name of function module
  585. ;
  586. ;    Definition    : Define the end of the code segment for a function
  587. ;              module.
  588. ;
  589. ;              Microsoft:
  590. ;                The code segment is FILENAME_TEXT (if medium
  591. ;                model, _TEXT if small) and is placed on a
  592. ;                word boundary, is defined as public and class
  593. ;                CODE.
  594. ;
  595. ;              Lattice:
  596. ;                The code segment is FILENAME_CODE (if medium
  597. ;                model, prog if small) and is placed on a
  598. ;                word boundary, is defined as public and class
  599. ;                CODE.
  600. ;
  601. ENDCODE     MACRO    FILENAME
  602. IF    VAP
  603.     _TEXT    ends
  604. ELSE
  605.     IF    FARPROC
  606.         IF    MSC
  607.             _TEXT    ends
  608.         ELSE
  609.             _CODE    ends
  610.         ENDIF
  611.     ELSE
  612.         IF    MSC
  613.             _TEXT    ends
  614.         ELSE
  615.             prog    ends
  616.         ENDIF
  617.     ENDIF
  618. ENDIF
  619. ENDM
  620.  
  621. ;
  622. ;    Macro Name    : STARTFILE    FILENAME
  623. ;
  624. ;    Parameters    : FILENAME = Name of function module
  625. ;
  626. ;    Definition    : Define the name of a function module, and also
  627. ;              defines the code and data segments.  The code
  628. ;              is left open (no ENDCODE macro call).  You must
  629. ;              place an ENDCODE call at the end of your code
  630. ;              section.
  631. ;
  632. ;              Microsoft:
  633. ;                The code segment is FILENAME_TEXT (if medium
  634. ;                model, _TEXT if small) and is placed on a
  635. ;                word boundary, is defined as public and class
  636. ;                CODE.  The data segment is _DATA.
  637. ;
  638. ;              Lattice:
  639. ;                The code segment is FILENAME_CODE (if medium
  640. ;                model, prog if small) and is placed on a
  641. ;                word boundary, is defined as public and class
  642. ;                CODE.  The data segment is DATA.
  643. ;
  644. ;              The data segment is placed in dgroup.
  645. ;
  646. STARTFILE MACRO FILENAME
  647.     name    FILENAME
  648.  
  649.     STARTCODE    FILENAME
  650.     ENDCODE     FILENAME
  651. ;
  652.     DataGroup
  653.     EndData
  654. ;
  655.     STARTCODE    FILENAME
  656.  
  657. IF    VAP
  658.     assume    cs:_TEXT
  659. ELSE
  660.     IF    FARPROC
  661.         IF    MSC
  662.                 assume    cs:_TEXT
  663.         ELSE
  664.                 assume    cs:_CODE
  665.         ENDIF
  666.     ELSE
  667.         IF    MSC
  668.                 assume    cs:_TEXT
  669.         ELSE
  670.             pgroup    group    prog
  671.                 assume    cs:pgroup
  672.         ENDIF
  673.     ENDIF
  674. ENDIF
  675.  
  676. IF    MSC
  677.     dgroup    group    _data
  678. ELSE
  679.     dgroup    group    data
  680. ENDIF
  681.  
  682.     assume    ds:dgroup
  683.     assume    es:dgroup
  684. ENDM
  685.  
  686. ;IF     VAP
  687. ;     extrn NetWareShellServices:dword
  688. ;ENDIF
  689.  
  690. IFE    DOSENV                        ; if not DOS
  691.                             ;   environment, and
  692.     IFE    OPSYSHERE                ; SysRoutine not
  693.                             ;   defined in module
  694.                             ;   being assembled
  695.         IF    SYSCALLS            ; and System calls
  696.                             ;   are made (as
  697.                             ;    opposed to
  698.                             ;    interrupts)
  699.             EXTPROC SysRoutine,SysRouti    ; then define external
  700.                             ;   SysRoutine
  701.         ENDIF
  702.     ENDIF
  703. ENDIF
  704.  
  705. callkbd MACRO            ;keyboard macro
  706. IF    DOSENV            ; in DOS environment, does int 16h
  707.     int    16h
  708. ELSE                ; in protected mode (OS/2),
  709.     push    16h        ;  calls SysRoutine (which calls KbdSysCall)
  710.     call    SysRoutine
  711.     add    sp,2
  712. ENDIF
  713. ENDM
  714.  
  715. callvio MACRO            ;video macro
  716. IF    DOSENV            ; in DOS environment, does int 10h
  717.     int    10h
  718. ELSE                ; in protected mode (OS/2),
  719.     push    10h        ;  calls SysRoutine (which calls VioSysCall)
  720.     call    SysRoutine
  721.     add    sp,2
  722. ENDIF
  723. ENDM
  724.  
  725. callos    MACRO            ;DOS int 21h macro
  726. ;IF     VAP
  727. ;     call     dword ptr cs:NetWareShellServices
  728. ;ELSE
  729.     IF    DOSENV            ; in DOS environment, does int 21h
  730.         int    21h
  731.     ELSE                ; in protected mode (OS/2),
  732.         push    21h        ;   calls SysRoutine (which calls
  733.                     ;   SystemCall)
  734.         call    SysRoutine
  735.         pop    bx        ; this register will be popped
  736.                     ;   later (just disgarded here)
  737.                     ; cannot "add sp,2" because it will
  738. ;                    ;   change flags
  739.     ENDIF
  740. ;ENDIF
  741. ENDM
  742.  
  743. GETDATASEG    MACRO    REG    ;get the default data segment address
  744. IF    MSC            ;into the register REG.
  745.     mov    REG,seg _DATA
  746. ELSE
  747.     mov    REG,seg DATA
  748. ENDIF
  749. ENDM
  750.  
  751. jmps    macro    jmp_addr    ;perform a short jump.    Justs eliminates
  752.     jmp    short jmp_addr    ;the need for the word short in your code.
  753. endm
  754. .LIST
  755.