home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / SND_TOOL / FUNK108A.ZIP / DOS32V30.ZIP / PAL / STRINGS / BTOA.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-20  |  1.3 KB  |  46 lines

  1. ;**********************************************************************************************************************************
  2. ; Filename: BTOA.ASM
  3. ;   Author: Peter Andersson
  4. ;  Version: 0.0
  5. ;  Created: 1995.02.09
  6. ;  Updated: -
  7. ;**********************************************************************************************************************************
  8. ; Copyright Peter Andersson, 1994-1995.
  9. ; All rights reserved.
  10. ;**********************************************************************************************************************************
  11. ; Function: PSZ @btoa(ULONG value,PSZ string);
  12. ;    Input: Eax, value - value to convert to a binary string
  13. ;           Edx, string - pointer to the storage string
  14. ;   Output: pointer to the storage string
  15. ;  Comment: Converts a value to a binary string
  16. ;**********************************************************************************************************************************
  17.  
  18.     Include    STDDEF.INC
  19.  
  20.     Codeseg
  21.  
  22. Extrn NumberConvert:Byte
  23.  
  24. Proc    btoa    ,2
  25.         Sub    Esp,36
  26.         Push    Edx
  27.         Lea    Edx,[Esp+4+35]
  28.         Clear    Ecx
  29.         Mov    [Byte Edx],0
  30.     Align    4
  31. @@Loop:        Mov    Cl,Al
  32.         And    Cl,01h
  33.         Dec    Edx
  34.         Mov    Cl,[Ecx+NumberConvert]
  35.         Shr    Eax,1
  36.         Mov    [Edx],Cl
  37.         Jnz    @@Loop
  38.         Mov    Eax,[Esp]
  39.         Call    @stpcpy
  40.         Mov    Edx,Eax
  41.         Pop    Eax,+36
  42.         Ret
  43. Endp
  44.  
  45.     End
  46.