Metropoli BBS
VIEWER: ptos.asm MODE: TEXT (ASCII)
;******************************************************************************
; Filename: PTOS.ASM
;   Author: Peter Andersson
;  Version: 0.0
;  Created: 1994.06.05
;  Updated: 1995.03.12
;******************************************************************************
; Copyright 1994, Peter Andersson.
; All rights reserved.
;******************************************************************************
; Function: PSZ @ptos(PVOID pstr)
;  Comment: Converts a Pascal string to a C string.
;    Input: Eax - pstr
;  Returns: Pointer to the C string or null if out of memory.
;******************************************************************************

        Include STDDEF.INC

        Codeseg

Proc    ptos ,1
                Push    Ebx
                Mov     Ebx,Eax
                Clear   Eax
                Mov     Al,[Ebx]
                Inc     Eax
                Call    @malloc
                TestZ   Eax
                Jz      @@Exit01
                Clear   Ecx
                Lea     Edx,[Ebx+1]
                Mov     Cl,[Ebx]
                Call    @memcpy
                Clear   Edx
                Mov     Dl,[Ebx]
                Mov     [Byte Eax+Edx],0
@@Exit01:       Pop     Ebx
                Ret
Endp

        End

[ RETURN TO DIRECTORY ]