Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ;*****************************************************************************
  2. ;*
  3. ;*                            Open Watcom Project
  4. ;*
  5. ;*    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
  6. ;*
  7. ;*  ========================================================================
  8. ;*
  9. ;*    This file contains Original Code and/or Modifications of Original
  10. ;*    Code as defined in and that are subject to the Sybase Open Watcom
  11. ;*    Public License version 1.0 (the 'License'). You may not use this file
  12. ;*    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
  13. ;*    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
  14. ;*    provided with the Original Code and Modifications, and is also
  15. ;*    available at www.sybase.com/developer/opensource.
  16. ;*
  17. ;*    The Original Code and all software distributed under the License are
  18. ;*    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  19. ;*    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
  20. ;*    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
  21. ;*    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
  22. ;*    NON-INFRINGEMENT. Please see the License for the specific language
  23. ;*    governing rights and limitations under the License.
  24. ;*
  25. ;*  ========================================================================
  26. ;*
  27. ;* Description:  Signed 64-bit division for 386.
  28. ;*
  29. ;*****************************************************************************
  30.  
  31.  
  32. ;========================================================================
  33. ;==     Name:           LLDIV                                          ==
  34. ;==     Operation:      Signed 8 byte divide                           ==
  35. ;==     Inputs:         EAX;EDX Dividend                               ==
  36. ;==                     ECX;EBX Divisor                                ==
  37. ;==                     SS:ESI  pointer to result structure            ==
  38. ;==     Volatile:       none                                           ==
  39. ;========================================================================
  40.  
  41. include mdef.inc
  42. include struct.inc
  43.  
  44. ifdef _PROFILE
  45. include p5prof.inc
  46. endif
  47.         modstart        lldiv386
  48.  
  49.         xref    __I8D
  50.  
  51. ;        defpe   imaxdiv
  52. ;        xdefp   "C",imaxdiv
  53.         defpe   lldiv
  54.         xdefp   "C",lldiv
  55.     ifdef _PROFILE
  56.         P5Prolog
  57.     endif
  58.     ifdef __STACK__
  59.         push    EBX             ; save EBX
  60.         mov     EAX,08[ESP]     ; get numerator
  61.         mov     EDX,12[ESP]
  62.         mov     EBX,16[ESP]     ; get denominator
  63.         mov     ECX,20[ESP]
  64.     endif
  65.         docall  __I8D           ; call long division routine
  66.  
  67.         mov     [ESI],EAX       ; store quotient
  68.         mov     4[ESI],EDX
  69.         mov     8[ESI],EBX      ; store remainder
  70.         mov     12[ESI],ECX
  71.     ifdef __STACK__
  72.         pop     EBX             ; restore EBX
  73.     endif
  74.     ifdef _PROFILE
  75.         P5Epilog
  76.     endif
  77.         ret                     ; return
  78.         endproc lldiv
  79. ;        endproc imaxdiv
  80.  
  81.         endmod
  82.         end
  83.