Author Topic: How to get the string-len in ASM  (Read 2347 times)

0 Members and 1 Guest are viewing this topic.

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 964
    • it-berater
How to get the string-len in ASM
« on: January 14, 2011, 09:39:47 AM »
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.

Code: [Select]
'---------------------------------------------------------------------------
' 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
'---------------------------------------------------------------------------