home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / DASD / OS2DASD / ABMAC.INC next >
Encoding:
Text File  |  1995-04-14  |  5.4 KB  |  214 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. ;/*****************************************************************************
  12. ;*
  13. ;* SOURCE FILE NAME = ABMAC.INC
  14. ;*
  15. ;* DESCRIPTIVE NAME = OS2DASD.DMD - OS/2 DASD Device Manager
  16. ;*
  17. ;*
  18. ;* VERSION      V2.0
  19. ;*
  20. ;* DATE
  21. ;*
  22. ;* DESCRIPTION  Miscellaneous assembly macros
  23. ;*
  24. ;*
  25. ;* CHANGE ACTIVITY =
  26. ;*   DATE      FLAG        APAR   CHANGE DESCRIPTION
  27. ;*   --------  ----------  -----  --------------------------------------
  28. ;*   mm/dd/yy  @nnnnn      xxxxx  xxxxxxx
  29. ;*****************************************************************************/
  30.  
  31. ENABLE  macro
  32.         jmp  $+2                ; timing delay
  33.         sti                     ; enable processor external interrupts
  34.         endm
  35.  
  36. ENAB    macro
  37.         sti                     ; enable processor external interrupts
  38.         endm
  39.  
  40. DISABLE macro
  41.         cli                     ; disable processor external interrupts
  42.         endm
  43.  
  44. DEVHLP  macro   function
  45.         mov     dl,function
  46.         call    dword ptr [_Device_Help]
  47.         endm
  48.  
  49.  
  50.  
  51. IOWait  macro
  52.         local   l
  53.         jmp     short   l
  54. l       label   near
  55.         endm
  56.  
  57. DebugPublic macro label
  58.   if abdebug
  59.          public label
  60.   endif
  61.   endm
  62.  
  63. INT3    macro
  64.   if abdebug
  65.         INT 03H
  66.   endif
  67.   endm
  68.  
  69. ListLevel macro list,bug
  70.   if bug
  71.     if1
  72.       %out Warning: debuging code is being generated
  73.     endif
  74.   endif
  75.   ifidn <list>,<1>                     ;; .list and .xlist
  76.           .list                        ;; .lall .xall .sall
  77.           .sfcond                      ;; .lfcond .sfconf (.tfcond)
  78.           .sall
  79.   else
  80.     ifidn <list>,<2>
  81.           .list
  82.           .sfcond
  83.           .xall
  84.     else
  85.       ifidn <list>,<3>
  86.           .list
  87.           .lfcond
  88.           .lall
  89.           if1
  90.             %out listing level = 3
  91.           endif
  92.       else
  93.           .xlist
  94.           .sfcond
  95.           .sall
  96.       endif
  97.     endif
  98.   endif
  99.   endm
  100.  
  101. TRACEREQUEST  macro    ;; trace requested DOS command on entry
  102.   if abdebug           ;; placed in ABDSK1.ASM
  103.     if abtrace
  104.       ifndef ReqTrace
  105.         extrn ReqTrace:near
  106.       endif
  107.       call ReqTrace
  108.     endif
  109.   endif
  110.   endm
  111.  
  112. TRACERESULT  macro     ;; trace requested DOS command and result on complete.
  113.   if abdebug           ;; placed in ABSUBR.ASM
  114.     if abtrace
  115.       if ndef RsltTrace
  116.         call RsltTrace
  117.       endif
  118.     endif
  119.   endif
  120.   endm
  121.  
  122. VideoPause MACRO parm
  123.     push ax
  124.     push dx
  125.     mov al,parm
  126.     mov dl,DevHlp_VideoPause
  127.     CALL dword ptr [DevHlpFunc]
  128.     pop dx
  129.     pop ax
  130.     ENDM
  131.  
  132. ;*
  133. ;*
  134. ;* Build Entry Point Table for Strategy 1
  135. ;*
  136. ;* DDTableStart
  137. ;*
  138. ;* Args:
  139. ;*
  140. ;*   <resgroup>  - Group name containing resident routines
  141. ;*   <swapgroup> - Group name containing swappable routines
  142. ;*   <epmask>    - Label for distance bit mask (0=Resident, 1=Swappable)
  143. ;*   <epcount>   - Number of entry points in table
  144. ;*
  145. ;*
  146. ;* DDEntry  -- (This macro is repeated for each EP)
  147. ;*
  148. ;* Args:
  149. ;*
  150. ;*   <ep>        - Entry point -- (Defined in <resgroup> or <swapgroup>)
  151. ;*   <eptype>    - "RESIDENT" or "SWAPPABLE"
  152. ;*
  153. ;*
  154. ;* DDTableEnd
  155. ;*
  156. ;* Args:
  157. ;*
  158. ;*    none
  159. ;*
  160. ;* These macros generate a entry point table (2-bytes) per entry point, and
  161. ;* a bit mask containing the 'distance' for each entry point (near/far).
  162. ;*
  163. ;*
  164.  
  165. DDTableStart    macro   resgroup,swapgroup,epmask,epcount
  166. ;*
  167. ?bitmask0 = 0                                   ; Distance Bit Mask DWORD 1
  168. ?bitmask1 = 0                                   ;                   DWORD 2
  169. ?fcount   = 0
  170.  
  171. ?maskname       equ  <epmask>                   ; Copy args to pass to
  172. ?tblcount       equ  <epcount>                  ; other macros
  173. ?swapgroup      equ  <swapgroup>
  174. ?resgroup       equ  <resgroup>
  175. ;*
  176.                 endm
  177. ;*
  178. ;*
  179.  
  180. DDTableEnd      macro
  181. ;*
  182. ?genop          macro   op,p1,p2
  183. &p1             &op     p2
  184.                 endm
  185.  
  186. ;*
  187.                 ?genop  <equ>,%?tblcount,?fcount  ; Set <epcount>
  188.                 ?genop  <dd>,%?maskname,?bitmask0 ; Gen Distance mask DWORD 1
  189.  
  190.                 if      ?fcount gt 32             ; If More than 32 ep's ?
  191.                   dd    ?bitmask1                 ; --Gen Distance mask DWORD 2
  192.                 endif
  193.  
  194. ;*              purge   ?genop
  195. ;*
  196.                 endm
  197. ;*
  198. ;*
  199. DDEntry         macro   ep,eptype
  200.  
  201.                 ifidn   <&eptype>,<SWAPPABLE>
  202.                   dw    offset ?swapgroup:&ep     ; Gen offset from swap group
  203.                   if    ?fcount le 31
  204.                     ?bitmask0 =  (1 shl ?fcount) or ?bitmask0
  205.                   else
  206.                     ?bitmask1 =  (1 shl (?fcount-32)) or ?bitmask1
  207.                   endif
  208.                 else
  209.                   dw    offset ?resgroup:&ep
  210.                 endif                             ; Gen offset from res group
  211.                 ?fcount = ?fcount + 1
  212.  
  213.                 endm
  214.