Convert BCD to Decimal
Posted on 1998-04-12
I'm having real problems converting a BCD number to decimal. I want to do it using assembly coding. I have tried shifting (shl,shr) the upper 4 and lower 4 bits right out of the number to deal with them on their own. I found out shifting doesnt work like that (it just adds on a bunch of 0's where you shifted from and keeps the numbers I thought would shift right out of the register ( would be nice to have them dropped out ) ).
If I have a BCD number in a register (16 or 8 bit) (ie. Get Real Time Clock returns hour in BCD to CH) how can I properly change it to decimal?
Thanks in advance