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

  1. ;****************************************************************************
  2. ; Filename: XTOA.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 @xtoa(ULONG value,PSZ string);
  12. ;    Input: Eax, value - value to convert to a hex string
  13. ;           Edx, string - pointer to the storage string
  14. ;   Output: pointer to the storage string
  15. ;  Comment: Converts a value to a hex string
  16. ;****************************************************************************
  17.  
  18.     Include    STDDEF.INC
  19.  
  20.     Codeseg
  21.  
  22. Extrn NumberConvert:Byte
  23.  
  24. Proc    xtoa    ,2
  25.         Sub    Esp,12
  26.         Push    Edx
  27.         Lea    Edx,[Esp+4+11]
  28.         Clear    Ecx
  29.         Mov    [Byte Edx],0
  30. @@Loop:        Mov    Cl,Al
  31.         And    Cl,0Fh
  32.         Dec    Edx
  33.         Mov    Cl,[Ecx+NumberConvert]
  34.         Shr    Eax,4
  35.         Mov    [Edx],Cl
  36.         Jnz    @@Loop
  37.         Mov    Eax,[Esp]
  38.         Call    @stpcpy
  39.         Mov    Edx,Eax
  40.         Pop    Eax,+12
  41.         Ret
  42. Endp
  43.  
  44.     End
  45.