944,014 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 4299
  • Assembly RSS
Apr 18th, 2007
0

multidigit binary to ascii

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
andiey is offline Offline
1 posts
since Apr 2007
Apr 21st, 2008
0

Re: multidigit binary to ascii

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ags123 is offline Offline
2 posts
since Apr 2008
May 25th, 2008
0

Re: multidigit binary to ascii

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
yoonees is offline Offline
1 posts
since May 2008
May 25th, 2008
0

Re: multidigit binary to ascii

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: i need an assembly code program
Next Thread in Assembly Forum Timeline: comparing 2 strings





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC