Routine that converts from HEX to BCD

Thread Starter

MMattar9

Joined Sep 12, 2013
3
Hello,

For my assembly language/ embedded systems class I need to write a routine that converts from Hexadecimal to BCD.

Can anyone help me out here with the code for how to do this?

Please state any limitations also!

Thanks!!!
 

t06afre

Joined May 11, 2009
5,934
Hello,
For my assembly language/ embedded systems class I need to write a rutine that converts from Hexadecimal to BCD.
Can anyone help me out here with the code for how to do this?
Please state any limitations also!
Thanks!!!
Well I see a few limitations. First of all we will not do your homework for you. Second we do not have any idea what kind of assembler you are using in your class:p
To get out of this awkward back eddy why not post your current work and also write some words about why and how you struggle. Then I am sure somebody will help you
 

tshuck

Joined Oct 18, 2012
3,534
What have you got so far? You need to make an attempt, as this is homework and deserves to be in homework help....

Knowing the processor might also help! :)

What are the steps to converting from binary to BCD?
 

WBahn

Joined Mar 31, 2012
30,076
This should definitely be over in Homework Help -- you might get more assistance over there if it were. But don't start a new post over there. You might ask a mod to move it (or we can bring it to their attention if you want) or they might move it on their own.

Start with a toy example on paper. You have the value 0x0C and you want to convert that to 0x12. How would you do it by hand? Next consider how you would convert 0xAB to 0x171. Then how you would convert 0xFF to 0x255.

There are patterns that develop that you can use to develop an algorithm.
 
Top