home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / DASD / IBM / IBM2ADSK / ADSKASUB.ASM next >
Encoding:
Assembly Source File  |  1995-04-14  |  5.5 KB  |  185 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT (C) Microsoft Corporation, 1989
  4. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  5. ;
  6. ;    The following IBM OS/2 WARP source code is provided to you solely for
  7. ;    the purpose of assisting you in your development of OS/2 WARP device
  8. ;    drivers. You may use this code in accordance with the IBM License
  9. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  10. ;    Copyright statement may not be removed.;
  11. ;*****************************************************************************/
  12. ;       SCCSID = src/dev/dasd/ibm/ibm2adsk/adskasub.asm, adsk, ddk_subset, b_bdd.032 93/03/20
  13.  
  14.         page    ,132
  15.  
  16. ;**************************************************************************
  17. ;*
  18. ;* SOURCE FILE NAME = ADSKASUB.ASM
  19. ;*
  20. ;* DESCRIPTIVE NAME = IBM2ADSK.ADD - Adapter Driver for ABIOS DASD Devices
  21. ;*
  22. ;*
  23. ;*
  24. ;* VERSION = V2.0
  25. ;*
  26. ;* DATE
  27. ;*
  28. ;* DESCRIPTION : Miscellaneous assembler helper routines
  29. ;*
  30. ;*
  31. ;* CHANGE ACTIVITY =
  32. ;*   DATE      FLAG        APAR   CHANGE DESCRIPTION
  33. ;*   --------  ----------  -----  --------------------------------------
  34. ;*   mm/dd/yy  @Vnnnnn     XXXXX  XXXXXXX
  35. ;*
  36. ;*
  37. ;*
  38. ;*
  39. ;*
  40. ;****************************************************************************
  41.  
  42.         .386p
  43. Code    segment dword public USE16 'CODE'
  44.         assume  CS:Code
  45.  
  46. STK     equ     [bp]
  47.  
  48. ;-------------------------------------------------------------------------;
  49. ;                                                                         ;
  50. ;                                                                         ;
  51. ;       VOID  NEAR memcpy( PBYTE Dst, PBYTE Src, USHORT cb   );           ;
  52. ;                                                                         ;
  53. ;                                                                         ;
  54. ;-------------------------------------------------------------------------;
  55.  
  56. Dst     =       4
  57. Src     =       8
  58. cb      =       12
  59.  
  60.                 public  _memcpy
  61. _memcpy         label   near
  62.  
  63.                 push    bp
  64.                 mov     bp, sp
  65.  
  66.                 push    dx
  67.                 push    ecx
  68.                 push    esi
  69.                 push    edi
  70.                 push    es
  71.                 push    ds
  72. ;
  73.                 xor     esi, esi
  74.                 xor     edi, edi
  75. ;
  76.                 lds     si,  STK.Src
  77.                 les     di,  STK.Dst
  78.                 movzx   ecx, word ptr STK.cb
  79.                 mov     dx,  cx
  80.                 cld
  81. ;
  82.                 shr     cx, 2
  83.                 jz      memc0010
  84.                 rep     movsd
  85. ;
  86. memc0010:
  87.                 mov     cx, dx
  88.                 and     cx, 3
  89.                 jz      memc0020
  90. ;
  91.                 rep     movsb
  92. memc0020:
  93.                 pop     ds
  94.                 pop     es
  95.                 pop     edi
  96.                 pop     esi
  97.                 pop     ecx
  98.                 pop     dx
  99.  
  100.                 pop     bp
  101.  
  102.                 ret
  103.  
  104.  
  105. ;-------------------------------------------------------------------------;
  106. ;                                                                         ;
  107. ;                                                                         ;
  108. ; ULONG NEAR ULONGdivUSHORT( ULONG Dividend, USHORT Divisor, NPUSHORT Rem);      ;
  109. ;                                                                         ;
  110. ;                                                                         ;
  111. ;-------------------------------------------------------------------------;
  112.  
  113. Dividend    =       4
  114. Divisor     =       8
  115. Rem         =       10
  116.  
  117.                 public  _ULONGdivUSHORT
  118. _ULONGdivUSHORT label   near
  119.  
  120.                 push    bp
  121.                 mov     bp, sp
  122.  
  123.                 push    ecx
  124.  
  125.                 xor     edx, edx
  126.                 mov     eax, STK.Dividend
  127.                 movzx   ecx, word ptr STK.Divisor
  128.  
  129.                 div     ecx
  130.  
  131.                 movzx   ecx, word ptr STK.Rem
  132.                 or      cx, cx
  133.                 jz      ULUS0010
  134.  
  135.                 mov     [ecx], dx
  136. ULUS0010:
  137.                 mov     edx, eax
  138.                 and     eax, 0ffffh
  139.                 shr     edx, 16
  140.  
  141.                 pop     ecx
  142.  
  143.                 pop     bp
  144.                 ret
  145.  
  146. ;-------------------------------------------------------------------------;
  147. ;                                                                         ;
  148. ;                                                                         ;
  149. ; ULONG NEAR ULONGmulULONG( ULONG Multiplier, ULONG Multiplicand);        ;
  150. ;                                                                         ;
  151. ;                                                                         ;
  152. ;-------------------------------------------------------------------------;
  153.  
  154. Multiplier      =       4
  155. Multiplicand    =       8
  156.  
  157.                 public  _ULONGmulULONG
  158. _ULONGmulULONG  label   near
  159.  
  160.                 push    bp
  161.                 mov     bp, sp
  162.  
  163.                 push    ecx
  164.  
  165.                 xor     edx, edx
  166.                 mov     eax, STK.Multiplier
  167.                 mov     ecx, STK.Multiplicand
  168.  
  169.                 mul     ecx
  170.                 jno     UMUL0010
  171.  
  172.                 mov     eax, -1
  173. UMUL0010:
  174.                 mov     edx, eax
  175.                 and     eax, 0ffffh
  176.                 shr     edx, 16
  177.  
  178.                 pop     ecx
  179.  
  180.                 pop     bp
  181.                 ret
  182.  
  183. Code            ends
  184.                 end
  185.