I'm trying to take a string of numbers and convert it to an actual number. I can successfully convert it if it's just one digit, but I'm unsure how to convert a number with two or more digits.

section .data

str:    db      '3'     ;string to be converted

section .text
global  _start

_start:
mov     ebx, [str]
sub     ebx, 48         ;convert character to number

mov     eax, 1
int     0X80            ;exit, returning the converted number

123

First loop is 1
Second loop is 1*10+2
Third loop is 12*10+3

Ok, now I have another problem. I can easily access the second number in the string using mov eax, [str+1] However, this number can't be looped, so I try to do the same thing only using a register, which doesn't work. Does anyone know how to do this?
Thanks!

You put the address of the string in a register, then increment the register.

Read about indexing in your processor manual.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.