Metropoli BBS
VIEWER: btoa.asm MODE: TEXT (ASCII)
;**********************************************************************************************************************************
; Filename: BTOA.ASM
;   Author: Peter Andersson
;  Version: 0.0
;  Created: 1995.02.09
;  Updated: -
;**********************************************************************************************************************************
; Copyright Peter Andersson, 1994-1995.
; All rights reserved.
;**********************************************************************************************************************************
; Function: PSZ @btoa(ULONG value,PSZ string);
;    Input: Eax, value - value to convert to a binary string
;           Edx, string - pointer to the storage string
;   Output: pointer to the storage string
;  Comment: Converts a value to a binary string
;**********************************************************************************************************************************

        Include STDDEF.INC

        Codeseg

Extrn NumberConvert:Byte

Proc    btoa    ,2
                Sub     Esp,36
                Push    Edx
                Lea     Edx,[Esp+4+35]
                Clear   Ecx
                Mov     [Byte Edx],0
        Align   4
@@Loop:         Mov     Cl,Al
                And     Cl,01h
                Dec     Edx
                Mov     Cl,[Ecx+NumberConvert]
                Shr     Eax,1
                Mov     [Edx],Cl
                Jnz     @@Loop
                Mov     Eax,[Esp]
                Call    @stpcpy
                Mov     Edx,Eax
                Pop     Eax,+36
                Ret
Endp

        End

[ RETURN TO DIRECTORY ]