home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / DASD / OS2ASPI / ASPIASUB.ASM next >
Encoding:
Assembly Source File  |  1995-04-14  |  5.2 KB  |  219 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 = src/dev/dasd/os2aspi/aspiasub.asm, aspi, r206 93/03/20
  12.  
  13.         page    ,132
  14.  
  15. ;/*****************************************************************************
  16. ;*
  17. ;* SOURCE FILE NAME = ASPIASUB.ASM
  18. ;*
  19. ;* DESCRIPTIVE NAME = OS2ASPI.DMD - OS/2 ASPI Device Manager
  20. ;*
  21. ;*
  22. ;*
  23. ;* VERSION      V2.0
  24. ;*
  25. ;* DATE
  26. ;*
  27. ;* DESCRIPTION : Assembly helper routines
  28. ;*
  29. ;*
  30. ;* CHANGE ACTIVITY =
  31. ;*   DATE      FLAG        APAR   CHANGE DESCRIPTION
  32. ;*   --------  ----------  -----  --------------------------------------
  33. ;*   mm/dd/yy  @Vnnnnn     xxxxx  xxxxxxx
  34. ;*****************************************************************************/
  35.  
  36.         .386p
  37. Code    segment dword public USE16 'CODE'
  38.         assume  CS:Code
  39.  
  40. STK     equ     [bp]
  41.  
  42. ;*
  43. ;*      VOID  NEAR memcpy( PBYTE Dst, PBYTE Src, USHORT cb   );
  44. ;*
  45.  
  46. Dst     =       4
  47. Src     =       8
  48. cb      =       12
  49.  
  50.                 public  _memcpy
  51. _memcpy         label   near
  52.  
  53.                 push    bp
  54.                 mov     bp, sp
  55.  
  56.                 push    dx
  57.                 push    ecx
  58.                 push    esi
  59.                 push    edi
  60.                 push    es
  61.                 push    ds
  62. ;*
  63.                 xor     esi, esi
  64.                 xor     edi, edi
  65. ;*
  66.                 lds     si,  STK.Src
  67.                 les     di,  STK.Dst
  68.                 movzx   ecx, word ptr STK.cb
  69.                 mov     dx,  cx
  70.                 cld
  71. ;*
  72.                 shr     cx, 2
  73.                 jz      memc0010
  74.                 rep     movsd
  75. ;*
  76. memc0010:
  77.                 mov     cx, dx
  78.                 and     cx, 3
  79.                 jz      memc0020
  80. ;*
  81.                 rep     movsb
  82. memc0020:
  83.                 pop     ds
  84.                 pop     es
  85.                 pop     edi
  86.                 pop     esi
  87.                 pop     ecx
  88.                 pop     dx
  89.  
  90.                 pop     bp
  91.  
  92.                 ret
  93.  
  94.  
  95. ;*
  96. ;*      VOID  NEAR memset( PBYTE Dst, UCHAR  Value, USHORT byteCount);
  97. ;*
  98.  
  99. Dst             =       4
  100. Value           =       8
  101. byteCount       =       10
  102.  
  103.                 public  _memset
  104. _memset         label   near
  105.  
  106.                 push    bp
  107.                 mov     bp, sp
  108.  
  109.                 push    dx
  110.                 push    ecx
  111.                 push    esi
  112.                 push    edi
  113.                 push    es
  114. ;*
  115.                 xor     esi, esi
  116.                 xor     edi, edi
  117. ;*
  118.                 xor     eax, eax
  119.                 mov     al,  STK.Value
  120.                 les     di,  STK.Dst
  121.                 movzx   ecx, word ptr STK.byteCount
  122.                 mov     dx,  cx
  123.                 cld
  124. ;*
  125.                 shr     cx, 2
  126.                 jz      mems0010
  127.                 rep     stosd
  128. ;*
  129. mems0010:
  130.                 mov     cx, dx
  131.                 and     cx, 3
  132.                 jz      mems0020
  133. ;*
  134.                 rep     stosb
  135. mems0020:
  136.                 pop     es
  137.                 pop     edi
  138.                 pop     esi
  139.                 pop     ecx
  140.                 pop     dx
  141.  
  142.                 pop     bp
  143.  
  144.                 ret
  145.  
  146.  
  147. ;*
  148. ;* ULONG NEAR ULONGdivUSHORT( ULONG Dividend, USHORT Divisor, NPUSHORT Rem)      ;
  149. ;*
  150.  
  151. Dividend    =       4
  152. Divisor     =       8
  153. Rem         =       10
  154.  
  155.                 public  _ULONGdivUSHORT
  156. _ULONGdivUSHORT label   near
  157.  
  158.                 push    bp
  159.                 mov     bp, sp
  160.  
  161.                 push    ecx
  162.  
  163.                 xor     edx, edx
  164.                 mov     eax, STK.Dividend
  165.                 movzx   ecx, word ptr STK.Divisor
  166.  
  167.                 div     ecx
  168.  
  169.                 movzx   ecx, word ptr STK.Rem
  170.                 or      cx, cx
  171.                 jz      ULUS0010
  172.  
  173.                 mov     [ecx], dx
  174. ULUS0010:
  175.                 mov     edx, eax
  176.                 and     eax, 0ffffh
  177.                 shr     edx, 16
  178.  
  179.                 pop     ecx
  180.  
  181.                 pop     bp
  182.                 ret
  183.  
  184. ;*
  185. ;* ULONG NEAR ULONGmulULONG( ULONG Multiplier, ULONG Multiplicand);
  186. ;*
  187.  
  188. Multiplier      =       4
  189. Multiplicand    =       8
  190.  
  191.                 public  _ULONGmulULONG
  192. _ULONGmulULONG  label   near
  193.  
  194.                 push    bp
  195.                 mov     bp, sp
  196.  
  197.                 push    ecx
  198.  
  199.                 xor     edx, edx
  200.                 mov     eax, STK.Multiplier
  201.                 mov     ecx, STK.Multiplicand
  202.  
  203.                 mul     ecx
  204.                 jno     UMUL0010
  205.  
  206.                 mov     eax, -1
  207. UMUL0010:
  208.                 mov     edx, eax
  209.                 and     eax, 0ffffh
  210.                 shr     edx, 16
  211.  
  212.                 pop     ecx
  213.  
  214.                 pop     bp
  215.                 ret
  216.  
  217. Code            ends
  218.                 end
  219.