multidigit binary to ascii

Reply

Join Date: Apr 2007
Posts: 1
Reputation: andiey is an unknown quantity at this point 
Solved Threads: 0
andiey andiey is offline Offline
Newbie Poster

multidigit binary to ascii

 
0
  #1
Apr 18th, 2007
Hello,
I'm fairly new to programming, with little knowledge of assembly languages. I had a quick question on a program I am working on. I have to use LC3 to make a simple calculator. I have everything down, I just can't for the life of me figure out how to convert the number from binary to ascii to output it. I have tried going place by place, subtracting 10,000 with a counter, then 1,000, then 100, 10, 1 etc. I keep running into problems this way. There has to be an easier way. Any advice?
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 2
Reputation: ags123 is an unknown quantity at this point 
Solved Threads: 0
ags123 ags123 is offline Offline
Newbie Poster

Re: multidigit binary to ascii

 
0
  #2
Apr 21st, 2008
ASCII .FILL x30 ;the mask to add to a digit to convert it to ASCII
NEGASCII .FILL xFFD0 ;the negative version of the ASCII mask
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 1
Reputation: yoonees is an unknown quantity at this point 
Solved Threads: 0
yoonees yoonees is offline Offline
Newbie Poster

Re: multidigit binary to ascii

 
0
  #3
May 25th, 2008
Hi,

I, too, am facing the same problem but I'm programming the 68HC11. I've tried using the DAA (Decimal Adjust A) but it doesn't work the way I wanted it. Is there another around it?

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: multidigit binary to ascii

 
0
  #4
May 25th, 2008
Well you could post what you tried in a new thread, rather than hijacking an old thread with "it doesn't work".

IIRC, DAA mean you turn say a numeric value of say 0x42 (aka 66 decimal) into 0x66. You still need to extract each nibble and add '0' to it to get something printable, but it does save you from having to do /10 and %10 to extract each digit.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC