home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / SND_TOOL / FUNK108A.ZIP / DOS32V30.ZIP / PAL / MATH / MAX3.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-20  |  1014 b   |  42 lines

  1. ;******************************************************************************
  2. ; Filename: MAX3.ASM
  3. ;   Author: Peter Andersson
  4. ;  Version: 0.0
  5. ;  Created: 1994.09.17
  6. ;  Updated: 1995.03.10
  7. ;******************************************************************************
  8. ; Copyright Peter Andersson, 1994-1995.
  9. ; All rights reserved.
  10. ;******************************************************************************
  11. ; Function: ULONG @max3(ULONG a,ULONG b,ULONG c)
  12. ;  Comment: Returns the largest of three values
  13. ;    Input: Eax - value a
  14. ;           Edx - value b
  15. ;           Ecx - value c
  16. ;  Returns: if (a>b) return (a>c)?a:c; else return (b>c)?b:c
  17. ;******************************************************************************
  18.  
  19.     Include    STDDEF.INC
  20.  
  21.     Codeseg
  22.  
  23. Proc    max3 ,3
  24.         Push    Ebx
  25.         Cmp    Edx,Eax
  26.         Sbb    Ebx,Ebx
  27.         And    Eax,Ebx
  28.         Not    Ebx
  29.         And    Edx,Ebx
  30.         Or    Eax,Edx
  31.         Cmp    Ecx,Eax
  32.         Sbb    Ebx,Ebx
  33.         And    Eax,Ebx
  34.         Not    Ebx
  35.         And    Ecx,Ebx
  36.         Or    Eax,Ecx
  37.         Pop    Ebx
  38.         Ret
  39. Endp    
  40.  
  41.     End
  42.