User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 391,913 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,708 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser:
Views: 1925 | Replies: 3
Reply
Join Date: Apr 2007
Posts: 1
Reputation: andiey is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
andiey andiey is offline Offline
Newbie Poster

multidigit binary to ascii

  #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?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2008
Posts: 2
Reputation: ags123 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ags123 ags123 is offline Offline
Newbie Poster

Re: multidigit binary to ascii

  #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  
Join Date: May 2008
Posts: 1
Reputation: yoonees is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
yoonees yoonees is offline Offline
Newbie Poster

Re: multidigit binary to ascii

  #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  
Join Date: Dec 2005
Posts: 3,261
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 20
Solved Threads: 368
Colleague
Salem's Avatar
Salem Salem is offline Offline
void main'ers are DOOMed

Re: multidigit binary to ascii

  #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.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Assembly Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Assembly Forum

All times are GMT -4. The time now is 7:56 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC