home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / NOTEPAD2.ZIP / UTIL.ASM < prev   
Assembly Source File  |  1989-02-08  |  628b  |  30 lines

  1.         include cmacros.inc
  2.  
  3.         .MODEL SMALL
  4.         .286
  5.  
  6.         .CODE
  7.  
  8. ;-----------------------------------------------------------------------
  9. ;
  10. ; MultDivNR(a, b, c): calc a * b / c, with 32-bit intermediate result
  11. ;
  12. ; Same as MultDiv, except with no rounding.
  13. ;
  14. cProc   MultDivNR,<PUBLIC>
  15.         ParmW   a
  16.         ParmW   b
  17.         ParmW   c
  18. cBegin
  19.         mov     ax,a            ; calc (a * b) / c (no rounding)
  20.         mov     cx,c
  21.         or      cx,cx
  22.         jz      mdnrexit        ; just return A if we'll get divide by 0
  23.         imul    b
  24.         idiv    cx
  25. mdnrexit:
  26. cEnd
  27. END
  28.  
  29.  
  30.