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?

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

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.