... this macro converts an string to an integer...
but for example, if the 0 ended string is string db '634',0
the integer value converted is 6340
so... any idea? (i don't know why this happens... the code was in this forum, but i don't remeber who wrote it
macro atoi string,destination
{
xor eax,eax
mov esi,string
mov ebx,10 ;we'll be multiplying by 10
.digitloop:
mul ebx ;shift eax by one decimal digit left (eg. multuiply by 10)
;or dx,dx ;check if edx was affected... then overflow
;jz .overflow
movzx ecx,byte [esi] ;mov byte[si] to CL and zero CH
inc esi
or ecx,ecx ;end if 0 found
jz .done
sub ecx,'0' ;convert from ascii digit to digit
add eax,ecx
jmp .digitloop
.done:
mov [destination],eax
}