Idealy I would like it in a function eg:
Code: Select all
.string_to_int
more code here
Code: Select all
.string_to_int
more code here
Yes.Does anyone know how to change a string to a number in assembly?
Code: Select all
xor ebx, ebx ; clear the loop variables
xor eax, eax
.declp:
lodsb
test al, al ; hit end of string?
je short .done
lea ebx, [ebx + ebx*4] ; first multiply by 5
lea ebx, [eax + ebx*2 - 0x30] ; then multiply by 2, add in al, subtract ascii 0
jmp short .declp
.done: