I have updated the ATODW from M32LIB functions to make it like the VAL function in basic and work like it.
here is it :


val proc String:DWORD

; ----------------------------------------
; Convert decimal string into dword value
; return value in eax
; ----------------------------------------

push esi
push edi

xor eax, eax
mov esi, String
xor ecx, ecx
xor edx, edx
mov al, [esi]
inc esi
cmp al, 2dh
jne proceed
mov al, byte ptr [esi]
not edx
inc esi
jmp proceed

@@:
cmp al,'0'
jl Endit
cmp al,'9'
jg Endit
sub al, 30h
lea ecx, dword ptr [ecx+4*ecx]
lea ecx, dword ptr [eax+2*ecx]
mov al, byte ptr [esi]
inc esi

proceed:
or al, al
jne @B
Endit:
lea eax, dword ptr [edx+ecx]
xor eax, edx

pop edi
pop esi

ret

val endp



Posted on 2002-04-15 07:19:26 by amr