954,490 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

NEED HELP! (hex to decimal output)

guys! i realy need your help! i have this big problem of how to convert hex to decmal. theoreticaly it is very easy but the problem is that in assembly, everything is done in hex example if u add 10d+10d, assembly will add it as Ah+Ah = 14h. thats where the problem comes in! how do i display 20 and not 14h?

asurmen28
Newbie Poster
1 post since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

Do you know how to convert a hexadecimal value to decimal on paper? That's the first step, then you can convert the paper algorithm into something better suited for assembly.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 
guys! i realy need your help! i have this big problem of how to convert hex to decmal. theoreticaly it is very easy but the problem is that in assembly, everything is done in hex example if u add 10d+10d, assembly will add it as Ah+Ah = 14h. thats where the problem comes in! how do i display 20 and not 14h?

If you get value in some register let ax ,divide it by mov bx,0xa
divide ax by bx the remainder will be in dx,take this and store at last index of memeory that you will use,and loop will run 4 time or till that ax becomes zero finally result will be in memory.
Try this it.s so easy.............

zaigham_zam
Newbie Poster
1 post since Dec 2008
Reputation Points: 10
Solved Threads: 0
 

;try this

Attachments dwtoa.zip (1.35KB)
low_coder
Junior Poster in Training
55 posts since Nov 2008
Reputation Points: 40
Solved Threads: 4
 

;try this one too - it takes two numbers in ascii, converts them to hex ;and adds them together, then it converts the result to ascii and ;displays it in MessageBox

Attachments atodw_dwtoa.zip (1.6KB)
low_coder
Junior Poster in Training
55 posts since Nov 2008
Reputation Points: 40
Solved Threads: 4
 

Nice solutions guys but the question was posted about 8 months ago.... I hope he's figured out the solution by now.

abello00
Newbie Poster
2 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You