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

  1. ;******************************************************************************
  2. ; Filename: PTOS.ASM
  3. ;   Author: Peter Andersson
  4. ;  Version: 0.0
  5. ;  Created: 1994.06.05
  6. ;  Updated: 1995.03.12
  7. ;******************************************************************************
  8. ; Copyright 1994, Peter Andersson.
  9. ; All rights reserved.
  10. ;******************************************************************************
  11. ; Function: PSZ @ptos(PVOID pstr)
  12. ;  Comment: Converts a Pascal string to a C string.
  13. ;    Input: Eax - pstr
  14. ;  Returns: Pointer to the C string or null if out of memory.
  15. ;******************************************************************************
  16.  
  17.     Include    STDDEF.INC
  18.  
  19.     Codeseg
  20.  
  21. Proc    ptos ,1
  22.         Push    Ebx
  23.         Mov    Ebx,Eax
  24.         Clear    Eax
  25.         Mov    Al,[Ebx]
  26.         Inc    Eax
  27.         Call    @malloc
  28.         TestZ    Eax
  29.         Jz    @@Exit01
  30.         Clear    Ecx
  31.         Lea    Edx,[Ebx+1]
  32.         Mov    Cl,[Ebx]
  33.         Call    @memcpy
  34.         Clear    Edx
  35.         Mov    Dl,[Ebx]
  36.         Mov    [Byte Eax+Edx],0
  37. @@Exit01:    Pop    Ebx
  38.         Ret
  39. Endp
  40.  
  41.     End
  42.