Metropoli BBS
VIEWER: max3.asm MODE: TEXT (ASCII)
;******************************************************************************
; Filename: MAX3.ASM
;   Author: Peter Andersson
;  Version: 0.0
;  Created: 1994.09.17
;  Updated: 1995.03.10
;******************************************************************************
; Copyright Peter Andersson, 1994-1995.
; All rights reserved.
;******************************************************************************
; Function: ULONG @max3(ULONG a,ULONG b,ULONG c)
;  Comment: Returns the largest of three values
;    Input: Eax - value a
;           Edx - value b
;           Ecx - value c
;  Returns: if (a>b) return (a>c)?a:c; else return (b>c)?b:c
;******************************************************************************

        Include STDDEF.INC

        Codeseg

Proc    max3 ,3
                Push    Ebx
                Cmp     Edx,Eax
                Sbb     Ebx,Ebx
                And     Eax,Ebx
                Not     Ebx
                And     Edx,Ebx
                Or      Eax,Edx
                Cmp     Ecx,Eax
                Sbb     Ebx,Ebx
                And     Eax,Ebx
                Not     Ebx
                And     Ecx,Ebx
                Or      Eax,Ecx
                Pop     Ebx
                Ret
Endp    

        End

[ RETURN TO DIRECTORY ]