Assuming you compile your application in ASCII mode, you can do it like this
Code: Select all
Procedure.a GetLRC(tcTxt.s)
!xor eax, eax
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
!mov rdx, [p.v_tcTxt]
!getlrc0:
!mov cl, [rdx]
!inc rdx
CompilerElse
!mov edx, [p.v_tcTxt]
!getlrc0:
!mov cl, [edx]
!inc edx
CompilerEndIf
!xor al, cl
!and cl, cl
!jnz getlrc0
!and al, al
!jnz getlrc1
!mov al, 0xff
!getlrc1:
ProcedureReturn
EndProcedure
Debug GetLRC("hello")
Passing a pointer instead of a string might be faster.
Code: Select all
Procedure.a GetLRC(*tcTxt)
!xor eax, eax
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
!mov rdx, [p.p_tcTxt]
!getlrc0:
!mov cl, [rdx]
!inc rdx
CompilerElse
!mov edx, [p.p_tcTxt]
!getlrc0:
!mov cl, [edx]
!inc edx
CompilerEndIf
!xor al, cl
!and cl, cl
!jnz getlrc0
!and al, al
!jnz getlrc1
!mov al, 0xff
!getlrc1:
ProcedureReturn
EndProcedure
Debug GetLRC(@"hello")