• Welcome to Jose's Read Only Forum 2023.
 

How to get the string-len in ASM

Started by Theo Gottwald, January 14, 2011, 09:39:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

Of course this should not be a replacement for the original LEN().
It's to show you how to get the string-len of a dynamic string inside your own ASM-Block.

'---------------------------------------------------------------------------
' PBLEN Ermittelt Länge eines dynamischen Strings in PB (wie LEN())

FUNCTION String_Len(sNum AS STRING) AS DWORD
!mov edi,sNum                   ;get the pointer to the string information
!mov edi,[edi]                  ;get the pointer to the string contents
!mov edx,[edi-4]                ;edx now has len of sNum
!mov function,edx               ;write answer to function
END FUNCTION
'---------------------------------------------------------------------------