How to convert ASCII number into decimal number

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Locked
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

How to convert ASCII number into decimal number

Post by BrightLight »

Hello, I need help.
Let's say we have this code:

Code: Select all

mov si, number
call change_number

number			db "80"
As you can see, the number is actually a number in ASCII text. How do I convert this to 80 itself (non ASCII)? I don't mind if you tell me to do it in hex or decimal, both are fine.
Help will be greatly appreciated! :)
You know your OS is advanced when you stop using the Intel programming guide as a reference.
alexfru
Member
Member
Posts: 1112
Joined: Tue Mar 04, 2014 5:27 am

Re: How to convert ASCII number into decimal number

Post by alexfru »

I'd expect OS devers to be able to either figure out trivial things like this on their own or have sufficient google-fu skills.
What have you tried?
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: How to convert ASCII number into decimal number

Post by BrightLight »

alexfru wrote:What have you tried?
Pretty much everything, there's nothing on this topic anywhere.
Just if it may help, I'm doing this in NASM.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: How to convert ASCII number into decimal number

Post by Combuster »

The first attempt at finding the answer provided one. Case dismissed.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Locked