0

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?

4
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by Salem
0

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

0

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. :)

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.