implemented masm label "@@:" with High Level Asm
here is example that has 2 procedures , both of them will convert string to value.
in the first one Ebx must hold string address , Ecx must hold end address of string
in the second one you call it by normal way.
the 2 procedures i got them from MASM forum and modified it.
/********************************
High level asm Example No 18
By Emil Halim
6-3-2013
*********************************/
$CPP
$NOMAIN
$NOWIN
#include "Windows.h"
FastProc atod_proc
$AsmX
xor edx, edx
@@:
movzx eax, byte ptr [ebx]
lea edx, [edx+4*edx]
lea edx, [2*edx+eax-48]
inc ebx
cmp ecx, ebx
jne @B
xchg eax, edx
ret
$AsmX
End FastProc
FastProc atod_proc_2
$AsmX
edx = [esp+4] ; get first para in edx
xor eax, eax ; clear eax
@@: movzx ecx, byte ptr [edx] ; move 1 byte into ecx
lea eax, [eax+4*eax] ; eax -> 5 * eax
lea eax, [2*eax+ecx-30h] ; eax -> 2 * eax + (ecx-30h)
edx++ ; inc edx
cmp byte ptr [edx], 0 ; if end of string then return
jne @b
ret
$AsmX
End FastProc
FUNCTION main()
!const char MyStr[] = "2000";
raw ln ,value
!ln = strlen( MyStr );
^ ebx = &MyStr ; get str address into ebx
^ ecx = ebx ; copy ebx to ecx
^ ecx += ln ; get length of str into ecx
^ call atod_proc ; call the function
^ value = eax ; store result in value variable
print value
print atod_proc_2(MyStr$)
Pause
END FUNCTION