buffer db '1','7','8','k',0

mov eax, uval(addr buffer)

now eax is 1839


buffer db '1','7','8',0

mov eax, uval(addr buffer)

eax is 178

Posted on 2005-01-28 08:03:33 by jndk
but c fun atoi can work good,
why, the vual fun cannot recognise 'k' ?
and is there anther method to solve this problem as you know MASM have not the fun of "atoi"
Posted on 2005-01-28 08:07:16 by jndk
The underlying function with the macro is not designed to handle alphabetic characters. You can write them to do that but they are slower. It is designed for unsigned DWORD values.
Posted on 2005-01-28 08:10:14 by hutch--
thanks a lot, I'm writing self atoi fun now :roll:
Posted on 2005-01-28 08:14:25 by jndk
i write atoi


atoi proc uses ebx esi edi lpst:DWORD
xor ecx, ecx
mov edi, lpst
@@: movzx esi, BYTE ptr
.if esi
.if esi=='0' || esi=='1'|| esi=='2'|| esi=='3'|| esi=='4'|| esi=='5'\
|| esi=='6'|| esi=='7'|| esi=='8'|| esi=='9'
mov eax, ecx
mov ebx, 10
mul ebx
add eax, esi
sub eax, '0'
mov ecx, eax
mov eax, ecx
inc edi
jmp @B
mov eax,ecx
atoi endp :oops:
Posted on 2005-01-28 08:33:11 by jndk